Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / renderer / media / media_stream_video_capturer_source.cc
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.
4
5 #include "content/renderer/media/media_stream_video_capturer_source.h"
6
7 #include "base/bind.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"
11
12 namespace content {
13
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);
21 }
22
23 MediaStreamVideoCapturerSource::~MediaStreamVideoCapturerSource() {
24 }
25
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));
34 }
35
36 }  // namespace content