| Index: chromium/patches/to_upstream/12_ogg_seek_to_zero.patch
|
| diff --git a/chromium/patches/to_upstream/12_ogg_seek_to_zero.patch b/chromium/patches/to_upstream/12_ogg_seek_to_zero.patch
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c714064e70585060a415357e5e5695dc4b5ea8d3
|
| --- /dev/null
|
| +++ b/chromium/patches/to_upstream/12_ogg_seek_to_zero.patch
|
| @@ -0,0 +1,59 @@
|
| +diff -wurp -N orig/libavformat/oggdec.c ffmpeg/libavformat/oggdec.c
|
| +--- orig/libavformat/oggdec.c 2011-07-12 20:48:31.175020888 -0700
|
| ++++ ffmpeg/libavformat/oggdec.c 2011-07-12 20:48:31.225013975 -0700
|
| +@@ -618,6 +618,8 @@ static int64_t ogg_read_timestamp(AVForm
|
| + AVIOContext *bc = s->pb;
|
| + int64_t pts = AV_NOPTS_VALUE;
|
| + int i = -1;
|
| ++ int packet = 0;
|
| ++ int64_t start_pos = *pos_arg;
|
| + avio_seek(bc, *pos_arg, SEEK_SET);
|
| + ogg_reset(ogg);
|
| +
|
| +@@ -627,6 +629,12 @@ static int64_t ogg_read_timestamp(AVForm
|
| + pts = ogg_calc_pts(s, i, NULL);
|
| + if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY))
|
| + pts = AV_NOPTS_VALUE;
|
| ++
|
| ++ // This is for the special case for the first packet in the stream.
|
| ++ if (pts == AV_NOPTS_VALUE && start_pos <= s->data_offset && !packet) {
|
| ++ pts = 0;
|
| ++ }
|
| ++ ++packet;
|
| + }
|
| + if (pts != AV_NOPTS_VALUE)
|
| + break;
|
| +@@ -641,6 +649,10 @@ static int ogg_read_seek(AVFormatContext
|
| + struct ogg *ogg = s->priv_data;
|
| + struct ogg_stream *os = ogg->streams + stream_index;
|
| + int ret;
|
| ++ int64_t seek_pos;
|
| ++ int64_t pos_arg;
|
| ++ int64_t seek_pts;
|
| ++ int i;
|
| +
|
| + // Try seeking to a keyframe first. If this fails (very possible),
|
| + // av_seek_frame will fall back to ignoring keyframes
|
| +@@ -652,6 +664,22 @@ static int ogg_read_seek(AVFormatContext
|
| + os = ogg->streams + stream_index;
|
| + if (ret < 0)
|
| + os->keyframe_seek = 0;
|
| ++
|
| ++ // Save the position seeked to.
|
| ++ pos_arg = seek_pos = url_ftell(s->pb);
|
| ++ seek_pts = ogg_read_timestamp(s, stream_index, &pos_arg, url_fsize(s->pb));
|
| ++ os = ogg->streams + stream_index;
|
| ++
|
| ++ // Since we have seeked to the beginning then reset lastpts and lastdts to 0.
|
| ++ if (!seek_pts) {
|
| ++ for (i = 0; i < ogg->nstreams; i++){
|
| ++ struct ogg_stream *stream = ogg->streams + i;
|
| ++ stream->lastpts = 0;
|
| ++ stream->lastdts = 0;
|
| ++ }
|
| ++ os->keyframe_seek = 0;
|
| ++ }
|
| ++ url_fseek(s->pb, seek_pos, SEEK_SET);
|
| + return ret;
|
| + }
|
| +
|
|
|