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

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

Issue 2097403002: Add a race-checking mechanism. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: bah Created 4 years, 5 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/race_checker.h"
18 #include "webrtc/base/thread_annotations.h" 19 #include "webrtc/base/thread_annotations.h"
19 #include "webrtc/base/thread_checker.h" 20 #include "webrtc/base/thread_checker.h"
20 #include "webrtc/common_video/video_render_frames.h" 21 #include "webrtc/common_video/video_render_frames.h"
21 #include "webrtc/media/base/videosinkinterface.h" 22 #include "webrtc/media/base/videosinkinterface.h"
22 23
23 namespace webrtc { 24 namespace webrtc {
24 class EventTimerWrapper; 25 class EventTimerWrapper;
25 26
26 class IncomingVideoStream : public rtc::VideoSinkInterface<VideoFrame> { 27 class IncomingVideoStream : public rtc::VideoSinkInterface<VideoFrame> {
27 public: 28 public:
28 IncomingVideoStream(int32_t delay_ms, 29 IncomingVideoStream(int32_t delay_ms,
29 rtc::VideoSinkInterface<VideoFrame>* callback); 30 rtc::VideoSinkInterface<VideoFrame>* callback);
30 ~IncomingVideoStream() override; 31 ~IncomingVideoStream() override;
31 32
32 protected: 33 protected:
33 static bool IncomingVideoStreamThreadFun(void* obj); 34 static bool IncomingVideoStreamThreadFun(void* obj);
34 bool IncomingVideoStreamProcess(); 35 bool IncomingVideoStreamProcess();
35 36
36 private: 37 private:
37 enum { kEventStartupTimeMs = 10 }; 38 enum { kEventStartupTimeMs = 10 };
38 enum { kEventMaxWaitTimeMs = 100 }; 39 enum { kEventMaxWaitTimeMs = 100 };
39 enum { kFrameRatePeriodMs = 1000 }; 40 enum { kFrameRatePeriodMs = 1000 };
40 41
41 void OnFrame(const VideoFrame& video_frame) override; 42 void OnFrame(const VideoFrame& video_frame) override;
42 43
43 rtc::ThreadChecker main_thread_checker_; 44 rtc::ThreadChecker main_thread_checker_;
44 rtc::ThreadChecker render_thread_checker_; 45 rtc::ThreadChecker render_thread_checker_;
46 rtc::RaceChecker decoder_race_checker_;
45 47
46 rtc::CriticalSection buffer_critsect_; 48 rtc::CriticalSection buffer_critsect_;
47 rtc::PlatformThread incoming_render_thread_; 49 rtc::PlatformThread incoming_render_thread_;
48 std::unique_ptr<EventTimerWrapper> deliver_buffer_event_; 50 std::unique_ptr<EventTimerWrapper> deliver_buffer_event_;
49 51
50 rtc::VideoSinkInterface<VideoFrame>* const external_callback_; 52 rtc::VideoSinkInterface<VideoFrame>* const external_callback_;
51 std::unique_ptr<VideoRenderFrames> render_buffers_ 53 std::unique_ptr<VideoRenderFrames> render_buffers_
52 GUARDED_BY(buffer_critsect_); 54 GUARDED_BY(buffer_critsect_);
53 }; 55 };
54 56
55 } // namespace webrtc 57 } // namespace webrtc
56 58
57 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ 59 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698