vlc | branch: master | Steve Lhomme <[email protected]> | Thu Sep 17 14:32:18 2020 +0200| [35903fdebc69459981e9196173ac69e197282736] | committer: Steve Lhomme
transcode: simplify the picture queue tail handling Rather than a pointer on the last picture pointer, we use either NULL (no tail/chain empty) or a pointer to the last picture in the chain. Make sure that the pictures we queue don't have a p_next otherwise it would screw the computation of the last. (the issue existed before this patch) > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=35903fdebc69459981e9196173ac69e197282736 --- modules/stream_out/transcode/transcode.h | 2 +- modules/stream_out/transcode/video.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/stream_out/transcode/transcode.h b/modules/stream_out/transcode/transcode.h index 0ca725d46b..315c5173a0 100644 --- a/modules/stream_out/transcode/transcode.h +++ b/modules/stream_out/transcode/transcode.h @@ -89,7 +89,7 @@ struct sout_stream_id_sys_t { struct { picture_t *first; - picture_t **last; + picture_t *tail; } pic; struct { subpicture_t *first; diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c index ed00436349..1bcbfb9d38 100644 --- a/modules/stream_out/transcode/video.c +++ b/modules/stream_out/transcode/video.c @@ -150,8 +150,12 @@ static void decoder_queue_video( decoder_t *p_dec, picture_t *p_pic ) sout_stream_id_sys_t *id = p_owner->id; vlc_mutex_lock(&id->fifo.lock); - *id->fifo.pic.last = p_pic; - id->fifo.pic.last = &p_pic->p_next; + if (id->fifo.pic.first == NULL) + id->fifo.pic.first = p_pic; + else + id->fifo.pic.tail->p_next = p_pic; + id->fifo.pic.tail = p_pic; + assert(p_pic->p_next == NULL); vlc_mutex_unlock(&id->fifo.lock); } @@ -160,7 +164,7 @@ static picture_t *transcode_dequeue_all_pics( sout_stream_id_sys_t *id ) vlc_mutex_lock(&id->fifo.lock); picture_t *p_pics = id->fifo.pic.first; id->fifo.pic.first = NULL; - id->fifo.pic.last = &id->fifo.pic.first; + id->fifo.pic.tail = NULL; vlc_mutex_unlock(&id->fifo.lock); return p_pics; @@ -174,7 +178,7 @@ int transcode_video_init( sout_stream_t *p_stream, const es_format_t *p_fmt, (char*)&p_fmt->i_codec, (char*)&id->p_enccfg->i_codec ); id->fifo.pic.first = NULL; - id->fifo.pic.last = &id->fifo.pic.first; + id->fifo.pic.tail = NULL; id->b_transcode = true; es_format_Init( &id->decoder_out, VIDEO_ES, 0 ); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
