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 |
(...skipping 14 matching lines...) Expand all Loading... |
25 virtual int32_t RenderFrame(const uint32_t streamId, | 25 virtual int32_t RenderFrame(const uint32_t streamId, |
26 const VideoFrame& videoFrame) = 0; | 26 const VideoFrame& videoFrame) = 0; |
27 | 27 |
28 protected: | 28 protected: |
29 virtual ~VideoRenderCallback() {} | 29 virtual ~VideoRenderCallback() {} |
30 }; | 30 }; |
31 | 31 |
32 class IncomingVideoStream : public VideoRenderCallback { | 32 class IncomingVideoStream : public VideoRenderCallback { |
33 public: | 33 public: |
34 explicit IncomingVideoStream(uint32_t stream_id); | 34 explicit IncomingVideoStream(uint32_t stream_id); |
| 35 IncomingVideoStream(uint32_t stream_id, bool renderer_has_timing); |
35 ~IncomingVideoStream(); | 36 ~IncomingVideoStream(); |
36 | 37 |
37 // Get callback to deliver frames to the module. | 38 // Get callback to deliver frames to the module. |
38 VideoRenderCallback* ModuleCallback(); | 39 VideoRenderCallback* ModuleCallback(); |
39 virtual int32_t RenderFrame(const uint32_t stream_id, | 40 virtual int32_t RenderFrame(const uint32_t stream_id, |
40 const VideoFrame& video_frame); | 41 const VideoFrame& video_frame); |
41 | 42 |
42 // Set callback to the platform dependent code. | 43 // Set callback to the platform dependent code. |
43 void SetRenderCallback(VideoRenderCallback* render_callback); | 44 void SetRenderCallback(VideoRenderCallback* render_callback); |
44 | 45 |
(...skipping 21 matching lines...) Expand all Loading... |
66 protected: | 67 protected: |
67 static bool IncomingVideoStreamThreadFun(void* obj); | 68 static bool IncomingVideoStreamThreadFun(void* obj); |
68 bool IncomingVideoStreamProcess(); | 69 bool IncomingVideoStreamProcess(); |
69 | 70 |
70 private: | 71 private: |
71 enum { kEventStartupTimeMs = 10 }; | 72 enum { kEventStartupTimeMs = 10 }; |
72 enum { kEventMaxWaitTimeMs = 100 }; | 73 enum { kEventMaxWaitTimeMs = 100 }; |
73 enum { kFrameRatePeriodMs = 1000 }; | 74 enum { kFrameRatePeriodMs = 1000 }; |
74 | 75 |
75 uint32_t const stream_id_; | 76 uint32_t const stream_id_; |
| 77 const bool renderer_has_timing_; |
76 // Critsects in allowed to enter order. | 78 // Critsects in allowed to enter order. |
77 const rtc::scoped_ptr<CriticalSectionWrapper> stream_critsect_; | 79 const rtc::scoped_ptr<CriticalSectionWrapper> stream_critsect_; |
78 const rtc::scoped_ptr<CriticalSectionWrapper> thread_critsect_; | 80 const rtc::scoped_ptr<CriticalSectionWrapper> thread_critsect_; |
79 const rtc::scoped_ptr<CriticalSectionWrapper> buffer_critsect_; | 81 const rtc::scoped_ptr<CriticalSectionWrapper> buffer_critsect_; |
80 rtc::scoped_ptr<ThreadWrapper> incoming_render_thread_ | 82 rtc::scoped_ptr<ThreadWrapper> incoming_render_thread_ |
81 GUARDED_BY(thread_critsect_); | 83 GUARDED_BY(thread_critsect_); |
82 rtc::scoped_ptr<EventTimerWrapper> deliver_buffer_event_; | 84 rtc::scoped_ptr<EventTimerWrapper> deliver_buffer_event_; |
83 | 85 |
84 bool running_ GUARDED_BY(stream_critsect_); | 86 bool running_ GUARDED_BY(stream_critsect_); |
85 VideoRenderCallback* external_callback_ GUARDED_BY(thread_critsect_); | 87 VideoRenderCallback* external_callback_ GUARDED_BY(thread_critsect_); |
86 VideoRenderCallback* render_callback_ GUARDED_BY(thread_critsect_); | 88 VideoRenderCallback* render_callback_ GUARDED_BY(thread_critsect_); |
87 const rtc::scoped_ptr<VideoRenderFrames> render_buffers_ | 89 const rtc::scoped_ptr<VideoRenderFrames> render_buffers_ |
88 GUARDED_BY(buffer_critsect_); | 90 GUARDED_BY(buffer_critsect_); |
89 | 91 |
90 uint32_t incoming_rate_ GUARDED_BY(stream_critsect_); | 92 uint32_t incoming_rate_ GUARDED_BY(stream_critsect_); |
91 int64_t last_rate_calculation_time_ms_ GUARDED_BY(stream_critsect_); | 93 int64_t last_rate_calculation_time_ms_ GUARDED_BY(stream_critsect_); |
92 uint16_t num_frames_since_last_calculation_ GUARDED_BY(stream_critsect_); | 94 uint16_t num_frames_since_last_calculation_ GUARDED_BY(stream_critsect_); |
93 int64_t last_render_time_ms_ GUARDED_BY(thread_critsect_); | 95 int64_t last_render_time_ms_ GUARDED_BY(thread_critsect_); |
94 VideoFrame temp_frame_ GUARDED_BY(thread_critsect_); | 96 VideoFrame temp_frame_ GUARDED_BY(thread_critsect_); |
95 VideoFrame start_image_ GUARDED_BY(thread_critsect_); | 97 VideoFrame start_image_ GUARDED_BY(thread_critsect_); |
96 VideoFrame timeout_image_ GUARDED_BY(thread_critsect_); | 98 VideoFrame timeout_image_ GUARDED_BY(thread_critsect_); |
97 uint32_t timeout_time_ GUARDED_BY(thread_critsect_); | 99 uint32_t timeout_time_ GUARDED_BY(thread_critsect_); |
98 }; | 100 }; |
99 | 101 |
100 } // namespace webrtc | 102 } // namespace webrtc |
101 | 103 |
102 #endif // WEBRTC_COMMON_VIDEO_INTERFACE_INCOMING_VIDEO_STREAM_H_ | 104 #endif // WEBRTC_COMMON_VIDEO_INTERFACE_INCOMING_VIDEO_STREAM_H_ |
OLD | NEW |