[FFmpeg-cvslog] lavf/daudenc: clarify error messages

Stefano Sabatini git at videolan.org
Wed Jan 24 01:21:35 EET 2024


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Sat Jan 20 15:08:49 2024 +0100| [bba784d60401e0d2f669cd79799c434ba0357deb] | committer: Stefano Sabatini

lavf/daudenc: clarify error messages

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bba784d60401e0d2f669cd79799c434ba0357deb
---

 libavformat/daudenc.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/libavformat/daudenc.c b/libavformat/daudenc.c
index 2d84b16650..37c20618bd 100644
--- a/libavformat/daudenc.c
+++ b/libavformat/daudenc.c
@@ -25,8 +25,21 @@
 static int daud_init(struct AVFormatContext *s)
 {
     AVCodecParameters *par = s->streams[0]->codecpar;
-    if (par->ch_layout.nb_channels != 6 || par->sample_rate != 96000)
+
+    if (par->ch_layout.nb_channels != 6) {
+        av_log(s, AV_LOG_ERROR,
+               "Invalid number of channels %d, must be exactly 6\n",
+               par->ch_layout.nb_channels);
+        return AVERROR(EINVAL);
+    }
+
+    if (par->sample_rate != 96000) {
+        av_log(s, AV_LOG_ERROR,
+               "Invalid sample rate %d, must be 96000\n",
+               par->sample_rate);
         return AVERROR(EINVAL);
+    }
+
     return 0;
 }
 
@@ -34,7 +47,8 @@ static int daud_write_packet(struct AVFormatContext *s, AVPacket *pkt)
 {
     if (pkt->size > 65535) {
         av_log(s, AV_LOG_ERROR,
-               "Packet size too large for s302m. (%d > 65535)\n", pkt->size);
+               "Packet size %d too large for s302m, must be <= 65535.\n",
+               pkt->size);
         return AVERROR_INVALIDDATA;
     }
     avio_wb16(s->pb, pkt->size);



More information about the ffmpeg-cvslog mailing list