Home | History | Annotate | Download | only in test
      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 #ifndef WEBRTC_TEST_VCM_CAPTURER_H_
     11 #define WEBRTC_TEST_VCM_CAPTURER_H_
     12 
     13 #include "webrtc/base/criticalsection.h"
     14 #include "webrtc/common_types.h"
     15 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
     16 #include "webrtc/modules/video_capture/video_capture.h"
     17 #include "webrtc/test/video_capturer.h"
     18 
     19 namespace webrtc {
     20 namespace test {
     21 
     22 class VcmCapturer : public VideoCapturer, public VideoCaptureDataCallback {
     23  public:
     24   static VcmCapturer* Create(VideoCaptureInput* input,
     25                              size_t width,
     26                              size_t height,
     27                              size_t target_fps);
     28   virtual ~VcmCapturer();
     29 
     30   void Start() override;
     31   void Stop() override;
     32 
     33   void OnIncomingCapturedFrame(const int32_t id,
     34                                const VideoFrame& frame) override;  // NOLINT
     35   void OnCaptureDelayChanged(const int32_t id, const int32_t delay) override;
     36 
     37  private:
     38   explicit VcmCapturer(VideoCaptureInput* input);
     39   bool Init(size_t width, size_t height, size_t target_fps);
     40   void Destroy();
     41 
     42   rtc::CriticalSection crit_;
     43   bool started_ GUARDED_BY(crit_);
     44   VideoCaptureModule* vcm_;
     45   VideoCaptureCapability capability_;
     46 };
     47 }  // test
     48 }  // webrtc
     49 
     50 #endif  // WEBRTC_TEST_VCM_CAPTURER_H_
     51