vlc | branch: master | Ilkka Ollakka <[email protected]> | Tue May 27 20:07:01 
2014 +0300| [dd7aba1d8886de48f741ef3e2b0c3c17dee33448] | committer: Ilkka 
Ollakka

avcodec: use VLC_TS_INVALID and CLOCK_FREQ on encoding

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

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

diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index b35c9fc..9b93278 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -1068,7 +1068,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t 
*p_pict )
         frame->top_field_first = !!p_pict->b_top_field_first;
 
         /* Set the pts of the frame being encoded */
-        frame->pts = p_pict->date ? p_pict->date : AV_NOPTS_VALUE;
+        frame->pts = (p_pict->date == VLC_TS_INVALID) ? AV_NOPTS_VALUE : 
p_pict->date;
 
         if ( p_sys->b_hurry_up && frame->pts != AV_NOPTS_VALUE )
         {
@@ -1107,7 +1107,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t 
*p_pict )
             }
         }
 
-        if ( frame->pts != AV_NOPTS_VALUE && frame->pts != 0 )
+        if ( ( frame->pts != AV_NOPTS_VALUE ) && ( frame->pts != 
VLC_TS_INVALID ) )
         {
             if ( p_sys->i_last_pts == frame->pts )
             {
@@ -1193,7 +1193,7 @@ static block_t *encode_audio_buffer( encoder_t *p_enc, 
encoder_sys_t *p_sys,  AV
     }
     p_block->i_buffer = packet.size;
 
-    p_block->i_length = (mtime_t)1000000 *
+    p_block->i_length = (mtime_t)CLOCK_FREQ *
      (mtime_t)p_sys->i_frame_size /
      (mtime_t)p_sys->p_context->sample_rate;
 

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

Reply via email to