[FFmpeg-cvslog] vda_h264_dec: backup context before overriding

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Nov 21 18:59:10 CET 2013


On Thu, Nov 21, 2013 at 02:47:26PM +0100, Xidorn Quan wrote:
> ffmpeg | branch: master | Xidorn Quan <quanxunzhen at gmail.com> | Tue Nov 19 08:37:01 2013 +0800| [973b1a6b9070e2bf17d17568cbaf4043ce931f51] | committer: Xidorn Quan
> 
> vda_h264_dec: backup context before overriding
> 
> Some of context fields which must be overrided by this wrapper decoder
> may be set and used by user, so we have to save and restore them before
> and after invoking the inner decoder to secure user.

I don't think this is a very good solution.
For a multithreaded client it would still see fields like get_buffer
changing even though the documentation mentions only the user as setting
it.
I admit it would waste some CPU time, but one possibility would be to
do:

AVCodecContext tmp = *avctx;
set_context(&tmp);
....
restore_context(&tmp);
*avctx = tmp;

For the threading stuff we also have
update_context_from_thread
update_context_from_user
that do similar stuff, but I suspect trying to share code with
them would be messy.


More information about the ffmpeg-cvslog mailing list