diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-10-05 11:34:04 +0200 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-10-05 11:34:04 +0200 |
commit | 827d4b794282e87d457f3642b8b8e2e45e17c05b (patch) | |
tree | 0799dc4503c695d5d894062d34fa6d2a3b2bd5f6 /libavcodec/mmaldec.c | |
parent | 45ab078e35a4116f1d0ebd10e310ddd0ac91ac7b (diff) | |
parent | 65db4899fa8790049bec3af16ecdb75dd81051fd (diff) | |
download | ffmpeg-827d4b794282e87d457f3642b8b8e2e45e17c05b.tar.gz |
Merge commit '65db4899fa8790049bec3af16ecdb75dd81051fd'
* commit '65db4899fa8790049bec3af16ecdb75dd81051fd':
mmaldec: refactor to have more context per MMAL input buffer
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavcodec/mmaldec.c')
-rw-r--r-- | libavcodec/mmaldec.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c index ecac924689..4e07352629 100644 --- a/libavcodec/mmaldec.c +++ b/libavcodec/mmaldec.c @@ -188,8 +188,9 @@ static av_cold int ffmmal_close_decoder(AVCodecContext *avctx) static void input_callback(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) { if (!buffer->cmd) { - AVBufferRef *buf = buffer->user_data; - av_buffer_unref(&buf); + FFBufferEntry *entry = buffer->user_data; + av_buffer_unref(&entry->ref); + av_free(entry); } mmal_buffer_header_release(buffer); } @@ -535,19 +536,19 @@ static int ffmmal_fill_input_port(AVCodecContext *avctx) mbuffer->flags = buffer->flags; mbuffer->data = buffer->data; mbuffer->length = buffer->length; - mbuffer->user_data = buffer->ref; + mbuffer->user_data = buffer; mbuffer->alloc_size = ctx->decoder->input[0]->buffer_size; - if ((status = mmal_port_send_buffer(ctx->decoder->input[0], mbuffer))) { - mmal_buffer_header_release(mbuffer); - av_buffer_unref(&buffer->ref); - } - // Remove from start of the list ctx->waiting_buffers = buffer->next; if (ctx->waiting_buffers_tail == buffer) ctx->waiting_buffers_tail = NULL; - av_free(buffer); + + if ((status = mmal_port_send_buffer(ctx->decoder->input[0], mbuffer))) { + mmal_buffer_header_release(mbuffer); + av_buffer_unref(&buffer->ref); + av_free(buffer); + } if (status) { av_log(avctx, AV_LOG_ERROR, "MMAL error %d when sending input\n", (int)status); |