| 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 20 matching lines...) Expand all Loading... |
| 31 // Overrides VideoSinkInterface | 31 // Overrides VideoSinkInterface |
| 32 void OnFrame(const VideoFrame& video_frame) override; | 32 void OnFrame(const VideoFrame& video_frame) override; |
| 33 | 33 |
| 34 // Callback for file recording, snapshot, ... | 34 // Callback for file recording, snapshot, ... |
| 35 void SetExternalCallback(rtc::VideoSinkInterface<VideoFrame>* render_object); | 35 void SetExternalCallback(rtc::VideoSinkInterface<VideoFrame>* render_object); |
| 36 | 36 |
| 37 // Start/Stop. | 37 // Start/Stop. |
| 38 int32_t Start(); | 38 int32_t Start(); |
| 39 int32_t Stop(); | 39 int32_t Stop(); |
| 40 | 40 |
| 41 // Clear all buffers. | |
| 42 int32_t Reset(); | |
| 43 | |
| 44 // Properties. | |
| 45 uint32_t IncomingRate() const; | |
| 46 | |
| 47 int32_t SetExpectedRenderDelay(int32_t delay_ms); | 41 int32_t SetExpectedRenderDelay(int32_t delay_ms); |
| 48 | 42 |
| 49 protected: | 43 protected: |
| 50 static bool IncomingVideoStreamThreadFun(void* obj); | 44 static bool IncomingVideoStreamThreadFun(void* obj); |
| 51 bool IncomingVideoStreamProcess(); | 45 bool IncomingVideoStreamProcess(); |
| 52 | 46 |
| 53 private: | 47 private: |
| 54 enum { kEventStartupTimeMs = 10 }; | 48 enum { kEventStartupTimeMs = 10 }; |
| 55 enum { kEventMaxWaitTimeMs = 100 }; | 49 enum { kEventMaxWaitTimeMs = 100 }; |
| 56 enum { kFrameRatePeriodMs = 1000 }; | 50 enum { kFrameRatePeriodMs = 1000 }; |
| 57 | 51 |
| 58 void DeliverFrame(const VideoFrame& video_frame); | 52 void DeliverFrame(const VideoFrame& video_frame); |
| 59 | 53 |
| 60 const bool disable_prerenderer_smoothing_; | 54 const bool disable_prerenderer_smoothing_; |
| 61 // Critsects in allowed to enter order. | 55 // Critsects in allowed to enter order. |
| 62 rtc::CriticalSection stream_critsect_; | 56 rtc::CriticalSection stream_critsect_; |
| 63 rtc::CriticalSection thread_critsect_; | 57 rtc::CriticalSection thread_critsect_; |
| 64 rtc::CriticalSection buffer_critsect_; | 58 rtc::CriticalSection buffer_critsect_; |
| 65 // TODO(pbos): Make plain member and stop resetting this thread, just | 59 // TODO(pbos): Make plain member and stop resetting this thread, just |
| 66 // start/stoping it is enough. | 60 // start/stoping it is enough. |
| 67 std::unique_ptr<rtc::PlatformThread> incoming_render_thread_ | 61 std::unique_ptr<rtc::PlatformThread> incoming_render_thread_ |
| 68 GUARDED_BY(thread_critsect_); | 62 GUARDED_BY(thread_critsect_); |
| 69 std::unique_ptr<EventTimerWrapper> deliver_buffer_event_; | 63 std::unique_ptr<EventTimerWrapper> deliver_buffer_event_; |
| 70 | 64 |
| 71 bool running_ GUARDED_BY(stream_critsect_); | 65 bool running_ GUARDED_BY(stream_critsect_); |
| 72 rtc::VideoSinkInterface<VideoFrame>* external_callback_ | 66 rtc::VideoSinkInterface<VideoFrame>* external_callback_ |
| 73 GUARDED_BY(thread_critsect_); | 67 GUARDED_BY(thread_critsect_); |
| 74 const std::unique_ptr<VideoRenderFrames> render_buffers_ | 68 const std::unique_ptr<VideoRenderFrames> render_buffers_ |
| 75 GUARDED_BY(buffer_critsect_); | 69 GUARDED_BY(buffer_critsect_); |
| 76 | |
| 77 uint32_t incoming_rate_ GUARDED_BY(stream_critsect_); | |
| 78 int64_t last_rate_calculation_time_ms_ GUARDED_BY(stream_critsect_); | |
| 79 uint16_t num_frames_since_last_calculation_ GUARDED_BY(stream_critsect_); | |
| 80 }; | 70 }; |
| 81 | 71 |
| 82 } // namespace webrtc | 72 } // namespace webrtc |
| 83 | 73 |
| 84 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ | 74 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ |
| OLD | NEW |