Rework nodes to call Run() only after registration

* While it should not be a big problem the
  bebook specify to do it after custom operations,
  most nodes also follow this way, this commit restore
  consistency.
This commit is contained in:
Dario Casalinuovo 2015-07-24 19:50:08 +02:00
parent d009f28613
commit 6d2f2ec177
13 changed files with 47 additions and 46 deletions

View File

@ -181,9 +181,6 @@ DVBMediaNode::DVBMediaNode(
fRequiredFormatEncAudio = fDefaultFormatEncAudio;
fRequiredFormatTS = fDefaultFormatTS;
// start the BMediaEventLooper control loop running
Run();
TRACE("current RunMode = %d\n", RunMode());
#ifdef DUMP_VIDEO
@ -350,6 +347,8 @@ DVBMediaNode::NodeRegistered()
//printf("RunMode = %d\n", RunMode());
//printf("_m_recordDelay = %Ld\n", _m_recordDelay);
Run();
}

View File

@ -66,9 +66,6 @@ EqualizerNode::HandleMessage(int32 message, const void *data, size_t size)
void
EqualizerNode::NodeRegistered()
{
SetPriority(B_REAL_TIME_PRIORITY);
Run();
fPreferredFormat.type = B_MEDIA_RAW_AUDIO;
fPreferredFormat.u.raw_audio.buffer_size = BUFF_SIZE;
fPreferredFormat.u.raw_audio = media_raw_audio_format::wildcard;
@ -95,6 +92,9 @@ EqualizerNode::NodeRegistered()
InitParameterValues();
InitParameterWeb();
SetPriority(B_REAL_TIME_PRIORITY);
Run();
}

View File

@ -195,10 +195,6 @@ void ESDSinkNode::NodeRegistered(void)
return;
}
SetPriority(B_REAL_TIME_PRIORITY);
Run();
// media_input *input = new media_input;
fInput.format = fPreferredFormat;
@ -236,6 +232,9 @@ void ESDSinkNode::NodeRegistered(void)
#ifdef PRINTING
PRINT(("apply configuration in : %lld\n", system_time() - start));
#endif
SetPriority(B_REAL_TIME_PRIORITY);
Run();
}
status_t ESDSinkNode::RequestCompleted(const media_request_info &info)

View File

@ -138,9 +138,6 @@ FireWireDVNode::NodeRegistered()
{
CALLED();
SetPriority(B_REAL_TIME_PRIORITY);
Run();
fOutputEncVideo.node = Node();
fOutputEncVideo.source.port = ControlPort();
fOutputEncVideo.source.id = 0;
@ -149,6 +146,9 @@ FireWireDVNode::NodeRegistered()
strcpy(fOutputEncVideo.name, "encoded video");
RefreshParameterWeb();
SetPriority(B_REAL_TIME_PRIORITY);
Run();
}

View File

@ -17,6 +17,7 @@
#include <Buffer.h>
#include <Catalog.h>
#include <FindDirectory.h>
#include <MediaDefs.h>
#include <MediaRoster.h>
#include <ParameterWeb.h>
#include <Path.h>
@ -1066,9 +1067,9 @@ AudioMixer::EnableOutput(const media_source& what, bool enabled,
void
AudioMixer::NodeRegistered()
{
Run();
SetPriority(120);
UpdateParameterWeb();
SetPriority(B_REAL_TIME_PRIORITY);
Run();
}

View File

@ -168,8 +168,11 @@ node_output::~node_output()
MultiAudioNode::MultiAudioNode(BMediaAddOn* addon, const char* name,
MultiAudioDevice* device, int32 internalID, BMessage* config)
: BMediaNode(name), BBufferConsumer(B_MEDIA_RAW_AUDIO),
:
BMediaNode(name),
BBufferConsumer(B_MEDIA_RAW_AUDIO),
BBufferProducer(B_MEDIA_RAW_AUDIO),
BMediaEventLooper(),
fBufferLock("multi audio buffers"),
fThread(-1),
fDevice(device),
@ -335,9 +338,6 @@ MultiAudioNode::NodeRegistered()
return;
}
SetPriority(B_REAL_TIME_PRIORITY);
Run();
node_input *currentInput = NULL;
int32 currentId = 0;
@ -461,6 +461,9 @@ MultiAudioNode::NodeRegistered()
PRINT(("apply configuration in : %" B_PRIdBIGTIME "\n",
system_time() - start));
SetPriority(B_REAL_TIME_PRIORITY);
Run();
}

