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

Side by Side Diff: content/renderer/media/webrtc_local_audio_track.cc

Issue 221863003: Notify the track before source provider goes away. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed the comments. Created 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/webrtc_local_audio_track.h" 5 #include "content/renderer/media/webrtc_local_audio_track.h"
6 6
7 #include "content/public/renderer/media_stream_audio_sink.h" 7 #include "content/public/renderer/media_stream_audio_sink.h"
8 #include "content/renderer/media/media_stream_audio_level_calculator.h" 8 #include "content/renderer/media/media_stream_audio_level_calculator.h"
9 #include "content/renderer/media/media_stream_audio_processor.h" 9 #include "content/renderer/media/media_stream_audio_processor.h"
10 #include "content/renderer/media/media_stream_audio_sink_owner.h" 10 #include "content/renderer/media/media_stream_audio_sink_owner.h"
(...skipping 10 matching lines...) Expand all
21 const scoped_refptr<WebRtcAudioCapturer>& capturer, 21 const scoped_refptr<WebRtcAudioCapturer>& capturer,
22 WebAudioCapturerSource* webaudio_source) 22 WebAudioCapturerSource* webaudio_source)
23 : MediaStreamTrack(adapter, true), 23 : MediaStreamTrack(adapter, true),
24 adapter_(adapter), 24 adapter_(adapter),
25 capturer_(capturer), 25 capturer_(capturer),
26 webaudio_source_(webaudio_source) { 26 webaudio_source_(webaudio_source) {
27 DCHECK(capturer.get() || webaudio_source); 27 DCHECK(capturer.get() || webaudio_source);
28 28
29 adapter_->Initialize(this); 29 adapter_->Initialize(this);
30 30
31 if (!webaudio_source_) {
32 source_provider_.reset(new WebRtcLocalAudioSourceProvider());
33 AddSink(source_provider_.get());
34 }
35 DVLOG(1) << "WebRtcLocalAudioTrack::WebRtcLocalAudioTrack()"; 31 DVLOG(1) << "WebRtcLocalAudioTrack::WebRtcLocalAudioTrack()";
36 } 32 }
37 33
38 WebRtcLocalAudioTrack::~WebRtcLocalAudioTrack() { 34 WebRtcLocalAudioTrack::~WebRtcLocalAudioTrack() {
39 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 35 DCHECK(main_render_thread_checker_.CalledOnValidThread());
40 DVLOG(1) << "WebRtcLocalAudioTrack::~WebRtcLocalAudioTrack()"; 36 DVLOG(1) << "WebRtcLocalAudioTrack::~WebRtcLocalAudioTrack()";
41 // Users might not call Stop() on the track. 37 // Users might not call Stop() on the track.
42 Stop(); 38 Stop();
43 } 39 }
44 40
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 242
247 for (SinkList::ItemList::const_iterator it = sinks.begin(); 243 for (SinkList::ItemList::const_iterator it = sinks.begin();
248 it != sinks.end(); 244 it != sinks.end();
249 ++it){ 245 ++it){
250 (*it)->OnReadyStateChanged(blink::WebMediaStreamSource::ReadyStateEnded); 246 (*it)->OnReadyStateChanged(blink::WebMediaStreamSource::ReadyStateEnded);
251 (*it)->Reset(); 247 (*it)->Reset();
252 } 248 }
253 } 249 }
254 250
255 } // namespace content 251 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698