File:  [DVB] / libsoftmpeg / fusionsound_realtimepriority_reset_on_flush.diff
Revision 1.1: download - view: text, annotated - select for diffs
Fri Feb 6 12:04:54 2004 UTC (20 years, 4 months ago) by hunold
Branches: MAIN
CVS tags: HEAD
- reformat docs
- add constant offset and a note that we need to fix it
- add fusionsound realtimepriority patch and a note to the docs

diff -u -r1.13 ifusionsoundstream.c
--- src/ifusionsoundstream.c	5 Feb 2004 13:01:37 -0000	1.13
+++ src/ifusionsoundstream.c	5 Feb 2004 15:55:32 -0000
@@ -30,6 +30,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
+#include <sys/ioctl.h>
 
 #include <math.h>
 
@@ -330,6 +331,9 @@
      /* Reset the buffer. */
      data->pos_write = data->pos_read;
 
+     /* flush pending sound data so we don't have to wait */
+     fs_core_reset( data->core );
+
      pthread_mutex_unlock( &data->lock );
 
      return DFB_OK;
diff -u -r1.21 core_sound.c
--- src/core/core_sound.c	3 Feb 2004 17:38:33 -0000	1.21
+++ src/core/core_sound.c	5 Feb 2004 15:55:32 -0000
@@ -286,6 +286,12 @@
      return DFB_OK;
 }
 
+void
+fs_core_reset( CoreSound *core )
+{
+    ioctl( core->fd, SNDCTL_DSP_RESET, 0 );
+}
+
 int
 fs_core_output_delay( CoreSound *core )
 {
@@ -313,6 +319,12 @@
 
      bool             empty = true;
 
+     struct sched_param param;
+     int policy;
+     pthread_t pthread = pthread_self();
+     pthread_getschedparam(pthread, &policy, &param);
+     param.sched_priority = 10;	
+     pthread_setschedparam(pthread, SCHED_RR, &param);
 
      while (true) {
           int             i;
diff -u -r1.3 core_sound.h
--- src/core/core_sound.h	16 Jan 2004 16:31:38 -0000	1.3
+++ src/core/core_sound.h	5 Feb 2004 15:55:32 -0000
@@ -57,5 +57,10 @@
  */
 int fs_core_output_delay( CoreSound *core );
 
+/*
+ * Resets the sound device
+ */
+void fs_core_reset( CoreSound *core );
+
 #endif
 

LinuxTV legacy CVS <linuxtv.org/cvs>