blob: 624bb9d17ac2fac9c881bb9e6fe16cc437c2f266 [file] [log] [blame]
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +00001/*
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
pbos@webrtc.org281cff82013-05-17 13:44:48 +000011#include "webrtc/video_engine/test/common/video_capturer.h"
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000012
pbos@webrtc.orge8350192013-07-10 15:02:02 +000013#include "webrtc/test/testsupport/fileutils.h"
pbos@webrtc.org2f02da82013-07-09 08:02:33 +000014#include "webrtc/video_engine/test/common/file_capturer.h"
pbos@webrtc.orgc1506a22013-05-29 13:41:03 +000015#include "webrtc/video_engine/test/common/frame_generator.h"
16#include "webrtc/video_engine/test/common/frame_generator_capturer.h"
17#include "webrtc/video_engine/test/common/vcm_capturer.h"
18
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000019namespace webrtc {
20namespace test {
21
22class NullCapturer : public VideoCapturer {
23 public:
24 NullCapturer() : VideoCapturer(NULL) {}
25 virtual ~NullCapturer() {}
26
27 virtual void Start() {}
28 virtual void Stop() {}
29};
30
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000031VideoCapturer::VideoCapturer(VideoSendStreamInput* input)
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000032 : input_(input) {}
33
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000034VideoCapturer* VideoCapturer::Create(VideoSendStreamInput* input,
pbos@webrtc.org074eb202013-05-23 12:20:16 +000035 size_t width,
36 size_t height,
pbos@webrtc.orge3e46152013-05-29 15:13:12 +000037 int fps,
pbos@webrtc.orgc1506a22013-05-29 13:41:03 +000038 Clock* clock) {
pbos@webrtc.org074eb202013-05-23 12:20:16 +000039 VcmCapturer* vcm_capturer = VcmCapturer::Create(input, width, height, fps);
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000040
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000041 if (vcm_capturer != NULL) {
42 return vcm_capturer;
43 }
44 // TODO(pbos): Log a warning that this failed.
45
pbos@webrtc.orgc1506a22013-05-29 13:41:03 +000046 FrameGeneratorCapturer* frame_generator_capturer =
47 FrameGeneratorCapturer::Create(
pbos@webrtc.org2f02da82013-07-09 08:02:33 +000048 input, FrameGenerator::Create(width, height, clock), fps);
pbos@webrtc.orgc1506a22013-05-29 13:41:03 +000049 if (frame_generator_capturer != NULL) {
50 return frame_generator_capturer;
51 }
52 // TODO(pbos): Log a warning that this failed.
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000053
54 return new NullCapturer();
55}
56} // test
57} // webrtc