Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removed: two ffmpeg asf patches that cause problems

As noted by tiben20.
  • Loading branch information...
commit 7605bca09a4648e2042acb737a16c22f5f77aca4 1 parent a458453
@anssih anssih authored
View
24 lib/ffmpeg/libavformat/asfdec.c
@@ -1058,8 +1058,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
if (s->packet_size > 0)
pos= (pos+s->packet_size-1-s->data_offset)/s->packet_size*s->packet_size+ s->data_offset;
*ppos= pos;
- if (url_fseek(s->pb, pos, SEEK_SET) < 0)
- return AV_NOPTS_VALUE;
+ url_fseek(s->pb, pos, SEEK_SET);
//printf("asf_read_pts\n");
asf_reset_header(s);
@@ -1101,11 +1100,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
int64_t current_pos= url_ftell(s->pb);
int i;
- if(url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET) < 0) {
- asf->index_read= -1;
- return;
- }
-
+ url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
ff_get_guid(s->pb, &g);
/* the data object can be followed by other top-level objects,
@@ -1114,7 +1109,6 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
int64_t gsize= get_le64(s->pb);
if (gsize < 24 || url_feof(s->pb)) {
url_fseek(s->pb, current_pos, SEEK_SET);
- asf->index_read= -1;
return;
}
url_fseek(s->pb, gsize-24, SEEK_CUR);
@@ -1155,20 +1149,9 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
int64_t pos;
int index;
- if (pts == 0) {
- // this is a hack since av_gen_search searches the entire file in this case
- av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", s->data_offset);
- if (url_fseek(s->pb, s->data_offset, SEEK_SET) < 0)
- return -1;
- return 0;
- }
-
if (s->packet_size <= 0)
return -1;
- if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO)
- return -1;
-
/* Try using the protocol's read_seek if available */
if(s->pb) {
int ret = av_url_read_fseek(s->pb, stream_index, pts, flags);
@@ -1215,8 +1198,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
/* do the seek */
av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos);
- if(url_fseek(s->pb, pos, SEEK_SET)<0)
- return -1;
+ url_fseek(s->pb, pos, SEEK_SET);
}
asf_reset_header(s);
return 0;
View
55 lib/ffmpeg/patches/0003-asf-hacks.patch
@@ -1,55 +0,0 @@
-From abf62ced1700fda797e839bc8be5dfb43bd2e67a Mon Sep 17 00:00:00 2001
-From: Cory Fields <theuni-nospam-@xbmc.org>
-Date: Mon, 28 Jun 2010 01:34:29 -0400
-Subject: [PATCH 03/36] asf hacks
-
----
- libavformat/asfdec.c | 15 ++++++++++++++-
- 1 files changed, 14 insertions(+), 1 deletions(-)
-
-diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
-index 35e892c..2bda885 100644
---- a/libavformat/asfdec.c
-+++ b/libavformat/asfdec.c
-@@ -1109,6 +1109,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
- int64_t gsize= get_le64(s->pb);
- if (gsize < 24 || url_feof(s->pb)) {
- url_fseek(s->pb, current_pos, SEEK_SET);
-+ asf->index_read= -1;
- return;
- }
- url_fseek(s->pb, gsize-24, SEEK_CUR);
-@@ -1149,9 +1150,20 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
- int64_t pos;
- int index;
-
-+ if (pts == 0) {
-+ // this is a hack since av_gen_search searches the entire file in this case
-+ av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", s->data_offset);
-+ if (url_fseek(s->pb, s->data_offset, SEEK_SET) < 0)
-+ return -1;
-+ return 0;
-+ }
-+
- if (s->packet_size <= 0)
- return -1;
-
-+ if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO)
-+ return -1;
-+
- /* Try using the protocol's read_seek if available */
- if(s->pb) {
- int ret = av_url_read_fseek(s->pb, stream_index, pts, flags);
-@@ -1198,7 +1210,8 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
-
- /* do the seek */
- av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos);
-- url_fseek(s->pb, pos, SEEK_SET);
-+ if(url_fseek(s->pb, pos, SEEK_SET)<0)
-+ return -1;
- }
- asf_reset_header(s);
- return 0;
---
-1.7.3
-
View
39 lib/ffmpeg/patches/0014-changed-check-some-more-url_fseeks-in-asf-demuxer-to.patch
@@ -1,39 +0,0 @@
-From 9f19ad85257c413cf6c1facb6dc49efa8a10b6b3 Mon Sep 17 00:00:00 2001
-From: Cory Fields <theuni-nospam-@xbmc.org>
-Date: Mon, 28 Jun 2010 22:27:09 -0400
-Subject: [PATCH 14/36] changed: check some more url_fseeks in asf demuxer to avoid problems if file system is unseekable
-
----
- libavformat/asfdec.c | 9 +++++++--
- 1 files changed, 7 insertions(+), 2 deletions(-)
-
-diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
-index 2bda885..4347601 100644
---- a/libavformat/asfdec.c
-+++ b/libavformat/asfdec.c
-@@ -1058,7 +1058,8 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
- if (s->packet_size > 0)
- pos= (pos+s->packet_size-1-s->data_offset)/s->packet_size*s->packet_size+ s->data_offset;
- *ppos= pos;
-- url_fseek(s->pb, pos, SEEK_SET);
-+ if (url_fseek(s->pb, pos, SEEK_SET) < 0)
-+ return AV_NOPTS_VALUE;
-
- //printf("asf_read_pts\n");
- asf_reset_header(s);
-@@ -1100,7 +1101,11 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
- int64_t current_pos= url_ftell(s->pb);
- int i;
-
-- url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
-+ if(url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET) < 0) {
-+ asf->index_read= -1;
-+ return;
-+ }
-+
- ff_get_guid(s->pb, &g);
-
- /* the data object can be followed by other top-level objects,
---
-1.7.3
-

10 comments on commit 7605bca

@elupus
Collaborator

You do realise this will break alot of file where we read asf from a source that can't seek right? The last i heard about those patches was that removing them didn't make anything better just changed the problems.

@elupus
Collaborator

If a url_fseek fails we should always bail out appropriatly. The point of those changes was to handle this cleanly instead of reading utter junk and breaking other things.

@anssih
Collaborator

Yes, I know what the changes were for. However I was told (by tiben20 and cptspiff, IIRC) that these caused crashers and should be removed. Is that not the case?

@elupus
Collaborator

As said, the last comment i read on trac on the issue, removing them only changed the issues to a different sort. It didn't really improve playback or seeking. So by removing the changes, we break other files with no apperent benefit.

I would like to see a file where removing these changes fixes it, since that would show me what is wrong with the patches.

@anssih
Collaborator

I think the backtrace is http://pastebin.ca/2044414 (the host is down right now, so can't be sure). In any case, I can look into this to try to reintroduce the seeking fixes into ffmpeg upstream without the associated regressions. What is the reproducable test case for the original issue? (i.e. does the issue happen with every .asf file when used on non-seekable connection, and how does it manifest itself?)

@elupus
Collaborator

Yea I think it was pretty much any asf on a nonseekable source (so you should be able to just always return -1 on a seek to reproduce). Was a damn long time ago now thou, so i'm not 100% sure anymore.

@gnif
Collaborator

This did not fix the issue I reported with WMA HD seek crash on the following file
http://download.microsoft.com/download/0/9/d/09d051c4-decc-4d39-9c57-f520187213a1/Amazing_Caves_720.exe

@anssih
Collaborator

OK, thanks, I'll try to have some time to check that out tomorrow.

@anssih
Collaborator

So the crasher issues are not related to this after all? ... I thought it had been confirmed.
Tiben20, cptspiff (if it was you some weeks ago IIRC), you remember any specific reasons for why you asked me to remove the asf patches, or was it all just a misunderstanding (in which case this should be reverted)?

@anssih
Collaborator

I'll simply restore the patches for now, then, until I'll get some sample which they break.

Please sign in to comment.
Something went wrong with that request. Please try again.