mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 08:35:26 +00:00
67 lines
2.1 KiB
Diff
67 lines
2.1 KiB
Diff
diff --git a/media/liboggplay/src/liboggplay/oggplay.c b/media/liboggplay/src/liboggplay/oggplay.c
|
|
--- a/media/liboggplay/src/liboggplay/oggplay.c
|
|
+++ b/media/liboggplay/src/liboggplay/oggplay.c
|
|
@@ -638,16 +638,17 @@ OggPlayErrorCode
|
|
oggplay_step_decoding(OggPlay *me) {
|
|
|
|
OggPlayCallbackInfo ** info;
|
|
int num_records;
|
|
int r;
|
|
int i;
|
|
int need_data = 0;
|
|
int chunk_count = 0;
|
|
+ int read_data = 0;
|
|
|
|
if (me == NULL) {
|
|
return E_OGGPLAY_BAD_OGGPLAY;
|
|
}
|
|
|
|
/*
|
|
* check whether the OggPlayDataCallback is set for the given
|
|
* OggPlay handle. If not return with error as there's no callback
|
|
@@ -686,17 +687,21 @@ read_more_data:
|
|
if (me->active_tracks == 0) {
|
|
int remaining = 0;
|
|
for (i = 0; i < me->num_tracks; i++) {
|
|
if (me->decode_data[i]->current_loc +
|
|
me->decode_data[i]->granuleperiod >= me->target + me->decode_data[i]->offset) {
|
|
remaining++;
|
|
}
|
|
}
|
|
- if (remaining == 0) {
|
|
+ if (remaining == 0 && !read_data) {
|
|
+ /*
|
|
+ * There's no more data to read, and we've not read any that needs
|
|
+ * to be sent to the buffer list via a callback, so exit.
|
|
+ */
|
|
return E_OGGPLAY_OK;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* if any of the tracks have not yet met the target (modified by that
|
|
* track's offset), then retrieve more data
|
|
*/
|
|
@@ -783,16 +788,21 @@ read_more_data:
|
|
* e.g. some buffer overflow.
|
|
*/
|
|
|
|
case OGGZ_ERR_OUT_OF_MEMORY:
|
|
/* ran out of memory during decoding! */
|
|
return E_OGGPLAY_OUT_OF_MEMORY;
|
|
|
|
default:
|
|
+ /*
|
|
+ * We read some data. Set a flag so that we're guaranteed to try to
|
|
+ * send it to the buffer list via a callback.
|
|
+ */
|
|
+ read_data = 1;
|
|
break;
|
|
}
|
|
}
|
|
/*
|
|
* prepare a callback
|
|
*/
|
|
num_records = oggplay_callback_info_prepare (me, &info);
|
|
if (info != NULL) {
|