From fdfd8a502e8d3f9f7d5bf51c13a8cfa897792b94 Mon Sep 17 00:00:00 2001 From: Dario Casalinuovo Date: Sun, 15 Jan 2017 19:25:00 +0100 Subject: [PATCH] General MediaClient cleanup * Avoid setting fRunning in different places. * Fix SimpleMediaOutput kind mismatch. * Other minor fixes. --- src/kits/media/MediaClientNode.cpp | 5 ++--- src/kits/media/SimpleMediaClient.cpp | 2 +- src/tests/kits/media/media_client/media_client.cpp | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/kits/media/MediaClientNode.cpp b/src/kits/media/MediaClientNode.cpp index 47cc4257a2..14fe6b3572 100755 --- a/src/kits/media/MediaClientNode.cpp +++ b/src/kits/media/MediaClientNode.cpp @@ -99,7 +99,6 @@ BMediaClientNode::Start(bigtime_t performanceTime) CALLED(); BMediaEventLooper::Start(performanceTime); - fOwner->fRunning = true; } @@ -109,7 +108,6 @@ BMediaClientNode::Stop(bigtime_t performanceTime, bool immediate) CALLED(); BMediaEventLooper::Stop(performanceTime, immediate); - fOwner->fRunning = false; } @@ -538,6 +536,8 @@ BMediaClientNode::HandleEvent(const media_timed_event* event, if (RunState() != B_STARTED) fOwner->HandleStart(event->event_time); + fStartTime = event->event_time; + _ScheduleConnections(event->event_time); break; } @@ -579,7 +579,6 @@ BMediaClientNode::_ScheduleConnections(bigtime_t eventTime) if (output->HasBinding()) continue; - fStartTime = eventTime; media_timed_event firstBufferEvent(eventTime, B_NEW_BUFFER); diff --git a/src/kits/media/SimpleMediaClient.cpp b/src/kits/media/SimpleMediaClient.cpp index cf9b64f559..475599690c 100644 --- a/src/kits/media/SimpleMediaClient.cpp +++ b/src/kits/media/SimpleMediaClient.cpp @@ -196,7 +196,7 @@ BSimpleMediaInput::BufferReceived(BBuffer* buffer) BSimpleMediaOutput::BSimpleMediaOutput() : -BMediaConnection(B_MEDIA_INPUT), + BMediaConnection(B_MEDIA_OUTPUT), BSimpleMediaConnection(B_MEDIA_OUTPUT), BMediaOutput() { diff --git a/src/tests/kits/media/media_client/media_client.cpp b/src/tests/kits/media/media_client/media_client.cpp index 840e61c848..1e94fb5f95 100644 --- a/src/tests/kits/media/media_client/media_client.cpp +++ b/src/tests/kits/media/media_client/media_client.cpp @@ -57,8 +57,8 @@ void _ConsumerProducerTest() { _InitClients(false); - BMediaOutput* output = sProducer->BeginOutput(); - BMediaInput* input = sConsumer->BeginInput(); + BSimpleMediaOutput* output = sProducer->BeginOutput(); + BSimpleMediaInput* input = sConsumer->BeginInput(); output->SetAcceptedFormat(_BuildRawAudioFormat()); input->SetAcceptedFormat(_BuildRawAudioFormat());