From c0496e66f69f8571153a8673eec72b55f3d23086 Mon Sep 17 00:00:00 2001 From: "astor@webrtc.org" Date: Fri, 10 Aug 2012 10:14:43 +0000 Subject: [PATCH] Expose a function for setting bandwidth estimation parameters in ViERTP_RTCP. Review URL: https://webrtc-codereview.appspot.com/678007 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2591 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/video_engine/include/vie_rtp_rtcp.h | 10 ++++++++++ src/video_engine/vie_rtp_rtcp_impl.cc | 16 ++++++++++++++++ src/video_engine/vie_rtp_rtcp_impl.h | 2 ++ src/video_engine/vie_shared_data.cc | 5 +++++ src/video_engine/vie_shared_data.h | 2 +- 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/video_engine/include/vie_rtp_rtcp.h b/src/video_engine/include/vie_rtp_rtcp.h index bbaeae33b8..f3a87667f0 100644 --- a/src/video_engine/include/vie_rtp_rtcp.h +++ b/src/video_engine/include/vie_rtp_rtcp.h @@ -256,6 +256,16 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP { const int video_channel, unsigned int* estimated_bandwidth) const = 0; + // This function sets various options for the bandwidth estimator + // code. The options are applied to new channels only. For a given + // channel, the options that are active at the time when the channel + // is created are immutable for that channel. See + // http://tools.ietf.org/html/draft-alvestrand-rtcweb-congestion-02 + // (or later, updated documentation) and common_types.h to get a + // feel for what the options do. + virtual int SetOverUseDetectorOptions( + const OverUseDetectorOptions& options) const = 0; + // This function enables capturing of RTP packets to a binary file on a // specific channel and for a given direction. The file can later be // replayed using e.g. RTP Tools rtpplay since the binary file format is diff --git a/src/video_engine/vie_rtp_rtcp_impl.cc b/src/video_engine/vie_rtp_rtcp_impl.cc index 5554734f1a..2e009ffe41 100644 --- a/src/video_engine/vie_rtp_rtcp_impl.cc +++ b/src/video_engine/vie_rtp_rtcp_impl.cc @@ -761,6 +761,22 @@ int ViERTP_RTCPImpl::GetEstimatedReceiveBandwidth( static_cast(estimated_bandwidth)); } +int ViERTP_RTCPImpl::SetOverUseDetectorOptions( + const OverUseDetectorOptions& options) const { + if (!shared_data_->Initialized()) { + shared_data_->SetLastError(kViENotInitialized); + WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()), + "%s - ViE instance %d not initialized", __FUNCTION__, + shared_data_->instance_id()); + return -1; + } + // Lock the channel manager to avoid creating a channel with + // "undefined" bwe settings (atomic copy). + ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); + shared_data_->SetOverUseDetectorOptions(options); + return 0; +} + int ViERTP_RTCPImpl::StartRTPDump(const int video_channel, const char file_nameUTF8[1024], RTPDirections direction) { diff --git a/src/video_engine/vie_rtp_rtcp_impl.h b/src/video_engine/vie_rtp_rtcp_impl.h index 89d4c8d184..1d96e084cb 100644 --- a/src/video_engine/vie_rtp_rtcp_impl.h +++ b/src/video_engine/vie_rtp_rtcp_impl.h @@ -95,6 +95,8 @@ class ViERTP_RTCPImpl virtual int GetEstimatedReceiveBandwidth( const int video_channel, unsigned int* estimated_bandwidth) const; + virtual int SetOverUseDetectorOptions( + const OverUseDetectorOptions& options) const; virtual int StartRTPDump(const int video_channel, const char file_nameUTF8[1024], RTPDirections direction); diff --git a/src/video_engine/vie_shared_data.cc b/src/video_engine/vie_shared_data.cc index a395578920..b927144884 100644 --- a/src/video_engine/vie_shared_data.cc +++ b/src/video_engine/vie_shared_data.cc @@ -75,6 +75,11 @@ int ViESharedData::LastErrorInternal() const { return error; } +void ViESharedData::SetOverUseDetectorOptions( + const OverUseDetectorOptions& options) { + over_use_detector_options_ = options; +} + int ViESharedData::NumberOfCores() const { return number_cores_; } diff --git a/src/video_engine/vie_shared_data.h b/src/video_engine/vie_shared_data.h index 6621e4bb64..062e5c50a4 100644 --- a/src/video_engine/vie_shared_data.h +++ b/src/video_engine/vie_shared_data.h @@ -34,7 +34,7 @@ class ViESharedData { int SetUnInitialized(); void SetLastError(const int error) const; int LastErrorInternal() const; - + void SetOverUseDetectorOptions(const OverUseDetectorOptions& options); int NumberOfCores() const; int instance_id() { return instance_id_;}