Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: webrtc/audio/audio_receive_stream.cc

Issue 2688473004: RtpPacketReceiver base class and OnRtpPacket, with a pre-parsed RTP packet. (Closed)
Patch Set: Rename OnRTPPacket --> OnRtpPacket. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return ss.str(); 60 return ss.str();
61 } 61 }
62 62
63 namespace internal { 63 namespace internal {
64 AudioReceiveStream::AudioReceiveStream( 64 AudioReceiveStream::AudioReceiveStream(
65 PacketRouter* packet_router, 65 PacketRouter* packet_router,
66 const webrtc::AudioReceiveStream::Config& config, 66 const webrtc::AudioReceiveStream::Config& config,
67 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, 67 const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
68 webrtc::RtcEventLog* event_log) 68 webrtc::RtcEventLog* event_log)
69 : config_(config), 69 : config_(config),
70 rtp_config_(config.rtp.extensions, config.rtp.transport_cc),
70 audio_state_(audio_state) { 71 audio_state_(audio_state) {
71 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString(); 72 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString();
72 RTC_DCHECK_NE(config_.voe_channel_id, -1); 73 RTC_DCHECK_NE(config_.voe_channel_id, -1);
73 RTC_DCHECK(audio_state_.get()); 74 RTC_DCHECK(audio_state_.get());
74 RTC_DCHECK(packet_router); 75 RTC_DCHECK(packet_router);
75 76
76 module_process_thread_checker_.DetachFromThread(); 77 module_process_thread_checker_.DetachFromThread();
77 78
78 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); 79 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine());
79 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id); 80 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id);
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 296 }
296 297
297 bool AudioReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { 298 bool AudioReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) {
298 // TODO(solenberg): Tests call this function on a network thread, libjingle 299 // TODO(solenberg): Tests call this function on a network thread, libjingle
299 // calls on the worker thread. We should move towards always using a network 300 // calls on the worker thread. We should move towards always using a network
300 // thread. Then this check can be enabled. 301 // thread. Then this check can be enabled.
301 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); 302 // RTC_DCHECK(!thread_checker_.CalledOnValidThread());
302 return channel_proxy_->ReceivedRTCPPacket(packet, length); 303 return channel_proxy_->ReceivedRTCPPacket(packet, length);
303 } 304 }
304 305
305 bool AudioReceiveStream::DeliverRtp(const uint8_t* packet, 306 const RtpPacketReceiver::RtpConfig& AudioReceiveStream::rtp_config() const {
306 size_t length, 307 return rtp_config_;
307 const PacketTime& packet_time) { 308 }
309
310 bool AudioReceiveStream::OnRtpPacket(const RtpPacketReceived& packet) {
308 // TODO(solenberg): Tests call this function on a network thread, libjingle 311 // TODO(solenberg): Tests call this function on a network thread, libjingle
309 // calls on the worker thread. We should move towards always using a network 312 // calls on the worker thread. We should move towards always using a network
310 // thread. Then this check can be enabled. 313 // thread. Then this check can be enabled.
311 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); 314 // RTC_DCHECK(!thread_checker_.CalledOnValidThread());
312 return channel_proxy_->ReceivedRTPPacket(packet, length, packet_time); 315 return channel_proxy_->OnRtpPacket(packet);
313 } 316 }
314 317
315 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { 318 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const {
316 RTC_DCHECK_RUN_ON(&worker_thread_checker_); 319 RTC_DCHECK_RUN_ON(&worker_thread_checker_);
317 return config_; 320 return config_;
318 } 321 }
319 322
320 VoiceEngine* AudioReceiveStream::voice_engine() const { 323 VoiceEngine* AudioReceiveStream::voice_engine() const {
321 auto* voice_engine = audio_state()->voice_engine(); 324 auto* voice_engine = audio_state()->voice_engine();
322 RTC_DCHECK(voice_engine); 325 RTC_DCHECK(voice_engine);
323 return voice_engine; 326 return voice_engine;
324 } 327 }
325 328
326 internal::AudioState* AudioReceiveStream::audio_state() const { 329 internal::AudioState* AudioReceiveStream::audio_state() const {
327 auto* audio_state = static_cast<internal::AudioState*>(audio_state_.get()); 330 auto* audio_state = static_cast<internal::AudioState*>(audio_state_.get());
328 RTC_DCHECK(audio_state); 331 RTC_DCHECK(audio_state);
329 return audio_state; 332 return audio_state;
330 } 333 }
331 334
332 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { 335 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) {
333 ScopedVoEInterface<VoEBase> base(voice_engine()); 336 ScopedVoEInterface<VoEBase> base(voice_engine());
334 if (playout) { 337 if (playout) {
335 return base->StartPlayout(config_.voe_channel_id); 338 return base->StartPlayout(config_.voe_channel_id);
336 } else { 339 } else {
337 return base->StopPlayout(config_.voe_channel_id); 340 return base->StopPlayout(config_.voe_channel_id);
338 } 341 }
339 } 342 }
340 } // namespace internal 343 } // namespace internal
341 } // namespace webrtc 344 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698