lavf/webm_dash: Fix incorrect bandwidth computation

Fix incorrect bandwidth computation in some cases. When the cue end
descriptor is null (i.e.) start_time_ns == -1, existing bandwidth
computed (if any) should be returned rather than returning 0.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Vignesh Venkatasubramanian 2014-10-01 10:13:31 -07:00 committed by Michael Niedermayer
parent 8acb76567a
commit b1071db3df

View File

@ -3188,9 +3188,10 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t
}
if (desc_end.start_time_ns == -1) {
// The prebuffer is larger than the duration.
return (matroska->duration * matroska->time_scale >= prebuffered_ns) ? -1 : 0;
}
if (matroska->duration * matroska->time_scale >= prebuffered_ns)
return -1;
bits_per_second = 0.0;
} else {
// The prebuffer ends in the last Cue. Estimate how much data was
// prebuffered.
pre_bytes = desc_end.end_offset - desc_end.start_offset;
@ -3237,6 +3238,7 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t
desc_end = get_cue_desc(s, desc_end.end_time_ns, cues_start);
} while (desc_end.start_time_ns != -1);
}
if (bandwidth < bits_per_second) bandwidth = bits_per_second;
}
return (int64_t)bandwidth;