mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
libstagefright: port to refcounted frames
Untested. Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
dda8afc391
commit
d1c96b28d7
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user