diff mbox

[FFmpeg-devel] ffmpeg.c: Fallback to duration_dts, when duration_pts can't be determined.

Message ID 20171010012707.22557-1-isasi@google.com
State Superseded
Headers show

Commit Message

Sasi Inguva Oct. 10, 2017, 1:27 a.m. UTC
This is required for FLV files, for which duration_pts comes out to be zero.

Signed-off-by: Sasi Inguva <isasi@google.com>
---
 fftools/ffmpeg.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Thomas Mundt Oct. 10, 2017, 12:40 p.m. UTC | #1
2017-10-10 3:27 GMT+02:00 Sasi Inguva <isasi-at-google.com@ffmpeg.org>:

> This is required for FLV files, for which duration_pts comes out to be
> zero.
>
> Signed-off-by: Sasi Inguva <isasi@google.com>
> ---
>  fftools/ffmpeg.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 6d64bc1043..5f373db847 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -2665,6 +2665,9 @@ static int process_input_packet(InputStream *ist,
> const AVPacket *pkt, int no_eo
>                      ist->next_dts = AV_NOPTS_VALUE;
>              }
>
> +            if (duration_pts == 0)
> +                duration_pts = duration_dts;
> +
>              if (got_output)
>                  ist->next_pts += av_rescale_q(duration_pts,
> ist->st->time_base, AV_TIME_BASE_Q);
>              break;
>

duration_dts is already rescaled. Should be ist->next_pts += duration_dts
when duration_pts == 0.

Regards,
Thomas
Sasi Inguva Oct. 10, 2017, 5:36 p.m. UTC | #2
True. Thanks! Sending the corrected patch.

On Tue, Oct 10, 2017 at 5:40 AM, Thomas Mundt <tmundt75@gmail.com> wrote:

> 2017-10-10 3:27 GMT+02:00 Sasi Inguva <isasi-at-google.com@ffmpeg.org>:
>
>> This is required for FLV files, for which duration_pts comes out to be
>> zero.
>>
>> Signed-off-by: Sasi Inguva <isasi@google.com>
>> ---
>>  fftools/ffmpeg.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
>> index 6d64bc1043..5f373db847 100644
>> --- a/fftools/ffmpeg.c
>> +++ b/fftools/ffmpeg.c
>> @@ -2665,6 +2665,9 @@ static int process_input_packet(InputStream *ist,
>> const AVPacket *pkt, int no_eo
>>                      ist->next_dts = AV_NOPTS_VALUE;
>>              }
>>
>> +            if (duration_pts == 0)
>> +                duration_pts = duration_dts;
>> +
>>              if (got_output)
>>                  ist->next_pts += av_rescale_q(duration_pts,
>> ist->st->time_base, AV_TIME_BASE_Q);
>>              break;
>>
>
> duration_dts is already rescaled. Should be ist->next_pts += duration_dts
> when duration_pts == 0.
>
> Regards,
> Thomas
>
Nicolas George Oct. 12, 2017, 8:51 a.m. UTC | #3
L'octidi 18 vendémiaire, an CCXXVI, Sasi Inguva a écrit :
> This is required for FLV files, for which duration_pts comes out to be zero.
> 
> Signed-off-by: Sasi Inguva <isasi@google.com>
> ---
>  fftools/ffmpeg.c | 3 +++
>  1 file changed, 3 insertions(+)

Could you make a FATE test so that it stays fixed?

Regards,
diff mbox

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 6d64bc1043..5f373db847 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2665,6 +2665,9 @@  static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
                     ist->next_dts = AV_NOPTS_VALUE;
             }
 
+            if (duration_pts == 0)
+                duration_pts = duration_dts;
+
             if (got_output)
                 ist->next_pts += av_rescale_q(duration_pts, ist->st->time_base, AV_TIME_BASE_Q);
             break;