diff options
author | Paul B Mahol <onemda@gmail.com> | 2013-07-04 20:17:38 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2013-07-04 20:17:38 +0000 |
commit | d1c96b28d7b6c9db9a6c5d19d33b41311bbe2ca6 (patch) | |
tree | eaac4e65ece24fc830080b385729cdeb0f08e0d4 | |
parent | dda8afc391798e345c73f857f8e0fb8424ceb77b (diff) | |
download | ffmpeg-d1c96b28d7b6c9db9a6c5d19d33b41311bbe2ca6.tar.gz |
libstagefright: port to refcounted frames
Untested.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r-- | libavcodec/libstagefright.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/libavcodec/libstagefright.cpp b/libavcodec/libstagefright.cpp index d02e6f32ac..bb49d8a625 100644 --- a/libavcodec/libstagefright.cpp +++ b/libavcodec/libstagefright.cpp @@ -186,7 +186,7 @@ void* decode_thread(void *arg) buffer->release(); goto push_frame; } - ret = ff_get_buffer(avctx, frame->vframe, 0); + ret = ff_get_buffer(avctx, frame->vframe, AV_GET_BUFFER_FLAG_REF); if (ret < 0) { frame->status = ret; decode_done = 1; @@ -457,10 +457,8 @@ static int Stagefright_decode_frame(AVCodecContext *avctx, void *data, return -1; } - if (s->prev_frame) { - avctx->release_buffer(avctx, s->prev_frame); - av_freep(&s->prev_frame); - } + if (s->prev_frame) + av_frame_free(&s->prev_frame); s->prev_frame = ret_frame; *got_frame = 1; @@ -482,10 +480,8 @@ static av_cold int Stagefright_close(AVCodecContext *avctx) while (!s->out_queue->empty()) { frame = *s->out_queue->begin(); s->out_queue->erase(s->out_queue->begin()); - if (frame->vframe) { - avctx->release_buffer(avctx, frame->vframe); - av_freep(&frame->vframe); - } + if (frame->vframe) + av_frame_free(&frame->vframe); av_freep(&frame); } pthread_mutex_unlock(&s->out_mutex); @@ -515,10 +511,8 @@ static av_cold int Stagefright_close(AVCodecContext *avctx) pthread_join(s->decode_thread_id, NULL); - if (s->prev_frame) { - avctx->release_buffer(avctx, s->prev_frame); - av_freep(&s->prev_frame); - } + if (s->prev_frame) + av_frame_free(&s->prev_frame); s->thread_started = false; } @@ -534,10 +528,8 @@ static av_cold int Stagefright_close(AVCodecContext *avctx) while (!s->out_queue->empty()) { frame = *s->out_queue->begin(); s->out_queue->erase(s->out_queue->begin()); - if (frame->vframe) { - avctx->release_buffer(avctx, frame->vframe); - av_freep(&frame->vframe); - } + if (frame->vframe) + av_frame_free(&frame->vframe); av_freep(&frame); } |