summaryrefslogtreecommitdiff
path: root/libavcodec/pthread_frame.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-19 19:02:36 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-19 19:02:36 +0200
commitaf72f62d7b2ab00d6f69c0838f662beb566862d8 (patch)
tree90aad791bc96b1ac9d55cfa491e15dae236c8216 /libavcodec/pthread_frame.c
parent4a2fd251f477447cdd4f7ee14f3670a7f1f0c4ed (diff)
parent9929b3564c0dca42ed7baa6798ef15b6f0013c83 (diff)
Merge commit '9929b3564c0dca42ed7baa6798ef15b6f0013c83'
* commit '9929b3564c0dca42ed7baa6798ef15b6f0013c83': pthread_frame: simplify the code by using new AVPacket API Conflicts: libavcodec/pthread_frame.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pthread_frame.c')
-rw-r--r--libavcodec/pthread_frame.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index fcaa001b16..30788e9914 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -65,8 +65,6 @@ typedef struct PerThreadContext {
AVCodecContext *avctx; ///< Context used to decode packets passed to this thread.
AVPacket avpkt; ///< Input packet (for decoding) or output (for encoding).
- uint8_t *buf; ///< backup storage for packet data when the input packet is not refcounted
- int allocated_buf_size; ///< Size allocated for buf
AVFrame *frame; ///< Output frame (for decoding) or input (for encoding).
int got_frame; ///< The output of got_picture_ptr from the last avcodec_decode_video() call.
@@ -342,25 +340,8 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
}
}
- av_packet_free_side_data(&p->avpkt);
- av_buffer_unref(&p->avpkt.buf);
- p->avpkt = *avpkt;
- if (avpkt->buf)
- p->avpkt.buf = av_buffer_ref(avpkt->buf);
- else {
- av_fast_malloc(&p->buf, &p->allocated_buf_size, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
- if (!p->buf) {
- pthread_mutex_unlock(&p->mutex);
- return AVERROR(ENOMEM);
- }
- p->avpkt.data = p->buf;
- memcpy(p->buf, avpkt->data, avpkt->size);
- memset(p->buf + avpkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
- }
- if ((ret = av_copy_packet_side_data(&p->avpkt, avpkt)) < 0) {
- pthread_mutex_unlock(&p->mutex);
- return ret;
- }
+ av_packet_unref(&p->avpkt);
+ av_packet_ref(&p->avpkt, avpkt);
p->state = STATE_SETTING_UP;
pthread_cond_signal(&p->input_cond);
@@ -599,9 +580,7 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
pthread_cond_destroy(&p->input_cond);
pthread_cond_destroy(&p->progress_cond);
pthread_cond_destroy(&p->output_cond);
- av_packet_free_side_data(&p->avpkt);
- av_buffer_unref(&p->avpkt.buf);
- av_freep(&p->buf);
+ av_packet_unref(&p->avpkt);
av_freep(&p->released_buffers);
if (i) {