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

Side by Side Diff: webrtc/audio/audio_send_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: presubmit complaints 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
« no previous file with comments | « webrtc/audio/audio_send_stream.h ('k') | webrtc/audio/audio_send_stream_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_send_stream.h" 11 #include "webrtc/audio/audio_send_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/audio/scoped_voe_interface.h" 17 #include "webrtc/audio/scoped_voe_interface.h"
18 #include "webrtc/base/checks.h" 18 #include "webrtc/base/checks.h"
19 #include "webrtc/base/logging.h" 19 #include "webrtc/base/logging.h"
20 #include "webrtc/voice_engine/channel_proxy.h"
20 #include "webrtc/voice_engine/include/voe_audio_processing.h" 21 #include "webrtc/voice_engine/include/voe_audio_processing.h"
21 #include "webrtc/voice_engine/include/voe_codec.h" 22 #include "webrtc/voice_engine/include/voe_codec.h"
22 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" 23 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
23 #include "webrtc/voice_engine/include/voe_volume_control.h" 24 #include "webrtc/voice_engine/include/voe_volume_control.h"
25 #include "webrtc/voice_engine/voice_engine_impl.h"
24 26
25 namespace webrtc { 27 namespace webrtc {
26 std::string AudioSendStream::Config::Rtp::ToString() const { 28 std::string AudioSendStream::Config::Rtp::ToString() const {
27 std::stringstream ss; 29 std::stringstream ss;
28 ss << "{ssrc: " << ssrc; 30 ss << "{ssrc: " << ssrc;
29 ss << ", extensions: ["; 31 ss << ", extensions: [";
30 for (size_t i = 0; i < extensions.size(); ++i) { 32 for (size_t i = 0; i < extensions.size(); ++i) {
31 ss << extensions[i].ToString(); 33 ss << extensions[i].ToString();
32 if (i != extensions.size() - 1) { 34 if (i != extensions.size() - 1) {
33 ss << ", "; 35 ss << ", ";
(...skipping 10 matching lines...) Expand all
44 ss << "{rtp: " << rtp.ToString(); 46 ss << "{rtp: " << rtp.ToString();
45 ss << ", voe_channel_id: " << voe_channel_id; 47 ss << ", voe_channel_id: " << voe_channel_id;
46 // TODO(solenberg): Encoder config. 48 // TODO(solenberg): Encoder config.
47 ss << ", cng_payload_type: " << cng_payload_type; 49 ss << ", cng_payload_type: " << cng_payload_type;
48 ss << ", red_payload_type: " << red_payload_type; 50 ss << ", red_payload_type: " << red_payload_type;
49 ss << '}'; 51 ss << '}';
50 return ss.str(); 52 return ss.str();
51 } 53 }
52 54
53 namespace internal { 55 namespace internal {
54
55 AudioSendStream::AudioSendStream( 56 AudioSendStream::AudioSendStream(
56 const webrtc::AudioSendStream::Config& config, 57 const webrtc::AudioSendStream::Config& config,
57 const rtc::scoped_refptr<webrtc::AudioState>& audio_state) 58 const rtc::scoped_refptr<webrtc::AudioState>& audio_state)
58 : config_(config), audio_state_(audio_state) { 59 : config_(config), audio_state_(audio_state) {
59 LOG(LS_INFO) << "AudioSendStream: " << config_.ToString(); 60 LOG(LS_INFO) << "AudioSendStream: " << config_.ToString();
60 RTC_DCHECK_NE(config_.voe_channel_id, -1); 61 RTC_DCHECK_NE(config_.voe_channel_id, -1);
61 RTC_DCHECK(audio_state_.get()); 62 RTC_DCHECK(audio_state_.get());
62 63
64 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine());
65 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id);
66 channel_proxy_->SetRTCPStatus(true);
67 channel_proxy_->SetLocalSSRC(config.rtp.ssrc);
68 channel_proxy_->SetRTCP_CNAME(config.rtp.c_name);
69
63 const int channel_id = config.voe_channel_id; 70 const int channel_id = config.voe_channel_id;
64 ScopedVoEInterface<VoERTP_RTCP> rtp(voice_engine()); 71 ScopedVoEInterface<VoERTP_RTCP> rtp(voice_engine());
65 int error = rtp->SetRTCPStatus(channel_id, true);
66 RTC_DCHECK_EQ(0, error);
67 error = rtp->SetLocalSSRC(channel_id, config.rtp.ssrc);
68 RTC_DCHECK_EQ(0, error);
69 error = rtp->SetRTCP_CNAME(channel_id, config.rtp.c_name.c_str());
70 RTC_DCHECK_EQ(0, error);
71 for (const auto& extension : config.rtp.extensions) { 72 for (const auto& extension : config.rtp.extensions) {
72 // One-byte-extension local identifiers are in the range 1-14 inclusive. 73 // One-byte-extension local identifiers are in the range 1-14 inclusive.
73 RTC_DCHECK_GE(extension.id, 1); 74 RTC_DCHECK_GE(extension.id, 1);
74 RTC_DCHECK_LE(extension.id, 14); 75 RTC_DCHECK_LE(extension.id, 14);
75 if (extension.name == RtpExtension::kAbsSendTime) { 76 if (extension.name == RtpExtension::kAbsSendTime) {
76 error = rtp->SetSendAbsoluteSenderTimeStatus(channel_id, true, 77 int error = rtp->SetSendAbsoluteSenderTimeStatus(channel_id, true,
77 extension.id); 78 extension.id);
78 RTC_DCHECK_EQ(0, error); 79 RTC_DCHECK_EQ(0, error);
79 } else if (extension.name == RtpExtension::kAudioLevel) { 80 } else if (extension.name == RtpExtension::kAudioLevel) {
80 error = rtp->SetSendAudioLevelIndicationStatus(channel_id, true, 81 int error = rtp->SetSendAudioLevelIndicationStatus(channel_id, true,
81 extension.id); 82 extension.id);
82 RTC_DCHECK_EQ(0, error); 83 RTC_DCHECK_EQ(0, error);
83 } else { 84 } else {
84 RTC_NOTREACHED() << "Registering unsupported RTP extension."; 85 RTC_NOTREACHED() << "Registering unsupported RTP extension.";
85 } 86 }
86 } 87 }
87 } 88 }
88 89
89 AudioSendStream::~AudioSendStream() { 90 AudioSendStream::~AudioSendStream() {
90 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 91 RTC_DCHECK(thread_checker_.CalledOnValidThread());
91 LOG(LS_INFO) << "~AudioSendStream: " << config_.ToString(); 92 LOG(LS_INFO) << "~AudioSendStream: " << config_.ToString();
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 208
208 VoiceEngine* AudioSendStream::voice_engine() const { 209 VoiceEngine* AudioSendStream::voice_engine() const {
209 internal::AudioState* audio_state = 210 internal::AudioState* audio_state =
210 static_cast<internal::AudioState*>(audio_state_.get()); 211 static_cast<internal::AudioState*>(audio_state_.get());
211 VoiceEngine* voice_engine = audio_state->voice_engine(); 212 VoiceEngine* voice_engine = audio_state->voice_engine();
212 RTC_DCHECK(voice_engine); 213 RTC_DCHECK(voice_engine);
213 return voice_engine; 214 return voice_engine;
214 } 215 }
215 } // namespace internal 216 } // namespace internal
216 } // namespace webrtc 217 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/audio/audio_send_stream.h ('k') | webrtc/audio/audio_send_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698