1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/renderer/media/media_stream_video_capturer_source.h"
8 #include "base/debug/trace_event.h"
9 #include "content/renderer/media/rtc_media_constraints.h"
10 #include "content/renderer/media/rtc_video_capturer.h"
14 MediaStreamVideoCapturerSource::MediaStreamVideoCapturerSource(
15 const StreamDeviceInfo& device_info,
16 const SourceStoppedCallback& stop_callback,
17 MediaStreamDependencyFactory* factory)
18 : MediaStreamVideoSource(factory) {
19 SetDeviceInfo(device_info);
20 SetStopCallback(stop_callback);
23 MediaStreamVideoCapturerSource::~MediaStreamVideoCapturerSource() {
26 void MediaStreamVideoCapturerSource::InitAdapter(
27 const blink::WebMediaConstraints& constraints) {
28 // Create the webrtc::VideoSource implementation.
29 RTCMediaConstraints webrtc_constraints(constraints);
30 cricket::VideoCapturer* capturer =
31 factory()->CreateVideoCapturer(device_info());
32 SetAdapter(factory()->CreateVideoSource(capturer,
33 &webrtc_constraints));
36 } // namespace content