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

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

Issue 2663063008: Remove unnecessary RTPHeaderParser, following https://codereview.webrtc.org/2659563002/ (Closed)
Patch Set: 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
11 #include "webrtc/audio/audio_receive_stream.h" 11 #include "webrtc/audio/audio_receive_stream.h"
12 12
13 #include <string> 13 #include <string>
14 #include <utility> 14 #include <utility>
15 15
16 #include "webrtc/api/call/audio_sink.h" 16 #include "webrtc/api/call/audio_sink.h"
17 #include "webrtc/audio/audio_send_stream.h" 17 #include "webrtc/audio/audio_send_stream.h"
18 #include "webrtc/audio/audio_state.h" 18 #include "webrtc/audio/audio_state.h"
19 #include "webrtc/audio/conversion.h" 19 #include "webrtc/audio/conversion.h"
20 #include "webrtc/base/checks.h" 20 #include "webrtc/base/checks.h"
21 #include "webrtc/base/logging.h" 21 #include "webrtc/base/logging.h"
22 #include "webrtc/base/timeutils.h" 22 #include "webrtc/base/timeutils.h"
23 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h" 23 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h"
24 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" 24 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" 25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
26 #include "webrtc/voice_engine/channel_proxy.h" 26 #include "webrtc/voice_engine/channel_proxy.h"
27 #include "webrtc/voice_engine/include/voe_base.h" 27 #include "webrtc/voice_engine/include/voe_base.h"
28 #include "webrtc/voice_engine/include/voe_codec.h" 28 #include "webrtc/voice_engine/include/voe_codec.h"
29 #include "webrtc/voice_engine/include/voe_neteq_stats.h"
30 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
31 #include "webrtc/voice_engine/include/voe_video_sync.h"
32 #include "webrtc/voice_engine/include/voe_volume_control.h"
33 #include "webrtc/voice_engine/voice_engine_impl.h" 29 #include "webrtc/voice_engine/voice_engine_impl.h"
34 30
35 namespace webrtc { 31 namespace webrtc {
36 32
37 std::string AudioReceiveStream::Config::Rtp::ToString() const { 33 std::string AudioReceiveStream::Config::Rtp::ToString() const {
38 std::stringstream ss; 34 std::stringstream ss;
39 ss << "{remote_ssrc: " << remote_ssrc; 35 ss << "{remote_ssrc: " << remote_ssrc;
40 ss << ", local_ssrc: " << local_ssrc; 36 ss << ", local_ssrc: " << local_ssrc;
41 ss << ", transport_cc: " << (transport_cc ? "on" : "off"); 37 ss << ", transport_cc: " << (transport_cc ? "on" : "off");
42 ss << ", nack: " << nack.ToString(); 38 ss << ", nack: " << nack.ToString();
(...skipping 24 matching lines...) Expand all
67 63
68 namespace internal { 64 namespace internal {
69 AudioReceiveStream::AudioReceiveStream( 65 AudioReceiveStream::AudioReceiveStream(
70 PacketRouter* packet_router, 66 PacketRouter* packet_router,
71 RemoteBitrateEstimator* remote_bitrate_estimator, 67 RemoteBitrateEstimator* remote_bitrate_estimator,
72 const webrtc::AudioReceiveStream::Config& config, 68 const webrtc::AudioReceiveStream::Config& config,
73 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, 69 const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
74 webrtc::RtcEventLog* event_log) 70 webrtc::RtcEventLog* event_log)
75 : remote_bitrate_estimator_(remote_bitrate_estimator), 71 : remote_bitrate_estimator_(remote_bitrate_estimator),
76 config_(config), 72 config_(config),
77 audio_state_(audio_state), 73 audio_state_(audio_state) {
78 rtp_header_parser_(RtpHeaderParser::Create()) {
79 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString(); 74 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString();
80 RTC_DCHECK_NE(config_.voe_channel_id, -1); 75 RTC_DCHECK_NE(config_.voe_channel_id, -1);
81 RTC_DCHECK(audio_state_.get()); 76 RTC_DCHECK(audio_state_.get());
82 RTC_DCHECK(packet_router); 77 RTC_DCHECK(packet_router);
83 RTC_DCHECK(remote_bitrate_estimator); 78 RTC_DCHECK(remote_bitrate_estimator);
84 RTC_DCHECK(rtp_header_parser_);
85 79
86 module_process_thread_checker_.DetachFromThread(); 80 module_process_thread_checker_.DetachFromThread();
87 81
88 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); 82 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine());
89 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id); 83 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id);
90 channel_proxy_->SetRtcEventLog(event_log); 84 channel_proxy_->SetRtcEventLog(event_log);
91 channel_proxy_->SetLocalSSRC(config.rtp.local_ssrc); 85 channel_proxy_->SetLocalSSRC(config.rtp.local_ssrc);
92 // TODO(solenberg): Config NACK history window (which is a packet count), 86 // TODO(solenberg): Config NACK history window (which is a packet count),
93 // using the actual packet size for the configured codec. 87 // using the actual packet size for the configured codec.
94 channel_proxy_->SetNACKStatus(config_.rtp.nack.rtp_history_ms != 0, 88 channel_proxy_->SetNACKStatus(config_.rtp.nack.rtp_history_ms != 0,
(...skipping 10 matching lines...) Expand all
105 99
106 channel_proxy_->RegisterExternalTransport(config.rtcp_send_transport); 100 channel_proxy_->RegisterExternalTransport(config.rtcp_send_transport);
107 101
108 for (const auto& kv : config.decoder_map) { 102 for (const auto& kv : config.decoder_map) {
109 channel_proxy_->SetRecPayloadType(kv.first, kv.second); 103 channel_proxy_->SetRecPayloadType(kv.first, kv.second);
110 } 104 }
111 105
112 for (const auto& extension : config.rtp.extensions) { 106 for (const auto& extension : config.rtp.extensions) {
113 if (extension.uri == RtpExtension::kAudioLevelUri) { 107 if (extension.uri == RtpExtension::kAudioLevelUri) {
114 channel_proxy_->SetReceiveAudioLevelIndicationStatus(true, extension.id); 108 channel_proxy_->SetReceiveAudioLevelIndicationStatus(true, extension.id);
115 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension(
116 kRtpExtensionAudioLevel, extension.id);
117 RTC_DCHECK(registered);
118 } else if (extension.uri == RtpExtension::kTransportSequenceNumberUri) { 109 } else if (extension.uri == RtpExtension::kTransportSequenceNumberUri) {
119 channel_proxy_->EnableReceiveTransportSequenceNumber(extension.id); 110 channel_proxy_->EnableReceiveTransportSequenceNumber(extension.id);
120 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension(
121 kRtpExtensionTransportSequenceNumber, extension.id);
122 RTC_DCHECK(registered);
123 } else { 111 } else {
124 RTC_NOTREACHED() << "Unsupported RTP extension."; 112 RTC_NOTREACHED() << "Unsupported RTP extension.";
125 } 113 }
126 } 114 }
127 // Configure bandwidth estimation. 115 // Configure bandwidth estimation.
128 channel_proxy_->RegisterReceiverCongestionControlObjects(packet_router); 116 channel_proxy_->RegisterReceiverCongestionControlObjects(packet_router);
129 } 117 }
130 118
131 AudioReceiveStream::~AudioReceiveStream() { 119 AudioReceiveStream::~AudioReceiveStream() {
132 RTC_DCHECK_RUN_ON(&worker_thread_checker_); 120 RTC_DCHECK_RUN_ON(&worker_thread_checker_);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 return channel_proxy_->ReceivedRTCPPacket(packet, length); 306 return channel_proxy_->ReceivedRTCPPacket(packet, length);
319 } 307 }
320 308
321 bool AudioReceiveStream::DeliverRtp(const uint8_t* packet, 309 bool AudioReceiveStream::DeliverRtp(const uint8_t* packet,
322 size_t length, 310 size_t length,
323 const PacketTime& packet_time) { 311 const PacketTime& packet_time) {
324 // TODO(solenberg): Tests call this function on a network thread, libjingle 312 // TODO(solenberg): Tests call this function on a network thread, libjingle
325 // calls on the worker thread. We should move towards always using a network 313 // calls on the worker thread. We should move towards always using a network
326 // thread. Then this check can be enabled. 314 // thread. Then this check can be enabled.
327 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); 315 // RTC_DCHECK(!thread_checker_.CalledOnValidThread());
328 RTPHeader header;
329 if (!rtp_header_parser_->Parse(packet, length, &header)) {
330 return false;
331 }
332
nisse-webrtc 2017/02/01 14:50:17 I would have expected Call to pass on its parsed h
the sun 2017/02/01 15:12:06 They are parsed again inside voe::Channel::Receive
nisse-webrtc 2017/02/02 08:10:11 I see. An opportunity for later improvement...
333 return channel_proxy_->ReceivedRTPPacket(packet, length, packet_time); 316 return channel_proxy_->ReceivedRTPPacket(packet, length, packet_time);
334 } 317 }
335 318
336 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { 319 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const {
337 RTC_DCHECK_RUN_ON(&worker_thread_checker_); 320 RTC_DCHECK_RUN_ON(&worker_thread_checker_);
338 return config_; 321 return config_;
339 } 322 }
340 323
341 VoiceEngine* AudioReceiveStream::voice_engine() const { 324 VoiceEngine* AudioReceiveStream::voice_engine() const {
342 auto* voice_engine = audio_state()->voice_engine(); 325 auto* voice_engine = audio_state()->voice_engine();
(...skipping 10 matching lines...) Expand all
353 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { 336 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) {
354 ScopedVoEInterface<VoEBase> base(voice_engine()); 337 ScopedVoEInterface<VoEBase> base(voice_engine());
355 if (playout) { 338 if (playout) {
356 return base->StartPlayout(config_.voe_channel_id); 339 return base->StartPlayout(config_.voe_channel_id);
357 } else { 340 } else {
358 return base->StopPlayout(config_.voe_channel_id); 341 return base->StopPlayout(config_.voe_channel_id);
359 } 342 }
360 } 343 }
361 } // namespace internal 344 } // namespace internal
362 } // namespace webrtc 345 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/audio/audio_receive_stream.h ('k') | webrtc/call/call.cc » ('j') | webrtc/call/call.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698