[vlc-devel] stream_Peek memory management...

Peter Tap ptrtap at yahoo.com
Tue Sep 20 02:32:43 CEST 2011


Laurent,

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.

Regards,
Peter




________________________________
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.

-- 
fenrir
_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
http://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110919/0783dce4/attachment.html>


More information about the vlc-devel mailing list