[vlc-devel] stream_Peek memory management...
ptrtap at yahoo.com
Tue Sep 20 02:32:43 CEST 2011
Thank you for your help. Things now make more sense.
I had written a stream filter for decoding an encrypted media file. Currently, the encryption is a simple XOR mechanism. In my "Peek" implementation, I was simply calling the underlying stream_Peek method and XORing the read buffer before returning. The problem I am running into is that the underlying stream may used cached data (src/input/stream.c). As a result, I end up XORing data that is already XORed.
Looks like the only way to get around this problem is to add my own layer of cached data.
I would appreciate your any suggestions/ideas you may have.
Thank you once again for your help.
From: Laurent Aimar <fenrir at elivagar.org>
To: Mailing list for VLC media player developers <vlc-devel at videolan.org>
Sent: Monday, September 19, 2011 1:30 AM
Subject: Re: [vlc-devel] stream_Peek memory management...
On Sun, Sep 18, 2011 at 04:35:08PM -0700, Peter Tap wrote:
> In vlc code, I noticed that the memory allocated from stream_Peek is not
> released in the code. A typical usage pattern is:
> const uint8_t* p_Peek;
> stream_Peek(s, &p_Peek, num);
> So, when stream_Peek succeeds, it creates memory for p_Peek and fills it with
> required data.
Not always. It can return a pointer into cached data when possible, and if not
then allocate a buffer and copy the data in it.
> What is confusing is that no one ever releases this memory.
stream_t keeps the ownership of the memory and will release it itself when
it is disposed of, or until the next stream_Peek() call.
vlc-devel mailing list
To unsubscribe or modify your subscription options:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vlc-devel