aout_buffer_t: store length instead of end timestamp
authorRémi Denis-Courmont <remi@remlab.net>
Wed, 23 Sep 2009 16:52:00 +0000 (19:52 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 23 Sep 2009 16:57:40 +0000 (19:57 +0300)
aout_buffer_t now looks very much like a subset of block_t at the
source code level. By the way, we might want to revisit the return value
of date_Increment()...

33 files changed:
include/vlc_aout.h
modules/audio_filter/resampler/bandlimited.c
modules/audio_filter/resampler/linear.c
modules/audio_filter/resampler/trivial.c
modules/audio_filter/resampler/ugly.c
modules/audio_output/oss.c
modules/audio_output/waveout.c
modules/codec/a52.c
modules/codec/adpcm.c
modules/codec/aes3.c
modules/codec/araw.c
modules/codec/avcodec/audio.c
modules/codec/dmo/dmo.c
modules/codec/dts.c
modules/codec/faad.c
modules/codec/flac.c
modules/codec/fluidsynth.c
modules/codec/lpcm.c
modules/codec/mpeg_audio.c
modules/codec/quicktime.c
modules/codec/realaudio.c
modules/codec/speex.c
modules/codec/vorbis.c
modules/codec/wmafixed/wma.c
modules/stream_out/transcode.c
modules/visualization/visual/visual.c
src/audio_output/common.c
src/audio_output/dec.c
src/audio_output/filters.c
src/audio_output/input.c
src/audio_output/mixer.c
src/audio_output/output.c
src/input/decoder.c

index 2173fa5..b68d9cd 100644 (file)
@@ -134,7 +134,7 @@ struct aout_buffer_t
     size_t                  i_size, i_nb_bytes;
     unsigned int            i_nb_samples;
     uint32_t                i_flags;
-    mtime_t                 i_pts, end_date;
+    mtime_t                 i_pts, i_length;
 
     struct aout_buffer_t *  p_next;
     void                 *p_sys;
index e1da18c..8b8c580 100644 (file)
@@ -220,9 +220,9 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
                 p_sys->i_old_wing;
 
             p_out_buf->i_pts = date_Get( &p_sys->end_date );
-            p_out_buf->end_date =
+            p_out_buf->i_length =
                 date_Increment( &p_sys->end_date,
-                                p_out_buf->i_nb_samples );
+                                p_out_buf->i_nb_samples ) - p_out_buf->i_pts;
 
             p_out_buf->i_nb_bytes = p_out_buf->i_nb_samples *
                 p_filter->input.i_bytes_per_frame;
@@ -455,8 +455,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
     /* Finalize aout buffer */
     p_out_buf->i_nb_samples = i_out;
     p_out_buf->i_pts = date_Get( &p_sys->end_date );
-    p_out_buf->end_date = date_Increment( &p_sys->end_date,
-                                          p_out_buf->i_nb_samples );
+    p_out_buf->i_length = date_Increment( &p_sys->end_date,
+                                  p_out_buf->i_nb_samples ) - p_out_buf->i_pts;
 
     p_out_buf->i_nb_bytes = p_out_buf->i_nb_samples *
         i_nb_channels * sizeof(int32_t);
index af43cfd..5e3ef6f 100644 (file)
@@ -231,8 +231,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
         date_Set( &p_sys->end_date, p_in_buf->i_pts );
     }
 
-    p_out_buf->end_date = date_Increment( &p_sys->end_date,
-                                              p_out_buf->i_nb_samples );
+    p_out_buf->i_length = date_Increment( &p_sys->end_date,
+                                  p_out_buf->i_nb_samples ) - p_out_buf->i_pts;
 
     p_out_buf->i_nb_bytes = p_out_buf->i_nb_samples *
         i_nb_channels * sizeof(int32_t);
index 0364333..9a53024 100644 (file)
@@ -113,6 +113,6 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
     p_out_buf->i_nb_samples = i_out_nb;
     p_out_buf->i_nb_bytes = i_out_nb * i_sample_bytes;
     p_out_buf->i_pts = p_in_buf->i_pts;
-    p_out_buf->end_date = p_out_buf->i_pts + p_out_buf->i_nb_samples *
+    p_out_buf->i_length = p_out_buf->i_nb_samples *
         1000000 / p_filter->output.i_rate;
 }
