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

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 1827263002: Early initialize recording on the ADM from WebRtcVoiceMediaChannel. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Simplify the solution Created 4 years, 8 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
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.h ('k') | webrtc/voice_engine/channel_proxy.h » ('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) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 return; 1071 return;
1072 } 1072 }
1073 LOG_RTCERR0(StopRtcEventLog); 1073 LOG_RTCERR0(StopRtcEventLog);
1074 } 1074 }
1075 1075
1076 int WebRtcVoiceEngine::CreateVoEChannel() { 1076 int WebRtcVoiceEngine::CreateVoEChannel() {
1077 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1077 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1078 return voe_wrapper_->base()->CreateChannel(voe_config_); 1078 return voe_wrapper_->base()->CreateChannel(voe_config_);
1079 } 1079 }
1080 1080
1081 webrtc::AudioDeviceModule* WebRtcVoiceEngine::adm() {
1082 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1083 RTC_DCHECK(adm_);
1084 return adm_;
1085 }
1086
1081 class WebRtcVoiceMediaChannel::WebRtcAudioSendStream 1087 class WebRtcVoiceMediaChannel::WebRtcAudioSendStream
1082 : public AudioSource::Sink { 1088 : public AudioSource::Sink {
1083 public: 1089 public:
1084 WebRtcAudioSendStream(int ch, webrtc::AudioTransport* voe_audio_transport, 1090 WebRtcAudioSendStream(int ch, webrtc::AudioTransport* voe_audio_transport,
1085 uint32_t ssrc, const std::string& c_name, 1091 uint32_t ssrc, const std::string& c_name,
1086 const std::vector<webrtc::RtpExtension>& extensions, 1092 const std::vector<webrtc::RtpExtension>& extensions,
1087 webrtc::Call* call) 1093 webrtc::Call* call)
1088 : voe_audio_transport_(voe_audio_transport), 1094 : voe_audio_transport_(voe_audio_transport),
1089 call_(call), 1095 call_(call),
1090 config_(nullptr) { 1096 config_(nullptr) {
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 playout_ = playout; 1799 playout_ = playout;
1794 return true; 1800 return true;
1795 } 1801 }
1796 1802
1797 void WebRtcVoiceMediaChannel::SetSend(bool send) { 1803 void WebRtcVoiceMediaChannel::SetSend(bool send) {
1798 TRACE_EVENT0("webrtc", "WebRtcVoiceMediaChannel::SetSend"); 1804 TRACE_EVENT0("webrtc", "WebRtcVoiceMediaChannel::SetSend");
1799 if (send_ == send) { 1805 if (send_ == send) {
1800 return; 1806 return;
1801 } 1807 }
1802 1808
1803 // Apply channel specific options when channel is enabled for sending. 1809 // Apply channel specific options, and initialize the ADM for recording (this
1810 // may take time on some platforms, e.g. Android).
1804 if (send) { 1811 if (send) {
1805 engine()->ApplyOptions(options_); 1812 engine()->ApplyOptions(options_);
1813
1814 // InitRecording() will return an error if the ADM is already recording.
1815 if (!engine()->adm()->Recording()) {
Taylor Brandstetter 2016/04/01 18:41:02 Shouldn't this call "RecordingIsInitialized"?
the sun 2016/04/01 21:35:40 Actually, it looks like both must be checked. Look
1816 if (engine()->adm()->InitRecording() != 0) {
1817 LOG(LS_WARNING) << "Failed to initialize recording";
1818 }
1819 }
1806 } 1820 }
1807 1821
1808 // Change the settings on each send channel. 1822 // Change the settings on each send channel.
1809 for (auto& kv : send_streams_) { 1823 for (auto& kv : send_streams_) {
1810 kv.second->SetSend(send); 1824 kv.second->SetSend(send);
1811 } 1825 }
1812 1826
1813 send_ = send; 1827 send_ = send;
1814 } 1828 }
1815 1829
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 } 2506 }
2493 } else { 2507 } else {
2494 LOG(LS_INFO) << "Stopping playout for channel #" << channel; 2508 LOG(LS_INFO) << "Stopping playout for channel #" << channel;
2495 engine()->voe()->base()->StopPlayout(channel); 2509 engine()->voe()->base()->StopPlayout(channel);
2496 } 2510 }
2497 return true; 2511 return true;
2498 } 2512 }
2499 } // namespace cricket 2513 } // namespace cricket
2500 2514
2501 #endif // HAVE_WEBRTC_VOICE 2515 #endif // HAVE_WEBRTC_VOICE
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.h ('k') | webrtc/voice_engine/channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698