[FFmpeg-devel] [PATCH 11/17] avformat/evc: don't use an AVIOContext as log context

James Almer jamrial at gmail.com
Mon Jun 19 02:43:26 EEST 2023


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/evc_parse.h | 3 ++-
 libavformat/evc.c      | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/evc_parse.h b/libavcodec/evc_parse.h
index a1fbbc643d..677e01a64a 100644
--- a/libavcodec/evc_parse.h
+++ b/libavcodec/evc_parse.h
@@ -105,7 +105,8 @@ static inline uint32_t evc_read_nal_unit_length(const uint8_t *bits, int bits_si
     uint32_t nalu_len = 0;
 
     if (bits_size < EVC_NALU_LENGTH_PREFIX_SIZE) {
-        av_log(logctx, AV_LOG_ERROR, "Can't read NAL unit length\n");
+        if (logctx) // Don't log without a context
+            av_log(logctx, AV_LOG_ERROR, "Can't read NAL unit length\n");
         return 0;
     }
 
diff --git a/libavformat/evc.c b/libavformat/evc.c
index dc75ccb56d..a7cc6167e8 100644
--- a/libavformat/evc.c
+++ b/libavformat/evc.c
@@ -359,7 +359,7 @@ int ff_isom_write_evcc(AVIOContext *pb, const uint8_t *data,
     evcc_init(&evcc);
 
     while (bytes_to_read > EVC_NALU_LENGTH_PREFIX_SIZE) {
-        nalu_size = evc_read_nal_unit_length(data, EVC_NALU_LENGTH_PREFIX_SIZE, pb);
+        nalu_size = evc_read_nal_unit_length(data, EVC_NALU_LENGTH_PREFIX_SIZE, NULL);
         if (nalu_size == 0) break;
 
         data += EVC_NALU_LENGTH_PREFIX_SIZE;
@@ -367,7 +367,7 @@ int ff_isom_write_evcc(AVIOContext *pb, const uint8_t *data,
 
         if (bytes_to_read < nalu_size) break;
 
-        nalu_type = evc_get_nalu_type(data, bytes_to_read, pb);
+        nalu_type = evc_get_nalu_type(data, bytes_to_read, NULL);
 
         // @see ISO/IEC 14496-15:2021 Coding of audio-visual objects - Part 15: section 12.3.3.3
         // NAL_unit_type indicates the type of the NAL units in the following array (which shall be all of that type);
-- 
2.41.0



More information about the ffmpeg-devel mailing list