From bc3f4d06e51964de6c55f63eddfa67c51b49b6e3 Mon Sep 17 00:00:00 2001 From: Chris Double Date: Fri, 15 May 2009 11:47:06 +1200 Subject: [PATCH] Bug 492436 - Fix for handling unknown Ogg streams - rs=roc --HG-- extra : rebase_source : 196ced84c53487b47a390fa043dd3e6de95d8bb3 --- media/liboggplay/README_MOZILLA | 4 +- media/liboggplay/bug492436.patch | 52 +++++++++++++++++++ .../include/oggplay/oggplay_enums.h | 3 ++ .../src/liboggplay/oggplay_callback.c | 1 + .../liboggplay/src/liboggplay/oggplay_query.c | 8 +++ media/liboggplay/update.sh | 1 + 6 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 media/liboggplay/bug492436.patch diff --git a/media/liboggplay/README_MOZILLA b/media/liboggplay/README_MOZILLA index 5f28e8e8f30..8f684d8ed7b 100644 --- a/media/liboggplay/README_MOZILLA +++ b/media/liboggplay/README_MOZILLA @@ -14,4 +14,6 @@ bug485291_yuv_align: only use optimized YUV routines if video dimensions are a m endian: pick up NSPR's little/big endian defines in oggplay's config.h. -trac466: Fix for infinite loop in liboggplay when running decoder on its own thread. +trac466: Fix for infinite loop in liboggplay when running decoder on its own thread. Cherry picked from liboggplay git commit e6871f. + +bug492436: Fix for that bug cherry picked from liboggplay git commit 4b97ad. diff --git a/media/liboggplay/bug492436.patch b/media/liboggplay/bug492436.patch new file mode 100644 index 00000000000..631efbffc0a --- /dev/null +++ b/media/liboggplay/bug492436.patch @@ -0,0 +1,52 @@ +diff --git a/media/liboggplay/include/oggplay/oggplay_enums.h b/media/liboggplay/include/oggplay/oggplay_enums.h +index aff0e51..ffb7cb4 100644 +--- a/media/liboggplay/include/oggplay/oggplay_enums.h ++++ b/media/liboggplay/include/oggplay/oggplay_enums.h +@@ -64,6 +64,9 @@ typedef enum OggPlayErrorCode { + E_OGGPLAY_NO_KATE_SUPPORT = -19, + E_OGGPLAY_NO_TIGER_SUPPORT = -20, + E_OGGPLAY_OUT_OF_MEMORY = -21, ++ E_OGGPLAY_TYPE_OVERFLOW = -22, /**< Integer overflow detected */ ++ ++ E_OGGPLAY_TRACK_IS_UNKNOWN = -23, /**< The selected track's content type is UNKNOWN */ + E_OGGPLAY_NOTCHICKENPAYBACK = -777 + } OggPlayErrorCode; + +diff --git a/media/liboggplay/src/liboggplay/oggplay_callback.c b/media/liboggplay/src/liboggplay/oggplay_callback.c +index 05cf363..593691f 100644 +--- a/media/liboggplay/src/liboggplay/oggplay_callback.c ++++ b/media/liboggplay/src/liboggplay/oggplay_callback.c +@@ -508,6 +508,7 @@ OggPlayCallbackFunctions callbacks[] = { + {NULL, NULL, NULL, sizeof(OggPlayDecode)}, /* CELT */ + {oggplay_init_kate, oggplay_callback_kate, oggplay_shutdown_kate, + sizeof(OggPlayKateDecode)}, /* KATE */ ++ {NULL, NULL, NULL, sizeof(OggPlayDecode)}, /* DIRAC */ + {NULL, NULL, NULL, sizeof(OggPlayDecode)} /* UNKNOWN */ + }; + +diff --git a/media/liboggplay/src/liboggplay/oggplay_query.c b/media/liboggplay/src/liboggplay/oggplay_query.c +index 2a69beb..6344ec8 100644 +--- a/media/liboggplay/src/liboggplay/oggplay_query.c ++++ b/media/liboggplay/src/liboggplay/oggplay_query.c +@@ -131,6 +131,10 @@ oggplay_set_track_active(OggPlay *me, int track_num) { + return E_OGGPLAY_TRACK_IS_SKELETON; + } + ++ if (me->decode_data[track_num]->content_type == OGGZ_CONTENT_UNKNOWN) { ++ return E_OGGPLAY_TRACK_IS_UNKNOWN; ++ } ++ + if ((p = me->decode_data[track_num]->final_granulepos) != -1) { + if (p * me->decode_data[track_num]->granuleperiod > me->target) { + return E_OGGPLAY_TRACK_IS_OVER; +@@ -179,6 +183,10 @@ oggplay_set_track_inactive(OggPlay *me, int track_num) { + return E_OGGPLAY_TRACK_IS_SKELETON; + } + ++ if (me->decode_data[track_num]->content_type == OGGZ_CONTENT_UNKNOWN) { ++ return E_OGGPLAY_TRACK_IS_UNKNOWN; ++ } ++ + if (me->decode_data[track_num]->active == 1) { + me->decode_data[track_num]->active = 0; + diff --git a/media/liboggplay/include/oggplay/oggplay_enums.h b/media/liboggplay/include/oggplay/oggplay_enums.h index aff0e5104ac..ffb7cb4a44b 100644 --- a/media/liboggplay/include/oggplay/oggplay_enums.h +++ b/media/liboggplay/include/oggplay/oggplay_enums.h @@ -64,6 +64,9 @@ typedef enum OggPlayErrorCode { E_OGGPLAY_NO_KATE_SUPPORT = -19, E_OGGPLAY_NO_TIGER_SUPPORT = -20, E_OGGPLAY_OUT_OF_MEMORY = -21, + E_OGGPLAY_TYPE_OVERFLOW = -22, /**< Integer overflow detected */ + + E_OGGPLAY_TRACK_IS_UNKNOWN = -23, /**< The selected track's content type is UNKNOWN */ E_OGGPLAY_NOTCHICKENPAYBACK = -777 } OggPlayErrorCode; diff --git a/media/liboggplay/src/liboggplay/oggplay_callback.c b/media/liboggplay/src/liboggplay/oggplay_callback.c index 05cf363e73d..593691fc7cc 100644 --- a/media/liboggplay/src/liboggplay/oggplay_callback.c +++ b/media/liboggplay/src/liboggplay/oggplay_callback.c @@ -508,6 +508,7 @@ OggPlayCallbackFunctions callbacks[] = { {NULL, NULL, NULL, sizeof(OggPlayDecode)}, /* CELT */ {oggplay_init_kate, oggplay_callback_kate, oggplay_shutdown_kate, sizeof(OggPlayKateDecode)}, /* KATE */ + {NULL, NULL, NULL, sizeof(OggPlayDecode)}, /* DIRAC */ {NULL, NULL, NULL, sizeof(OggPlayDecode)} /* UNKNOWN */ }; diff --git a/media/liboggplay/src/liboggplay/oggplay_query.c b/media/liboggplay/src/liboggplay/oggplay_query.c index 2a69beb9d84..6344ec8e6ac 100644 --- a/media/liboggplay/src/liboggplay/oggplay_query.c +++ b/media/liboggplay/src/liboggplay/oggplay_query.c @@ -131,6 +131,10 @@ oggplay_set_track_active(OggPlay *me, int track_num) { return E_OGGPLAY_TRACK_IS_SKELETON; } + if (me->decode_data[track_num]->content_type == OGGZ_CONTENT_UNKNOWN) { + return E_OGGPLAY_TRACK_IS_UNKNOWN; + } + if ((p = me->decode_data[track_num]->final_granulepos) != -1) { if (p * me->decode_data[track_num]->granuleperiod > me->target) { return E_OGGPLAY_TRACK_IS_OVER; @@ -179,6 +183,10 @@ oggplay_set_track_inactive(OggPlay *me, int track_num) { return E_OGGPLAY_TRACK_IS_SKELETON; } + if (me->decode_data[track_num]->content_type == OGGZ_CONTENT_UNKNOWN) { + return E_OGGPLAY_TRACK_IS_UNKNOWN; + } + if (me->decode_data[track_num]->active == 1) { me->decode_data[track_num]->active = 0; diff --git a/media/liboggplay/update.sh b/media/liboggplay/update.sh index fe62815d51a..5318e518e39 100644 --- a/media/liboggplay/update.sh +++ b/media/liboggplay/update.sh @@ -47,3 +47,4 @@ sed s/\#ifdef\ HAVE_INTTYPES_H/\#if\ HAVE_INTTYPES_H/g $1/src/liboggplay/oggplay patch -p3 < bug485291_yuv_align.patch patch -p3 < endian.patch patch -p3 < trac466.patch +patch -p3 < bug492436.patch