Commit bbe18d3e authored by conrad's avatar conrad

Fix playback with invalid files that don't set the continuation flag for

pages that continue packets started in prior pages.
Fixes issue1248

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@21688 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 1606e6ec
...@@ -122,6 +122,7 @@ ogg_reset (struct ogg * ogg) ...@@ -122,6 +122,7 @@ ogg_reset (struct ogg * ogg)
os->lastdts = AV_NOPTS_VALUE; os->lastdts = AV_NOPTS_VALUE;
os->nsegs = 0; os->nsegs = 0;
os->segp = 0; os->segp = 0;
os->incomplete = 0;
} }
ogg->curidx = -1; ogg->curidx = -1;
...@@ -268,7 +269,7 @@ ogg_read_page (AVFormatContext * s, int *str) ...@@ -268,7 +269,7 @@ ogg_read_page (AVFormatContext * s, int *str)
for (i = 0; i < nsegs; i++) for (i = 0; i < nsegs; i++)
size += os->segments[i]; size += os->segments[i];
if (flags & OGG_FLAG_CONT){ if (flags & OGG_FLAG_CONT || os->incomplete){
if (!os->psize){ if (!os->psize){
while (os->segp < os->nsegs){ while (os->segp < os->nsegs){
int seg = os->segments[os->segp++]; int seg = os->segments[os->segp++];
...@@ -356,6 +357,7 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize) ...@@ -356,6 +357,7 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize)
if (!complete && os->segp == os->nsegs){ if (!complete && os->segp == os->nsegs){
ogg->curidx = -1; ogg->curidx = -1;
os->incomplete = 1;
} }
}while (!complete); }while (!complete);
...@@ -366,6 +368,7 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize) ...@@ -366,6 +368,7 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize)
#endif #endif
ogg->curidx = idx; ogg->curidx = idx;
os->incomplete = 0;
if (os->header < 0){ if (os->header < 0){
int hdr = os->codec->header (s, idx); int hdr = os->codec->header (s, idx);
......
...@@ -71,6 +71,7 @@ struct ogg_stream { ...@@ -71,6 +71,7 @@ struct ogg_stream {
int header; int header;
int nsegs, segp; int nsegs, segp;
uint8_t segments[255]; uint8_t segments[255];
int incomplete; ///< whether we're expecting a continuation in the next page
int page_end; ///< current packet is the last one completed in the page int page_end; ///< current packet is the last one completed in the page
void *private; void *private;
}; };
......
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