Commit 9c3adb7c authored by tomajsjiang's avatar tomajsjiang Committed by Jun Zhao

lavf/utils: fix error like "offset 0x1f85: partial file"

fix error like "offset 0x1f85: partial file", the root cause is when
read the mp4 file from http, and the moov in the end of the mp4 file,
reconfig the buffer will drop some data.
Signed-off-by: 's avatarJun Zhao <barryjzhao@tencent.com>
Signed-off-by: 's avatarZhongxing Jiang <tomajsjiang@tencent.com>
parent 3d1506c6
...@@ -2136,7 +2136,13 @@ void ff_configure_buffers_for_index(AVFormatContext *s, int64_t time_tolerance) ...@@ -2136,7 +2136,13 @@ void ff_configure_buffers_for_index(AVFormatContext *s, int64_t time_tolerance)
/* XXX This could be adjusted depending on protocol*/ /* XXX This could be adjusted depending on protocol*/
if (s->pb->buffer_size < pos_delta && pos_delta < (1<<24)) { if (s->pb->buffer_size < pos_delta && pos_delta < (1<<24)) {
av_log(s, AV_LOG_VERBOSE, "Reconfiguring buffers to size %"PRId64"\n", pos_delta); av_log(s, AV_LOG_VERBOSE, "Reconfiguring buffers to size %"PRId64"\n", pos_delta);
ffio_set_buf_size(s->pb, pos_delta);
/* realloc the buffer and the original data will be retained */
if (ffio_realloc_buf(s->pb, pos_delta)) {
av_log(s, AV_LOG_ERROR, "Realloc buffer fail.\n");
return;
}
s->pb->short_seek_threshold = FFMAX(s->pb->short_seek_threshold, pos_delta/2); s->pb->short_seek_threshold = FFMAX(s->pb->short_seek_threshold, pos_delta/2);
} }
......
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