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

Unified 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: set upstream to 1830213002 Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/media/engine/webrtcvoiceengine.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index 7ae7062f63fda5a0d2c0d2284b8271836e1f8f5b..e1cd77a3ce718ef0d928171025936d652d2497e7 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -1111,6 +1111,12 @@ int WebRtcVoiceEngine::CreateVoEChannel() {
return voe_wrapper_->base()->CreateChannel(voe_config_);
}
+webrtc::AudioDeviceModule* WebRtcVoiceEngine::adm() {
+ RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(adm_);
+ return adm_;
+}
+
class WebRtcVoiceMediaChannel::WebRtcAudioSendStream
: public AudioSource::Sink {
public:
@@ -1833,9 +1839,11 @@ void WebRtcVoiceMediaChannel::SetSend(bool send) {
return;
}
- // Apply channel specific options when channel is enabled for sending.
+ // Apply channel specific options, and initialize ADM for recording, when
+ // channel is enabled for sending.
if (send) {
engine()->ApplyOptions(options_);
+ SetupRecording();
}
// Change the settings on each send channel.
@@ -1941,6 +1949,10 @@ bool WebRtcVoiceMediaChannel::AddSendStream(const StreamParams& sp) {
}
}
+ // Initialize ADM for recording.
+ if (send_) {
+ SetupRecording();
+ }
send_streams_[ssrc]->SetSend(send_);
return true;
}
@@ -2522,6 +2534,18 @@ bool WebRtcVoiceMediaChannel::SetPlayout(int channel, bool playout) {
}
return true;
}
+
+void WebRtcVoiceMediaChannel::SetupRecording() {
Taylor Brandstetter 2016/03/29 01:05:37 Maybe add a comment explaining that this is done a
the sun 2016/03/31 10:49:47 Done.
+ if (engine()->adm()->InitRecording() != 0) {
+ LOG(LS_WARNING) << "Foo";
+ return;
+ }
+ if (!send_streams_.empty()) {
+ if (engine()->adm()->StartRecording() != 0) {
Taylor Brandstetter 2016/03/29 01:05:37 It's really only "InitRecording" that was slow on
the sun 2016/03/31 10:49:47 Note that StartRecording() is only called once we
Taylor Brandstetter 2016/03/31 18:11:25 But after my recent change, a stream won't call "S
the sun 2016/04/01 09:07:46 Ah, thanks for explaining. I decided to leave the
+ LOG(LS_WARNING) << "Bar";
+ }
+ }
+}
} // namespace cricket
#endif // HAVE_WEBRTC_VOICE

Powered by Google App Engine
This is Rietveld 408576698