MediaClient: Move WIP min/max functions into BMediaConnection

This commit is contained in:
Dario Casalinuovo
2017-01-10 22:54:53 +01:00
parent e7aa210bca
commit e6004b7729
5 changed files with 39 additions and 37 deletions
-14
View File
@@ -124,17 +124,6 @@ public:
BMediaNode::run_mode RunMode() const; BMediaNode::run_mode RunMode() const;
status_t SetRunMode(BMediaNode::run_mode mode); 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 // Return the current performance time handled by the object when
// run_mode != B_OFFLINE. Otherwise returns the current offline time. // run_mode != B_OFFLINE. Otherwise returns the current offline time.
bigtime_t CurrentTime() const; bigtime_t CurrentTime() const;
@@ -191,9 +180,6 @@ private:
bigtime_t fCurrentTime; bigtime_t fCurrentTime;
bigtime_t fMinLatency;
bigtime_t fMaxLatency;
BObjectList<BMediaInput> fInputs; BObjectList<BMediaInput> fInputs;
BObjectList<BMediaOutput> fOutputs; BObjectList<BMediaOutput> fOutputs;
+14
View File
@@ -72,6 +72,17 @@ protected:
virtual void Connected(const media_format& format); virtual void Connected(const media_format& format);
virtual void Disconnected(); 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: private:
void ConnectionRegistered(BMediaClient* owner, void ConnectionRegistered(BMediaClient* owner,
media_connection_id id); media_connection_id id);
@@ -95,6 +106,9 @@ private:
bool fConnected; bool fConnected;
bigtime_t fMinLatency;
bigtime_t fMaxLatency;
virtual void _ReservedMediaConnection0(); virtual void _ReservedMediaConnection0();
virtual void _ReservedMediaConnection1(); virtual void _ReservedMediaConnection1();
virtual void _ReservedMediaConnection2(); virtual void _ReservedMediaConnection2();
-20
View File
@@ -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 bigtime_t
BMediaClient::CurrentTime() const BMediaClient::CurrentTime() const
{ {
+2 -2
View File
@@ -213,7 +213,7 @@ BMediaClientNode::GetLatencyFor(const media_destination& dest,
if (conn == NULL) if (conn == NULL)
return B_MEDIA_BAD_DESTINATION; return B_MEDIA_BAD_DESTINATION;
*latency = fOwner->fMaxLatency; *latency = conn->fMaxLatency;
*timesource = TimeSource()->ID(); *timesource = TimeSource()->ID();
return B_OK; return B_OK;
} }
@@ -494,7 +494,7 @@ BMediaClientNode::GetLatency(bigtime_t* outLatency)
CALLED(); CALLED();
// TODO: finish latency handling // TODO: finish latency handling
*outLatency = fOwner->fMinLatency; *outLatency = 0;
return B_OK; return B_OK;
} }
+23 -1
View File
@@ -12,7 +12,9 @@ BMediaConnection::BMediaConnection(media_connection_kinds kinds)
: :
fOwner(NULL), fOwner(NULL),
fBind(NULL), fBind(NULL),
fBufferGroup(NULL) fBufferGroup(NULL),
fMinLatency(0),
fMaxLatency(0)
{ {
CALLED(); CALLED();
@@ -136,6 +138,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 void
BMediaConnection::ConnectionRegistered(BMediaClient* owner, BMediaConnection::ConnectionRegistered(BMediaClient* owner,
media_connection_id id) media_connection_id id)