Commit 9731cf40 authored by Martin Storsjö's avatar Martin Storsjö

movenc: Keep writing zero-entry stts atoms as intended

a8765852 had the unintended side effect of returning AVERROR(ENOMEM)
when track->entry is zero, while the code intentionally wants to
continue in that case.
Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent 5aef535a
...@@ -1197,7 +1197,7 @@ static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) ...@@ -1197,7 +1197,7 @@ static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track)
/* Time to sample atom */ /* Time to sample atom */
static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track)
{ {
MOVStts *stts_entries; MOVStts *stts_entries = NULL;
uint32_t entries = -1; uint32_t entries = -1;
uint32_t atom_size; uint32_t atom_size;
int i; int i;
...@@ -1210,11 +1210,11 @@ static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track) ...@@ -1210,11 +1210,11 @@ static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track)
stts_entries[0].duration = 1; stts_entries[0].duration = 1;
entries = 1; entries = 1;
} else { } else {
stts_entries = track->entry ? if (track->entry) {
av_malloc(track->entry * sizeof(*stts_entries)) : /* worst case */ stts_entries = av_malloc(track->entry * sizeof(*stts_entries)); /* worst case */
NULL;
if (!stts_entries) if (!stts_entries)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
}
for (i = 0; i < track->entry; i++) { for (i = 0; i < track->entry; i++) {
int duration = get_cluster_duration(track, i); int duration = get_cluster_duration(track, i);
if (i && duration == stts_entries[entries].duration) { if (i && duration == stts_entries[entries].duration) {
......
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