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