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

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

Issue 2510583002: Reland #2 of Issue 2434073003: Extract bitrate allocation ... (Closed)
Patch Set: Addressed comments Created 4 years, 1 month 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
(...skipping 16 matching lines...) Expand all
27 #include "webrtc/modules/video_coding/generic_encoder.h" 27 #include "webrtc/modules/video_coding/generic_encoder.h"
28 #include "webrtc/modules/video_coding/jitter_buffer.h" 28 #include "webrtc/modules/video_coding/jitter_buffer.h"
29 #include "webrtc/modules/video_coding/media_optimization.h" 29 #include "webrtc/modules/video_coding/media_optimization.h"
30 #include "webrtc/modules/video_coding/receiver.h" 30 #include "webrtc/modules/video_coding/receiver.h"
31 #include "webrtc/modules/video_coding/timing.h" 31 #include "webrtc/modules/video_coding/timing.h"
32 #include "webrtc/modules/video_coding/utility/qp_parser.h" 32 #include "webrtc/modules/video_coding/utility/qp_parser.h"
33 #include "webrtc/system_wrappers/include/clock.h" 33 #include "webrtc/system_wrappers/include/clock.h"
34 34
35 namespace webrtc { 35 namespace webrtc {
36 36
37 class VideoBitrateAllocator;
38
37 namespace vcm { 39 namespace vcm {
38 40
39 class VCMProcessTimer { 41 class VCMProcessTimer {
40 public: 42 public:
41 VCMProcessTimer(int64_t periodMs, Clock* clock) 43 VCMProcessTimer(int64_t periodMs, Clock* clock)
42 : _clock(clock), 44 : _clock(clock),
43 _periodMs(periodMs), 45 _periodMs(periodMs),
44 _latestMs(_clock->TimeInMilliseconds()) {} 46 _latestMs(_clock->TimeInMilliseconds()) {}
45 int64_t Period() const; 47 int64_t Period() const;
46 int64_t TimeUntilProcess() const; 48 int64_t TimeUntilProcess() const;
(...skipping 21 matching lines...) Expand all
68 uint32_t numberOfCores, 70 uint32_t numberOfCores,
69 uint32_t maxPayloadSize); 71 uint32_t maxPayloadSize);
70 72
71 void RegisterExternalEncoder(VideoEncoder* externalEncoder, 73 void RegisterExternalEncoder(VideoEncoder* externalEncoder,
72 uint8_t payloadType, 74 uint8_t payloadType,
73 bool internalSource); 75 bool internalSource);
74 76
75 int Bitrate(unsigned int* bitrate) const; 77 int Bitrate(unsigned int* bitrate) const;
76 int FrameRate(unsigned int* framerate) const; 78 int FrameRate(unsigned int* framerate) const;
77 79
78 int32_t SetChannelParameters(uint32_t target_bitrate, // bits/s. 80 int32_t SetChannelParameters(uint32_t target_bitrate_bps,
79 uint8_t lossRate, 81 uint8_t lossRate,
80 int64_t rtt); 82 int64_t rtt,
83 VideoBitrateAllocator* bitrate_allocator);
84 // Updates the channel parameters, with a reallocated bitrate based on a
85 // presumably updated codec configuration, but does not update the encoder
86 // itself (it will be updated on the next frame).
87 void UpdateChannelParemeters(VideoBitrateAllocator* bitrate_allocator);
88
81 // Deprecated: 89 // Deprecated:
82 // TODO(perkj): Remove once no projects use it. 90 // TODO(perkj): Remove once no projects use it.
83 int32_t RegisterProtectionCallback(VCMProtectionCallback* protection); 91 int32_t RegisterProtectionCallback(VCMProtectionCallback* protection);
84 92
85 int32_t AddVideoFrame(const VideoFrame& videoFrame, 93 int32_t AddVideoFrame(const VideoFrame& videoFrame,
86 const CodecSpecificInfo* codecSpecificInfo); 94 const CodecSpecificInfo* codecSpecificInfo);
87 95
88 int32_t IntraFrameRequest(size_t stream_index); 96 int32_t IntraFrameRequest(size_t stream_index);
89 int32_t EnableFrameDropper(bool enable); 97 int32_t EnableFrameDropper(bool enable);
90 98
91 int64_t TimeUntilNextProcess() override; 99 int64_t TimeUntilNextProcess() override;
92 void Process() override; 100 void Process() override;
93 101
94 private: 102 private:
103 EncoderParameters UpdateEncoderParameters(
104 const EncoderParameters& params,
105 VideoBitrateAllocator* bitrate_allocator,
106 uint32_t target_bitrate_bps);
95 void SetEncoderParameters(EncoderParameters params, bool has_internal_source) 107 void SetEncoderParameters(EncoderParameters params, bool has_internal_source)
96 EXCLUSIVE_LOCKS_REQUIRED(encoder_crit_); 108 EXCLUSIVE_LOCKS_REQUIRED(encoder_crit_);
97 109
98 Clock* const clock_; 110 Clock* const clock_;
99 111
100 rtc::CriticalSection encoder_crit_; 112 rtc::CriticalSection encoder_crit_;
101 VCMGenericEncoder* _encoder; 113 VCMGenericEncoder* _encoder;
102 media_optimization::MediaOptimization _mediaOpt; 114 media_optimization::MediaOptimization _mediaOpt;
103 VCMEncodedFrameCallback _encodedFrameCallback GUARDED_BY(encoder_crit_); 115 VCMEncodedFrameCallback _encodedFrameCallback GUARDED_BY(encoder_crit_);
104 VCMSendStatisticsCallback* const send_stats_callback_; 116 VCMSendStatisticsCallback* const send_stats_callback_;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 VCMProcessTimer _receiveStatsTimer; 215 VCMProcessTimer _receiveStatsTimer;
204 VCMProcessTimer _retransmissionTimer; 216 VCMProcessTimer _retransmissionTimer;
205 VCMProcessTimer _keyRequestTimer; 217 VCMProcessTimer _keyRequestTimer;
206 QpParser qp_parser_; 218 QpParser qp_parser_;
207 ThreadUnsafeOneTimeEvent first_frame_received_; 219 ThreadUnsafeOneTimeEvent first_frame_received_;
208 }; 220 };
209 221
210 } // namespace vcm 222 } // namespace vcm
211 } // namespace webrtc 223 } // namespace webrtc
212 #endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_ 224 #endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/video_coding.gypi ('k') | webrtc/modules/video_coding/video_coding_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698