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

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

Issue 218763007: Update MediaStreamTrack::Stop to latest draft. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review. 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 | Annotate | Revision Log
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_dependency_factory.h" 5 #include "content/renderer/media/media_stream_dependency_factory.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 RTCMediaConstraints native_audio_constraints(audio_constraints); 198 RTCMediaConstraints native_audio_constraints(audio_constraints);
199 ApplyFixedAudioConstraints(&native_audio_constraints); 199 ApplyFixedAudioConstraints(&native_audio_constraints);
200 200
201 StreamDeviceInfo device_info = source_data->device_info(); 201 StreamDeviceInfo device_info = source_data->device_info();
202 RTCMediaConstraints constraints = native_audio_constraints; 202 RTCMediaConstraints constraints = native_audio_constraints;
203 // May modify both |constraints| and |effects|. 203 // May modify both |constraints| and |effects|.
204 HarmonizeConstraintsAndEffects(&constraints, 204 HarmonizeConstraintsAndEffects(&constraints,
205 &device_info.device.input.effects); 205 &device_info.device.input.effects);
206 206
207 scoped_refptr<WebRtcAudioCapturer> capturer( 207 scoped_refptr<WebRtcAudioCapturer> capturer(
208 CreateAudioCapturer(render_view_id, device_info, audio_constraints)); 208 CreateAudioCapturer(render_view_id, device_info, audio_constraints,
209 source_data));
209 if (!capturer.get()) { 210 if (!capturer.get()) {
210 DLOG(WARNING) << "Failed to create the capturer for device " 211 DLOG(WARNING) << "Failed to create the capturer for device "
211 << device_info.device.id; 212 << device_info.device.id;
212 // TODO(xians): Don't we need to check if source_observer is observing 213 // TODO(xians): Don't we need to check if source_observer is observing
213 // something? If not, then it looks like we have a leak here. 214 // something? If not, then it looks like we have a leak here.
214 // OTOH, if it _is_ observing something, then the callback might 215 // OTOH, if it _is_ observing something, then the callback might
215 // be called multiple times which is likely also a bug. 216 // be called multiple times which is likely also a bug.
216 return false; 217 return false;
217 } 218 }
218 source_data->SetAudioCapturer(capturer); 219 source_data->SetAudioCapturer(capturer);
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 } else { 698 } else {
698 NOTREACHED() << "Worker thread not running."; 699 NOTREACHED() << "Worker thread not running.";
699 } 700 }
700 } 701 }
701 } 702 }
702 703
703 scoped_refptr<WebRtcAudioCapturer> 704 scoped_refptr<WebRtcAudioCapturer>
704 MediaStreamDependencyFactory::CreateAudioCapturer( 705 MediaStreamDependencyFactory::CreateAudioCapturer(
705 int render_view_id, 706 int render_view_id,
706 const StreamDeviceInfo& device_info, 707 const StreamDeviceInfo& device_info,
707 const blink::WebMediaConstraints& constraints) { 708 const blink::WebMediaConstraints& constraints,
709 MediaStreamAudioSource* audio_source) {
708 // TODO(xians): Handle the cases when gUM is called without a proper render 710 // TODO(xians): Handle the cases when gUM is called without a proper render
709 // view, for example, by an extension. 711 // view, for example, by an extension.
710 DCHECK_GE(render_view_id, 0); 712 DCHECK_GE(render_view_id, 0);
711 713
712 EnsureWebRtcAudioDeviceImpl(); 714 EnsureWebRtcAudioDeviceImpl();
713 DCHECK(GetWebRtcAudioDevice()); 715 DCHECK(GetWebRtcAudioDevice());
714 return WebRtcAudioCapturer::CreateCapturer(render_view_id, device_info, 716 return WebRtcAudioCapturer::CreateCapturer(render_view_id, device_info,
715 constraints, 717 constraints,
716 GetWebRtcAudioDevice()); 718 GetWebRtcAudioDevice(),
719 audio_source);
717 } 720 }
718 721
719 void MediaStreamDependencyFactory::AddNativeTrackToBlinkTrack( 722 void MediaStreamDependencyFactory::AddNativeTrackToBlinkTrack(
720 webrtc::MediaStreamTrackInterface* native_track, 723 webrtc::MediaStreamTrackInterface* native_track,
721 const blink::WebMediaStreamTrack& webkit_track, 724 const blink::WebMediaStreamTrack& webkit_track,
722 bool is_local_track) { 725 bool is_local_track) {
723 DCHECK(!webkit_track.isNull() && !webkit_track.extraData()); 726 DCHECK(!webkit_track.isNull() && !webkit_track.extraData());
724 blink::WebMediaStreamTrack track = webkit_track; 727 blink::WebMediaStreamTrack track = webkit_track;
725 728
726 if (track.source().type() == blink::WebMediaStreamSource::TypeVideo) { 729 if (track.source().type() == blink::WebMediaStreamSource::TypeVideo) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 } 795 }
793 796
794 void MediaStreamDependencyFactory::EnsureWebRtcAudioDeviceImpl() { 797 void MediaStreamDependencyFactory::EnsureWebRtcAudioDeviceImpl() {
795 if (audio_device_) 798 if (audio_device_)
796 return; 799 return;
797 800
798 audio_device_ = new WebRtcAudioDeviceImpl(); 801 audio_device_ = new WebRtcAudioDeviceImpl();
799 } 802 }
800 803
801 } // namespace content 804 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698