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

Side by Side Diff: webrtc/modules/video_coding/generic_encoder.h

Issue 2097403002: Add a race-checking mechanism. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: RUNS_SYNCHRONIZED 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_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_ 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_
12 #define WEBRTC_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_ 12 #define WEBRTC_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_
13 13
14 #include <stdio.h> 14 #include <stdio.h>
15 #include <vector> 15 #include <vector>
16 16
17 #include "webrtc/modules/video_coding/include/video_codec_interface.h" 17 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
18 #include "webrtc/modules/video_coding/include/video_coding_defines.h" 18 #include "webrtc/modules/video_coding/include/video_coding_defines.h"
19 19
20 #include "webrtc/base/criticalsection.h" 20 #include "webrtc/base/criticalsection.h"
21 #include "webrtc/base/race_checker.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 class CriticalSectionWrapper; 24 class CriticalSectionWrapper;
24 25
25 namespace media_optimization { 26 namespace media_optimization {
26 class MediaOptimization; 27 class MediaOptimization;
27 } // namespace media_optimization 28 } // namespace media_optimization
28 29
29 struct EncoderParameters { 30 struct EncoderParameters {
30 uint32_t target_bitrate; 31 uint32_t target_bitrate;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void SetEncoderParameters(const EncoderParameters& params); 76 void SetEncoderParameters(const EncoderParameters& params);
76 EncoderParameters GetEncoderParameters() const; 77 EncoderParameters GetEncoderParameters() const;
77 78
78 int32_t SetPeriodicKeyFrames(bool enable); 79 int32_t SetPeriodicKeyFrames(bool enable);
79 int32_t RequestFrame(const std::vector<FrameType>& frame_types); 80 int32_t RequestFrame(const std::vector<FrameType>& frame_types);
80 bool InternalSource() const; 81 bool InternalSource() const;
81 void OnDroppedFrame(); 82 void OnDroppedFrame();
82 bool SupportsNativeHandle() const; 83 bool SupportsNativeHandle() const;
83 84
84 private: 85 private:
85 VideoEncoder* const encoder_; 86 rtc::RaceChecker race_checker_;
87
88 VideoEncoder* const encoder_ GUARDED_BY(race_checker_);
86 VideoEncoderRateObserver* const rate_observer_; 89 VideoEncoderRateObserver* const rate_observer_;
87 VCMEncodedFrameCallback* const vcm_encoded_frame_callback_; 90 VCMEncodedFrameCallback* const vcm_encoded_frame_callback_;
88 const bool internal_source_; 91 const bool internal_source_;
89 rtc::CriticalSection params_lock_; 92 rtc::CriticalSection params_lock_;
90 EncoderParameters encoder_params_ GUARDED_BY(params_lock_); 93 EncoderParameters encoder_params_ GUARDED_BY(params_lock_);
91 bool is_screenshare_; 94 bool is_screenshare_;
92 }; 95 };
93 96
94 } // namespace webrtc 97 } // namespace webrtc
95 98
96 #endif // WEBRTC_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_ 99 #endif // WEBRTC_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698