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

Unified Diff: content/renderer/media/webrtc_local_audio_track.cc

Issue 15979027: start/stop the source of the capturer when 1st audiotrack/last audiotrack is added/removed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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: content/renderer/media/webrtc_local_audio_track.cc
diff --git a/content/renderer/media/webrtc_local_audio_track.cc b/content/renderer/media/webrtc_local_audio_track.cc
index 0aa63658c516256a90b33696437143d775199f2b..4abd407f28afc8c9409f3eb23725434658183485 100644
--- a/content/renderer/media/webrtc_local_audio_track.cc
+++ b/content/renderer/media/webrtc_local_audio_track.cc
@@ -29,14 +29,13 @@ WebRtcLocalAudioTrack::WebRtcLocalAudioTrack(
capturer_(capturer),
track_source_(track_source) {
DCHECK(capturer.get());
- capturer_->AddSink(this);
DVLOG(1) << "WebRtcLocalAudioTrack::WebRtcLocalAudioTrack()";
}
WebRtcLocalAudioTrack::~WebRtcLocalAudioTrack() {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(sinks_.empty());
- capturer_->RemoveSink(this);
+ DCHECK(!capturer_.get());
henrika (OOO until Aug 14) 2013/06/05 09:09:20 What ensures that RemoveSink i called now?
no longer working on chromium 2013/06/05 16:29:45 Right, I also realized it this morning, we should
DVLOG(1) << "WebRtcLocalAudioTrack::~WebRtcLocalAudioTrack()";
}
@@ -124,4 +123,17 @@ void WebRtcLocalAudioTrack::RemoveSink(
}
}
+void WebRtcLocalAudioTrack::Start() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ DVLOG(1) << "WebRtcLocalAudioTrack::Start()";
+ capturer_->AddSink(this);
+}
+
+void WebRtcLocalAudioTrack::Stop() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ DVLOG(1) << "WebRtcLocalAudioTrack::Stop()";
+ capturer_->RemoveSink(this);
+ capturer_ = NULL;
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698