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

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

Issue 1813173002: Deletes the class VideoRendererCallback. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Break long lines. Add explicit keyword on IncomingVideoStream constructor. Created 4 years, 8 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
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/common_video/video_render_frames.h" 19 #include "webrtc/common_video/video_render_frames.h"
20 #include "webrtc/media/base/videosinkinterface.h"
20 21
21 namespace webrtc { 22 namespace webrtc {
22 class EventTimerWrapper; 23 class EventTimerWrapper;
23 24
24 class VideoRenderCallback { 25
26 class IncomingVideoStream : public rtc::VideoSinkInterface<VideoFrame> {
25 public: 27 public:
26 virtual int32_t RenderFrame(const uint32_t streamId, 28 explicit IncomingVideoStream(bool disable_prerenderer_smoothing);
27 const VideoFrame& videoFrame) = 0;
28
29 protected:
30 virtual ~VideoRenderCallback() {}
31 };
32
33 class IncomingVideoStream : public VideoRenderCallback {
34 public:
35 IncomingVideoStream(uint32_t stream_id, bool disable_prerenderer_smoothing);
36 ~IncomingVideoStream(); 29 ~IncomingVideoStream();
37 30
38 // Get callback to deliver frames to the module. 31 // Get callback to deliver frames to the module.
39 VideoRenderCallback* ModuleCallback(); 32 rtc::VideoSinkInterface<VideoFrame>* ModuleCallback();
40 virtual int32_t RenderFrame(const uint32_t stream_id, 33 void OnFrame(const VideoFrame& video_frame) override;
41 const VideoFrame& video_frame);
42 34
43 // Set callback to the platform dependent code. 35 // Set callback to the platform dependent code.
44 void SetRenderCallback(VideoRenderCallback* render_callback); 36 void SetRenderCallback(rtc::VideoSinkInterface<VideoFrame>* render_callback);
45 37
46 // Callback for file recording, snapshot, ... 38 // Callback for file recording, snapshot, ...
47 void SetExternalCallback(VideoRenderCallback* render_object); 39 void SetExternalCallback(rtc::VideoSinkInterface<VideoFrame>* render_object);
48 40
49 // Start/Stop. 41 // Start/Stop.
50 int32_t Start(); 42 int32_t Start();
51 int32_t Stop(); 43 int32_t Stop();
52 44
53 // Clear all buffers. 45 // Clear all buffers.
54 int32_t Reset(); 46 int32_t Reset();
55 47
56 // Properties. 48 // Properties.
57 uint32_t StreamId() const;
58 uint32_t IncomingRate() const; 49 uint32_t IncomingRate() const;
59 50
60 void SetStartImage(const VideoFrame& video_frame); 51 void SetStartImage(const VideoFrame& video_frame);
61 52
62 void SetTimeoutImage(const VideoFrame& video_frame, 53 void SetTimeoutImage(const VideoFrame& video_frame,
63 const uint32_t timeout); 54 const uint32_t timeout);
64 55
65 int32_t SetExpectedRenderDelay(int32_t delay_ms); 56 int32_t SetExpectedRenderDelay(int32_t delay_ms);
66 57
67 protected: 58 protected:
68 static bool IncomingVideoStreamThreadFun(void* obj); 59 static bool IncomingVideoStreamThreadFun(void* obj);
69 bool IncomingVideoStreamProcess(); 60 bool IncomingVideoStreamProcess();
70 61
71 private: 62 private:
72 enum { kEventStartupTimeMs = 10 }; 63 enum { kEventStartupTimeMs = 10 };
73 enum { kEventMaxWaitTimeMs = 100 }; 64 enum { kEventMaxWaitTimeMs = 100 };
74 enum { kFrameRatePeriodMs = 1000 }; 65 enum { kFrameRatePeriodMs = 1000 };
75 66
76 void DeliverFrame(const VideoFrame& video_frame); 67 void DeliverFrame(const VideoFrame& video_frame);
77 68
78 uint32_t const stream_id_;
79 const bool disable_prerenderer_smoothing_; 69 const bool disable_prerenderer_smoothing_;
80 // Critsects in allowed to enter order. 70 // Critsects in allowed to enter order.
81 rtc::CriticalSection stream_critsect_; 71 rtc::CriticalSection stream_critsect_;
82 rtc::CriticalSection thread_critsect_; 72 rtc::CriticalSection thread_critsect_;
83 rtc::CriticalSection buffer_critsect_; 73 rtc::CriticalSection buffer_critsect_;
84 // TODO(pbos): Make plain member and stop resetting this thread, just 74 // TODO(pbos): Make plain member and stop resetting this thread, just
85 // start/stoping it is enough. 75 // start/stoping it is enough.
86 std::unique_ptr<rtc::PlatformThread> incoming_render_thread_ 76 std::unique_ptr<rtc::PlatformThread> incoming_render_thread_
87 GUARDED_BY(thread_critsect_); 77 GUARDED_BY(thread_critsect_);
88 std::unique_ptr<EventTimerWrapper> deliver_buffer_event_; 78 std::unique_ptr<EventTimerWrapper> deliver_buffer_event_;
89 79
90 bool running_ GUARDED_BY(stream_critsect_); 80 bool running_ GUARDED_BY(stream_critsect_);
91 VideoRenderCallback* external_callback_ GUARDED_BY(thread_critsect_); 81 rtc::VideoSinkInterface<VideoFrame>* external_callback_
92 VideoRenderCallback* render_callback_ GUARDED_BY(thread_critsect_); 82 GUARDED_BY(thread_critsect_);
83 rtc::VideoSinkInterface<VideoFrame>* render_callback_
84 GUARDED_BY(thread_critsect_);
93 const std::unique_ptr<VideoRenderFrames> render_buffers_ 85 const std::unique_ptr<VideoRenderFrames> render_buffers_
94 GUARDED_BY(buffer_critsect_); 86 GUARDED_BY(buffer_critsect_);
95 87
96 uint32_t incoming_rate_ GUARDED_BY(stream_critsect_); 88 uint32_t incoming_rate_ GUARDED_BY(stream_critsect_);
97 int64_t last_rate_calculation_time_ms_ GUARDED_BY(stream_critsect_); 89 int64_t last_rate_calculation_time_ms_ GUARDED_BY(stream_critsect_);
98 uint16_t num_frames_since_last_calculation_ GUARDED_BY(stream_critsect_); 90 uint16_t num_frames_since_last_calculation_ GUARDED_BY(stream_critsect_);
99 int64_t last_render_time_ms_ GUARDED_BY(thread_critsect_); 91 int64_t last_render_time_ms_ GUARDED_BY(thread_critsect_);
100 VideoFrame temp_frame_ GUARDED_BY(thread_critsect_); 92 VideoFrame temp_frame_ GUARDED_BY(thread_critsect_);
101 VideoFrame start_image_ GUARDED_BY(thread_critsect_); 93 VideoFrame start_image_ GUARDED_BY(thread_critsect_);
102 VideoFrame timeout_image_ GUARDED_BY(thread_critsect_); 94 VideoFrame timeout_image_ GUARDED_BY(thread_critsect_);
103 uint32_t timeout_time_ GUARDED_BY(thread_critsect_); 95 uint32_t timeout_time_ GUARDED_BY(thread_critsect_);
104 }; 96 };
105 97
106 } // namespace webrtc 98 } // namespace webrtc
107 99
108 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ 100 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698