]> git.sesse.net Git - vlc/commitdiff
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 2173fa521c915d9b13d04937a5b0a18ec79b7c55..b68d9cd9ac6fb4e27bc070a3a7794b2b0f384f44 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 e1da18cb8d2a424f0d1f92dd791834b7242d2dde..8b8c58003765250a471b19fb1f7e357b21499ff6 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 af43cfd73694e5ead95391cdf12c9f2e275b4f2e..5e3ef6f7b108515853733f9a06992b5d002d7c36 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 03643338c6ac374c213831ab49d4072ab63929e5..9a530247bbc7ea129bec11630f496f4c7a62fa2d 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 6ad93ce4d3d2cf2b1e2c5956937543c0570c9d8c..a961de0f343ec0eb25a425615dc8c890536fa81d 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 e70bf5150ec284974972c0197d428db0be1653fd..cab38aa670b1792fb8cc194d287ebb9f7667fb3c 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 ea6b8a39fed77e68ca332a14b27b39b8bd32f0dd..959f0ab072eef273d4fffc2d2a882fe7597d23c8 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 6ed74f4bebaa69e301238de7607824db9298bb70..9a17014d027cb50ec1a7ca7d977aeb2be5c6c586 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 474b53e1ba10c78b3be6798fad29d5206aa6497c..0b26e0089ee14fc7bcdbe65c3d8b3ffcc916c867 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 48ca5e43b7252da603ec462724ffd72386187058..5639cffadf8ef1da17a2bc840c809f91aa1f9624 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 b3200ab189fb65d6b872d4246715bdc12bdd4b06..f066b21cb3fc80fd035d5b262937a4eef175e30f 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 f1c52ed26c39bb14447167108878ca69871ab927..c2213d9a97ab0967e18b06c57e875939c813ac5f 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 fc6d5d69a27cb5d942cd4ad87e46242821ad3822..7a895c1c70a30c2bbb458ac39beaa53867fc6a99 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 f8f70a8840cf0c47785d9dc5f7d7d5f2b2baa9be..53aa31af4573e4d09a626d9caf50503b6d300bb5 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 558e943c9d4622ba44805f1346a289ab55d52e6f..fc1bc50b5868799b90a1ac0d00b102065f7ae38d 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 8fe5907e138ddeb03a4b4f6bda3cd6c4fa7d65ba..d3c3b66832be2cf2e31f9ddbe6aa8d0f16d2d7e2 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 24c5aea36bc516b3442586ca204be377e7147a12..34b4d15c13109aa655799aa95659053f3f1d94ea 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 22a8f2953c4d9a46425d7b6f47125d6fa11b5c81..b209d24e16aff7d7404f2ba0c047abfe205615b3 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 c66633ebe73961c95d98a6e1b5075651343243c8..1541911eedbbd41798f993b01e8c3d7a16d1c4b8 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 889bda96c7ca5673bcfb15caa4986c2be49112f4..ea934d838c7d5aa268ea4dd9716457273dadee93 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 440e4ed7facdf83870c7e058b7359f14ff739009..61a4628c89fca1baac9dfe60a4313a2b31982201 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 0ec02b463cbf55d9669a398c36276a4d8a57e91b..b9b6c9156c2edcf3d378baadd03402575c4788ad 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 564291f429483c9c62ec527fccb1b3fe3133e1d2..f130648206b3a0634cc8c724c04d56af8dec5dc3 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 fb83d924008bbfa1da57e98a7f4f5470d538e3a4..8a73369c71ebe596ee168c8d3901072d1d127d3a 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 83fafdb422124eb97c841938590d471b3c569d5a..7d498741df3ed5fefd8bcc5dcdadade78bfb8811 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 c5ed9a78b265d2d271a1274df4288b7074360344..1e2607d7c82bf526c758fbf98ef5c22dee8657ea 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 f71309ab61e64958afa0246b429f6a563ca7d60b..8647c7702a98a6355a5db093f97d3880b47d49c1 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 7c7a6996cdb9bcf06d9c6faf16cb761fbc51ef40..3887c6c828c96dce83676a60d8baaccf90a94573 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 d48e4aae24dce08ef5ee04afb92ddee3abbbb24b..ff0ca4130cb8431726dfad26f130688cf6a04ed5 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 db82c5e6eb036c00d6e77a8f72ef1db4b54d0d16..4180e43aa1bc238d95131661673bfd2468e3512d 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 6bd4d0206f56942d1387a49591f90ffb8cd351d1..6586cf2a611cd395e72785482410b08bd65e2251 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 e898c3bee84786edf5d00d7e7487b8329798cac4..d0d3a1aa7faefdee76a166e5edd3135f1c37410e 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 6440efb36b142ab3f1fcc908ea7b8f5c88746fe1..838542204b55c331ffc10fa2d9880c18c5d9505e 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 );