From 75b90c42e52be4d2aa7130aef33060d01e512d46 Mon Sep 17 00:00:00 2001 From: Dario Casalinuovo Date: Sat, 17 Dec 2016 19:07:23 +0100 Subject: [PATCH] MediaConnection: Fix buffer size and duration redudancy * There's no need to supply ways to mismatch the buffer duration and size. Anything should reflect the media_format, this is at least fixed on API level. --- headers/private/media/MediaConnection.h | 12 ++++++------ src/kits/media/MediaConnection.cpp | 20 ++------------------ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/headers/private/media/MediaConnection.h b/headers/private/media/MediaConnection.h index d4b341b671..414d281204 100644 --- a/headers/private/media/MediaConnection.h +++ b/headers/private/media/MediaConnection.h @@ -41,22 +41,22 @@ public: bool HasBinding() const; BMediaConnection* Binding() const; + bool IsConnected() const; + // This allow to specify a format that will be used while // connecting to another node. See BMediaClient::SetFormat. void SetAcceptedFormat( const media_format& format); const media_format& AcceptedFormat() const; - // Represents the buffer size used by the media_node - void SetBufferSize(size_t size); + // Represents the buffer size, depends on the format set or negotiated + // for this connection. size_t BufferSize() const; - // Represents the duration of one buffer - void SetBufferDuration(bigtime_t duration); + // Represents the duration of one buffer depends on the format set or + // negotiated for this connection. bigtime_t BufferDuration() const; - bool IsConnected() const; - // Disconnect this connection. When a connection is disconnected, // it can be reused as brand new. status_t Disconnect(); diff --git a/src/kits/media/MediaConnection.cpp b/src/kits/media/MediaConnection.cpp index 59beb2b832..6081196c8c 100644 --- a/src/kits/media/MediaConnection.cpp +++ b/src/kits/media/MediaConnection.cpp @@ -120,15 +120,8 @@ BMediaConnection::Release() } -void -BMediaConnection::SetBufferSize(size_t size) -{ - CALLED(); - - fBufferSize = size; -} - - +// TODO: The data represented by the following two functions should be +// automatically calculated depending on the media_format. size_t BMediaConnection::BufferSize() const { @@ -138,15 +131,6 @@ BMediaConnection::BufferSize() const } -void -BMediaConnection::SetBufferDuration(bigtime_t duration) -{ - CALLED(); - - fBufferDuration = duration; -} - - bigtime_t BMediaConnection::BufferDuration() const {