index 6ad93ce..a961de0 100644 (file)
@@ -126,6 +126,6 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
     p_out_buf->i_nb_samples = i_out_nb;
     p_out_buf->i_nb_bytes = i_out_nb * i_sample_bytes;
     p_out_buf->i_pts = p_in_buf->i_pts;
-    p_out_buf->end_date = p_out_buf->i_pts + p_out_buf->i_nb_samples *
+    p_out_buf->i_length = p_out_buf->i_nb_samples *
         1000000 / p_filter->output.i_rate;
 }
index e70bf51..cab38aa 100644 (file)
@@ -663,7 +663,7 @@ static void* OSSThread( vlc_object_t *p_this )
             i_size = p_buffer->i_nb_bytes;
             /* This is theoretical ... we'll see next iteration whether
              * we're drifting */
-            next_date += p_buffer->end_date - p_buffer->i_pts;
+            next_date += p_buffer->i_length;
         }
         else
         {
index ea6b8a3..959f0ab 100644 (file)
@@ -1062,8 +1062,7 @@ static void* WaveOutThread( vlc_object_t *p_this )
 
                 if( p_buffer )
                 {
-                    mtime_t buffer_length = (p_buffer->end_date
-                                             - p_buffer->i_pts);
+                    mtime_t buffer_length = p_buffer->i_length;
                     next_date = next_date + buffer_length;
                     i_buffer_length = buffer_length/1000;
                 }
index 6ed74f4..9a17014 100644 (file)
@@ -394,7 +394,8 @@ static aout_buffer_t *GetAoutBuffer( decoder_t *p_dec )
     if( p_buf == NULL ) return NULL;
 
     p_buf->i_pts = date_Get( &p_sys->end_date );
-    p_buf->end_date = date_Increment( &p_sys->end_date, p_sys->frame.i_samples );
+    p_buf->i_length = date_Increment( &p_sys->end_date,
+                                      p_sys->frame.i_samples ) - p_buf->i_pts;
 
     return p_buf;
 }
index 474b53e..0b26e00 100644 (file)
@@ -301,8 +301,8 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         }
 
         p_out->i_pts = date_Get( &p_sys->end_date );
-        p_out->end_date =
-            date_Increment( &p_sys->end_date, p_sys->i_samplesperblock );
+        p_out->i_length = date_Increment( &p_sys->end_date,
+                                     p_sys->i_samplesperblock ) - p_out->i_pts;
 
         switch( p_sys->codec )
         {
index 48ca5e4..5639cff 100644 (file)
@@ -135,7 +135,8 @@ static aout_buffer_t *Decode( decoder_t *p_dec, block_t **pp_block )
         goto exit;
 
     p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
-    p_aout_buffer->end_date = date_Increment( &p_sys->end_date, i_frame_length );
+    p_aout_buffer->i_length = date_Increment( &p_sys->end_date,
+                                      i_frame_length ) - p_aout_buffer->i_pts;
 
     p_block->i_buffer -= AES3_HEADER_LEN;
     p_block->p_buffer += AES3_HEADER_LEN;
index b3200ab..f066b21 100644 (file)
@@ -371,7 +371,8 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     }
 
     p_out->i_pts = date_Get( &p_sys->end_date );
-    p_out->end_date   = date_Increment( &p_sys->end_date, i_samples );
+    p_out->i_length = date_Increment( &p_sys->end_date, i_samples )
+                      - p_out->i_pts;
 
     if( p_sys->p_logtos16 )
     {
index f1c52ed..c2213d9 100644 (file)
@@ -243,7 +243,8 @@ static aout_buffer_t *SplitBuffer( decoder_t *p_dec )
         return NULL;
 
     p_buffer->i_pts = date_Get( &p_sys->end_date );
-    p_buffer->end_date = date_Increment( &p_sys->end_date, i_samples );
+    p_buffer->i_length = date_Increment( &p_sys->end_date, i_samples )
+                         - p_buffer->i_pts;
 
     if( p_sys->b_extract )
         aout_ChannelExtract( p_buffer->p_buffer, p_dec->fmt_out.audio.i_channels,
index fc6d5d6..7a895c1 100644 (file)
@@ -982,8 +982,9 @@ static void *DecBlock( decoder_t *p_dec, block_t **pp_block )
                     block_out.p_buffer, block_out.i_buffer );
             /* Date management */
             p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
-            p_aout_buffer->end_date =
-                date_Increment( &p_sys->end_date, i_samples );
+            p_aout_buffer->i_length =
+                date_Increment( &p_sys->end_date, i_samples )
+                - p_aout_buffer->i_pts;
         }
         p_out->vt->Release( (IUnknown *)p_out );
 
