[FFmpeg-devel] [PATCH] avformat/rtmpcrypt: fix discarded const warning

Ganesh Ajjanagadde gajjanag at mit.edu
Fri Sep 18 21:58:32 CEST 2015


On Fri, Sep 18, 2015 at 3:50 PM, Nicolas George <george at nsup.org> wrote:
> Le jour du Génie, an CCXXIII, Ganesh Ajjanagadde a écrit :
>> This patch silences a -Wdiscarded-qualifiers observed with GCC 5.2.
>>
>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>> ---
>>  libavformat/rtmpcrypt.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> I am not sure this is correct: the buffer is const for a reason, the warning
> is right. An application would be completely allowed to give a buffer in
> read-only memory, or to reuse the contents of the buffer afterwards.
>
> Actually, I suspect this muxer, if used as first output in the tee muxer,
> would cause the next outputs to be corrupt.

It is indeed fishy, since making it non-const essentially violates the
url_write const'ness.

>
> The correct fix would probably be to allocate a new buffer, probably keeping
> it in the context for performances reasons instead of allocating each time.

This sounds better. I did not think that creation of a separate buffer
would be necessary and wanted to avoid it unless absolutely essential;
will change based on this. Thanks.

>
> Regards,
>
> --
>   Nicolas George
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list