1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/test/video_capturer.h"
12
13 #include "webrtc/test/testsupport/fileutils.h"
14 #include "webrtc/test/frame_generator_capturer.h"
15 #include "webrtc/test/vcm_capturer.h"
16
17 namespace webrtc {
18 namespace test {
19
20 class NullCapturer : public VideoCapturer {
21 public:
NullCapturer()22 NullCapturer() : VideoCapturer(NULL) {}
~NullCapturer()23 virtual ~NullCapturer() {}
24
Start()25 virtual void Start() {}
Stop()26 virtual void Stop() {}
27 };
28
VideoCapturer(VideoSendStreamInput * input)29 VideoCapturer::VideoCapturer(VideoSendStreamInput* input)
30 : input_(input) {}
31
Create(VideoSendStreamInput * input,size_t width,size_t height,int fps,Clock * clock)32 VideoCapturer* VideoCapturer::Create(VideoSendStreamInput* input,
33 size_t width,
34 size_t height,
35 int fps,
36 Clock* clock) {
37 VcmCapturer* vcm_capturer = VcmCapturer::Create(input, width, height, fps);
38
39 if (vcm_capturer != NULL) {
40 return vcm_capturer;
41 }
42 // TODO(pbos): Log a warning that this failed.
43
44 FrameGeneratorCapturer* frame_generator_capturer =
45 FrameGeneratorCapturer::Create(input, width, height, fps, clock);
46 if (frame_generator_capturer != NULL) {
47 return frame_generator_capturer;
48 }
49 // TODO(pbos): Log a warning that this failed.
50
51 return new NullCapturer();
52 }
53 } // test
54 } // webrtc
55