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

Side by Side Diff: webrtc/modules/video_coding/main/source/video_coding_impl.h

Issue 1336023004: Keep lock after updating encoder parameters. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: void -> Set.. Created 5 years, 3 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/modules/video_coding/main/source/video_sender.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
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 bool internalSource); 86 bool internalSource);
87 87
88 int32_t CodecConfigParameters(uint8_t* buffer, int32_t size) const; 88 int32_t CodecConfigParameters(uint8_t* buffer, int32_t size) const;
89 int32_t SentFrameCount(VCMFrameCount* frameCount); 89 int32_t SentFrameCount(VCMFrameCount* frameCount);
90 int Bitrate(unsigned int* bitrate) const; 90 int Bitrate(unsigned int* bitrate) const;
91 int FrameRate(unsigned int* framerate) const; 91 int FrameRate(unsigned int* framerate) const;
92 92
93 int32_t SetChannelParameters(uint32_t target_bitrate, // bits/s. 93 int32_t SetChannelParameters(uint32_t target_bitrate, // bits/s.
94 uint8_t lossRate, 94 uint8_t lossRate,
95 int64_t rtt); 95 int64_t rtt);
96 int32_t UpdateEncoderParameters();
97 96
98 int32_t RegisterTransportCallback(VCMPacketizationCallback* transport); 97 int32_t RegisterTransportCallback(VCMPacketizationCallback* transport);
99 int32_t RegisterSendStatisticsCallback(VCMSendStatisticsCallback* sendStats); 98 int32_t RegisterSendStatisticsCallback(VCMSendStatisticsCallback* sendStats);
100 int32_t RegisterProtectionCallback(VCMProtectionCallback* protection); 99 int32_t RegisterProtectionCallback(VCMProtectionCallback* protection);
101 void SetVideoProtection(VCMVideoProtection videoProtection); 100 void SetVideoProtection(VCMVideoProtection videoProtection);
102 101
103 int32_t AddVideoFrame(const VideoFrame& videoFrame, 102 int32_t AddVideoFrame(const VideoFrame& videoFrame,
104 const VideoContentMetrics* _contentMetrics, 103 const VideoContentMetrics* _contentMetrics,
105 const CodecSpecificInfo* codecSpecificInfo); 104 const CodecSpecificInfo* codecSpecificInfo);
106 105
107 int32_t IntraFrameRequest(int stream_index); 106 int32_t IntraFrameRequest(int stream_index);
108 int32_t EnableFrameDropper(bool enable); 107 int32_t EnableFrameDropper(bool enable);
109 108
110 void SuspendBelowMinBitrate(); 109 void SuspendBelowMinBitrate();
111 bool VideoSuspended() const; 110 bool VideoSuspended() const;
112 111
113 int64_t TimeUntilNextProcess(); 112 int64_t TimeUntilNextProcess();
114 int32_t Process(); 113 int32_t Process();
115 114
116 private: 115 private:
117 Clock* clock_; 116 struct EncoderParameters {
117 uint32_t target_bitrate;
118 uint8_t loss_rate;
119 int64_t rtt;
120 uint32_t input_frame_rate;
121 bool updated;
122 };
123
124 void SetEncoderParameters(EncoderParameters params)
125 EXCLUSIVE_LOCKS_REQUIRED(send_crit_);
126
127 Clock* const clock_;
118 128
119 rtc::scoped_ptr<CriticalSectionWrapper> process_crit_sect_; 129 rtc::scoped_ptr<CriticalSectionWrapper> process_crit_sect_;
120 CriticalSectionWrapper* _sendCritSect; 130 mutable rtc::CriticalSection send_crit_;
121 VCMGenericEncoder* _encoder; 131 VCMGenericEncoder* _encoder;
122 VCMEncodedFrameCallback _encodedFrameCallback; 132 VCMEncodedFrameCallback _encodedFrameCallback;
123 std::vector<FrameType> _nextFrameTypes; 133 std::vector<FrameType> _nextFrameTypes;
124 media_optimization::MediaOptimization _mediaOpt; 134 media_optimization::MediaOptimization _mediaOpt;
125 VCMSendStatisticsCallback* _sendStatsCallback; 135 VCMSendStatisticsCallback* _sendStatsCallback GUARDED_BY(process_crit_sect_);
126 VCMCodecDataBase _codecDataBase; 136 VCMCodecDataBase _codecDataBase GUARDED_BY(send_crit_);
127 bool frame_dropper_enabled_; 137 bool frame_dropper_enabled_ GUARDED_BY(send_crit_);
128 VCMProcessTimer _sendStatsTimer; 138 VCMProcessTimer _sendStatsTimer;
129 139
130 // Must be accessed on the construction thread of VideoSender. 140 // Must be accessed on the construction thread of VideoSender.
131 VideoCodec current_codec_; 141 VideoCodec current_codec_;
132 rtc::ThreadChecker main_thread_; 142 rtc::ThreadChecker main_thread_;
133 143
134 VCMQMSettingsCallback* const qm_settings_callback_; 144 VCMQMSettingsCallback* const qm_settings_callback_;
135 VCMProtectionCallback* protection_callback_; 145 VCMProtectionCallback* protection_callback_;
136 146
137 rtc::CriticalSection params_lock_; 147 rtc::CriticalSection params_lock_;
138 struct EncoderParameters { 148 EncoderParameters encoder_params_ GUARDED_BY(params_lock_);
139 uint32_t target_bitrate;
140 uint8_t loss_rate;
141 int64_t rtt;
142 uint32_t input_frame_rate;
143 bool updated;
144 } encoder_params_ GUARDED_BY(params_lock_);
145 }; 149 };
146 150
147 class VideoReceiver { 151 class VideoReceiver {
148 public: 152 public:
149 typedef VideoCodingModule::ReceiverRobustness ReceiverRobustness; 153 typedef VideoCodingModule::ReceiverRobustness ReceiverRobustness;
150 154
151 VideoReceiver(Clock* clock, EventFactory* event_factory); 155 VideoReceiver(Clock* clock, EventFactory* event_factory);
152 ~VideoReceiver(); 156 ~VideoReceiver();
153 157
154 int32_t RegisterReceiveCodec(const VideoCodec* receiveCodec, 158 int32_t RegisterReceiveCodec(const VideoCodec* receiveCodec,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 236
233 VCMCodecDataBase _codecDataBase GUARDED_BY(_receiveCritSect); 237 VCMCodecDataBase _codecDataBase GUARDED_BY(_receiveCritSect);
234 VCMProcessTimer _receiveStatsTimer; 238 VCMProcessTimer _receiveStatsTimer;
235 VCMProcessTimer _retransmissionTimer; 239 VCMProcessTimer _retransmissionTimer;
236 VCMProcessTimer _keyRequestTimer; 240 VCMProcessTimer _keyRequestTimer;
237 }; 241 };
238 242
239 } // namespace vcm 243 } // namespace vcm
240 } // namespace webrtc 244 } // namespace webrtc
241 #endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_ 245 #endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/main/source/video_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698