diff mbox series

[FFmpeg-devel,3/3] avformat/utils: Set stream side-data size even without side-data

Message ID 20200522012431.29918-3-andreas.rheinhardt@gmail.com
State Accepted
Commit 38490cbeb3a48dd488f10a72efc8d8e3f8883ac4
Headers show
Series [FFmpeg-devel,1/3] avformat/matroskaenc: Don't use stream side-data size
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt May 22, 2020, 1:24 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
Was the earlier behaviour actually a bug (I think so) or is this new
behaviour something that should be explicitly documented?

Btw, the stream and packet side-data APIs differ in two more ways:
av_packet_new_side_data() adds padding to the buffer and zeroes it
whereas av_stream_new_side_data() does not. Should this be unified?

 libavformat/utils.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Anton Khirnov May 22, 2020, 8:34 a.m. UTC | #1
Quoting Andreas Rheinhardt (2020-05-22 03:24:31)
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
> Was the earlier behaviour actually a bug (I think so) or is this new
> behaviour something that should be explicitly documented?
> 
> Btw, the stream and packet side-data APIs differ in two more ways:
> av_packet_new_side_data() adds padding to the buffer and zeroes it
> whereas av_stream_new_side_data() does not. Should this be unified?

Given that the side data can be extradata, I'd say yes to padding.

For zeroing, not sure. The caller should fill the data completely, so
zeroing it may hide missed initialization.
diff mbox series

Patch

diff --git a/libavformat/utils.c b/libavformat/utils.c
index e6158d8058..b12aff5eb0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -5507,6 +5507,8 @@  uint8_t *av_stream_get_side_data(const AVStream *st,
             return st->side_data[i].data;
         }
     }
+    if (size)
+        *size = 0;
     return NULL;
 }