Add overhead observers to MediaTransportInterface
Bug: webrtc:9719 Change-Id: I18a494ac2edd52c1f61673f850e6e8abebbc5d0a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/123192 Reviewed-by: Anton Sukhanov <sukhanov@webrtc.org> Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27019}
This commit is contained in:
parent
06b77f9d8f
commit
d5af40225b
@ -28,6 +28,7 @@
|
||||
#include "api/transport/media/audio_transport.h"
|
||||
#include "api/transport/media/video_transport.h"
|
||||
#include "api/units/data_rate.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "rtc_base/copy_on_write_buffer.h"
|
||||
#include "rtc_base/network_route.h"
|
||||
|
||||
@ -280,8 +281,19 @@ class MediaTransportInterface {
|
||||
// transport overhead (ipv4/6, turn channeldata, tcp/udp, etc.).
|
||||
// If the transport is capable of fusing packets together, this overhead
|
||||
// might not be a very accurate number.
|
||||
// TODO(nisse): Deprecated.
|
||||
virtual size_t GetAudioPacketOverhead() const;
|
||||
|
||||
// Corresponding observers for audio and video overhead. Before destruction,
|
||||
// the observers must be unregistered by setting nullptr.
|
||||
|
||||
// TODO(nisse): Should move to per-stream objects, since packetization
|
||||
// overhead can vary per stream, e.g., depending on negotiated extensions. In
|
||||
// addition, we should move towards reporting total overhead including all
|
||||
// layers. Currently, overhead of the lower layers is reported elsewhere,
|
||||
// e.g., on route change between IPv4 and IPv6.
|
||||
virtual void SetAudioOverheadObserver(OverheadObserver* observer) {}
|
||||
|
||||
// Registers an observer for network change events. If the network route is
|
||||
// already established when the callback is added, |callback| will be called
|
||||
// immediately with the current network route. Before media transport is
|
||||
|
||||
@ -688,11 +688,6 @@ ChannelSend::ChannelSend(Clock* clock,
|
||||
// RTPMediaTransport. In this case it means that overhead and bandwidth
|
||||
// observers should not be called when using media transport.
|
||||
if (!media_transport_) {
|
||||
// TODO(sukhanov): Overhead observer is only needed for RTP path, because in
|
||||
// media transport audio overhead is currently considered constant (see
|
||||
// getter MediaTransportInterface::GetAudioPacketOverhead). In the future
|
||||
// when we introduce RTP media transport we should make audio overhead
|
||||
// interface consistent and work for both RTP and non-RTP implementations.
|
||||
configuration.overhead_observer = overhead_observer;
|
||||
configuration.bandwidth_callback = rtcp_observer_.get();
|
||||
configuration.transport_feedback_callback = feedback_observer_proxy_.get();
|
||||
@ -725,6 +720,7 @@ ChannelSend::ChannelSend(Clock* clock,
|
||||
if (media_transport_) {
|
||||
RTC_DLOG(LS_INFO) << "Setting media_transport_ rate observers.";
|
||||
media_transport_->AddTargetTransferRateObserver(this);
|
||||
media_transport_->SetAudioOverheadObserver(overhead_observer);
|
||||
} else {
|
||||
RTC_DLOG(LS_INFO) << "Not setting media_transport_ rate observers.";
|
||||
}
|
||||
@ -748,6 +744,7 @@ ChannelSend::~ChannelSend() {
|
||||
|
||||
if (media_transport_) {
|
||||
media_transport_->RemoveTargetTransferRateObserver(this);
|
||||
media_transport_->SetAudioOverheadObserver(nullptr);
|
||||
}
|
||||
|
||||
StopSend();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user