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

Side by Side Diff: content/renderer/media/media_stream_center.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/media_stream_center.h" 5 #include "content/renderer/media/media_stream_center.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Only local audio track is supported now. 147 // Only local audio track is supported now.
148 // TODO(xians): Support remote audio track. 148 // TODO(xians): Support remote audio track.
149 if (!media_stream_track || !media_stream_track->is_local_track ()) { 149 if (!media_stream_track || !media_stream_track->is_local_track ()) {
150 NOTIMPLEMENTED(); 150 NOTIMPLEMENTED();
151 return NULL; 151 return NULL;
152 } 152 }
153 153
154 blink::WebMediaStreamSource source = track.source(); 154 blink::WebMediaStreamSource source = track.source();
155 DCHECK_EQ(source.type(), blink::WebMediaStreamSource::TypeAudio); 155 DCHECK_EQ(source.type(), blink::WebMediaStreamSource::TypeAudio);
156 WebRtcLocalAudioSourceProvider* source_provider = 156 WebRtcLocalAudioSourceProvider* source_provider =
157 new WebRtcLocalAudioSourceProvider(); 157 new WebRtcLocalAudioSourceProvider(track);
158 MediaStreamAudioSink::AddToAudioTrack(source_provider, track);
159 return source_provider; 158 return source_provider;
160 } 159 }
161 160
162 void MediaStreamCenter::didStopLocalMediaStream( 161 void MediaStreamCenter::didStopLocalMediaStream(
163 const blink::WebMediaStream& stream) { 162 const blink::WebMediaStream& stream) {
164 DVLOG(1) << "MediaStreamCenter::didStopLocalMediaStream"; 163 DVLOG(1) << "MediaStreamCenter::didStopLocalMediaStream";
165 MediaStream* native_stream = MediaStream::GetMediaStream(stream); 164 MediaStream* native_stream = MediaStream::GetMediaStream(stream);
166 if (!native_stream) { 165 if (!native_stream) {
167 NOTREACHED(); 166 NOTREACHED();
168 return; 167 return;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 device.type == MEDIA_DEVICE_AUDIO_CAPTURE 271 device.type == MEDIA_DEVICE_AUDIO_CAPTURE
273 ? blink::WebSourceInfo::SourceKindAudio 272 ? blink::WebSourceInfo::SourceKindAudio
274 : blink::WebSourceInfo::SourceKindVideo, 273 : blink::WebSourceInfo::SourceKindVideo,
275 blink::WebString::fromUTF8(device.name), 274 blink::WebString::fromUTF8(device.name),
276 video_facing); 275 video_facing);
277 } 276 }
278 request_it->second.requestSucceeded(sourceInfos); 277 request_it->second.requestSucceeded(sourceInfos);
279 } 278 }
280 279
281 } // namespace content 280 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698