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_ |
11 #define WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_ | 11 #define WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_ |
12 | 12 |
13 #include <memory> | 13 #include <memory> |
14 #include <string> | 14 #include <string> |
15 | 15 |
16 #include "webrtc/api/video/video_frame.h" | 16 #include "webrtc/api/video/video_frame.h" |
| 17 #include "webrtc/api/video/video_content_type.h" |
17 #include "webrtc/base/criticalsection.h" | 18 #include "webrtc/base/criticalsection.h" |
18 #include "webrtc/base/task_queue.h" | 19 #include "webrtc/base/task_queue.h" |
19 #include "webrtc/test/video_capturer.h" | 20 #include "webrtc/test/video_capturer.h" |
20 #include "webrtc/typedefs.h" | 21 #include "webrtc/typedefs.h" |
21 | 22 |
22 namespace webrtc { | 23 namespace webrtc { |
23 | 24 |
24 class EventTimerWrapper; | 25 class EventTimerWrapper; |
25 | 26 |
26 namespace test { | 27 namespace test { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 59 |
59 void SetSinkWantsObserver(SinkWantsObserver* observer); | 60 void SetSinkWantsObserver(SinkWantsObserver* observer); |
60 | 61 |
61 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, | 62 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
62 const rtc::VideoSinkWants& wants) override; | 63 const rtc::VideoSinkWants& wants) override; |
63 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override; | 64 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override; |
64 | 65 |
65 void ForceFrame(); | 66 void ForceFrame(); |
66 void SetFakeRotation(VideoRotation rotation); | 67 void SetFakeRotation(VideoRotation rotation); |
67 | 68 |
| 69 void SetFakeContentType(VideoContentType content_type); |
| 70 |
68 int64_t first_frame_capture_time() const { return first_frame_capture_time_; } | 71 int64_t first_frame_capture_time() const { return first_frame_capture_time_; } |
69 | 72 |
70 FrameGeneratorCapturer(Clock* clock, | 73 FrameGeneratorCapturer(Clock* clock, |
71 std::unique_ptr<FrameGenerator> frame_generator, | 74 std::unique_ptr<FrameGenerator> frame_generator, |
72 int target_fps); | 75 int target_fps); |
73 bool Init(); | 76 bool Init(); |
74 | 77 |
75 private: | 78 private: |
76 class InsertFrameTask; | 79 class InsertFrameTask; |
77 | 80 |
78 void InsertFrame(); | 81 void InsertFrame(); |
79 static bool Run(void* obj); | 82 static bool Run(void* obj); |
80 | 83 |
81 Clock* const clock_; | 84 Clock* const clock_; |
82 bool sending_; | 85 bool sending_; |
83 rtc::VideoSinkInterface<VideoFrame>* sink_ GUARDED_BY(&lock_); | 86 rtc::VideoSinkInterface<VideoFrame>* sink_ GUARDED_BY(&lock_); |
84 SinkWantsObserver* sink_wants_observer_ GUARDED_BY(&lock_); | 87 SinkWantsObserver* sink_wants_observer_ GUARDED_BY(&lock_); |
85 | 88 |
86 rtc::CriticalSection lock_; | 89 rtc::CriticalSection lock_; |
87 std::unique_ptr<FrameGenerator> frame_generator_; | 90 std::unique_ptr<FrameGenerator> frame_generator_; |
88 | 91 |
89 int target_fps_; | 92 int target_fps_; |
90 VideoRotation fake_rotation_ = kVideoRotation_0; | 93 VideoRotation fake_rotation_ = kVideoRotation_0; |
91 | 94 |
| 95 VideoContentType fake_video_content_type_ = VideoContentType::kDefault; |
| 96 |
92 int64_t first_frame_capture_time_; | 97 int64_t first_frame_capture_time_; |
93 // Must be the last field, so it will be deconstructed first as tasks | 98 // Must be the last field, so it will be deconstructed first as tasks |
94 // in the TaskQueue access other fields of the instance of this class. | 99 // in the TaskQueue access other fields of the instance of this class. |
95 rtc::TaskQueue task_queue_; | 100 rtc::TaskQueue task_queue_; |
96 }; | 101 }; |
97 } // namespace test | 102 } // namespace test |
98 } // namespace webrtc | 103 } // namespace webrtc |
99 | 104 |
100 #endif // WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_ | 105 #endif // WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_ |
OLD | NEW |