index f8f70a8..53aa31a 100644 (file)
@@ -411,8 +411,8 @@ static aout_buffer_t *GetAoutBuffer( decoder_t *p_dec )
     p_buf->i_nb_bytes = p_sys->i_frame_size;
 
     p_buf->i_pts = date_Get( &p_sys->end_date );
-    p_buf->end_date =
-        date_Increment( &p_sys->end_date, p_sys->i_frame_length );
+    p_buf->i_length = date_Increment( &p_sys->end_date, p_sys->i_frame_length )
+                      - p_buf->i_pts;
 
     return p_buf;
 }
index 558e943..fc1bc50 100644 (file)
@@ -415,7 +415,9 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         }
 
         p_out->i_pts = date_Get( &p_sys->date );
-        p_out->end_date = date_Increment( &p_sys->date, frame.samples / frame.channels );
+        p_out->i_length = date_Increment( &p_sys->date,
+                                          frame.samples / frame.channels ),
+                          - p_out->i_pts;
 
         DoReordering( (uint32_t *)p_out->p_buffer, samples,
                       frame.samples / frame.channels, frame.channels,
index 8fe5907..d3c3b66 100644 (file)
@@ -663,8 +663,7 @@ DecoderWriteCallback( const FLAC__StreamDecoder *decoder,
 
     /* Date management (already done by packetizer) */
     p_sys->p_aout_buffer->i_pts = p_sys->p_block->i_pts;
-    p_sys->p_aout_buffer->end_date =
-        p_sys->p_block->i_pts + p_sys->p_block->i_length;
+    p_sys->p_aout_buffer->i_length = p_sys->p_block->i_length;
 
     return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
 }
index 24c5aea..34b4d15 100644 (file)
@@ -198,7 +198,8 @@ static aout_buffer_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
         goto drop;
 
     p_out->i_pts = date_Get (&p_sys->end_date );
-    p_out->end_date   = date_Increment (&p_sys->end_date, samples);
+    p_out->i_length = date_Increment (&p_sys->end_date, samples)
+                      - p_out->i_pts;
     if (!p_sys->fixed)
         fluid_synth_write_float (p_sys->synth, samples,
                                  p_out->p_buffer, 0, 2,
index 22a8f29..b209d24 100644 (file)
@@ -361,8 +361,9 @@ static void *DecodeFrame( decoder_t *p_dec, block_t **pp_block )
             return NULL;
 
         p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
-        p_aout_buffer->end_date =
-            date_Increment( &p_sys->end_date, i_frame_length );
+        p_aout_buffer->i_length =
+            date_Increment( &p_sys->end_date, i_frame_length )
+            - p_aout_buffer->i_pts;
 
         p_block->p_buffer += p_sys->i_header_size + i_padding;
         p_block->i_buffer -= p_sys->i_header_size + i_padding;
index c66633e..1541911 100644 (file)
@@ -539,8 +539,8 @@ static aout_buffer_t *GetAoutBuffer( decoder_t *p_dec )
     if( p_buf == NULL ) return NULL;
 
     p_buf->i_pts = date_Get( &p_sys->end_date );
-    p_buf->end_date =
-        date_Increment( &p_sys->end_date, p_sys->i_frame_length );
+    p_buf->i_length = date_Increment( &p_sys->end_date, p_sys->i_frame_length )
+                      - p_buf->i_pts;
     if( p_sys->b_discontinuity )
         p_buf->i_flags |= BLOCK_FLAG_DISCONTINUITY;
     p_sys->b_discontinuity = false;
index 889bda9..ea934d8 100644 (file)
@@ -647,7 +647,8 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
         if( p_out )
         {
             p_out->i_pts = date_Get( &p_sys->date );
-            p_out->end_date = date_Increment( &p_sys->date, i_frames );
+            p_out->i_length = date_Increment( &p_sys->date, i_frames )
+                              - p_out->i_pts;
 
             memcpy( p_out->p_buffer,
                     &p_sys->out_buffer[2 * p_sys->i_out * p_dec->fmt_out.audio.i_channels],
index 440e4ed..61a4628 100644 (file)
@@ -724,8 +724,8 @@ static aout_buffer_t *Decode( decoder_t *p_dec, block_t **pp_block )
 
         /* Date management */
         p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
-        p_aout_buffer->end_date =
-            date_Increment( &p_sys->end_date, i_samples );
+        p_aout_buffer->i_length = date_Increment( &p_sys->end_date, i_samples )
+                                  - p_aout_buffer->i_pts;
     }
 
     block_Release( p_block );
index 0ec02b4..b9b6c91 100644 (file)
@@ -713,7 +713,7 @@ static aout_buffer_t *DecodeRtpSpeexPacket( decoder_t *p_dec, block_t **pp_block
     */
     p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
     p_aout_buffer->end_date = date_Increment( &p_sys->end_date, 
-        p_sys->p_header->frame_size );
+        p_sys->p_header->frame_size ) - p_aout_buffer->i_pts;
     
     
     p_sys->i_frame_in_packet++;
@@ -772,8 +772,9 @@ static aout_buffer_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
 
         /* Date management */
         p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
-        p_aout_buffer->end_date =
-            date_Increment( &p_sys->end_date, p_sys->p_header->frame_size );
+        p_aout_buffer->i_length =
+            date_Increment( &p_sys->end_date, p_sys->p_header->frame_size )
+            - p_aout_buffer->i_pts;
 
         p_sys->i_frame_in_packet++;
 
index 564291f..f130648 100644 (file)
@@ -560,7 +560,8 @@ static aout_buffer_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
 
         /* Date management */
         p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
-        p_aout_buffer->end_date = date_Increment( &p_sys->end_date, i_samples );
+        p_aout_buffer->i_length = date_Increment( &p_sys->end_date,
+                                           i_samples ) - p_aout_buffer->i_pts;
         return p_aout_buffer;
     }
     else
index fb83d92..8a73369 100644 (file)
@@ -102,7 +102,8 @@ static aout_buffer_t *SplitBuffer( decoder_t *p_dec )
         return NULL;
 
     p_buffer->i_pts = date_Get( &p_sys->end_date );
-    p_buffer->end_date = date_Increment( &p_sys->end_date, i_samples );
+    p_buffer->i_length = date_Increment( &p_sys->end_date, i_samples )
+                         - p_buffer->i_pts;
 
     memcpy( p_buffer->p_buffer, p_sys->p_samples, p_buffer->i_nb_bytes );
     p_sys->p_samples += p_buffer->i_nb_bytes;
index 83fafdb..7d49874 100644 (file)
@@ -1305,15 +1305,13 @@ static int transcode_audio_process( sout_stream_t *p_stream,
             p_sys->i_master_drift = p_audio_buf->i_pts - i_dts;
             date_Increment( &id->interpolated_pts, p_audio_buf->i_nb_samples );
             p_audio_buf->i_pts -= p_sys->i_master_drift;
-            p_audio_buf->end_date -= p_sys->i_master_drift;
         }
 
         p_audio_block = p_audio_buf->p_sys;
         p_audio_block->i_buffer = p_audio_buf->i_nb_bytes;
         p_audio_block->i_dts = p_audio_block->i_pts =
             p_audio_buf->i_pts;
-        p_audio_block->i_length = p_audio_buf->end_date -
-            p_audio_buf->i_pts;
+        p_audio_block->i_length = p_audio_buf->i_length;
         p_audio_block->i_nb_samples = p_audio_buf->i_nb_samples;
 
         /* Run filter chain */
@@ -1330,7 +1328,7 @@ static int transcode_audio_process( sout_stream_t *p_stream,
         p_audio_buf->i_nb_bytes = p_audio_block->i_buffer;
         p_audio_buf->i_nb_samples = p_audio_block->i_nb_samples;
         p_audio_buf->i_pts = p_audio_block->i_dts;
-        p_audio_buf->end_date = p_audio_block->i_dts + p_audio_block->i_length;
+        p_audio_buf->i_length = p_audio_block->i_length;
 
         audio_timer_start( id->p_encoder );
         p_block = id->p_encoder->pf_encode_audio( id->p_encoder, p_audio_buf );
index c5ed9a7..1e2607d 100644 (file)
@@ -375,7 +375,7 @@ static void DoWork( aout_instance_t *p_aout, aout_filter_t *p_filter,
 #undef p_effect
     }
 
-    p_outpic->date = ( p_in_buf->i_pts + p_in_buf->end_date ) / 2;
+    p_outpic->date = p_in_buf->i_pts + (p_in_buf->i_length / 2);
 
     vout_DisplayPicture( p_sys->p_vout, p_outpic );
 }
index f71309a..8647c77 100644 (file)
@@ -370,12 +370,13 @@ void aout_FifoPush( aout_instance_t * p_aout, aout_fifo_t * p_fifo,
     if ( date_Get( &p_fifo->end_date ) )
     {
         p_buffer->i_pts = date_Get( &p_fifo->end_date );
-        p_buffer->end_date = date_Increment( &p_fifo->end_date,
+        p_buffer->i_length = date_Increment( &p_fifo->end_date,
                                              p_buffer->i_nb_samples );
+        p_buffer->i_length -= p_buffer->i_pts;
     }
     else
     {
-        date_Set( &p_fifo->end_date, p_buffer->end_date );
+        date_Set( &p_fifo->end_date, p_buffer->i_pts + p_buffer->i_length );
     }
 }
 
@@ -417,7 +418,6 @@ void aout_FifoMoveDates( aout_instance_t * p_aout, aout_fifo_t * p_fifo,
     while ( p_buffer != NULL )
     {
         p_buffer->i_pts += difference;
-        p_buffer->end_date += difference;
         p_buffer = p_buffer->p_next;
     }
 }
index 7c7a699..3887c6c 100644 (file)
@@ -281,7 +281,7 @@ aout_buffer_t * aout_DecNewBuffer( aout_input_t * p_input,
         return NULL;
 
     p_buffer->i_nb_samples = i_nb_samples;
-    p_buffer->i_pts = p_buffer->end_date = 0;
+    p_buffer->i_pts = p_buffer->i_length = 0;
     return p_buffer;
 }
 
@@ -306,8 +306,7 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
 
     assert( p_buffer->i_pts > 0 );
 
-    p_buffer->end_date = p_buffer->i_pts
-                            + (mtime_t)p_buffer->i_nb_samples * 1000000
+    p_buffer->i_length = (mtime_t)p_buffer->i_nb_samples * 1000000
                                 / p_input->input.i_rate;
 
     aout_lock_input( p_aout, p_input );
@@ -332,7 +331,7 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
         p_new_buffer->i_nb_samples = p_buffer->i_nb_samples;
         p_new_buffer->i_nb_bytes = p_buffer->i_nb_bytes;
         p_new_buffer->i_pts = p_buffer->i_pts;
-        p_new_buffer->end_date = p_buffer->end_date;
+        p_new_buffer->i_length = p_buffer->i_length;
         aout_BufferFree( p_buffer );
         p_buffer = p_new_buffer;
         p_input->b_changed = false;
@@ -384,7 +383,6 @@ void aout_DecChangePause( aout_instance_t *p_aout, aout_input_t *p_input, bool b
         for( aout_buffer_t *p = p_input->mixer.fifo.p_first; p != NULL; p = p->p_next )
         {
             p->i_pts += i_duration;
-            p->end_date += i_duration;
         }
         aout_unlock_mixer( p_aout );
     }
index d48e4aa..ff0ca41 100644 (file)
@@ -354,7 +354,7 @@ void aout_FiltersPlay( aout_instance_t * p_aout,
         if( p_output_buffer == NULL )
             return;
         p_output_buffer->i_pts = (*pp_input_buffer)->i_pts;
-        p_output_buffer->end_date = (*pp_input_buffer)->end_date;
+        p_output_buffer->i_length = (*pp_input_buffer)->i_length;
 
         /* Please note that p_output_buffer->i_nb_samples & i_nb_bytes
          * shall be set by the filter plug-in. */
index db82c5e..4180e43 100644 (file)
@@ -744,8 +744,6 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
 #endif
 
     /* Adding the start date will be managed by aout_FifoPush(). */
-    p_buffer->end_date = start_date +
-        (p_buffer->end_date - p_buffer->i_pts);
     p_buffer->i_pts = start_date;
 
     aout_lock_input_fifos( p_aout );
index 6bd4d02..6586cf2 100644 (file)
@@ -225,13 +225,14 @@ static int MixBuffer( aout_instance_t * p_aout )
         }
 
         /* Check for the continuity of start_date */
-        while ( p_buffer != NULL && p_buffer->end_date < start_date - 1 )
+        while ( p_buffer != NULL
+             && p_buffer->i_pts + p_buffer->i_length < start_date - 1 )
         {
             /* We authorize a +-1 because rounding errors get compensated
              * regularly. */
             aout_buffer_t * p_next = p_buffer->p_next;
             msg_Warn( p_aout, "the mixer got a packet in the past (%"PRId64")",
-                      start_date - p_buffer->end_date );
+                      start_date - (p_buffer->i_pts + p_buffer->i_length) );
             aout_BufferFree( p_buffer );
             p_fifo->p_first = p_buffer = p_next;
             p_input->mixer.begin = NULL;
@@ -247,10 +248,10 @@ static int MixBuffer( aout_instance_t * p_aout )
         {
             p_buffer = p_fifo->p_first;
             if ( p_buffer == NULL ) break;
-            if ( p_buffer->end_date >= end_date ) break;
+            if ( p_buffer->i_pts + p_buffer->i_length >= end_date ) break;
 
             /* Check that all buffers are contiguous. */
-            prev_date = p_fifo->p_first->end_date;
+            prev_date = p_fifo->p_first->i_pts + p_fifo->p_first->i_length;
             p_buffer = p_buffer->p_next;
             b_drop_buffers = 0;
             for ( ; p_buffer != NULL; p_buffer = p_buffer->p_next )
@@ -263,8 +264,8 @@ static int MixBuffer( aout_instance_t * p_aout )
                     b_drop_buffers = 1;
                     break;
                 }
-                if ( p_buffer->end_date >= end_date ) break;
-                prev_date = p_buffer->end_date;
+                if ( p_buffer->i_pts + p_buffer->i_length >= end_date ) break;
+                prev_date = p_buffer->i_pts + p_buffer->i_length;
             }
             if ( b_drop_buffers )
             {
@@ -353,7 +354,7 @@ static int MixBuffer( aout_instance_t * p_aout )
                               / p_aout->p_mixer->fmt.i_frame_length;
     }
     p_output_buffer->i_pts = start_date;
-    p_output_buffer->end_date = end_date;
+    p_output_buffer->i_length = end_date - start_date;
 
     p_aout->p_mixer->mix( p_aout->p_mixer, p_output_buffer );
 
index e898c3b..d0d3a1a 100644 (file)
@@ -288,7 +288,7 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout,
     {
         msg_Dbg( p_aout, "audio output is too slow (%"PRId64"), "
                  "trashing %"PRId64"us", mdate() - p_buffer->i_pts,
-                 p_buffer->end_date - p_buffer->i_pts );
+                 p_buffer->i_length );
         p_buffer = p_buffer->p_next;
         aout_BufferFree( p_aout->output.fifo.p_first );
         p_aout->output.fifo.p_first = p_buffer;
@@ -317,8 +317,7 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout,
     /* Here we suppose that all buffers have the same duration - this is
      * generally true, and anyway if it's wrong it won't be a disaster.
      */
-    if ( p_buffer->i_pts > start_date
-                         + (p_buffer->end_date - p_buffer->i_pts) )
+    if ( p_buffer->i_pts > start_date + p_buffer->i_length )
     /*
      *                   + AOUT_PTS_TOLERANCE )
      * There is no reason to want that, it just worsen the scheduling of
index 6440efb..8385422 100644 (file)
@@ -1171,7 +1171,7 @@ static void DecoderPlayAudio( decoder_t *p_dec, aout_buffer_t *p_audio,
         const bool b_dated = p_audio->i_pts > VLC_TS_INVALID;
         int i_rate = INPUT_RATE_DEFAULT;
 
-        DecoderFixTs( p_dec, &p_audio->i_pts, &p_audio->end_date, NULL,
+        DecoderFixTs( p_dec, &p_audio->i_pts, NULL, &p_audio->i_length,
                       &i_rate, AOUT_MAX_ADVANCE_TIME, false );
 
         vlc_mutex_unlock( &p_owner->lock );