vlc | branch: master | Ilkka Ollakka <[email protected]> | Fri Sep 30 09:36:28 
2016 +0300| [cdc04e5b3d79a4a6886b3aa555a2056d16dc3ee1] | committer: Ilkka 
Ollakka

avcodec: encoder: use similar timestamps with audio/video

As the flow is similar now, timestamps should be too

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

 modules/codec/avcodec/encoder.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index d784ecf..3f05ef6 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -1282,8 +1282,8 @@ static block_t *handle_delay_buffer( encoder_t *p_enc, 
encoder_sys_t *p_sys, int
     p_sys->frame->format     = p_sys->p_context->sample_fmt;
     p_sys->frame->nb_samples = leftover_samples + p_sys->i_samples_delay;
 
-
-    p_sys->frame->pts        = date_Get( &p_sys->buffer_date );
+    p_sys->frame->pts        = date_Get( &p_sys->buffer_date ) * 
p_sys->p_context->time_base.den /
+                                CLOCK_FREQ / p_sys->p_context->time_base.num;
 
     if( likely( p_sys->frame->pts != AV_NOPTS_VALUE) )
         date_Increment( &p_sys->buffer_date, p_sys->frame->nb_samples );
@@ -1407,7 +1407,8 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t 
*p_aout_buf )
         else
             p_sys->frame->nb_samples = p_sys->i_frame_size;
         p_sys->frame->format     = p_sys->p_context->sample_fmt;
-        p_sys->frame->pts        = date_Get( &p_sys->buffer_date );
+        p_sys->frame->pts        = date_Get( &p_sys->buffer_date ) * 
p_sys->p_context->time_base.den /
+                                    CLOCK_FREQ / 
p_sys->p_context->time_base.num;
 
         const int in_bytes = p_sys->frame->nb_samples *
             p_sys->p_context->channels * p_sys->i_sample_bytes;

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to