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 "webrtc/base/platform_thread.h" |
14 #include "webrtc/base/scoped_ptr.h" | 15 #include "webrtc/base/scoped_ptr.h" |
15 #include "webrtc/base/thread_annotations.h" | 16 #include "webrtc/base/thread_annotations.h" |
16 #include "webrtc/common_video/video_render_frames.h" | 17 #include "webrtc/common_video/video_render_frames.h" |
17 | 18 |
18 namespace webrtc { | 19 namespace webrtc { |
19 class CriticalSectionWrapper; | 20 class CriticalSectionWrapper; |
20 class EventTimerWrapper; | 21 class EventTimerWrapper; |
21 class PlatformThread; | |
22 class VideoRenderer; | |
23 | 22 |
24 class VideoRenderCallback { | 23 class VideoRenderCallback { |
25 public: | 24 public: |
26 virtual int32_t RenderFrame(const uint32_t streamId, | 25 virtual int32_t RenderFrame(const uint32_t streamId, |
27 const VideoFrame& videoFrame) = 0; | 26 const VideoFrame& videoFrame) = 0; |
28 | 27 |
29 protected: | 28 protected: |
30 virtual ~VideoRenderCallback() {} | 29 virtual ~VideoRenderCallback() {} |
31 }; | 30 }; |
32 | 31 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 enum { kFrameRatePeriodMs = 1000 }; | 73 enum { kFrameRatePeriodMs = 1000 }; |
75 | 74 |
76 void DeliverFrame(const VideoFrame& video_frame); | 75 void DeliverFrame(const VideoFrame& video_frame); |
77 | 76 |
78 uint32_t const stream_id_; | 77 uint32_t const stream_id_; |
79 const bool disable_prerenderer_smoothing_; | 78 const bool disable_prerenderer_smoothing_; |
80 // Critsects in allowed to enter order. | 79 // Critsects in allowed to enter order. |
81 const rtc::scoped_ptr<CriticalSectionWrapper> stream_critsect_; | 80 const rtc::scoped_ptr<CriticalSectionWrapper> stream_critsect_; |
82 const rtc::scoped_ptr<CriticalSectionWrapper> thread_critsect_; | 81 const rtc::scoped_ptr<CriticalSectionWrapper> thread_critsect_; |
83 const rtc::scoped_ptr<CriticalSectionWrapper> buffer_critsect_; | 82 const rtc::scoped_ptr<CriticalSectionWrapper> buffer_critsect_; |
84 rtc::scoped_ptr<PlatformThread> incoming_render_thread_ | 83 // TODO(pbos): Make plain member and stop resetting this thread, just |
| 84 // start/stoping it is enough. |
| 85 rtc::scoped_ptr<rtc::PlatformThread> incoming_render_thread_ |
85 GUARDED_BY(thread_critsect_); | 86 GUARDED_BY(thread_critsect_); |
86 rtc::scoped_ptr<EventTimerWrapper> deliver_buffer_event_; | 87 rtc::scoped_ptr<EventTimerWrapper> deliver_buffer_event_; |
87 | 88 |
88 bool running_ GUARDED_BY(stream_critsect_); | 89 bool running_ GUARDED_BY(stream_critsect_); |
89 VideoRenderCallback* external_callback_ GUARDED_BY(thread_critsect_); | 90 VideoRenderCallback* external_callback_ GUARDED_BY(thread_critsect_); |
90 VideoRenderCallback* render_callback_ GUARDED_BY(thread_critsect_); | 91 VideoRenderCallback* render_callback_ GUARDED_BY(thread_critsect_); |
91 const rtc::scoped_ptr<VideoRenderFrames> render_buffers_ | 92 const rtc::scoped_ptr<VideoRenderFrames> render_buffers_ |
92 GUARDED_BY(buffer_critsect_); | 93 GUARDED_BY(buffer_critsect_); |
93 | 94 |
94 uint32_t incoming_rate_ GUARDED_BY(stream_critsect_); | 95 uint32_t incoming_rate_ GUARDED_BY(stream_critsect_); |
95 int64_t last_rate_calculation_time_ms_ GUARDED_BY(stream_critsect_); | 96 int64_t last_rate_calculation_time_ms_ GUARDED_BY(stream_critsect_); |
96 uint16_t num_frames_since_last_calculation_ GUARDED_BY(stream_critsect_); | 97 uint16_t num_frames_since_last_calculation_ GUARDED_BY(stream_critsect_); |
97 int64_t last_render_time_ms_ GUARDED_BY(thread_critsect_); | 98 int64_t last_render_time_ms_ GUARDED_BY(thread_critsect_); |
98 VideoFrame temp_frame_ GUARDED_BY(thread_critsect_); | 99 VideoFrame temp_frame_ GUARDED_BY(thread_critsect_); |
99 VideoFrame start_image_ GUARDED_BY(thread_critsect_); | 100 VideoFrame start_image_ GUARDED_BY(thread_critsect_); |
100 VideoFrame timeout_image_ GUARDED_BY(thread_critsect_); | 101 VideoFrame timeout_image_ GUARDED_BY(thread_critsect_); |
101 uint32_t timeout_time_ GUARDED_BY(thread_critsect_); | 102 uint32_t timeout_time_ GUARDED_BY(thread_critsect_); |
102 }; | 103 }; |
103 | 104 |
104 } // namespace webrtc | 105 } // namespace webrtc |
105 | 106 |
106 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ | 107 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ |
OLD | NEW |