[vlc-devel] commit: spdif: Add a comment to explicitely explain why we don' t free old buffer. (Pierre d'Herbemont )

Pierre d'Herbemont pdherbemont at gmail.com
Fri Sep 4 12:45:08 CEST 2009


On Sep 4, 2009, at 9:42 AM, jpd at videolan.org wrote:

> On Thu, Sep 03, 2009 at 11:31:21PM +0200, git version control wrote:
>> vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> |  
>> Thu Sep  3 23:30:53 2009 +0200|  
>> [acac88798ee6fd5ec0ea59bdaef0a4989f6409cd] | committer: Pierre  
>> d'Herbemont
> [snip]
>>     aout_buffer_t * p_old_buffer = aout_FifoPop( NULL, &p_input- 
>> >fifo );
>> +    /* We don't free the old buffer because,
>> +     * The aout core use a hack to avoid useless memcpy: the  
>> buffer in which
>> +     * to mix is the same as the one in the first active input fifo.
>> +     * So the ownership of that buffer belongs to our caller */
>
> Had to read it a couple of times to understand what it means. Would  
> this
> be correct?
>
> 	/* We do not free the old buffer because we don't own it. We don't
> 	 * own it because the aout core uses a hack to avoid a memcpy by
> 	 * giving us the first active input fifo buffer to mix in. */

I think it would. Also if we don't own it, it is because the caller is  
passing this same buffer, and so our caller owns it. (That's what the  
assert checks).

Pierre.



More information about the vlc-devel mailing list