[FFmpeg-devel] lavf/segment: fix slight refactor to seg_write_packet

Submitted by Jason Pontious on March 30, 2017, 8:43 p.m.

Details

Message ID CAHqPg7RpSW40pai2ZM+BwS5xE5GJGrdsVNuVJbw-S7ZL1c_hpQ@mail.gmail.com
State New
Headers show

Commit Message

Jason Pontious March 30, 2017, 8:43 p.m.
I found an issue with a previous commit and I'm submitting the patch here.
The previous commit was from March '16 https://github.com/FFmpeg/
FFmpeg/commit/5b4f44f66ae3c42b7497929b6ef5f67e8b1ff0ad

Previous refactor commit did not produce an equivalent segment end_time in
all cases.
When setting end_time, the addition to start_time was completely removed.
---
 libavformat/segment.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

pkt->duration) * av_q2d(st->time_base) : 0;

         if (seg->times || (!seg->frames && !seg->use_clocktime) &&
seg->write_empty)
             goto calc_times;

Comments

Michael Niedermayer March 31, 2017, 12:10 a.m.
On Thu, Mar 30, 2017 at 04:43:12PM -0400, Jason Pontious wrote:
> I found an issue with a previous commit and I'm submitting the patch here.
> The previous commit was from March '16 https://github.com/FFmpeg/
> FFmpeg/commit/5b4f44f66ae3c42b7497929b6ef5f67e8b1ff0ad
> 
> Previous refactor commit did not produce an equivalent segment end_time in
> all cases.
> When setting end_time, the addition to start_time was completely removed.
> ---
>  libavformat/segment.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/segment.c b/libavformat/segment.c
> index 8ec3653..951ca91 100644
> --- a/libavformat/segment.c
> +++ b/libavformat/segment.c
> @@ -904,7 +904,8 @@ calc_times:
>          seg->cur_entry.index = seg->segment_idx + seg->segment_idx_wrap *
> seg->segment_idx_wrap_nb;
>          seg->cur_entry.start_time = (double)pkt->pts *
> av_q2d(st->time_base);

patch is corrupted by newlines

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 8ec3653..951ca91 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -904,7 +904,8 @@  calc_times:
         seg->cur_entry.index = seg->segment_idx + seg->segment_idx_wrap *
seg->segment_idx_wrap_nb;
         seg->cur_entry.start_time = (double)pkt->pts *
av_q2d(st->time_base);
         seg->cur_entry.start_pts = av_rescale_q(pkt->pts, st->time_base,
AV_TIME_BASE_Q);
-        seg->cur_entry.end_time = seg->cur_entry.start_time;
+        seg->cur_entry.end_time = seg->cur_entry.start_time +
+            pkt->pts != AV_NOPTS_VALUE ? (double)(pkt->pts +