• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2020 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 #ifndef TEST_PC_E2E_MEDIA_TEST_VIDEO_CAPTURER_VIDEO_TRACK_SOURCE_H_
12 #define TEST_PC_E2E_MEDIA_TEST_VIDEO_CAPTURER_VIDEO_TRACK_SOURCE_H_
13 
14 #include <memory>
15 #include <utility>
16 
17 #include "api/video/video_frame.h"
18 #include "api/video/video_source_interface.h"
19 #include "pc/video_track_source.h"
20 #include "test/test_video_capturer.h"
21 
22 namespace webrtc {
23 namespace webrtc_pc_e2e {
24 
25 class TestVideoCapturerVideoTrackSource : public VideoTrackSource {
26  public:
TestVideoCapturerVideoTrackSource(std::unique_ptr<test::TestVideoCapturer> video_capturer,bool is_screencast)27   TestVideoCapturerVideoTrackSource(
28       std::unique_ptr<test::TestVideoCapturer> video_capturer,
29       bool is_screencast)
30       : VideoTrackSource(/*remote=*/false),
31         video_capturer_(std::move(video_capturer)),
32         is_screencast_(is_screencast) {}
33 
34   ~TestVideoCapturerVideoTrackSource() = default;
35 
Start()36   void Start() { SetState(kLive); }
37 
Stop()38   void Stop() { SetState(kMuted); }
39 
is_screencast()40   bool is_screencast() const override { return is_screencast_; }
41 
42  protected:
source()43   rtc::VideoSourceInterface<VideoFrame>* source() override {
44     return video_capturer_.get();
45   }
46 
47  private:
48   std::unique_ptr<test::TestVideoCapturer> video_capturer_;
49   const bool is_screencast_;
50 };
51 
52 }  // namespace webrtc_pc_e2e
53 }  // namespace webrtc
54 
55 #endif  // TEST_PC_E2E_MEDIA_TEST_VIDEO_CAPTURER_VIDEO_TRACK_SOURCE_H_
56