Have padding decay to zero if no frames are being captured.
BUG=1837 TEST=trybots R=mflodman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2469004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4998 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
893c07f209
commit
3e00505e9a
@ -55,6 +55,8 @@ static const int kMinPacingDelayMs = 200;
|
|||||||
// VideoEngine API and remove the kTransmissionMaxBitrateMultiplier.
|
// VideoEngine API and remove the kTransmissionMaxBitrateMultiplier.
|
||||||
static const int kTransmissionMaxBitrateMultiplier = 2;
|
static const int kTransmissionMaxBitrateMultiplier = 2;
|
||||||
|
|
||||||
|
static const float kStopPaddingThresholdMs = 2000;
|
||||||
|
|
||||||
std::vector<uint32_t> AllocateStreamBitrates(
|
std::vector<uint32_t> AllocateStreamBitrates(
|
||||||
uint32_t total_bitrate,
|
uint32_t total_bitrate,
|
||||||
const SimulcastStream* stream_configs,
|
const SimulcastStream* stream_configs,
|
||||||
@ -142,6 +144,7 @@ ViEEncoder::ViEEncoder(int32_t engine_id,
|
|||||||
callback_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
callback_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
data_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
data_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
bitrate_controller_(bitrate_controller),
|
bitrate_controller_(bitrate_controller),
|
||||||
|
time_of_last_incoming_frame_ms_(0),
|
||||||
send_padding_(false),
|
send_padding_(false),
|
||||||
target_delay_ms_(0),
|
target_delay_ms_(0),
|
||||||
network_is_transmitting_(true),
|
network_is_transmitting_(true),
|
||||||
@ -559,6 +562,7 @@ void ViEEncoder::DeliverFrame(int id,
|
|||||||
video_frame->timestamp());
|
video_frame->timestamp());
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(data_cs_.get());
|
CriticalSectionScoped cs(data_cs_.get());
|
||||||
|
time_of_last_incoming_frame_ms_ = TickTime::MillisecondTimestamp();
|
||||||
if (default_rtp_rtcp_->SendingMedia() == false) {
|
if (default_rtp_rtcp_->SendingMedia() == false) {
|
||||||
// We've paused or we have no channels attached, don't encode.
|
// We've paused or we have no channels attached, don't encode.
|
||||||
return;
|
return;
|
||||||
@ -1078,6 +1082,16 @@ void ViEEncoder::OnNetworkChanged(const uint32_t bitrate_bps,
|
|||||||
// Disable padding if only sending one stream and video isn't muted.
|
// Disable padding if only sending one stream and video isn't muted.
|
||||||
pad_up_to_bitrate_kbps = 0;
|
pad_up_to_bitrate_kbps = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// The amount of padding should decay to zero if no frames are being
|
||||||
|
// captured.
|
||||||
|
CriticalSectionScoped cs(data_cs_.get());
|
||||||
|
int64_t now_ms = TickTime::MillisecondTimestamp();
|
||||||
|
if (now_ms - time_of_last_incoming_frame_ms_ > kStopPaddingThresholdMs)
|
||||||
|
max_padding_bitrate_kbps = 0;
|
||||||
|
}
|
||||||
|
|
||||||
paced_sender_->UpdateBitrate(bitrate_kbps,
|
paced_sender_->UpdateBitrate(bitrate_kbps,
|
||||||
max_padding_bitrate_kbps,
|
max_padding_bitrate_kbps,
|
||||||
pad_up_to_bitrate_kbps);
|
pad_up_to_bitrate_kbps);
|
||||||
|
@ -197,6 +197,7 @@ class ViEEncoder
|
|||||||
|
|
||||||
BitrateController* bitrate_controller_;
|
BitrateController* bitrate_controller_;
|
||||||
|
|
||||||
|
int64_t time_of_last_incoming_frame_ms_;
|
||||||
bool send_padding_;
|
bool send_padding_;
|
||||||
int target_delay_ms_;
|
int target_delay_ms_;
|
||||||
bool network_is_transmitting_;
|
bool network_is_transmitting_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user