Base padding bitrate for an encoder on the bitrate allocated for that encoder, rather than the total bitrate of the channel group.

Review URL: https://codereview.webrtc.org/1231273004

Cr-Commit-Position: refs/heads/master@{#9584}
This commit is contained in:
stefan
2015-07-15 04:39:22 -07:00
committed by Commit bot
parent 3258db26ed
commit a4a8d4ad27
3 changed files with 7 additions and 10 deletions

View File

@ -479,10 +479,8 @@ void ChannelGroup::OnNetworkChanged(uint32_t target_bitrate_bps,
int pad_up_to_bitrate_bps = 0; int pad_up_to_bitrate_bps = 0;
{ {
CriticalSectionScoped lock(encoder_map_cs_.get()); CriticalSectionScoped lock(encoder_map_cs_.get());
for (const auto& encoder : send_encoders_) { for (const auto& encoder : send_encoders_)
pad_up_to_bitrate_bps += pad_up_to_bitrate_bps += encoder.second->GetPaddingNeededBps();
encoder.second->GetPaddingNeededBps(target_bitrate_bps);
}
} }
pacer_->UpdateBitrate( pacer_->UpdateBitrate(
target_bitrate_bps / 1000, target_bitrate_bps / 1000,

View File

@ -397,9 +397,10 @@ int32_t ViEEncoder::ScaleInputImage(bool enable) {
return 0; return 0;
} }
int ViEEncoder::GetPaddingNeededBps(int bitrate_bps) const { int ViEEncoder::GetPaddingNeededBps() const {
int64_t time_of_last_frame_activity_ms; int64_t time_of_last_frame_activity_ms;
int min_transmit_bitrate_bps; int min_transmit_bitrate_bps;
int bitrate_bps;
{ {
CriticalSectionScoped cs(data_cs_.get()); CriticalSectionScoped cs(data_cs_.get());
bool send_padding = bool send_padding =
@ -408,15 +409,12 @@ int ViEEncoder::GetPaddingNeededBps(int bitrate_bps) const {
return 0; return 0;
time_of_last_frame_activity_ms = time_of_last_frame_activity_ms_; time_of_last_frame_activity_ms = time_of_last_frame_activity_ms_;
min_transmit_bitrate_bps = 1000 * min_transmit_bitrate_kbps_; min_transmit_bitrate_bps = 1000 * min_transmit_bitrate_kbps_;
bitrate_bps = last_observed_bitrate_bps_;
} }
VideoCodec send_codec; VideoCodec send_codec;
if (vcm_->SendCodec(&send_codec) != 0) if (vcm_->SendCodec(&send_codec) != 0)
return 0; return 0;
SimulcastStream* stream_configs = send_codec.simulcastStream;
// Allocate the bandwidth between the streams.
std::vector<uint32_t> stream_bitrates = AllocateStreamBitrates(
bitrate_bps, stream_configs, send_codec.numberOfSimulcastStreams);
bool video_is_suspended = vcm_->VideoSuspended(); bool video_is_suspended = vcm_->VideoSuspended();
@ -427,6 +425,7 @@ int ViEEncoder::GetPaddingNeededBps(int bitrate_bps) const {
if (send_codec.numberOfSimulcastStreams == 0) { if (send_codec.numberOfSimulcastStreams == 0) {
pad_up_to_bitrate_bps = send_codec.minBitrate * 1000; pad_up_to_bitrate_bps = send_codec.minBitrate * 1000;
} else { } else {
SimulcastStream* stream_configs = send_codec.simulcastStream;
pad_up_to_bitrate_bps = pad_up_to_bitrate_bps =
stream_configs[send_codec.numberOfSimulcastStreams - 1].minBitrate * stream_configs[send_codec.numberOfSimulcastStreams - 1].minBitrate *
1000; 1000;

View File

@ -177,7 +177,7 @@ class ViEEncoder : public RtcpIntraFrameObserver,
int channel_id() const { return channel_id_; } int channel_id() const { return channel_id_; }
int GetPaddingNeededBps(int bitrate_bps) const; int GetPaddingNeededBps() const;
protected: protected:
// Called by BitrateObserver. // Called by BitrateObserver.