OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 | 137 |
138 void AudioReceiveStream::Start() { | 138 void AudioReceiveStream::Start() { |
139 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 139 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
140 } | 140 } |
141 | 141 |
142 void AudioReceiveStream::Stop() { | 142 void AudioReceiveStream::Stop() { |
143 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 143 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
144 } | 144 } |
145 | 145 |
146 void AudioReceiveStream::SignalNetworkState(NetworkState state) { | |
147 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | |
148 } | |
149 | |
150 bool AudioReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { | |
151 // TODO(solenberg): Tests call this function on a network thread, libjingle | |
152 // calls on the worker thread. We should move towards always using a network | |
153 // thread. Then this check can be enabled. | |
154 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); | |
155 return channel_proxy_->ReceivedRTCPPacket(packet, length); | |
156 } | |
157 | |
158 bool AudioReceiveStream::DeliverRtp(const uint8_t* packet, | |
159 size_t length, | |
160 const PacketTime& packet_time) { | |
161 // TODO(solenberg): Tests call this function on a network thread, libjingle | |
162 // calls on the worker thread. We should move towards always using a network | |
163 // thread. Then this check can be enabled. | |
164 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); | |
165 RTPHeader header; | |
166 if (!rtp_header_parser_->Parse(packet, length, &header)) { | |
167 return false; | |
168 } | |
169 | |
170 // Only forward if the parsed header has one of the headers necessary for | |
171 // bandwidth estimation. RTP timestamps has different rates for audio and | |
172 // video and shouldn't be mixed. | |
173 if (remote_bitrate_estimator_ && | |
174 header.extension.hasTransportSequenceNumber) { | |
175 int64_t arrival_time_ms = TickTime::MillisecondTimestamp(); | |
176 if (packet_time.timestamp >= 0) | |
177 arrival_time_ms = (packet_time.timestamp + 500) / 1000; | |
178 size_t payload_size = length - header.headerLength; | |
179 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_size, | |
180 header, false); | |
181 } | |
182 | |
183 return channel_proxy_->ReceivedRTPPacket(packet, length, packet_time); | |
184 } | |
185 | |
186 webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats() const { | 146 webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats() const { |
187 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 147 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
188 webrtc::AudioReceiveStream::Stats stats; | 148 webrtc::AudioReceiveStream::Stats stats; |
189 stats.remote_ssrc = config_.rtp.remote_ssrc; | 149 stats.remote_ssrc = config_.rtp.remote_ssrc; |
190 ScopedVoEInterface<VoECodec> codec(voice_engine()); | 150 ScopedVoEInterface<VoECodec> codec(voice_engine()); |
191 | 151 |
192 webrtc::CallStatistics call_stats = channel_proxy_->GetRTCPStatistics(); | 152 webrtc::CallStatistics call_stats = channel_proxy_->GetRTCPStatistics(); |
193 webrtc::CodecInst codec_inst = {0}; | 153 webrtc::CodecInst codec_inst = {0}; |
194 if (codec->GetRecCodec(config_.voe_channel_id, codec_inst) == -1) { | 154 if (codec->GetRecCodec(config_.voe_channel_id, codec_inst) == -1) { |
195 return stats; | 155 return stats; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 void AudioReceiveStream::SetSink(std::unique_ptr<AudioSinkInterface> sink) { | 194 void AudioReceiveStream::SetSink(std::unique_ptr<AudioSinkInterface> sink) { |
235 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 195 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
236 channel_proxy_->SetSink(std::move(sink)); | 196 channel_proxy_->SetSink(std::move(sink)); |
237 } | 197 } |
238 | 198 |
239 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { | 199 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { |
240 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 200 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
241 return config_; | 201 return config_; |
242 } | 202 } |
243 | 203 |
| 204 void AudioReceiveStream::SignalNetworkState(NetworkState state) { |
| 205 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 206 } |
| 207 |
| 208 bool AudioReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { |
| 209 // TODO(solenberg): Tests call this function on a network thread, libjingle |
| 210 // calls on the worker thread. We should move towards always using a network |
| 211 // thread. Then this check can be enabled. |
| 212 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); |
| 213 return channel_proxy_->ReceivedRTCPPacket(packet, length); |
| 214 } |
| 215 |
| 216 bool AudioReceiveStream::DeliverRtp(const uint8_t* packet, |
| 217 size_t length, |
| 218 const PacketTime& packet_time) { |
| 219 // TODO(solenberg): Tests call this function on a network thread, libjingle |
| 220 // calls on the worker thread. We should move towards always using a network |
| 221 // thread. Then this check can be enabled. |
| 222 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); |
| 223 RTPHeader header; |
| 224 if (!rtp_header_parser_->Parse(packet, length, &header)) { |
| 225 return false; |
| 226 } |
| 227 |
| 228 // Only forward if the parsed header has one of the headers necessary for |
| 229 // bandwidth estimation. RTP timestamps has different rates for audio and |
| 230 // video and shouldn't be mixed. |
| 231 if (remote_bitrate_estimator_ && |
| 232 header.extension.hasTransportSequenceNumber) { |
| 233 int64_t arrival_time_ms = TickTime::MillisecondTimestamp(); |
| 234 if (packet_time.timestamp >= 0) |
| 235 arrival_time_ms = (packet_time.timestamp + 500) / 1000; |
| 236 size_t payload_size = length - header.headerLength; |
| 237 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_size, |
| 238 header, false); |
| 239 } |
| 240 |
| 241 return channel_proxy_->ReceivedRTPPacket(packet, length, packet_time); |
| 242 } |
| 243 |
244 VoiceEngine* AudioReceiveStream::voice_engine() const { | 244 VoiceEngine* AudioReceiveStream::voice_engine() const { |
245 internal::AudioState* audio_state = | 245 internal::AudioState* audio_state = |
246 static_cast<internal::AudioState*>(audio_state_.get()); | 246 static_cast<internal::AudioState*>(audio_state_.get()); |
247 VoiceEngine* voice_engine = audio_state->voice_engine(); | 247 VoiceEngine* voice_engine = audio_state->voice_engine(); |
248 RTC_DCHECK(voice_engine); | 248 RTC_DCHECK(voice_engine); |
249 return voice_engine; | 249 return voice_engine; |
250 } | 250 } |
251 } // namespace internal | 251 } // namespace internal |
252 } // namespace webrtc | 252 } // namespace webrtc |
OLD | NEW |