Browse Source

frame-mt: return consumed packet size in ff_thread_decode_frame

This is required to fulfill avcodec_decode_video2() promise to return
the number of consumed bytes on success.
tags/n0.9
Janne Grunau 14 years ago
parent
commit
117e2a30f2
2 changed files with 6 additions and 2 deletions
  1. +3
    -2
      libavcodec/pthread.c
  2. +3
    -0
      libavcodec/thread.h

+ 3
- 2
libavcodec/pthread.c View File

@@ -522,7 +522,7 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
if (fctx->next_decoding >= (avctx->thread_count-1)) fctx->delaying = 0;

*got_picture_ptr=0;
return 0;
return avpkt->size;
}

/*
@@ -563,7 +563,8 @@ int ff_thread_decode_frame(AVCodecContext *avctx,

fctx->next_finished = finished;

return p->result;
/* return the size of the consumed packet if no error occurred */
return (p->result >= 0) ? avpkt->size : p->result;
}

void ff_thread_report_progress(AVFrame *f, int n, int field)


+ 3
- 0
libavcodec/thread.h View File

@@ -42,6 +42,9 @@ void ff_thread_flush(AVCodecContext *avctx);
* Submits a new frame to a decoding thread.
* Returns the next available frame in picture. *got_picture_ptr
* will be 0 if none is available.
* The return value on success is the size of the consumed packet for
* compatiblity with avcodec_decode_video2(). This means the decoder
* has to consume the full packet.
*
* Parameters are the same as avcodec_decode_video2().
*/


Loading…
Cancel
Save