[FFmpeg-cvslog] adts: Return more meaningful error codes

Nidhi Makhijani git at videolan.org
Thu Aug 21 22:02:52 CEST 2014


ffmpeg | branch: master | Nidhi Makhijani <nidhimj22 at gmail.com> | Fri Aug 15 17:25:24 2014 +0530| [13c90bc9a359e969cc2b7f7e8199b02a0e4c6ec9] | committer: Diego Biurrun

adts: Return more meaningful error codes

Signed-off-by: Diego Biurrun <diego at biurrun.de>

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

 libavformat/adtsenc.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index bf7a62a..5194e75 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -57,23 +57,23 @@ static int adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t
 
     if (adts->objecttype > 3U) {
         av_log(s, AV_LOG_ERROR, "MPEG-4 AOT %d is not allowed in ADTS\n", adts->objecttype+1);
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
     if (adts->sample_rate_index == 15) {
         av_log(s, AV_LOG_ERROR, "Escape sample rate index illegal in ADTS\n");
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
     if (get_bits(&gb, 1)) {
         av_log(s, AV_LOG_ERROR, "960/120 MDCT window is not allowed in ADTS\n");
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
     if (get_bits(&gb, 1)) {
         av_log(s, AV_LOG_ERROR, "Scalable configurations are not allowed in ADTS\n");
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
     if (get_bits(&gb, 1)) {
         av_log(s, AV_LOG_ERROR, "Extension flag is not allowed in ADTS\n");
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
     if (!adts->channel_conf) {
         init_put_bits(&pb, adts->pce_data, MAX_PCE_SIZE);
@@ -93,9 +93,9 @@ static int adts_write_header(AVFormatContext *s)
     ADTSContext *adts = s->priv_data;
     AVCodecContext *avc = s->streams[0]->codec;
 
-    if (avc->extradata_size > 0 &&
-            adts_decode_extradata(s, adts, avc->extradata, avc->extradata_size) < 0)
-        return -1;
+    if (avc->extradata_size > 0)
+        return adts_decode_extradata(s, adts, avc->extradata,
+                                     avc->extradata_size);
 
     return 0;
 }



More information about the ffmpeg-cvslog mailing list