Quoting Mark Thompson (2016-03-10 16:56:21)
> >> +    ++avfc->nb_surfaces;
> >> +    if (avfc->nb_surfaces == 1) {
> >> +        // Test whether vaDeriveImage() works for this type of surface.
> >> +        VAImageFormat *expected_format;
> >> +        VAImage test_image;
> >> +        int err;
> >> +
> >> +        ctx->derive_works = 0;
> > 
> > I think this is unsafe, since this variable is also accessed in
> > mapping the frame, which can easily happen concurrently with this
> > function. So it would be better to make this test in frames_init.
> > Also, this function won't be called at all if the caller supplies his
> > own frame pool. The mapping function should work even then.
> 
> So call get_buffer() at the end of frames_init() and try the mapping there?
> That might be slightly surprising to the user supplying their own pool, but
> otherwise seems entirely reasonable.

I think just creating a single dummy surface with a random format and
calling derive on it might be simpler.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to