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

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

Issue 1459083007: Open backdoor in VoiceEngineImpl to get at the actual voe::Channel objects from an ID. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years 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 14
15 #include "webrtc/audio/audio_state.h" 15 #include "webrtc/audio/audio_state.h"
16 #include "webrtc/audio/conversion.h" 16 #include "webrtc/audio/conversion.h"
17 #include "webrtc/base/checks.h" 17 #include "webrtc/base/checks.h"
18 #include "webrtc/base/logging.h" 18 #include "webrtc/base/logging.h"
19 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h" 19 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h"
20 #include "webrtc/system_wrappers/include/tick_util.h" 20 #include "webrtc/system_wrappers/include/tick_util.h"
21 #include "webrtc/voice_engine/channel_proxy.h"
21 #include "webrtc/voice_engine/include/voe_base.h" 22 #include "webrtc/voice_engine/include/voe_base.h"
22 #include "webrtc/voice_engine/include/voe_codec.h" 23 #include "webrtc/voice_engine/include/voe_codec.h"
23 #include "webrtc/voice_engine/include/voe_neteq_stats.h" 24 #include "webrtc/voice_engine/include/voe_neteq_stats.h"
24 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" 25 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
25 #include "webrtc/voice_engine/include/voe_video_sync.h" 26 #include "webrtc/voice_engine/include/voe_video_sync.h"
26 #include "webrtc/voice_engine/include/voe_volume_control.h" 27 #include "webrtc/voice_engine/include/voe_volume_control.h"
28 #include "webrtc/voice_engine/voice_engine_impl.h"
27 29
28 namespace webrtc { 30 namespace webrtc {
29 std::string AudioReceiveStream::Config::Rtp::ToString() const { 31 std::string AudioReceiveStream::Config::Rtp::ToString() const {
30 std::stringstream ss; 32 std::stringstream ss;
31 ss << "{remote_ssrc: " << remote_ssrc; 33 ss << "{remote_ssrc: " << remote_ssrc;
32 ss << ", local_ssrc: " << local_ssrc; 34 ss << ", local_ssrc: " << local_ssrc;
33 ss << ", extensions: ["; 35 ss << ", extensions: [";
34 for (size_t i = 0; i < extensions.size(); ++i) { 36 for (size_t i = 0; i < extensions.size(); ++i) {
35 ss << extensions[i].ToString(); 37 ss << extensions[i].ToString();
36 if (i != extensions.size() - 1) { 38 if (i != extensions.size() - 1) {
(...skipping 30 matching lines...) Expand all
67 : remote_bitrate_estimator_(remote_bitrate_estimator), 69 : remote_bitrate_estimator_(remote_bitrate_estimator),
68 config_(config), 70 config_(config),
69 audio_state_(audio_state), 71 audio_state_(audio_state),
70 rtp_header_parser_(RtpHeaderParser::Create()) { 72 rtp_header_parser_(RtpHeaderParser::Create()) {
71 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString(); 73 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString();
72 RTC_DCHECK_NE(config_.voe_channel_id, -1); 74 RTC_DCHECK_NE(config_.voe_channel_id, -1);
73 RTC_DCHECK(remote_bitrate_estimator_); 75 RTC_DCHECK(remote_bitrate_estimator_);
74 RTC_DCHECK(audio_state_.get()); 76 RTC_DCHECK(audio_state_.get());
75 RTC_DCHECK(rtp_header_parser_); 77 RTC_DCHECK(rtp_header_parser_);
76 78
79 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine());
80 channel_proxy_.reset(voe_impl->GetChannelProxy(config_.voe_channel_id));
81 channel_proxy_->SetLocalSSRC(config.rtp.local_ssrc);
82
77 const int channel_id = config.voe_channel_id; 83 const int channel_id = config.voe_channel_id;
78 ScopedVoEInterface<VoERTP_RTCP> rtp(voice_engine()); 84 ScopedVoEInterface<VoERTP_RTCP> rtp(voice_engine());
79 int error = rtp->SetLocalSSRC(channel_id, config.rtp.local_ssrc);
80 RTC_DCHECK_EQ(0, error);
81 for (const auto& extension : config.rtp.extensions) { 85 for (const auto& extension : config.rtp.extensions) {
82 // One-byte-extension local identifiers are in the range 1-14 inclusive. 86 // One-byte-extension local identifiers are in the range 1-14 inclusive.
83 RTC_DCHECK_GE(extension.id, 1); 87 RTC_DCHECK_GE(extension.id, 1);
84 RTC_DCHECK_LE(extension.id, 14); 88 RTC_DCHECK_LE(extension.id, 14);
85 if (extension.name == RtpExtension::kAudioLevel) { 89 if (extension.name == RtpExtension::kAudioLevel) {
86 error = rtp->SetReceiveAudioLevelIndicationStatus(channel_id, true, 90 int error = rtp->SetReceiveAudioLevelIndicationStatus(channel_id, true,
87 extension.id); 91 extension.id);
88 RTC_DCHECK_EQ(0, error); 92 RTC_DCHECK_EQ(0, error);
89 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension( 93 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension(
90 kRtpExtensionAudioLevel, extension.id); 94 kRtpExtensionAudioLevel, extension.id);
91 RTC_DCHECK(registered); 95 RTC_DCHECK(registered);
92 } else if (extension.name == RtpExtension::kAbsSendTime) { 96 } else if (extension.name == RtpExtension::kAbsSendTime) {
93 error = rtp->SetReceiveAbsoluteSenderTimeStatus(channel_id, true, 97 int error = rtp->SetReceiveAbsoluteSenderTimeStatus(channel_id, true,
94 extension.id); 98 extension.id);
95 RTC_DCHECK_EQ(0, error); 99 RTC_DCHECK_EQ(0, error);
96 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension( 100 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension(
97 kRtpExtensionAbsoluteSendTime, extension.id); 101 kRtpExtensionAbsoluteSendTime, extension.id);
98 RTC_DCHECK(registered); 102 RTC_DCHECK(registered);
99 } else if (extension.name == RtpExtension::kTransportSequenceNumber) { 103 } else if (extension.name == RtpExtension::kTransportSequenceNumber) {
100 // TODO(holmer): Need to do something here or in DeliverRtp() to actually 104 // TODO(holmer): Need to do something here or in DeliverRtp() to actually
101 // handle audio packets with this header extension. 105 // handle audio packets with this header extension.
102 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension( 106 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension(
103 kRtpExtensionTransportSequenceNumber, extension.id); 107 kRtpExtensionTransportSequenceNumber, extension.id);
104 RTC_DCHECK(registered); 108 RTC_DCHECK(registered);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 240
237 VoiceEngine* AudioReceiveStream::voice_engine() const { 241 VoiceEngine* AudioReceiveStream::voice_engine() const {
238 internal::AudioState* audio_state = 242 internal::AudioState* audio_state =
239 static_cast<internal::AudioState*>(audio_state_.get()); 243 static_cast<internal::AudioState*>(audio_state_.get());
240 VoiceEngine* voice_engine = audio_state->voice_engine(); 244 VoiceEngine* voice_engine = audio_state->voice_engine();
241 RTC_DCHECK(voice_engine); 245 RTC_DCHECK(voice_engine);
242 return voice_engine; 246 return voice_engine;
243 } 247 }
244 } // namespace internal 248 } // namespace internal
245 } // namespace webrtc 249 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698