Index: webrtc/common_video/include/incoming_video_stream.h |
diff --git a/webrtc/common_video/include/incoming_video_stream.h b/webrtc/common_video/include/incoming_video_stream.h |
index 1fbee7a2df63b99af23cd3deea1e442e7a1124a5..f96a23dbeabaff21de247594d11f0fa77ae00800 100644 |
--- a/webrtc/common_video/include/incoming_video_stream.h |
+++ b/webrtc/common_video/include/incoming_video_stream.h |
@@ -15,20 +15,30 @@ |
#include "webrtc/base/criticalsection.h" |
#include "webrtc/base/platform_thread.h" |
-#include "webrtc/base/task_queue.h" |
#include "webrtc/base/thread_annotations.h" |
-#include "webrtc/base/thread_checker.h" |
#include "webrtc/common_video/video_render_frames.h" |
#include "webrtc/media/base/videosinkinterface.h" |
namespace webrtc { |
class EventTimerWrapper; |
+ |
class IncomingVideoStream : public rtc::VideoSinkInterface<VideoFrame> { |
public: |
- IncomingVideoStream(int32_t delay_ms, |
- rtc::VideoSinkInterface<VideoFrame>* callback); |
- ~IncomingVideoStream() override; |
+ explicit IncomingVideoStream(bool disable_prerenderer_smoothing); |
+ ~IncomingVideoStream(); |
+ |
+ // Overrides VideoSinkInterface |
+ void OnFrame(const VideoFrame& video_frame) override; |
+ |
+ // Callback for file recording, snapshot, ... |
+ void SetExternalCallback(rtc::VideoSinkInterface<VideoFrame>* render_object); |
+ |
+ // Start/Stop. |
+ int32_t Start(); |
+ int32_t Stop(); |
+ |
+ int32_t SetExpectedRenderDelay(int32_t delay_ms); |
protected: |
static bool IncomingVideoStreamThreadFun(void* obj); |
@@ -39,34 +49,24 @@ |
enum { kEventMaxWaitTimeMs = 100 }; |
enum { kFrameRatePeriodMs = 1000 }; |
- void OnFrame(const VideoFrame& video_frame) override; |
+ void DeliverFrame(const VideoFrame& video_frame); |
- rtc::ThreadChecker main_thread_checker_; |
- rtc::ThreadChecker render_thread_checker_; |
- rtc::ThreadChecker decoder_thread_checker_; |
- |
+ const bool disable_prerenderer_smoothing_; |
+ // Critsects in allowed to enter order. |
+ rtc::CriticalSection stream_critsect_; |
+ rtc::CriticalSection thread_critsect_; |
rtc::CriticalSection buffer_critsect_; |
- rtc::PlatformThread incoming_render_thread_; |
+ // TODO(pbos): Make plain member and stop resetting this thread, just |
+ // start/stoping it is enough. |
+ std::unique_ptr<rtc::PlatformThread> incoming_render_thread_ |
+ GUARDED_BY(thread_critsect_); |
std::unique_ptr<EventTimerWrapper> deliver_buffer_event_; |
- rtc::VideoSinkInterface<VideoFrame>* const external_callback_; |
- std::unique_ptr<VideoRenderFrames> render_buffers_ |
+ bool running_ GUARDED_BY(stream_critsect_); |
+ rtc::VideoSinkInterface<VideoFrame>* external_callback_ |
+ GUARDED_BY(thread_critsect_); |
+ const std::unique_ptr<VideoRenderFrames> render_buffers_ |
GUARDED_BY(buffer_critsect_); |
-}; |
- |
-class IncomingVideoStreamNoSmoothing |
- : public rtc::VideoSinkInterface<VideoFrame> { |
- public: |
- explicit IncomingVideoStreamNoSmoothing( |
- rtc::VideoSinkInterface<VideoFrame>* callback); |
- |
- private: |
- // Overrides VideoSinkInterface |
- void OnFrame(const VideoFrame& video_frame) override; |
- |
- rtc::ThreadChecker decoder_thread_checker_; |
- rtc::VideoSinkInterface<VideoFrame>* const callback_; |
- rtc::TaskQueue queue_; |
}; |
} // namespace webrtc |