On Fri, 1 Apr 2016 17:47:45 +0200 Michael Niedermayer <mich...@niedermayer.cc> wrote:
> On Fri, Apr 01, 2016 at 05:27:11PM +0200, Michael Niedermayer wrote: > > On Fri, Apr 01, 2016 at 04:53:55PM +0200, wm4 wrote: > > > On Fri, 1 Apr 2016 16:44:42 +0200 > > > Paul B Mahol <one...@gmail.com> wrote: > > > > > > > It should set it because it is not sane format. > > > > > > I mean, why do we want to keep this message, if it obviously didn't > > > help with anything? > > > > it is useful for debuging and to prevent invalid files from being > > created > > to elaborate on this > If a demuxer returns an AVPacket with multiple frames in it and that > gets stored in a output file then the output file is invalid with > no indication that it is. Such file would likely play fine on some > players and fail on others. Thats a really serious problem for the > user as even if he tests the output file by playing it he possibly > wont notice a problem > > With the multiple subframes message decoding both the original file > with the buggy demuxer as well as playing the newly created output > file would likely show warnings that would point at the problem > (which might be a forgotten needs_parsing in the demuxer) > > I belive its important to keep some means to detect this kind of > problem. Also as it is easy to set the parsing stuff up wrongly > a reverse engeneered container might appear to store 1 mp3 frame per > packet but that might then turn out false on analysis of a wider > range of files ... > > [...] > Anyway, the attached patch probably works. I didn't bother with silencing subsequent warnings. Spams log messages when playing shorten.
>From 784c19cfae60be3ef0cab78bf0b0333d36ec4c32 Mon Sep 17 00:00:00 2001 From: wm4 <nfx...@googlemail.com> Date: Fri, 1 Apr 2016 14:08:17 +0200 Subject: ffmpeg: move subframe warning to libavcodec With the new decode API, doing this in ffmpeg.c is impractical. There was resistance against removing the warning, so put it into libavcodec. Not bothering with reducing the warning to verbose log level for subsequent wanrings. The warning should be rare, and only happen when developing new codecs for the old API. diff --git a/ffmpeg.c b/ffmpeg.c index 9a14294..bdb0e5e 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -2316,13 +2316,6 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo ist->pts = ist->next_pts; ist->dts = ist->next_dts; - if (avpkt.size && avpkt.size != pkt->size && - !(ist->dec->capabilities & AV_CODEC_CAP_SUBFRAMES)) { - av_log(NULL, ist->showed_multi_packet_warning ? AV_LOG_VERBOSE : AV_LOG_WARNING, - "Multiple frames in a packet from stream %d\n", pkt->stream_index); - ist->showed_multi_packet_warning = 1; - } - switch (ist->dec_ctx->codec_type) { case AVMEDIA_TYPE_AUDIO: ret = decode_audio (ist, &avpkt, &got_output); diff --git a/ffmpeg.h b/ffmpeg.h index 403b098..377822c 100644 --- a/ffmpeg.h +++ b/ffmpeg.h @@ -283,7 +283,6 @@ typedef struct InputStream { double ts_scale; int saw_first_ts; - int showed_multi_packet_warning; AVDictionary *decoder_opts; AVRational framerate; /* framerate forced with -r */ int top_field_first; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 27c1123..937148a 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2416,6 +2416,9 @@ fail: av_frame_unref(frame); } + if (ret >= 0 && ret != avpkt->size && !(avctx->codec->capabilities & AV_CODEC_CAP_SUBFRAMES)) + av_log(avctx, AV_LOG_WARNING, "Multiple frames in a packet.\n"); + return ret; }
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel