[xiph-commits] r3774 - liboggplay/trunk/src/liboggplay
doublec at svn.annodex.net
doublec at svn.annodex.net
Sun Nov 9 16:07:29 PST 2008
Author: doublec
Date: 2008-11-09 16:07:28 -0800 (Sun, 09 Nov 2008)
New Revision: 3774
Modified:
liboggplay/trunk/src/liboggplay/oggplay.c
liboggplay/trunk/src/liboggplay/oggplay_private.h
liboggplay/trunk/src/liboggplay/oggplay_seek.c
Log:
Fix duration memory corruption bug. Fixes ticket 437
Modified: liboggplay/trunk/src/liboggplay/oggplay.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay.c 2008-11-08 04:08:04 UTC (rev 3773)
+++ liboggplay/trunk/src/liboggplay/oggplay.c 2008-11-10 00:07:28 UTC (rev 3774)
@@ -644,9 +644,12 @@
if (me->reader->duration)
return me->reader->duration(me->reader);
else {
- ogg_int64_t pos = oggz_tell_units(me->oggz);
- ogg_int64_t duration = oggz_seek_units(me->oggz, 0, SEEK_END);
+ ogg_int64_t pos;
+ ogg_int64_t duration;
+ pos = oggz_tell_units(me->oggz);
+ duration = oggz_seek_units(me->oggz, 0, SEEK_END);
oggz_seek_units(me->oggz, pos, SEEK_SET);
+ oggplay_seek_cleanup(me, pos);
return duration;
}
}
Modified: liboggplay/trunk/src/liboggplay/oggplay_private.h
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_private.h 2008-11-08 04:08:04 UTC (rev 3773)
+++ liboggplay/trunk/src/liboggplay/oggplay_private.h 2008-11-10 00:07:28 UTC (rev 3774)
@@ -225,6 +225,9 @@
void
oggplay_take_out_trash(OggPlay *me, OggPlaySeekTrash *trash);
+void
+oggplay_seek_cleanup(OggPlay *me, ogg_int64_t milliseconds);
+
typedef struct {
void (*init)(void *user_data);
int (*callback)(OGGZ * oggz, ogg_packet * op, long serialno,
Modified: liboggplay/trunk/src/liboggplay/oggplay_seek.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_seek.c 2008-11-08 04:08:04 UTC (rev 3773)
+++ liboggplay/trunk/src/liboggplay/oggplay_seek.c 2008-11-10 00:07:28 UTC (rev 3774)
@@ -41,11 +41,7 @@
OggPlayErrorCode
oggplay_seek(OggPlay *me, ogg_int64_t milliseconds) {
- OggPlaySeekTrash * trash;
- OggPlaySeekTrash ** p;
- OggPlayDataHeader ** end_of_list_p;
- int i;
- int eof;
+ ogg_int64_t eof;
if (me == NULL) {
return E_OGGPLAY_BAD_OGGPLAY;
@@ -76,6 +72,21 @@
}
}
+ oggplay_seek_cleanup(me, milliseconds);
+
+ return E_OGGPLAY_OK;
+
+}
+
+void
+oggplay_seek_cleanup(OggPlay* me, ogg_int64_t milliseconds)
+{
+
+ OggPlaySeekTrash * trash;
+ OggPlaySeekTrash ** p;
+ OggPlayDataHeader ** end_of_list_p;
+ int i;
+
/*
* first, create a trash object to store the context that we want to
* delete but can't until the presentation thread is no longer using it -
@@ -129,9 +140,6 @@
}
*p = trash;
-
- return E_OGGPLAY_OK;
-
}
void
More information about the commits
mailing list