[Live-devel] Stack overflow in QuickTimeFileSink

Derrick N. Guerrero guerreroderrick at gmail.com
Mon Oct 5 14:18:28 PDT 2009


I am recording h264 to the QuickTimeFileSink, and I was getting a stack
overflow whenever I close my recorder and the sink gets destructed. I ended
up applying the changes below to iteratively delete the chunks, but I was
wondering if there was something I'm supposed to do in order to clean up the
chunks periodically.

I don't seem to get the stack overflow anymore, but something tells me if
this records for a while and all of these chunks are kept in memory, then
it'll blow up pretty soon.

Thanks.
Derrick N. Guerrero

Index: QuickTimeFileSink.cpp
===================================================================
--- QuickTimeFileSink.cpp    (revision 116413)
+++ QuickTimeFileSink.cpp    (working copy)
@@ -1098,7 +1098,13 @@
 }

 ChunkDescriptor::~ChunkDescriptor() {
-  delete fNextChunk;
+    ChunkDescriptor *next = fNextChunk;
+    while (next) {
+        ChunkDescriptor *hold = next;
+        next = hold->fNextChunk;
+        hold->fNextChunk = NULL;
+        delete hold;
+    }
 }

 ChunkDescriptor* ChunkDescriptor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20091005/690bcd16/attachment.html>


More information about the live-devel mailing list