Implemented GetStartLatency

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5626 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2003-12-08 08:45:09 +00:00
parent 5f238ea9e9
commit fc8b28b6e1
2 changed files with 30 additions and 4 deletions

View File

@ -786,7 +786,7 @@ BMediaRoster::Connect(const media_source & from,
GetNodeFor(NodeIDFor(to.port), &destnode);
ReleaseNode(sourcenode);
ReleaseNode(destnode);
// BBufferConsumer::Connected
consumer_connected_request request4;
consumer_connected_reply reply4;
@ -2422,8 +2422,25 @@ status_t
BMediaRoster::GetStartLatencyFor(const media_node & time_source,
bigtime_t * out_latency)
{
UNIMPLEMENTED();
*out_latency = 5000;
CALLED();
if (out_latency == NULL)
return B_BAD_VALUE;
if (IS_INVALID_NODE(time_source))
return B_MEDIA_BAD_NODE;
if ((time_source.kind & B_TIME_SOURCE) == 0)
return B_MEDIA_BAD_NODE;
timesource_get_start_latency_request request;
timesource_get_start_latency_reply reply;
status_t rv;
rv = QueryPort(time_source.port, TIMESOURCE_GET_START_LATENCY, &request, sizeof(request), &reply, sizeof(reply));
if (rv != B_OK)
return rv;
*out_latency = reply.start_latency;
printf("BMediaRoster::GetStartLatencyFor timesource %ld has maximum initial latency %Ld\n", time_source.node, *out_latency);
return B_OK;
}

View File

@ -235,7 +235,7 @@ BTimeSource::HandleMessage(int32 message,
size_t size)
{
PRINT(4, "BTimeSource::HandleMessage %#lx, node %ld\n", message, fNodeID);
status_t rv;
switch (message) {
case TIMESOURCE_OP:
{
@ -275,6 +275,15 @@ BTimeSource::HandleMessage(int32 message,
DirectRemoveMe(data->node);
return B_OK;
}
case TIMESOURCE_GET_START_LATENCY:
{
const timesource_get_start_latency_request *request = static_cast<const timesource_get_start_latency_request *>(rawdata);
timesource_get_start_latency_reply reply;
rv = GetStartLatency(&reply.start_latency);
request->SendReply(rv, &reply, sizeof(reply));
return B_OK;
}
}
return B_ERROR;
}