OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #ifndef WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_ | 10 #ifndef WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_ |
(...skipping 23 matching lines...) Expand all Loading... |
34 public: | 34 public: |
35 // OnSinkWantsChanged is called when FrameGeneratorCapturer::AddOrUpdateSink | 35 // OnSinkWantsChanged is called when FrameGeneratorCapturer::AddOrUpdateSink |
36 // is called. | 36 // is called. |
37 virtual void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink, | 37 virtual void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink, |
38 const rtc::VideoSinkWants& wants) = 0; | 38 const rtc::VideoSinkWants& wants) = 0; |
39 | 39 |
40 protected: | 40 protected: |
41 virtual ~SinkWantsObserver() {} | 41 virtual ~SinkWantsObserver() {} |
42 }; | 42 }; |
43 | 43 |
44 static FrameGeneratorCapturer* Create(size_t width, | 44 static FrameGeneratorCapturer* Create(int width, |
45 size_t height, | 45 int height, |
46 int target_fps, | 46 int target_fps, |
47 Clock* clock); | 47 Clock* clock); |
48 | 48 |
49 static FrameGeneratorCapturer* CreateFromYuvFile(const std::string& file_name, | 49 static FrameGeneratorCapturer* CreateFromYuvFile(const std::string& file_name, |
50 size_t width, | 50 size_t width, |
51 size_t height, | 51 size_t height, |
52 int target_fps, | 52 int target_fps, |
53 Clock* clock); | 53 Clock* clock); |
54 virtual ~FrameGeneratorCapturer(); | 54 virtual ~FrameGeneratorCapturer(); |
55 | 55 |
56 void Start() override; | 56 void Start() override; |
57 void Stop() override; | 57 void Stop() override; |
58 void ChangeResolution(size_t width, size_t height); | 58 void ChangeResolution(size_t width, size_t height); |
59 | 59 |
60 void SetSinkWantsObserver(SinkWantsObserver* observer); | 60 void SetSinkWantsObserver(SinkWantsObserver* observer); |
61 | 61 |
62 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, | 62 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
63 const rtc::VideoSinkWants& wants) override; | 63 const rtc::VideoSinkWants& wants) override; |
64 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override; | 64 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override; |
65 | 65 |
66 void ForceFrame(); | 66 void ForceFrame(); |
67 void SetFakeRotation(VideoRotation rotation); | 67 void SetFakeRotation(VideoRotation rotation); |
68 | 68 |
69 int64_t first_frame_capture_time() const { return first_frame_capture_time_; } | 69 int64_t first_frame_capture_time() const { return first_frame_capture_time_; } |
70 | 70 |
71 FrameGeneratorCapturer(Clock* clock, | 71 FrameGeneratorCapturer(Clock* clock, |
72 FrameGenerator* frame_generator, | 72 std::unique_ptr<FrameGenerator> frame_generator, |
73 int target_fps); | 73 int target_fps); |
74 bool Init(); | 74 bool Init(); |
75 | 75 |
76 private: | 76 private: |
77 void InsertFrame(); | 77 void InsertFrame(); |
78 static bool Run(void* obj); | 78 static bool Run(void* obj); |
79 | 79 |
80 Clock* const clock_; | 80 Clock* const clock_; |
81 bool sending_; | 81 bool sending_; |
82 rtc::VideoSinkInterface<VideoFrame>* sink_ GUARDED_BY(&lock_); | 82 rtc::VideoSinkInterface<VideoFrame>* sink_ GUARDED_BY(&lock_); |
83 SinkWantsObserver* sink_wants_observer_ GUARDED_BY(&lock_); | 83 SinkWantsObserver* sink_wants_observer_ GUARDED_BY(&lock_); |
84 | 84 |
85 std::unique_ptr<EventTimerWrapper> tick_; | 85 std::unique_ptr<EventTimerWrapper> tick_; |
86 rtc::CriticalSection lock_; | 86 rtc::CriticalSection lock_; |
87 rtc::PlatformThread thread_; | 87 rtc::PlatformThread thread_; |
88 std::unique_ptr<FrameGenerator> frame_generator_; | 88 std::unique_ptr<FrameGenerator> frame_generator_; |
89 | 89 |
90 int target_fps_; | 90 int target_fps_; |
91 VideoRotation fake_rotation_ = kVideoRotation_0; | 91 VideoRotation fake_rotation_ = kVideoRotation_0; |
92 | 92 |
93 int64_t first_frame_capture_time_; | 93 int64_t first_frame_capture_time_; |
94 }; | 94 }; |
95 } // test | 95 } // test |
96 } // webrtc | 96 } // webrtc |
97 | 97 |
98 #endif // WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_ | 98 #endif // WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_ |
OLD | NEW |