aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2013-06-03 14:43:18 +0000
committerPaul B Mahol <onemda@gmail.com>2013-06-05 22:35:31 +0000
commitd5f7f1fef157e0f1dccaf6e39b40e8e3a63c3ef0 (patch)
treed3d75f3c960499c7bbf1441a1ea89499afb60b67 /libavcodec/utils.c
parent258a05b21684d7565f1b8e64e97cb22ac1394774 (diff)
downloadffmpeg-d5f7f1fef157e0f1dccaf6e39b40e8e3a63c3ef0.tar.gz
audio frame multi-threaded decoding
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e0aea28ecd..01e3fbd0dd 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2075,7 +2075,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
if (!avctx->refcounted_frames)
av_frame_unref(&avci->to_free);
- if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size) {
+ if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type & FF_THREAD_FRAME)) {
uint8_t *side;
int side_size;
// copy to ensure we do not change avpkt
@@ -2084,11 +2084,15 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
apply_param_change(avctx, &tmp);
avctx->pkt = &tmp;
- ret = avctx->codec->decode(avctx, frame, got_frame_ptr, &tmp);
+ if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
+ ret = ff_thread_decode_frame(avctx, frame, got_frame_ptr, &tmp);
+ else {
+ ret = avctx->codec->decode(avctx, frame, got_frame_ptr, &tmp);
+ frame->pkt_dts = avpkt->dts;
+ }
if (ret >= 0 && *got_frame_ptr) {
add_metadata_from_side_data(avctx, frame);
avctx->frame_number++;
- frame->pkt_dts = avpkt->dts;
av_frame_set_best_effort_timestamp(frame,
guess_correct_pts(avctx,
frame->pkt_pts,