Routing BitrateAllocationUpdate to audio codec.
This will be used in a later CL to use the link capacity field in the update to control the Opus encoder. Bug: webrtc:9718 Change-Id: If2ad16a8f4656e8cdf10c33f5fb060ef7ca5caba Reviewed-on: https://webrtc-review.googlesource.com/c/111510 Reviewed-by: Oskar Sundbom <ossu@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25761}
This commit is contained in:
parent
3890c1ae6d
commit
254d869c00
@ -475,8 +475,7 @@ uint32_t AudioSendStream::OnBitrateUpdated(BitrateAllocationUpdate update) {
|
||||
if (update.target_bitrate > max_bitrate)
|
||||
update.target_bitrate = max_bitrate;
|
||||
|
||||
channel_send_->SetBitrate(update.target_bitrate.bps(),
|
||||
update.bwe_period.ms());
|
||||
channel_send_->OnBitrateAllocation(update);
|
||||
|
||||
// The amount of audio protection is not exposed by the encoder, hence
|
||||
// always returning 0.
|
||||
|
||||
@ -42,6 +42,7 @@ namespace {
|
||||
using testing::_;
|
||||
using testing::Eq;
|
||||
using testing::Ne;
|
||||
using testing::Field;
|
||||
using testing::Invoke;
|
||||
using testing::Return;
|
||||
using testing::StrEq;
|
||||
@ -472,7 +473,9 @@ TEST(AudioSendStreamTest, DoesNotPassHigherBitrateThanMaxBitrate) {
|
||||
ConfigHelper helper(false, true);
|
||||
auto send_stream = helper.CreateAudioSendStream();
|
||||
EXPECT_CALL(*helper.channel_send(),
|
||||
SetBitrate(helper.config().max_bitrate_bps, _));
|
||||
OnBitrateAllocation(
|
||||
Field(&BitrateAllocationUpdate::target_bitrate,
|
||||
Eq(DataRate::bps(helper.config().max_bitrate_bps)))));
|
||||
BitrateAllocationUpdate update;
|
||||
update.target_bitrate = DataRate::bps(helper.config().max_bitrate_bps + 5000);
|
||||
update.packet_loss_ratio = 0;
|
||||
@ -484,7 +487,10 @@ TEST(AudioSendStreamTest, DoesNotPassHigherBitrateThanMaxBitrate) {
|
||||
TEST(AudioSendStreamTest, ProbingIntervalOnBitrateUpdated) {
|
||||
ConfigHelper helper(false, true);
|
||||
auto send_stream = helper.CreateAudioSendStream();
|
||||
EXPECT_CALL(*helper.channel_send(), SetBitrate(_, 5000));
|
||||
|
||||
EXPECT_CALL(*helper.channel_send(),
|
||||
OnBitrateAllocation(Field(&BitrateAllocationUpdate::bwe_period,
|
||||
Eq(TimeDelta::ms(5000)))));
|
||||
BitrateAllocationUpdate update;
|
||||
update.target_bitrate = DataRate::bps(helper.config().max_bitrate_bps + 5000);
|
||||
update.packet_loss_ratio = 0;
|
||||
|
||||
@ -111,7 +111,7 @@ class ChannelSend
|
||||
void StopSend() override;
|
||||
|
||||
// Codecs
|
||||
void SetBitrate(int bitrate_bps, int64_t probing_interval_ms) override;
|
||||
void OnBitrateAllocation(BitrateAllocationUpdate update) override;
|
||||
int GetBitrate() const override;
|
||||
|
||||
// Network
|
||||
@ -898,7 +898,7 @@ void ChannelSend::ModifyEncoder(
|
||||
audio_coding_->ModifyEncoder(modifier);
|
||||
}
|
||||
|
||||
void ChannelSend::SetBitrate(int bitrate_bps, int64_t probing_interval_ms) {
|
||||
void ChannelSend::OnBitrateAllocation(BitrateAllocationUpdate update) {
|
||||
// This method can be called on the worker thread, module process thread
|
||||
// or on a TaskQueue via VideoSendStreamImpl::OnEncoderConfigurationChanged.
|
||||
// TODO(solenberg): Figure out a good way to check this or enforce calling
|
||||
@ -909,11 +909,11 @@ void ChannelSend::SetBitrate(int bitrate_bps, int64_t probing_interval_ms) {
|
||||
|
||||
audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
|
||||
if (*encoder) {
|
||||
(*encoder)->OnReceivedUplinkBandwidth(bitrate_bps, probing_interval_ms);
|
||||
(*encoder)->OnReceivedUplinkAllocation(update);
|
||||
}
|
||||
});
|
||||
retransmission_rate_limiter_->SetMaxRate(bitrate_bps);
|
||||
configured_bitrate_bps_ = bitrate_bps;
|
||||
retransmission_rate_limiter_->SetMaxRate(update.target_bitrate.bps());
|
||||
configured_bitrate_bps_ = update.target_bitrate.bps();
|
||||
}
|
||||
|
||||
int ChannelSend::GetBitrate() const {
|
||||
|
||||
@ -80,7 +80,7 @@ class ChannelSendInterface {
|
||||
virtual bool SetSendTelephoneEventPayloadType(int payload_type,
|
||||
int payload_frequency) = 0;
|
||||
virtual bool SendTelephoneEventOutband(int event, int duration_ms) = 0;
|
||||
virtual void SetBitrate(int bitrate_bps, int64_t probing_interval_ms) = 0;
|
||||
virtual void OnBitrateAllocation(BitrateAllocationUpdate update) = 0;
|
||||
virtual int GetBitrate() const = 0;
|
||||
virtual void SetInputMute(bool muted) = 0;
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ class MockChannelSend : public voe::ChannelSendInterface {
|
||||
MOCK_METHOD2(SetSendTelephoneEventPayloadType,
|
||||
bool(int payload_type, int payload_frequency));
|
||||
MOCK_METHOD2(SendTelephoneEventOutband, bool(int event, int duration_ms));
|
||||
MOCK_METHOD2(SetBitrate, void(int bitrate_bps, int64_t probing_interval_ms));
|
||||
MOCK_METHOD1(OnBitrateAllocation, void(BitrateAllocationUpdate update));
|
||||
MOCK_METHOD1(SetInputMute, void(bool muted));
|
||||
MOCK_METHOD1(RegisterTransport, void(Transport* transport));
|
||||
MOCK_METHOD2(ReceivedRTCPPacket, bool(const uint8_t* packet, size_t length));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user