Add 'UpdateAllocationLimits' in media transport.
Bug: webrtc:9719 Change-Id: I90bd1d9858c259d7339420c574ad83d6fb18299c Reviewed-on: https://webrtc-review.googlesource.com/c/118946 Reviewed-by: Steve Anton <steveanton@webrtc.org> Reviewed-by: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Anton Sukhanov <sukhanov@webrtc.org> Commit-Queue: Peter Slatala <psla@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26426}
This commit is contained in:

committed by
Commit Bot

parent
435ea0a741
commit
48c5493393
@ -133,6 +133,7 @@ rtc_static_library("libjingle_peerconnection_api") {
|
|||||||
"audio_codecs:audio_codecs_api",
|
"audio_codecs:audio_codecs_api",
|
||||||
"transport:bitrate_settings",
|
"transport:bitrate_settings",
|
||||||
"transport:network_control",
|
"transport:network_control",
|
||||||
|
"units:data_rate",
|
||||||
"video:encoded_image",
|
"video:encoded_image",
|
||||||
"video:video_frame",
|
"video:video_frame",
|
||||||
"//third_party/abseil-cpp/absl/strings",
|
"//third_party/abseil-cpp/absl/strings",
|
||||||
|
@ -188,4 +188,7 @@ size_t MediaTransportInterface::GetAudioPacketOverhead() const {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MediaTransportInterface::SetAllocatedBitrateLimits(
|
||||||
|
const MediaTransportAllocatedBitrateLimits& limits) {}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "absl/types/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/array_view.h"
|
#include "api/array_view.h"
|
||||||
#include "api/rtc_error.h"
|
#include "api/rtc_error.h"
|
||||||
|
#include "api/units/data_rate.h"
|
||||||
#include "api/video/encoded_image.h"
|
#include "api/video/encoded_image.h"
|
||||||
#include "rtc_base/copy_on_write_buffer.h"
|
#include "rtc_base/copy_on_write_buffer.h"
|
||||||
#include "rtc_base/deprecation.h"
|
#include "rtc_base/deprecation.h"
|
||||||
@ -49,6 +50,12 @@ class AudioPacketReceivedObserver {
|
|||||||
virtual void OnFirstAudioPacketReceived(int64_t channel_id) = 0;
|
virtual void OnFirstAudioPacketReceived(int64_t channel_id) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct MediaTransportAllocatedBitrateLimits {
|
||||||
|
DataRate min_pacing_rate = DataRate::Zero();
|
||||||
|
DataRate max_padding_bitrate = DataRate::Zero();
|
||||||
|
DataRate max_total_allocated_bitrate = DataRate::Zero();
|
||||||
|
};
|
||||||
|
|
||||||
// A collection of settings for creation of media transport.
|
// A collection of settings for creation of media transport.
|
||||||
struct MediaTransportSettings final {
|
struct MediaTransportSettings final {
|
||||||
MediaTransportSettings();
|
MediaTransportSettings();
|
||||||
@ -449,6 +456,11 @@ class MediaTransportInterface {
|
|||||||
virtual void SetMediaTransportStateCallback(
|
virtual void SetMediaTransportStateCallback(
|
||||||
MediaTransportStateCallback* callback) = 0;
|
MediaTransportStateCallback* callback) = 0;
|
||||||
|
|
||||||
|
// Updates allocation limits.
|
||||||
|
// TODO(psla): Make abstract when downstream implementation implement it.
|
||||||
|
virtual void SetAllocatedBitrateLimits(
|
||||||
|
const MediaTransportAllocatedBitrateLimits& limits);
|
||||||
|
|
||||||
// Sends a data buffer to the remote endpoint using the given send parameters.
|
// Sends a data buffer to the remote endpoint using the given send parameters.
|
||||||
// |buffer| may not be larger than 256 KiB. Returns an error if the send
|
// |buffer| may not be larger than 256 KiB. Returns an error if the send
|
||||||
// fails.
|
// fails.
|
||||||
|
@ -93,6 +93,9 @@ class FakeMediaTransport : public MediaTransportInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetAllocatedBitrateLimits(
|
||||||
|
const MediaTransportAllocatedBitrateLimits& limits) override {}
|
||||||
|
|
||||||
int target_rate_observers_size() { return target_rate_observers_.size(); }
|
int target_rate_observers_size() { return target_rate_observers_.size(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -81,6 +81,9 @@ class WrapperMediaTransport : public MediaTransportInterface {
|
|||||||
wrapped_->SetDataSink(sink);
|
wrapped_->SetDataSink(sink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetAllocatedBitrateLimits(
|
||||||
|
const MediaTransportAllocatedBitrateLimits& limits) override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MediaTransportInterface* wrapped_;
|
MediaTransportInterface* wrapped_;
|
||||||
};
|
};
|
||||||
@ -372,4 +375,8 @@ void MediaTransportPair::LoopbackMediaTransport::OnStateChanged() {
|
|||||||
state_callback_->OnStateChanged(state_);
|
state_callback_->OnStateChanged(state_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MediaTransportPair::LoopbackMediaTransport::SetAllocatedBitrateLimits(
|
||||||
|
const MediaTransportAllocatedBitrateLimits& limits) {}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -127,6 +127,9 @@ class MediaTransportPair {
|
|||||||
|
|
||||||
Stats GetStats();
|
Stats GetStats();
|
||||||
|
|
||||||
|
void SetAllocatedBitrateLimits(
|
||||||
|
const MediaTransportAllocatedBitrateLimits& limits) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnData(uint64_t channel_id, MediaTransportEncodedAudioFrame frame);
|
void OnData(uint64_t channel_id, MediaTransportEncodedAudioFrame frame);
|
||||||
|
|
||||||
|
11
call/call.cc
11
call/call.cc
@ -1180,6 +1180,17 @@ void Call::OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps,
|
|||||||
transport_send_ptr_->SetAllocatedSendBitrateLimits(
|
transport_send_ptr_->SetAllocatedSendBitrateLimits(
|
||||||
min_send_bitrate_bps, max_padding_bitrate_bps, total_bitrate_bps);
|
min_send_bitrate_bps, max_padding_bitrate_bps, total_bitrate_bps);
|
||||||
|
|
||||||
|
{
|
||||||
|
rtc::CritScope lock(&target_observer_crit_);
|
||||||
|
if (media_transport_) {
|
||||||
|
MediaTransportAllocatedBitrateLimits limits;
|
||||||
|
limits.min_pacing_rate = DataRate::bps(min_send_bitrate_bps);
|
||||||
|
limits.max_padding_bitrate = DataRate::bps(max_padding_bitrate_bps);
|
||||||
|
limits.max_total_allocated_bitrate = DataRate::bps(total_bitrate_bps);
|
||||||
|
media_transport_->SetAllocatedBitrateLimits(limits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rtc::CritScope lock(&bitrate_crit_);
|
rtc::CritScope lock(&bitrate_crit_);
|
||||||
min_allocated_send_bitrate_bps_ = min_send_bitrate_bps;
|
min_allocated_send_bitrate_bps_ = min_send_bitrate_bps;
|
||||||
configured_max_padding_bitrate_bps_ = max_padding_bitrate_bps;
|
configured_max_padding_bitrate_bps_ = max_padding_bitrate_bps;
|
||||||
|
Reference in New Issue
Block a user