View File

@ -448,10 +448,6 @@ OpenSoundNode::NodeRegistered()
return;
}
SetPriority(B_REAL_TIME_PRIORITY);
Run();
TRACE("NodeRegistered: %d engines\n", fDevice->CountEngines());
for (int32 i = 0; i < fDevice->CountEngines(); i++) {
OpenSoundDeviceEngine* engine = fDevice->EngineAt(i);
@ -576,6 +572,9 @@ OpenSoundNode::NodeRegistered()
}
TRACE("apply configuration in : %lldµs\n", system_time() - start);
SetPriority(B_REAL_TIME_PRIORITY);
Run();
}

View File

@ -629,16 +629,16 @@ ToneProducer::NodeRegistered()
{
FPRINTF(stderr, "ToneProducer::NodeRegistered\n");
// Start the BMediaEventLooper thread
SetPriority(B_REAL_TIME_PRIORITY);
Run();
// output init moved to ctor
// e.moon [4jun99]
// Set up our parameter web
mWeb = make_parameter_web();
SetParameterWeb(mWeb);
// Start the BMediaEventLooper thread
SetPriority(B_REAL_TIME_PRIORITY);
Run();
}
void

View File

@ -64,9 +64,6 @@ VSTNode::HandleMessage(int32 message, const void* data, size_t size)
void
VSTNode::NodeRegistered()
{
SetPriority(B_REAL_TIME_PRIORITY);
Run();
fPreferredFormat.type = B_MEDIA_RAW_AUDIO;
fPreferredFormat.u.raw_audio.buffer_size = BUFF_SIZE;
fPreferredFormat.u.raw_audio = media_raw_audio_format::wildcard;
@ -93,6 +90,9 @@ VSTNode::NodeRegistered()
InitParameterValues();
InitParameterWeb();
SetPriority(B_REAL_TIME_PRIORITY);
Run();
}
//BControllable

View File

@ -227,10 +227,6 @@ void FlangerNode::NodeRegistered() {
PRINT(("FlangerNode::NodeRegistered()\n"));
// Start the BMediaEventLooper thread
SetPriority(B_REAL_TIME_PRIORITY);
Run();
// figure preferred ('template') format
m_preferredFormat.type = B_MEDIA_RAW_AUDIO;
getPreferredFormat(m_preferredFormat);
@ -258,6 +254,10 @@ void FlangerNode::NodeRegistered() {
// init parameters
initParameterValues();
initParameterWeb();
// Start the BMediaEventLooper thread
SetPriority(B_REAL_TIME_PRIORITY);
Run();
}
// "Augment OfflineTime() to compute the node's current time; it's called

View File

@ -383,10 +383,6 @@ void AudioFilterNode::NodeRegistered() {
PRINT(("AudioFilterNode::NodeRegistered()\n"));
status_t err;
// Start the BMediaEventLooper thread
SetPriority(B_REAL_TIME_PRIORITY);
Run();
// init input
m_input.destination.port = ControlPort();
@ -414,6 +410,10 @@ void AudioFilterNode::NodeRegistered() {
// init parameters
initParameterWeb();
// Start the BMediaEventLooper thread
SetPriority(B_REAL_TIME_PRIORITY);
Run();
}
// "Augment OfflineTime() to compute the node's current time; it's called

View File

@ -587,15 +587,15 @@ AudioProducer::NodeRegistered()
{
TRACE("%p->AudioProducer::NodeRegistered()\n", this);
// Start the BMediaEventLooper thread
SetPriority(B_REAL_TIME_PRIORITY);
Run();
// set up as much information about our output as we can
fOutput.source.port = ControlPort();
fOutput.source.id = 0;
fOutput.node = Node();
::strcpy(fOutput.name, Name());
// Start the BMediaEventLooper thread
SetPriority(B_REAL_TIME_PRIORITY);
Run();
}

View File

@ -422,15 +422,15 @@ GameProducer::AdditionalBufferRequested(const media_source& source,
void
GameProducer::NodeRegistered()
{
// Start the BMediaEventLooper thread
SetPriority(B_REAL_TIME_PRIORITY);
Run();
// set up as much information about our output as we can
fOutput.source.port = ControlPort();
fOutput.source.id = 0;
fOutput.node = Node();
strlcpy(fOutput.name, "GameProducer Output", B_MEDIA_NAME_LENGTH);
// Start the BMediaEventLooper thread
SetPriority(B_REAL_TIME_PRIORITY);
Run();
}