summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDario Casalinuovo <b.vitruvio@gmail.com>2017-01-10 21:54:53 (GMT)
committerDario Casalinuovo <b.vitruvio@gmail.com>2017-01-10 21:54:53 (GMT)
commite6004b7729710ea60bdcce10e551508a5a855a1f (patch)
treed68f7d75b0f9a58ce3d1b19ccbeb23a9644b30d9
parente7aa210bca0016b648411c8be84b40b3e19d9b9a (diff)
MediaClient: Move WIP min/max functions into BMediaConnectionhrev50856
-rwxr-xr-xheaders/private/media/MediaClient.h14
-rw-r--r--headers/private/media/MediaConnection.h14
-rwxr-xr-xsrc/kits/media/MediaClient.cpp20
-rwxr-xr-xsrc/kits/media/MediaClientNode.cpp4
-rw-r--r--src/kits/media/MediaConnection.cpp24
5 files changed, 39 insertions, 37 deletions
diff --git a/headers/private/media/MediaClient.h b/headers/private/media/MediaClient.h
index b5d04b5..ce37b1a 100755
--- a/headers/private/media/MediaClient.h
+++ b/headers/private/media/MediaClient.h
@@ -124,17 +124,6 @@ public:
BMediaNode::run_mode RunMode() const;
status_t SetRunMode(BMediaNode::run_mode mode);
- // Specify a latency range to allow the node behave correctly.
- // Ideally the minimum latency should be the algorithmic latency you expect
- // from the node and will be used as starting point. The max latency is the
- // maximum acceptable by you, over that point the node will adjust it's
- // performance time to recover if a big delay happen.
- void SetLatencyRange(bigtime_t min,
- bigtime_t max);
-
- void GetLatencyRange(bigtime_t* min,
- bigtime_t* max) const;
-
// Return the current performance time handled by the object when
// run_mode != B_OFFLINE. Otherwise returns the current offline time.
bigtime_t CurrentTime() const;
@@ -191,9 +180,6 @@ private:
bigtime_t fCurrentTime;
- bigtime_t fMinLatency;
- bigtime_t fMaxLatency;
-
BObjectList<BMediaInput> fInputs;
BObjectList<BMediaOutput> fOutputs;
diff --git a/headers/private/media/MediaConnection.h b/headers/private/media/MediaConnection.h
index cce9a24..97694a1 100644
--- a/headers/private/media/MediaConnection.h
+++ b/headers/private/media/MediaConnection.h
@@ -72,6 +72,17 @@ protected:
virtual void Connected(const media_format& format);
virtual void Disconnected();
+ // Specify a latency range to allow the connection behave correctly.
+ // Ideally the minimum latency should be the algorithmic latency you expect
+ // from the node and will be used as starting point. The max latency is the
+ // maximum acceptable by you, over that point the node will adjust it's
+ // performance time to recover if a big delay happen.
+ void SetLatencyRange(bigtime_t min,
+ bigtime_t max);
+
+ void GetLatencyRange(bigtime_t* min,
+ bigtime_t* max) const;
+
private:
void ConnectionRegistered(BMediaClient* owner,
media_connection_id id);
@@ -95,6 +106,9 @@ private:
bool fConnected;
+ bigtime_t fMinLatency;
+ bigtime_t fMaxLatency;
+
virtual void _ReservedMediaConnection0();
virtual void _ReservedMediaConnection1();
virtual void _ReservedMediaConnection2();
diff --git a/src/kits/media/MediaClient.cpp b/src/kits/media/MediaClient.cpp
index 4ad3a97..9d5e832 100755
--- a/src/kits/media/MediaClient.cpp
+++ b/src/kits/media/MediaClient.cpp
@@ -379,26 +379,6 @@ BMediaClient::SetTimeSource(const media_client& timesource)
}
-void
-BMediaClient::GetLatencyRange(bigtime_t* min, bigtime_t* max) const
-{
- CALLED();
-
- *min = fMinLatency;
- *max = fMaxLatency;
-}
-
-
-void
-BMediaClient::SetLatencyRange(bigtime_t min, bigtime_t max)
-{
- CALLED();
-
- fMinLatency = min;
- fMaxLatency = max;
-}
-
-
bigtime_t
BMediaClient::CurrentTime() const
{
diff --git a/src/kits/media/MediaClientNode.cpp b/src/kits/media/MediaClientNode.cpp
index 15bd140..563a9ac 100755
--- a/src/kits/media/MediaClientNode.cpp
+++ b/src/kits/media/MediaClientNode.cpp
@@ -213,7 +213,7 @@ BMediaClientNode::GetLatencyFor(const media_destination& dest,
if (conn == NULL)
return B_MEDIA_BAD_DESTINATION;
- *latency = fOwner->fMaxLatency;
+ *latency = conn->fMaxLatency;
*timesource = TimeSource()->ID();
return B_OK;
}
@@ -494,7 +494,7 @@ BMediaClientNode::GetLatency(bigtime_t* outLatency)
CALLED();
// TODO: finish latency handling
- *outLatency = fOwner->fMinLatency;
+ *outLatency = 0;
return B_OK;
}
diff --git a/src/kits/media/MediaConnection.cpp b/src/kits/media/MediaConnection.cpp
index e40277f..f9c8ea8 100644
--- a/src/kits/media/MediaConnection.cpp
+++ b/src/kits/media/MediaConnection.cpp
@@ -12,7 +12,9 @@ BMediaConnection::BMediaConnection(media_connection_kinds kinds)
:
fOwner(NULL),
fBind(NULL),
- fBufferGroup(NULL)
+ fBufferGroup(NULL),
+ fMinLatency(0),
+ fMaxLatency(0)
{
CALLED();
@@ -137,6 +139,26 @@ BMediaConnection::Disconnected()
void
+BMediaConnection::GetLatencyRange(bigtime_t* min, bigtime_t* max) const
+{
+ CALLED();
+
+ *min = fMinLatency;
+ *max = fMaxLatency;
+}
+
+
+void
+BMediaConnection::SetLatencyRange(bigtime_t min, bigtime_t max)
+{
+ CALLED();
+
+ fMinLatency = min;
+ fMaxLatency = max;
+}
+
+
+void
BMediaConnection::ConnectionRegistered(BMediaClient* owner,
media_connection_id id)
{