Commit dd7aba1d authored by Ilkka Ollakka's avatar Ilkka Ollakka

avcodec: use VLC_TS_INVALID and CLOCK_FREQ on encoding

parent 45aa11da
...@@ -1068,7 +1068,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict ) ...@@ -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; frame->top_field_first = !!p_pict->b_top_field_first;
/* Set the pts of the frame being encoded */ /* 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 ) 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 ) ...@@ -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 ) 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 ...@@ -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_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->i_frame_size /
(mtime_t)p_sys->p_context->sample_rate; (mtime_t)p_sys->p_context->sample_rate;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment