mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-19 05:49:09 +02:00
avformat/utils: Don't compare pointers when sorting chapters
The chapters are independently allocated, so that comparing the pointers is undefined behaviour. Furthermore, its result is not platform-independent (and may not even be deterministic on a particular platform). So compare the chapters' ids instead. (avpriv_new_chapter() ensures that there are no duplicate ids.) Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
6e0823ab83
commit
e04ddba64f
@ -3160,7 +3160,7 @@ static int chapter_start_cmp(const void *p1, const void *p2)
|
||||
int delta = av_compare_ts(ch1->start, ch1->time_base, ch2->start, ch2->time_base);
|
||||
if (delta)
|
||||
return delta;
|
||||
return (ch1 > ch2) - (ch1 < ch2);
|
||||
return FFDIFFSIGN(ch1->id, ch2->id);
|
||||
}
|
||||
|
||||
static int compute_chapters_end(AVFormatContext *s)
|
||||
|
Loading…
x
Reference in New Issue
Block a user