OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/call/flexfec_receive_stream.h" | 11 #include "webrtc/call/flexfec_receive_stream_impl.h" |
12 | 12 |
13 #include "webrtc/base/checks.h" | 13 #include "webrtc/base/checks.h" |
14 #include "webrtc/base/logging.h" | 14 #include "webrtc/base/logging.h" |
15 | 15 |
16 namespace webrtc { | 16 namespace webrtc { |
17 | 17 |
18 std::string FlexfecReceiveStream::Stats::ToString(int64_t time_ms) const { | 18 std::string FlexfecReceiveStream::Stats::ToString(int64_t time_ms) const { |
19 std::stringstream ss; | 19 std::stringstream ss; |
20 ss << "FlexfecReceiveStream stats: " << time_ms | 20 ss << "FlexfecReceiveStream stats: " << time_ms |
21 << ", {flexfec_bitrate_bps: " << flexfec_bitrate_bps << "}"; | 21 << ", {flexfec_bitrate_bps: " << flexfec_bitrate_bps << "}"; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return nullptr; | 77 return nullptr; |
78 } | 78 } |
79 RTC_DCHECK_EQ(1U, config.protected_media_ssrcs.size()); | 79 RTC_DCHECK_EQ(1U, config.protected_media_ssrcs.size()); |
80 return std::unique_ptr<FlexfecReceiver>( | 80 return std::unique_ptr<FlexfecReceiver>( |
81 new FlexfecReceiver(config.remote_ssrc, config.protected_media_ssrcs[0], | 81 new FlexfecReceiver(config.remote_ssrc, config.protected_media_ssrcs[0], |
82 recovered_packet_callback)); | 82 recovered_packet_callback)); |
83 } | 83 } |
84 | 84 |
85 } // namespace | 85 } // namespace |
86 | 86 |
87 namespace internal { | 87 FlexfecReceiveStreamImpl::FlexfecReceiveStreamImpl( |
88 | |
89 FlexfecReceiveStream::FlexfecReceiveStream( | |
90 const Config& config, | 88 const Config& config, |
91 RecoveredPacketReceiver* recovered_packet_callback) | 89 RecoveredPacketReceiver* recovered_packet_callback) |
92 : started_(false), | 90 : started_(false), |
93 config_(config), | 91 config_(config), |
94 receiver_( | 92 receiver_( |
95 MaybeCreateFlexfecReceiver(config_, recovered_packet_callback)) { | 93 MaybeCreateFlexfecReceiver(config_, recovered_packet_callback)) { |
96 LOG(LS_INFO) << "FlexfecReceiveStream: " << config_.ToString(); | 94 LOG(LS_INFO) << "FlexfecReceiveStreamImpl: " << config_.ToString(); |
97 } | 95 } |
98 | 96 |
99 FlexfecReceiveStream::~FlexfecReceiveStream() { | 97 FlexfecReceiveStreamImpl::~FlexfecReceiveStreamImpl() { |
100 LOG(LS_INFO) << "~FlexfecReceiveStream: " << config_.ToString(); | 98 LOG(LS_INFO) << "~FlexfecReceiveStreamImpl: " << config_.ToString(); |
101 Stop(); | 99 Stop(); |
102 } | 100 } |
103 | 101 |
104 bool FlexfecReceiveStream::AddAndProcessReceivedPacket(const uint8_t* packet, | 102 bool FlexfecReceiveStreamImpl::AddAndProcessReceivedPacket( |
105 size_t packet_length) { | 103 const uint8_t* packet, |
| 104 size_t packet_length) { |
106 { | 105 { |
107 rtc::CritScope cs(&crit_); | 106 rtc::CritScope cs(&crit_); |
108 if (!started_) | 107 if (!started_) |
109 return false; | 108 return false; |
110 } | 109 } |
111 if (!receiver_) | 110 if (!receiver_) |
112 return false; | 111 return false; |
113 return receiver_->AddAndProcessReceivedPacket(packet, packet_length); | 112 return receiver_->AddAndProcessReceivedPacket(packet, packet_length); |
114 } | 113 } |
115 | 114 |
116 void FlexfecReceiveStream::Start() { | 115 void FlexfecReceiveStreamImpl::Start() { |
117 rtc::CritScope cs(&crit_); | 116 rtc::CritScope cs(&crit_); |
118 started_ = true; | 117 started_ = true; |
119 } | 118 } |
120 | 119 |
121 void FlexfecReceiveStream::Stop() { | 120 void FlexfecReceiveStreamImpl::Stop() { |
122 rtc::CritScope cs(&crit_); | 121 rtc::CritScope cs(&crit_); |
123 started_ = false; | 122 started_ = false; |
124 } | 123 } |
125 | 124 |
126 // TODO(brandtr): Implement this member function when we have designed the | 125 // TODO(brandtr): Implement this member function when we have designed the |
127 // stats for FlexFEC. | 126 // stats for FlexFEC. |
128 FlexfecReceiveStream::Stats FlexfecReceiveStream::GetStats() const { | 127 FlexfecReceiveStreamImpl::Stats FlexfecReceiveStreamImpl::GetStats() const { |
129 return webrtc::FlexfecReceiveStream::Stats(); | 128 return FlexfecReceiveStream::Stats(); |
130 } | 129 } |
131 | 130 |
132 } // namespace internal | |
133 | |
134 } // namespace webrtc | 131 } // namespace webrtc |
OLD | NEW |