[FFmpeg-devel,09/37] avformat/matroskadec: Remove redundant initialization

Submitted by Andreas Rheinhardt on May 16, 2019, 10:29 p.m.

Details

Message ID 20190516223018.30827-10-andreas.rheinhardt@gmail.com
State New
Headers show

Commit Message

Andreas Rheinhardt May 16, 2019, 10:29 p.m.
Every new element of an EbmlList is zeroed initially in
ebml_parse_elem, so that in particular a SimpleBlock's duration is
initialized to zero. Therefore it is unnecessary to initialize this
field again (for SimpleBlocks) in matroska_parse_cluster_incremental.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/matroskadec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

James Almer June 23, 2019, 4:16 a.m.
On 5/16/2019 7:29 PM, Andreas Rheinhardt wrote:
> Every new element of an EbmlList is zeroed initially in
> ebml_parse_elem, so that in particular a SimpleBlock's duration is
> initialized to zero. Therefore it is unnecessary to initialize this
> field again (for SimpleBlocks) in matroska_parse_cluster_incremental.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/matroskadec.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index 0f9d55566f..34bc86f25f 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -3516,8 +3516,7 @@ static int matroska_parse_cluster_incremental(MatroskaDemuxContext *matroska)
>              int is_keyframe = blocks[i].non_simple ? blocks[i].reference == INT64_MIN : -1;
>              uint8_t* additional = blocks[i].additional.size > 0 ?
>                                      blocks[i].additional.data : NULL;
> -            if (!blocks[i].non_simple)
> -                blocks[i].duration = 0;
> +
>              res = matroska_parse_block(matroska, blocks[i].bin.buf, blocks[i].bin.data,
>                                         blocks[i].bin.size, blocks[i].bin.pos,
>                                         matroska->current_cluster.timecode,

Applied, thanks.

Patch hide | download patch | download mbox

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 0f9d55566f..34bc86f25f 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3516,8 +3516,7 @@  static int matroska_parse_cluster_incremental(MatroskaDemuxContext *matroska)
             int is_keyframe = blocks[i].non_simple ? blocks[i].reference == INT64_MIN : -1;
             uint8_t* additional = blocks[i].additional.size > 0 ?
                                     blocks[i].additional.data : NULL;
-            if (!blocks[i].non_simple)
-                blocks[i].duration = 0;
+
             res = matroska_parse_block(matroska, blocks[i].bin.buf, blocks[i].bin.data,
                                        blocks[i].bin.size, blocks[i].bin.pos,
                                        matroska->current_cluster.timecode,