[FFmpeg-devel] [PATCH] concurrency errors in libstagefright decoder
Clément Bœsch
ubitux at gmail.com
Thu Mar 28 10:15:32 CET 2013
On Thu, Mar 28, 2013 at 04:07:20PM +1030, Michael Zucchi wrote:
>
> Hi,
>
> This adds a mutex around the buffer memory operations as they are
> performed in different threads. It isn't required for those after the
> thread.join() for obvious reasons.
>
> Regards
> !Z
>
> diff --git a/libavcodec/libstagefright.cpp b/libavcodec/libstagefright.cpp
> index a6fd1b9..c42db5f 100644
> --- a/libavcodec/libstagefright.cpp
> +++ b/libavcodec/libstagefright.cpp
> @@ -66,6 +66,7 @@ struct StagefrightContext {
> sp<MediaSource> *source;
> List<Frame*> *in_queue, *out_queue;
> pthread_mutex_t in_mutex, out_mutex;
> + pthread_mutex_t codec_mutex;
> pthread_cond_t condition;
> pthread_t decode_thread_id;
>
> @@ -185,7 +186,11 @@ void* decode_thread(void *arg)
> buffer->release();
> goto push_frame;
> }
> - ret = ff_get_buffer(avctx, frame->vframe);
> +
> + pthread_mutex_lock(&s->codec_mutex);
> + ret = avctx->get_buffer(avctx, frame->vframe);
Why the switch from ff_get_buffer() to the internal call?
[...]
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130328/232b04cb/attachment.asc>
More information about the ffmpeg-devel
mailing list