[vlc-commits] aout: only (directly) access output FIFO from output functions

Rémi Denis-Courmont git at videolan.org
Mon Aug 1 22:30:22 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug  1 23:25:43 2011 +0300| [9b23a3ae8eb05ab22f4fef796572f40ed9f4358e] | committer: Rémi Denis-Courmont

aout: only (directly) access output FIFO from output functions

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9b23a3ae8eb05ab22f4fef796572f40ed9f4358e
---

 src/audio_output/dec.c    |    6 ++----
 src/audio_output/input.c  |    4 ++--
 src/audio_output/output.c |    7 +++++++
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index 21edfca..bbbf7f0 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -225,6 +225,8 @@ void aout_DecChangePause( audio_output_t *p_aout, aout_input_t *p_input, bool b_
     aout_lock( p_aout );
     assert( p_aout->p_input == p_input );
 
+    aout_OutputPause( p_aout, b_paused, i_date );
+
     if( b_paused )
     {
         p_input->i_pause_date = i_date;
@@ -236,10 +238,7 @@ void aout_DecChangePause( audio_output_t *p_aout, aout_input_t *p_input, bool b_
         mtime_t i_duration = i_date - p_input->i_pause_date;
         p_input->i_pause_date = VLC_TS_INVALID;
         aout_FifoMoveDates( &p_input->fifo, i_duration );
-        aout_FifoMoveDates( &p_aout->fifo, i_duration );
     }
-
-    aout_OutputPause( p_aout, b_paused, i_date );
     aout_unlock( p_aout );
 }
 
@@ -247,7 +246,6 @@ void aout_DecFlush( audio_output_t *p_aout, aout_input_t *p_input )
 {
     aout_lock( p_aout );
     aout_FifoReset( &p_input->fifo );
-    aout_FifoReset( &p_aout->fifo );
     aout_OutputFlush( p_aout, false );
     aout_unlock( p_aout );
 }
diff --git a/src/audio_output/input.c b/src/audio_output/input.c
index 70c581a..1ef4c70 100644
--- a/src/audio_output/input.c
+++ b/src/audio_output/input.c
@@ -548,7 +548,7 @@ void aout_InputPlay( audio_output_t * p_aout, aout_input_t * p_input,
         msg_Warn( p_aout, "computed PTS is out of range (%"PRId64"), "
                   "clearing out", now - start_date );
         aout_FifoReset( &p_input->fifo );
-        aout_FifoReset( &p_aout->fifo );
+        aout_OutputFlush( p_aout, false );
         if ( p_input->i_resampling_type != AOUT_RESAMPLING_NONE )
             msg_Warn( p_aout, "timing screwed, stopping resampling" );
         inputResamplingStop( p_input );
@@ -579,7 +579,7 @@ void aout_InputPlay( audio_output_t * p_aout, aout_input_t * p_input,
         msg_Warn( p_aout, "buffer way too early (%"PRId64"), clearing queue",
                   drift );
         aout_FifoReset( &p_input->fifo );
-        aout_FifoReset( &p_aout->fifo );
+        aout_OutputFlush( p_aout, false );
         if ( p_input->i_resampling_type != AOUT_RESAMPLING_NONE )
             msg_Warn( p_aout, "timing screwed, stopping resampling" );
         inputResamplingStop( p_input );
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 9258fc9..6f63222 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -250,6 +250,12 @@ void aout_OutputPause( audio_output_t *aout, bool pause, mtime_t date )
 
     if( aout->pf_pause != NULL )
         aout->pf_pause( aout, pause, date );
+    if( !pause )
+    {
+        mtime_t duration = date - aout->p_input->i_pause_date;
+        /* XXX: ^ onk onk! gruik! ^ */
+        aout_FifoMoveDates( &aout->fifo, duration );
+    }
 }
 
 /**
@@ -264,6 +270,7 @@ void aout_OutputFlush( audio_output_t *aout, bool wait )
 
     if( aout->pf_flush != NULL )
         aout->pf_flush( aout, wait );
+    aout_FifoReset( &aout->fifo );
 }
 
 



More information about the vlc-commits mailing list