[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6145 - gnuradio/trunk/gr-audio-osx/src
From: |
michaelld |
Subject: |
[Commit-gnuradio] r6145 - gnuradio/trunk/gr-audio-osx/src |
Date: |
Thu, 16 Aug 2007 21:18:37 -0600 (MDT) |
Author: michaelld
Date: 2007-08-16 21:18:37 -0600 (Thu, 16 Aug 2007)
New Revision: 6145
Modified:
gnuradio/trunk/gr-audio-osx/src/audio_osx_source.cc
gnuradio/trunk/gr-audio-osx/src/circular_buffer.h
Log:
added some debugging comments; fixed a bug in the circular buffer so
that the internal mutex is released correctly and new data overwrites
older data when an overrun occurs and writing is not blocked.
Modified: gnuradio/trunk/gr-audio-osx/src/audio_osx_source.cc
===================================================================
--- gnuradio/trunk/gr-audio-osx/src/audio_osx_source.cc 2007-08-16 19:51:09 UTC
(rev 6144)
+++ gnuradio/trunk/gr-audio-osx/src/audio_osx_source.cc 2007-08-17 03:18:37 UTC
(rev 6145)
@@ -248,7 +248,7 @@
"audio_osx_source::audio_osx_source");
#if _OSX_AU_DEBUG_
- fprintf (stderr, "---- Device Stream Format ----\n" );
+ fprintf (stderr, "\n---- Device Stream Format ----\n" );
PrintStreamDesc (&asbd_device);
#endif
@@ -264,7 +264,7 @@
"audio_osx_source::audio_osx_source");
#if _OSX_AU_DEBUG_
- fprintf (stderr, "---- Client Stream Format ----\n");
+ fprintf (stderr, "\n---- Client Stream Format ----\n");
PrintStreamDesc (&asbd_client);
#endif
@@ -839,6 +839,11 @@
while (--l_counter >= 0) {
float* inBuffer = (float*) This->d_OutputBuffer->mBuffers[l_counter].mData;
+
+#if _OSX_AU_DEBUG_
+ fprintf (stderr, "cb2.5: enqueuing audio data.\n");
+#endif
+
int l_res = This->d_buffers[l_counter]->enqueue (inBuffer,
ActualOutputFrames);
if (l_res == -1)
res = -1;
@@ -857,7 +862,7 @@
}
#if _OSX_AU_DEBUG_
- fprintf (stderr, "cb5: #OI = %4ld, #Cnt = %4ld, mSC = %ld, \n",
+ fprintf (stderr, "cb3: #OI = %4ld, #Cnt = %4ld, mSC = %ld, \n",
ActualOutputFrames, This->d_queueSampleCount,
This->d_max_sample_count);
#endif
@@ -865,9 +870,17 @@
// signal that data is available, if appropraite
This->d_cond_data->signal ();
+#if _OSX_AU_DEBUG_
+ fprintf (stderr, "cb4: releasing internal mutex.\n");
+#endif
+
// release control to allow for other processing parts to run
This->d_internal->post ();
+#if _OSX_AU_DEBUG_
+ fprintf (stderr, "cb5: returning.\n");
+#endif
+
return (err);
}
Modified: gnuradio/trunk/gr-audio-osx/src/circular_buffer.h
===================================================================
--- gnuradio/trunk/gr-audio-osx/src/circular_buffer.h 2007-08-16 19:51:09 UTC
(rev 6144)
+++ gnuradio/trunk/gr-audio-osx/src/circular_buffer.h 2007-08-17 03:18:37 UTC
(rev 6145)
@@ -159,6 +159,8 @@
d_internal->unlock ();
return (2);
}
+ // set the return value to 1: success; change if needed
+ int retval = 1;
if (bufLen_I > d_n_avail_write_I) {
if (d_doWriteBlock) {
while (bufLen_I > d_n_avail_write_I) {
@@ -185,7 +187,7 @@
#if DO_DEBUG
fprintf (stderr, "circular_buffer::enqueue: overflow\n");
#endif
- return (-1);
+ retval = -1;
}
}
UInt32 n_now_I = d_bufLen_I - d_writeNdx_I, n_start_I = 0;
@@ -203,7 +205,7 @@
d_n_avail_write_I -= bufLen_I;
d_readBlock->signal ();
d_internal->unlock ();
- return (1);
+ return (retval);
};
/*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6145 - gnuradio/trunk/gr-audio-osx/src,
michaelld <=