[xiph-commits] r3699 - browser_plugin/trunk/src/audio

j at svn.annodex.net j at svn.annodex.net
Fri Aug 8 14:11:12 PDT 2008


Author: j
Date: 2008-08-08 14:11:12 -0700 (Fri, 08 Aug 2008)
New Revision: 3699

Modified:
   browser_plugin/trunk/src/audio/sydney_audio_pulseaudio.c
Log:
pthread_mutex_lock.c:87: __pthread_mutex_lock: Assertion 'mutex->__data.__owner == 0' failed.

Modified: browser_plugin/trunk/src/audio/sydney_audio_pulseaudio.c
===================================================================
--- browser_plugin/trunk/src/audio/sydney_audio_pulseaudio.c	2008-08-08 20:02:04 UTC (rev 3698)
+++ browser_plugin/trunk/src/audio/sydney_audio_pulseaudio.c	2008-08-08 21:11:12 UTC (rev 3699)
@@ -440,9 +440,9 @@
 
 int
 sa_stream_get_position(sa_stream_t *s, sa_position_t position, int64_t *pos) {
-  int error;
   pa_usec_t usec;
-  
+  int64_t latency;
+
   if (s == NULL || s->output_stream == NULL) {
     return SA_ERROR_NO_INIT;
   }
@@ -450,10 +450,13 @@
     return SA_ERROR_NOT_SUPPORTED;
   }
 
-  usec = pa_simple_get_latency(s->output_stream, &error);
+  usec = pa_simple_get_latency(s->output_stream, NULL);
+  latency = pa_usec_to_bytes(usec, &s->output_spec);
 
+  // this part causes a crash sometimes
+  // pthread_mutex_lock.c:87: __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed.
   pthread_mutex_lock(&s->mutex);
-  *pos = s->bytes_written - pa_usec_to_bytes(usec, &s->output_spec);
+  *pos  = s->bytes_written - latency;
   pthread_mutex_unlock(&s->mutex);
   return SA_SUCCESS;
 }
@@ -465,9 +468,7 @@
     return SA_ERROR_NO_INIT;
   }
 
-  pthread_mutex_lock(&s->mutex);
   pa_simple_flush(s->output_stream, NULL);
-  pthread_mutex_unlock(&s->mutex);
   return SA_SUCCESS;
 }
 
@@ -480,10 +481,6 @@
 
   pthread_mutex_lock(&s->mutex);
 
-  /*
-   * The audio device resets its mSampleTime counter after pausing,
-   * so we need to clear our tracking value to keep that in sync.
-   */
   s->bytes_written = 0;
   pthread_mutex_unlock(&s->mutex);
   return SA_SUCCESS;



More information about the commits mailing list