[FFmpeg-devel] [PATCH 2/2] ffmpeg: use thread message API.

Clément Bœsch u at pkh.me
Thu Feb 20 16:40:13 CET 2014


On Thu, Feb 20, 2014 at 04:22:14PM +0100, Nicolas George wrote:
> Signed-off-by: Nicolas George <george at nsup.org>
> ---
>  ffmpeg.c | 98 ++++++++++++++++++----------------------------------------------
>  ffmpeg.h |  5 ++--
>  2 files changed, 29 insertions(+), 74 deletions(-)
> 
> 
> This applies on top of "ffmpeg: make reading packets from thread blocking.",
> because the logic to determine if the file should be non-blocking is still
> used.
> 
> This makes the helgrind error disappear.
> 

\o/

> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index 28bebe5..d3defff 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -59,6 +59,7 @@
>  #include "libavutil/timestamp.h"
>  #include "libavutil/bprint.h"
>  #include "libavutil/time.h"
> +#include "libavutil/threadmessage.h"
>  #include "libavformat/os_support.h"
>  
>  #include "libavformat/ffm.h" // not public API
> @@ -137,11 +138,6 @@ AVIOContext *progress_avio = NULL;
>  
>  static uint8_t *subtitle_out;
>  
> -#if HAVE_PTHREADS
> -/* signal to input threads that they should exit; set by the main thread */
> -static int transcoding_finished;
> -#endif
> -
>  #define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
>  
>  InputStream **input_streams = NULL;
> @@ -2943,32 +2939,31 @@ static void *input_thread(void *arg)
>      InputFile *f = arg;
>      int ret = 0;
>  
> -    while (!transcoding_finished && ret >= 0) {
> +    while (1) {

No risk by having this loop entered once while it previously wouldn't
have? (like typically in case of a premature error?)

>          AVPacket pkt;
>          ret = av_read_frame(f->ctx, &pkt);
>  
[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140220/37f87830/attachment.asc>


More information about the ffmpeg-devel mailing list