OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 | 10 |
11 #ifndef WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ | 11 #ifndef WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ |
12 #define WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ | 12 #define WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ |
13 | 13 |
| 14 #include <memory> |
| 15 |
| 16 #include "webrtc/base/criticalsection.h" |
| 17 #include "webrtc/base/platform_thread.h" |
14 #include "webrtc/base/race_checker.h" | 18 #include "webrtc/base/race_checker.h" |
15 #include "webrtc/base/task_queue.h" | 19 #include "webrtc/base/thread_annotations.h" |
| 20 #include "webrtc/base/thread_checker.h" |
16 #include "webrtc/common_video/video_render_frames.h" | 21 #include "webrtc/common_video/video_render_frames.h" |
17 #include "webrtc/media/base/videosinkinterface.h" | 22 #include "webrtc/media/base/videosinkinterface.h" |
18 | 23 |
19 namespace webrtc { | 24 namespace webrtc { |
| 25 class EventTimerWrapper; |
20 | 26 |
21 class IncomingVideoStream : public rtc::VideoSinkInterface<VideoFrame> { | 27 class IncomingVideoStream : public rtc::VideoSinkInterface<VideoFrame> { |
22 public: | 28 public: |
23 IncomingVideoStream(int32_t delay_ms, | 29 IncomingVideoStream(int32_t delay_ms, |
24 rtc::VideoSinkInterface<VideoFrame>* callback); | 30 rtc::VideoSinkInterface<VideoFrame>* callback); |
25 ~IncomingVideoStream() override; | 31 ~IncomingVideoStream() override; |
26 | 32 |
| 33 protected: |
| 34 static void IncomingVideoStreamThreadFun(void* obj); |
| 35 void IncomingVideoStreamProcess(); |
| 36 |
27 private: | 37 private: |
28 void OnFrame(const VideoFrame& video_frame) override; | 38 void OnFrame(const VideoFrame& video_frame) override; |
29 void Dequeue(); | |
30 | |
31 // Fwd decl of a QueuedTask implementation for carrying frames over to the TQ. | |
32 class NewFrameTask; | |
33 | 39 |
34 rtc::ThreadChecker main_thread_checker_; | 40 rtc::ThreadChecker main_thread_checker_; |
| 41 rtc::ThreadChecker render_thread_checker_; |
35 rtc::RaceChecker decoder_race_checker_; | 42 rtc::RaceChecker decoder_race_checker_; |
36 | 43 |
37 VideoRenderFrames render_buffers_; // Only touched on the TaskQueue. | 44 rtc::CriticalSection buffer_critsect_; |
38 rtc::VideoSinkInterface<VideoFrame>* const callback_; | 45 rtc::PlatformThread incoming_render_thread_; |
39 rtc::TaskQueue incoming_render_queue_; | 46 std::unique_ptr<EventTimerWrapper> deliver_buffer_event_; |
| 47 |
| 48 rtc::VideoSinkInterface<VideoFrame>* const external_callback_; |
| 49 std::unique_ptr<VideoRenderFrames> render_buffers_ |
| 50 GUARDED_BY(buffer_critsect_); |
40 }; | 51 }; |
41 | 52 |
42 } // namespace webrtc | 53 } // namespace webrtc |
43 | 54 |
44 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ | 55 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ |
OLD | NEW |