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

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: addressed comments 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
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.h ('k') | webrtc/test/mock_voe_channel_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvoiceengine.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index 21094fde4d45af8baed7c5228237a5caba363e04..949838062829d7275215c3d5ae7f3fbe8a99a646 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -1078,6 +1078,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:
@@ -1799,18 +1805,19 @@ void WebRtcVoiceMediaChannel::SetSend(bool send) {
if (send_ == send) {
return;
}
+ send_ = send;
- // Apply channel specific options when channel is enabled for sending.
- if (send) {
+ // Apply channel specific options.
+ if (send_) {
engine()->ApplyOptions(options_);
}
+ SetupRecording();
juberti2 2016/03/31 18:57:38 Won't this happen anyway as a result of SetSend?
the sun 2016/04/01 09:07:46 Well, it used to, but in the patch set you comment
+
// Change the settings on each send channel.
for (auto& kv : send_streams_) {
kv.second->SetSend(send);
}
-
- send_ = send;
}
bool WebRtcVoiceMediaChannel::SetAudioSend(uint32_t ssrc,
@@ -1908,6 +1915,8 @@ bool WebRtcVoiceMediaChannel::AddSendStream(const StreamParams& sp) {
}
}
+ SetupRecording();
+
send_streams_[ssrc]->SetSend(send_);
return true;
}
@@ -2496,6 +2505,22 @@ bool WebRtcVoiceMediaChannel::SetPlayout(int channel, bool playout) {
}
return true;
}
+
+void WebRtcVoiceMediaChannel::SetupRecording() {
+ if (send_ && !engine()->adm()->Recording()) {
+ // InitRecording() is called as soon as we know we will be sending, as it
+ // may take time on some platforms (e.g. Android).
+ if (engine()->adm()->InitRecording() != 0) {
+ LOG(LS_WARNING) << "Failed to initialize recording";
juberti2 2016/03/31 18:57:38 Shouldn't we propagate this error upwards instead
the sun 2016/04/01 09:07:46 We used to propagate it up, but eventually, in pc/
+ return;
+ }
+ // StartRecording() is only called once we actually have a stream to send.
+ if (!send_streams_.empty() && engine()->adm()->StartRecording() != 0) {
+ LOG(LS_WARNING) << "Failed to start recording";
+ return;
+ }
+ }
+}
} // namespace cricket
#endif // HAVE_WEBRTC_VOICE
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.h ('k') | webrtc/test/mock_voe_channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698