Browse Source

Correct JackProcessSync::LockedTimedWait.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3660 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/v1.9.4
sletz 15 years ago
parent
commit
09916901dc
4 changed files with 27 additions and 22 deletions
  1. +4
    -0
      ChangeLog
  2. +2
    -2
      common/JackEngine.cpp
  3. +8
    -8
      macosx/coreaudio/JackCoreAudioDriver.cpp
  4. +13
    -12
      posix/JackProcessSync.cpp

+ 4
- 0
ChangeLog View File

@@ -25,6 +25,10 @@ Paul Davis
Jackdmp changes log
---------------------------

2009-10-22 Stephane Letz <letz@grame.fr>
* Correct JackProcessSync::LockedTimedWait.

2009-10-22 Stephane Letz <letz@grame.fr>
* Correct jackdmp.cpp (failures case were not correct..). Improve JackCoreAudioDriver code. Raise default port number to 2048.


+ 2
- 2
common/JackEngine.cpp View File

@@ -484,7 +484,7 @@ int JackEngine::GetClientRefNum(const char* name)
// Used for external clients
int JackEngine::ClientExternalOpen(const char* name, int pid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager)
{
jack_log("JackEngine::ClientOpen: name = %s ", name);
jack_log("JackEngine::ClientExternalOpen: name = %s ", name);

int refnum = AllocateRefnum();
if (refnum < 0) {
@@ -536,7 +536,7 @@ error:
// Used for server driver clients
int JackEngine::ClientInternalOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, bool wait)
{
jack_log("JackEngine::ClientInternalNew: name = %s", name);
jack_log("JackEngine::ClientInternalOpen: name = %s", name);

int refnum = AllocateRefnum();
if (refnum < 0) {


+ 8
- 8
macosx/coreaudio/JackCoreAudioDriver.cpp View File

@@ -222,7 +222,7 @@ OSStatus JackCoreAudioDriver::MeasureCallback(AudioDeviceID inDevice,
JackMachThread::GetParams(pthread_self(), &driver->fEngineControl->fPeriod, &driver->fEngineControl->fComputation, &driver->fEngineControl->fConstraint);
if (driver->fComputationGrain > 0) {
jack_log("JackCoreAudioDriver::MeasureCallback : RT thread computation setup to %ld percent of period", int(driver->fComputationGrain * 100));
jack_log("JackCoreAudioDriver::MeasureCallback : RT thread computation setup to %d percent of period", int(driver->fComputationGrain * 100));
driver->fEngineControl->fComputation = driver->fEngineControl->fPeriod * driver->fComputationGrain;
}
@@ -647,24 +647,24 @@ int JackCoreAudioDriver::SetupChannels(bool capturing, bool playing, int& inchan
}

if (inchannels > in_nChannels) {
jack_error("This device hasn't required input channels inchannels = %ld in_nChannels = %ld", inchannels, in_nChannels);
jack_error("This device hasn't required input channels inchannels = %d in_nChannels = %d", inchannels, in_nChannels);
if (strict)
return -1;
}

if (outchannels > out_nChannels) {
jack_error("This device hasn't required output channels outchannels = %ld out_nChannels = %ld", outchannels, out_nChannels);
jack_error("This device hasn't required output channels outchannels = %d out_nChannels = %d", outchannels, out_nChannels);
if (strict)
return -1;
}

if (inchannels == 0) {
jack_log("Setup max in channels = %ld", in_nChannels);
jack_log("Setup max in channels = %d", in_nChannels);
inchannels = in_nChannels;
}

if (outchannels == 0) {
jack_log("Setup max out channels = %ld", out_nChannels);
jack_log("Setup max out channels = %d", out_nChannels);
outchannels = out_nChannels;
}

@@ -717,7 +717,7 @@ int JackCoreAudioDriver::SetupBufferSizeAndSampleRate(jack_nframes_t buffer_size
int count = 0;
while (!fState && count++ < 100) {
usleep(100000);
jack_log("Wait count = %ld", count);
jack_log("Wait count = %d", count);
}

// Remove SR change notification
@@ -741,7 +741,7 @@ int JackCoreAudioDriver::OpenAUHAL(bool capturing,
UInt32 enableIO;
AudioStreamBasicDescription srcFormat, dstFormat;

jack_log("OpenAUHAL capturing = %ld playing = %ld inchannels = %ld outchannels = %ld in_nChannels = %ld out_nChannels = %ld ", capturing, playing, inchannels, outchannels, in_nChannels, out_nChannels);
jack_log("OpenAUHAL capturing = %d playing = %d inchannels = %d outchannels = %d in_nChannels = %d out_nChannels = %d", capturing, playing, inchannels, outchannels, in_nChannels, out_nChannels);

if (inchannels == 0 && outchannels == 0) {
jack_error("No input and output channels...");
@@ -1099,7 +1099,7 @@ int JackCoreAudioDriver::Open(jack_nframes_t buffer_size,

if (SetupBufferSizeAndSampleRate(buffer_size, samplerate) < 0)
return -1;
if (OpenAUHAL(capturing, playing, inchannels, outchannels, in_nChannels, out_nChannels, buffer_size, samplerate, true) < 0)
goto error;



+ 13
- 12
posix/JackProcessSync.cpp View File

@@ -104,6 +104,7 @@ bool JackProcessSync::TimedWait(long usec)
gettimeofday(&T1, 0);
jack_log("JackProcessSync::TimedWait finished delta = %5.1lf",
(1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec));
return (res == 0);
}

@@ -112,11 +113,11 @@ bool JackProcessSync::LockedTimedWait(long usec)
struct timeval T0, T1;
timespec time;
struct timeval now;
int res;
int res1, res2;

res = pthread_mutex_lock(&fMutex);
if (res != 0)
jack_error("JackProcessSync::LockedTimedWait error err = %s", usec, strerror(res));
res1 = pthread_mutex_lock(&fMutex);
if (res1 != 0)
jack_error("JackProcessSync::LockedTimedWait error err = %s", usec, strerror(res1));
jack_log("JackProcessSync::TimedWait time out = %ld", usec);
gettimeofday(&T0, 0);
@@ -125,19 +126,19 @@ bool JackProcessSync::LockedTimedWait(long usec)
unsigned int next_date_usec = now.tv_usec + usec;
time.tv_sec = now.tv_sec + (next_date_usec / 1000000);
time.tv_nsec = (next_date_usec % 1000000) * 1000;
res = pthread_cond_timedwait(&fCond, &fMutex, &time);
if (res != 0)
jack_error("JackProcessSync::LockedTimedWait error usec = %ld err = %s", usec, strerror(res));
res2 = pthread_cond_timedwait(&fCond, &fMutex, &time);
if (res2 != 0)
jack_error("JackProcessSync::LockedTimedWait error usec = %ld err = %s", usec, strerror(res2));

gettimeofday(&T1, 0);
res = pthread_mutex_unlock(&fMutex);
if (res != 0)
jack_error("JackProcessSync::LockedTimedWait error err = %s", usec, strerror(res));
res1 = pthread_mutex_unlock(&fMutex);
if (res1 != 0)
jack_error("JackProcessSync::LockedTimedWait error err = %s", usec, strerror(res1));
jack_log("JackProcessSync::TimedWait finished delta = %5.1lf",
(1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec));
return (res == 0);
return (res2 == 0);
}




Loading…
Cancel
Save