Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: webrtc/common_video/include/incoming_video_stream.h

Issue 2084873002: Revert of Split IncomingVideoStream into two implementations, with smoothing and without. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/common_video/incoming_video_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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> 14 #include <memory>
15 15
16 #include "webrtc/base/criticalsection.h" 16 #include "webrtc/base/criticalsection.h"
17 #include "webrtc/base/platform_thread.h" 17 #include "webrtc/base/platform_thread.h"
18 #include "webrtc/base/thread_annotations.h" 18 #include "webrtc/base/thread_annotations.h"
19 #include "webrtc/base/thread_checker.h"
20 #include "webrtc/common_video/video_render_frames.h" 19 #include "webrtc/common_video/video_render_frames.h"
21 #include "webrtc/media/base/videosinkinterface.h" 20 #include "webrtc/media/base/videosinkinterface.h"
22 21
23 namespace webrtc { 22 namespace webrtc {
24 class EventTimerWrapper; 23 class EventTimerWrapper;
25 24
25
26 class IncomingVideoStream : public rtc::VideoSinkInterface<VideoFrame> { 26 class IncomingVideoStream : public rtc::VideoSinkInterface<VideoFrame> {
27 public: 27 public:
28 IncomingVideoStream(int32_t delay_ms, 28 explicit IncomingVideoStream(bool disable_prerenderer_smoothing);
29 rtc::VideoSinkInterface<VideoFrame>* callback); 29 ~IncomingVideoStream();
30 ~IncomingVideoStream() override; 30
31 // Overrides VideoSinkInterface
32 void OnFrame(const VideoFrame& video_frame) override;
33
34 // Callback for file recording, snapshot, ...
35 void SetExternalCallback(rtc::VideoSinkInterface<VideoFrame>* render_object);
36
37 // Start/Stop.
38 int32_t Start();
39 int32_t Stop();
40
41 int32_t SetExpectedRenderDelay(int32_t delay_ms);
31 42
32 protected: 43 protected:
33 static bool IncomingVideoStreamThreadFun(void* obj); 44 static bool IncomingVideoStreamThreadFun(void* obj);
34 bool IncomingVideoStreamProcess(); 45 bool IncomingVideoStreamProcess();
35 46
36 private: 47 private:
37 enum { kEventStartupTimeMs = 10 }; 48 enum { kEventStartupTimeMs = 10 };
38 enum { kEventMaxWaitTimeMs = 100 }; 49 enum { kEventMaxWaitTimeMs = 100 };
39 enum { kFrameRatePeriodMs = 1000 }; 50 enum { kFrameRatePeriodMs = 1000 };
40 51
41 void OnFrame(const VideoFrame& video_frame) override; 52 void DeliverFrame(const VideoFrame& video_frame);
42 53
43 rtc::ThreadChecker main_thread_checker_; 54 const bool disable_prerenderer_smoothing_;
44 rtc::ThreadChecker render_thread_checker_; 55 // Critsects in allowed to enter order.
45 rtc::ThreadChecker decoder_thread_checker_; 56 rtc::CriticalSection stream_critsect_;
46 57 rtc::CriticalSection thread_critsect_;
47 rtc::CriticalSection buffer_critsect_; 58 rtc::CriticalSection buffer_critsect_;
48 rtc::PlatformThread incoming_render_thread_; 59 // TODO(pbos): Make plain member and stop resetting this thread, just
60 // start/stoping it is enough.
61 std::unique_ptr<rtc::PlatformThread> incoming_render_thread_
62 GUARDED_BY(thread_critsect_);
49 std::unique_ptr<EventTimerWrapper> deliver_buffer_event_; 63 std::unique_ptr<EventTimerWrapper> deliver_buffer_event_;
50 64
51 rtc::VideoSinkInterface<VideoFrame>* const external_callback_; 65 bool running_ GUARDED_BY(stream_critsect_);
52 std::unique_ptr<VideoRenderFrames> render_buffers_ 66 rtc::VideoSinkInterface<VideoFrame>* external_callback_
67 GUARDED_BY(thread_critsect_);
68 const std::unique_ptr<VideoRenderFrames> render_buffers_
53 GUARDED_BY(buffer_critsect_); 69 GUARDED_BY(buffer_critsect_);
54 }; 70 };
55 71
56 } // namespace webrtc 72 } // namespace webrtc
57 73
58 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ 74 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/common_video/incoming_video_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698