Re: [FFmpeg-devel] [PATCH] AAC sequence header data setup if stream copy
On Wed, Nov 18, 2015 at 05:04:06PM +0200, Maksym Veremeyenko wrote: > Hi, > > FLV remuxed from MPEG-TS stream does not contains *AAC sequence > header* as result no audio with some RTMP servers like *crtmpserver* > and YouTube. > > I am not a first who faced with such problem: > http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2014-May/157791.html > http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2014-June/158342.html > > Proposed solution differ from *Tudor SUCIU* a bit. It use the same > idea but implementation was taken from > *ff_aac_put_audio_specific_config*. > > Attached patch implement setting *AAC sequence header* in two ways. > First way is just to set given bytes into that header: > > ffmpeg -re -f mpegts -i /usr/local/src/2015-11-15/M1_award.ts > -acodec copy -vcodec copy -bsf:a aac_adtstoasc -aac_seq_header_data > "1190" -flags +global_header -f flv rtmp://127.0.0.1/live/demo > > 11 90 is a two bytes of *AAC sequence header* that describe > AAC/LC+48000Hz+stereo > > another way is just build it from encoder parameters: > > ffmpeg -re -f mpegts -i /usr/local/src/2015-11-15/M1_award.ts > -acodec copy -vcodec copy -bsf:a aac_adtstoasc -flvflags > aac_seq_header_detect -flags +global_header -f flv > rtmp://127.0.0.1/live/demo > > but it require copying *profile* value from decoder context in ffmpeg.c: > > diff --git a/ffmpeg.c b/ffmpeg.c > index c4e9280..a976f61 100644 > --- a/ffmpeg.c > +++ b/ffmpeg.c > @@ -2970,6 +2970,7 @@ static int transcode_init(void) > enc_ctx->audio_service_type = dec_ctx->audio_service_type; > enc_ctx->block_align= dec_ctx->block_align; > enc_ctx->initial_padding= dec_ctx->delay; > +enc_ctx->profile= dec_ctx->profile; > #if FF_API_AUDIOENC_DELAY > enc_ctx->delay = dec_ctx->delay; > #endif > > both methods makes possible to work with *crtmpserver* and YouTube > by simple remuxing streams for publishing > > -- > Maksym Veremeyenko > ffmpeg.c |1 > libavformat/flvenc.c | 53 > +++ > 2 files changed, 54 insertions(+) > ebc7cedea320684411a4a4c7f6a962c939612db0 > 0001-AAC-sequence-header-data-setup-if-stream-copy.patch > From afdc10c4f496d1e72a3b955513cf6891767d731a Mon Sep 17 00:00:00 2001 > From: Maksym Veremeyenko> Date: Tue, 17 Nov 2015 20:02:22 +0200 > Subject: [PATCH] AAC sequence header data setup if stream copy > > --- > ffmpeg.c |1 + > libavformat/flvenc.c | 53 > ++ > 2 files changed, 54 insertions(+), 0 deletions(-) > > diff --git a/ffmpeg.c b/ffmpeg.c > index c4e9280..a976f61 100644 > --- a/ffmpeg.c > +++ b/ffmpeg.c > @@ -2970,6 +2970,7 @@ static int transcode_init(void) > enc_ctx->audio_service_type = dec_ctx->audio_service_type; > enc_ctx->block_align= dec_ctx->block_align; > enc_ctx->initial_padding= dec_ctx->delay; > +enc_ctx->profile= dec_ctx->profile; > #if FF_API_AUDIOENC_DELAY > enc_ctx->delay = dec_ctx->delay; > #endif > diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c > index e217ba8..6380fd7 100644 > --- a/libavformat/flvenc.c > +++ b/libavformat/flvenc.c > @@ -28,6 +28,9 @@ > #include "flv.h" > #include "internal.h" > #include "metadata.h" > +#include "libavutil/opt.h" > +#include "libavcodec/put_bits.h" > +#include "libavcodec/aacenctab.h" > > > static const AVCodecTag flv_video_codec_ids[] = { > @@ -68,6 +71,10 @@ typedef struct FLVContext { > AVCodecContext *video_enc; > double framerate; > AVCodecContext *data_enc; > + > +uint8_t *aac_seq_header_data; > +int aac_seq_header_length; > +int flags; > } FLVContext; > > typedef struct FLVStreamContext { > @@ -452,6 +459,37 @@ static int flv_write_header(AVFormatContext *s) > if (enc->codec_id == AV_CODEC_ID_AAC) { > avio_w8(pb, get_audio_flags(s, enc)); > avio_w8(pb, 0); // AAC sequence header > +if (!enc->extradata_size && flv->aac_seq_header_data) > +{ > +avio_write(pb, flv->aac_seq_header_data, > flv->aac_seq_header_length); > + > +av_log(s, AV_LOG_WARNING, "AAC sequence header > length=%d\n", flv->aac_seq_header_length); > +} > +else if (!enc->extradata_size && !flv->aac_seq_header_data > && flv->flags & 1) > +{ > +PutBitContext pbc; > +int samplerate_index; > +int channels = flv->audio_enc->channels - > (flv->audio_enc->channels == 8 ? 1 : 0); > +uint8_t data[2]; > + > +for (samplerate_index = 0; samplerate_index < 16; > samplerate_index++) > +if
Re: [FFmpeg-devel] UDP constant bitrate feature (cbr)
On Tue, Nov 17, 2015 at 03:06:27PM -0800, Zach Swena wrote: > Hi Pavel, > > I can confirm that there is a problem with the UDP packet engine in > FFmpeg. FFmpeg has excessive jitter in it's UDP streaming output to the > point where hardware decoders can't handle it. My solution was to buffer > to disk and have my own program read and send the datagrams via a very > tight event loop. While increasing the PCR period is not a bad thing, > FFmpeg really should stream at a more consistant rate. Can someone explain > the theory behind how the UDP rate control is currently implemented in > FFmpeg? PCR sounds like a good way to tell when to send a packet, except > not every packet contains one. If FFmpeg uses PCR to tell how long to wait > to send a packet, then do the packets in between go at line speed? I plan > on taking a look at the code that does this, but I would really appreciate > it if someone who knows the code could explain the theory as I usually deal > with a slightly different dev setup. i suggest you read the mpeg specs, they detail when things should be sent down to each byte IIRC also IIRC its not that complicated, more like timestamp + bytepos/rate [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I know you won't believe me, but the highest form of Human Excellence is to question oneself and others. -- Socrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 01/13] Rename mipsdspr1 to mipsdsp
On Wed, Nov 18, 2015 at 11:13:37AM +, Vicente Olivert Riera wrote: > Signed-off-by: Vicente Olivert Riera> --- > Changes v1 -> v2: > - Remove a block of code for mipsdspr2 which wasn't intended to be in >this patch and it was causing a syntax error in the configure script. >Highlighted by Michael Niedermayer: >https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183444.html > > Makefile |2 +- > arch.mak |2 +- > configure | 28 ++-- > libavcodec/aacenc.c |2 +- > libavcodec/mips/Makefile |4 ++-- > libavcodec/mips/ac3dsp_mips.c |4 ++-- > libavcodec/mips/mpegaudiodsp_mips_fixed.c |2 +- > libavcodec/mpegaudiodec_template.c|4 ++-- > libavcodec/mpegaudiodsp.c |2 +- > libavcodec/mpegaudiodsp.h |2 +- > 10 files changed, 26 insertions(+), 26 deletions(-) Changed or removed configure options should be documented not sure where but maybe some release notes [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Rewriting code that is poorly written but fully understood is good. Rewriting code that one doesnt understand is a sign that one is less smart then the original author, trying to rewrite it will not make it better. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 02/13] Remove --mips32r5 configure option
Dear Michael Niedermayer, On 11/18/2015 04:59 PM, Michael Niedermayer wrote: > On Wed, Nov 18, 2015 at 11:13:38AM +, Vicente Olivert Riera wrote: >> Having a configure option with the same name as a MIPS ISA is confusing, >> so better to remove it. This option was being used to add some >> optimizations to a specific core (p5600). We will add the optimizations >> just when the p5600 core has been detected, in a later patch. >> >> Signed-off-by: Vicente Olivert Riera>> --- >> Changes v1 -> v2: >> - Nothing. > > If a patch didnt change and was previously approved, please add a > Reviewed-by: or Approved-by: or somethig equivalent to the commit > message, so readers, developers and reveiwers know that it has already > been reviewed Nobody replied to my emails with a "Reviewed-by:" tag, that's why I haven't added it in my v2. Regards, Vincent. > > [...] > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 02/13] Remove --mips32r5 configure option
On Wed, Nov 18, 2015 at 11:13:38AM +, Vicente Olivert Riera wrote: > Having a configure option with the same name as a MIPS ISA is confusing, > so better to remove it. This option was being used to add some > optimizations to a specific core (p5600). We will add the optimizations > just when the p5600 core has been detected, in a later patch. > > Signed-off-by: Vicente Olivert Riera> --- > Changes v1 -> v2: > - Nothing. If a patch didnt change and was previously approved, please add a Reviewed-by: or Approved-by: or somethig equivalent to the commit message, so readers, developers and reveiwers know that it has already been reviewed [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] UDP constant bitrate feature (cbr)
> i suggest you read the mpeg specs, they detail when things should be > sent down to each byte IIRC > also IIRC its not that complicated, more like timestamp + bytepos/rate Only for strict CBR streams which FFmpeg cannot know a priori. That's why the only correct way is to index the stream as it's received and play out at a smooth rate like multicat does. Kieran ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] movenc-test: Pad the packet data start with 0s
On Tue, Nov 17, 2015 at 04:00:30PM +, Derek Buitenhuis wrote: > This way, it never starts with 0xFFF0, and never trips the > ADTS "Detection" code in movenc.c. > > Signed-off-by: Derek Buitenhuis> --- > libavformat/movenc-test.c | 4 ++-- > tests/ref/fate/movenc | 40 > 2 files changed, 22 insertions(+), 22 deletions(-) > > diff --git a/libavformat/movenc-test.c b/libavformat/movenc-test.c > index 8132bab..ceaebca 100644 > --- a/libavformat/movenc-test.c > +++ b/libavformat/movenc-test.c > @@ -215,7 +215,7 @@ static void mux_frames(int n) > int end_frames = frames + n; > while (1) { > AVPacket pkt; > -uint8_t pktdata[4]; > +uint8_t pktdata[8] = { 0 }; > av_init_packet(); > > if (av_compare_ts(audio_dts, audio_st->time_base, video_dts, > video_st->time_base) < 0) { > @@ -257,7 +257,7 @@ static void mux_frames(int n) > > if (clear_duration) > pkt.duration = 0; > -AV_WB32(pktdata, pkt.pts); > +AV_WB32(pktdata + 4, pkt.pts); > pkt.data = pktdata; > pkt.size = 4; this looks a bit strange doesnt this write the PTS into bytes which are never used or read? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Awnsering whenever a program halts or runs forever is On a turing machine, in general impossible (turings halting problem). On any real computer, always possible as a real computer has a finite number of states N, and will either halt in less than N cycles or never halt. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec: add OpenJPEG 2.x compatibility
On Tue, Nov 17, 2015 at 07:27:55AM -0800, Michael Bradshaw wrote: > Hi, > > Attached patch adds support for OpenJPEG 2.0/2.1. Please review. > > Thanks, > > Michael Bradshaw > configure |5 > libavcodec/libopenjpegdec.c | 173 > libavcodec/libopenjpegenc.c | 269 > +--- > 3 files changed, 382 insertions(+), 65 deletions(-) > 4e7c94ca16fa09210c4d74a4cf589ae9db540e9a > 0001-avcodec-add-OpenJPEG-2.x-compatibility.patch > From 1cdf996b7fdaed429731054e96f9e6b565c9436d Mon Sep 17 00:00:00 2001 > From: Michael Bradshaw> Date: Sun, 1 Nov 2015 19:11:12 -0800 > Subject: [PATCH] avcodec: add OpenJPEG 2.x compatibility this seems breaking the decoder ./ffmpeg -i matrixbench_mpeg2.mpg -vcodec libopenjpeg -vframes 1 test.j2k ./ffmpeg -strict -2 -vcodec libopenjpeg -i test.j2k -f null - [libopenjpeg @ 0x28f3220] Error decoding codestream header. [j2k_pipe @ 0x28d1bc0] decoding for stream 0 failed [j2k_pipe @ 0x28d1bc0] Could not find codec parameters for stream 0 (Video: jpeg2000, none): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options test.j2k: could not find codec parameters !HAVE_OPENJPEG_2_1_OPENJPEG_H=yes !HAVE_OPENJPEG_2_0_OPENJPEG_H=yes !HAVE_OPENJPEG_1_5_OPENJPEG_H=yes CONFIG_LIBOPENJPEG=yes CONFIG_LIBOPENJPEG_DECODER=yes CONFIG_LIBOPENJPEG_ENCODER=yes ii libopenjpeg-dev 1.3+dfsg-4+squeeze2build0.12.04.1 development files for libopenjpeg2, a JPEG 2000 image library ii libopenjpeg2 1.3+dfsg-4+squeeze2build0.12.04.1 JPEG 2000 image compression/decompression library [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Old school: Use the lowest level language in which you can solve the problem conveniently. New school: Use the highest level language in which the latest supercomputer can solve the problem without the user falling asleep waiting. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec: add OpenJPEG 2.x compatibility
On Wed, Nov 18, 2015 at 6:21 AM, Derek Buitenhuis < derek.buitenh...@gmail.com> wrote: > On 11/17/2015 3:27 PM, Michael Bradshaw wrote: > > Attached patch adds support for OpenJPEG 2.0/2.1. Please review. > > This seems like quite a large change. Does it perhaps warrant its own > file/decoder name? I thought about it, but it shares a lot of functionality with the 1.x code, including program options (the only difference being the OPJ_ prefix in 2.x). I could rip out all the common functionality into some shared libopenjpeg.h/c files, and replace the program options with custom values that each codec then translates into OpenJPEG's option values, and then have two codecs for 1.x and 2.x. The logic in that case will be simpler to follow because there won't be as many macros, but overall it will be a larger change. Opinions? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] movenc-test: Pad the packet data start with 0s
On 11/18/2015 3:15 PM, Michael Niedermayer wrote: > this looks a bit strange > doesnt this write the PTS into bytes which are never used or read? Uh, yep. Need to update size too. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2] movenc-test: Pad the packet data start with 0s
This way, it never starts with 0xFFF0, and never trips the ADTS "Detection" code in movenc.c. Signed-off-by: Derek Buitenhuis--- libavformat/movenc-test.c | 6 +++--- tests/ref/fate/movenc | 40 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/libavformat/movenc-test.c b/libavformat/movenc-test.c index 8132bab..d9c7a1a 100644 --- a/libavformat/movenc-test.c +++ b/libavformat/movenc-test.c @@ -215,7 +215,7 @@ static void mux_frames(int n) int end_frames = frames + n; while (1) { AVPacket pkt; -uint8_t pktdata[4]; +uint8_t pktdata[8] = { 0 }; av_init_packet(); if (av_compare_ts(audio_dts, audio_st->time_base, video_dts, video_st->time_base) < 0) { @@ -257,9 +257,9 @@ static void mux_frames(int n) if (clear_duration) pkt.duration = 0; -AV_WB32(pktdata, pkt.pts); +AV_WB32(pktdata + 4, pkt.pts); pkt.data = pktdata; -pkt.size = 4; +pkt.size = 8; if (skip_write) continue; if (skip_write_audio && pkt.stream_index == 1) diff --git a/tests/ref/fate/movenc b/tests/ref/fate/movenc index dffb30c..3e7fe34 100644 --- a/tests/ref/fate/movenc +++ b/tests/ref/fate/movenc @@ -1,24 +1,24 @@ -167647a7019bb1f134329b22bd4ddcdf 2681 non-empty-moov -8a7595021c11a848ac20ec4f77c9d0bf 3113 non-empty-moov-elst -f9d6b8fce9404a8d2a947badcf65fba6 3049 non-empty-moov-no-elst -d43b8a181c074d94f152e6f03f83abb2 9115 ismv -204d141d70e4801333ab516bb9e1d3fc 2303 empty-moov -5af446fd5e0a7978e8dff9511938ddab 2703 empty-moov-no-elst -ad43cfb415822a0d70db0f11a87ced66 2535 empty-moov-no-elst-no-adjust -204d141d70e4801333ab516bb9e1d3fc 2303 delay-moov -0cf964a5e0908cfb3a023d5c48776ac6 2607 delay-moov-elst -9a6a892af043f1d77b2f5ee6deaadcd7 1858 delay-moov-empty-track -7453fb089ad8799669259cbf559bdb37 1761 delay-moov-empty-track-flush +249e02e3645ea5ca2c74397c62c53314 3269 non-empty-moov +3281ff664e9a06e5a03ec6ea1729696c 3721 non-empty-moov-elst +b408a545b1963a5ea82cf37208b66548 3629 non-empty-moov-no-elst +f717c240ddfc036ed8a635b0af55bac2 11459 ismv +176a315a5385cb2e082d863e0fb22bf1 2891 empty-moov +10eb3fdf6ed1400a1eec50746537159f 3283 empty-moov-no-elst +bcd4d6d22f828f1061e13f3af459644f 3115 empty-moov-no-elst-no-adjust +176a315a5385cb2e082d863e0fb22bf1 2891 delay-moov +1398c80f1f5fd7f8e127bb5b17311016 3203 delay-moov-elst +ed6dd0e0fd6d0d9d1145b201674325f6 2098 delay-moov-empty-track +7f1dabd680135708c6ff359e4ab27165 2001 delay-moov-empty-track-flush 39d798aa11a265c7906f9e11d4f303c0 1159 empty-moov-header -473d94ed152c332015f7e1d327fa855d 996 empty-moov-content +a0165f4a26a409212b0946e981bdefb9 1584 empty-moov-content 39d798aa11a265c7906f9e11d4f303c0 1159 delay-moov-header -473d94ed152c332015f7e1d327fa855d 996 delay-moov-content -64e38d416e9344c8046e37426cdf2807 584 empty-moov-second-frag -64e38d416e9344c8046e37426cdf2807 584 empty-moov-second-frag-discont -64e38d416e9344c8046e37426cdf2807 584 delay-moov-second-frag-discont +a0165f4a26a409212b0946e981bdefb9 1584 delay-moov-content +272a474cfd2a68cc5f05b426b14a2b7d 876 empty-moov-second-frag +272a474cfd2a68cc5f05b426b14a2b7d 876 empty-moov-second-frag-discont +272a474cfd2a68cc5f05b426b14a2b7d 876 delay-moov-second-frag-discont 6256445b9595de78be493e0faf2bc5d7 1219 delay-moov-elst-init -5bcd7237855218554de38044dbd31cda 704 delay-moov-elst-second-frag +fcae8f40e015b59aabc8d4a99a759ca1 996 delay-moov-elst-second-frag 6256445b9595de78be493e0faf2bc5d7 1219 delay-moov-elst-init-discont -5bcd7237855218554de38044dbd31cda 704 delay-moov-elst-second-frag-discont -da0d89d03fa601b40f6a653c8314e333 3615 vfr -da0d89d03fa601b40f6a653c8314e333 3615 vfr-noduration +fcae8f40e015b59aabc8d4a99a759ca1 996 delay-moov-elst-second-frag-discont +6cd6085f4f0ff536acfcb77cb658eb47 4935 vfr +6cd6085f4f0ff536acfcb77cb658eb47 4935 vfr-noduration -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] movenc-test: Pad the packet data start with 0s
On Wed, Nov 18, 2015 at 03:51:16PM +, Derek Buitenhuis wrote: > This way, it never starts with 0xFFF0, and never trips the > ADTS "Detection" code in movenc.c. > > Signed-off-by: Derek Buitenhuis> --- > libavformat/movenc-test.c | 6 +++--- > tests/ref/fate/movenc | 40 > 2 files changed, 23 insertions(+), 23 deletions(-) LGTM thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] UDP constant bitrate feature (cbr)
Yea, how it is supposed to happen isn't complicated. To be of any help, I have to wrap my mind around how FFmpeg currently times the output stream. That mechanism currently does not produce as stable of a transmission rate as multiplexer and decoder hardware requires. Since there is a bounty available for this, it would be nice if someone more qualified could tackle this problem. Until someone steps up, I will be poking at it from my end. I am used to reading c++ intead of c code, so my reading is still a little slow. Fixing this problem will open up new possibilities on how I can use FFmpeg. Zach On Wed, Nov 18, 2015 at 9:03 AM, Michael Niedermayerwrote: > On Tue, Nov 17, 2015 at 03:06:27PM -0800, Zach Swena wrote: > > Hi Pavel, > > > > I can confirm that there is a problem with the UDP packet engine in > > FFmpeg. FFmpeg has excessive jitter in it's UDP streaming output to the > > point where hardware decoders can't handle it. My solution was to buffer > > to disk and have my own program read and send the datagrams via a very > > tight event loop. While increasing the PCR period is not a bad thing, > > FFmpeg really should stream at a more consistant rate. Can someone > explain > > the theory behind how the UDP rate control is currently implemented in > > FFmpeg? PCR sounds like a good way to tell when to send a packet, except > > not every packet contains one. If FFmpeg uses PCR to tell how long to > wait > > to send a packet, then do the packets in between go at line speed? I > plan > > on taking a look at the code that does this, but I would really > appreciate > > it if someone who knows the code could explain the theory as I usually > deal > > with a slightly different dev setup. > > i suggest you read the mpeg specs, they detail when things should be > sent down to each byte IIRC > also IIRC its not that complicated, more like timestamp + bytepos/rate > > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > I know you won't believe me, but the highest form of Human Excellence is > to question oneself and others. -- Socrates > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 03/10] vtenc: Removed trailing whitespace.
From: Rick KernSigned-off-by: Rick Kern --- libavcodec/vtenc.c | 308 ++--- 1 file changed, 154 insertions(+), 154 deletions(-) diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c index f497c38..b363492 100644 --- a/libavcodec/vtenc.c +++ b/libavcodec/vtenc.c @@ -44,20 +44,20 @@ typedef struct BufNode{ typedef struct VTEncContext{ AVClass* class; VTCompressionSessionRef session; - + pthread_mutex_t lock; pthread_cond_t cv_sample_sent; int async_error; - + BufNode* q_head; BufNode* q_tail; - + int64_t frame_ct_out; int64_t frame_ct_in; - + int64_t first_pts; int64_t dts_delta; - + char* profile; char* level; @@ -68,62 +68,62 @@ typedef struct VTEncContext{ static void set_async_error(VTEncContext* vtctx, int err){ pthread_mutex_lock(>lock); - + vtctx->async_error = err; - + BufNode* info = vtctx->q_head; vtctx->q_head = vtctx->q_tail = NULL; - + while(info){ CFRelease(info->cm_buffer); - + BufNode* next = info->next; free(info); info = next; } - + pthread_mutex_unlock(>lock); } static int vtenc_q_pop(VTEncContext* vtctx, bool wait, CMSampleBufferRef* buf){ pthread_mutex_lock(>lock); - + if(vtctx->async_error){ pthread_mutex_unlock(>lock); return vtctx->async_error; } - + if(vtctx->flushing && vtctx->frame_ct_in == vtctx->frame_ct_out){ *buf = NULL; - + pthread_mutex_unlock(>lock); return 0; } - + if(!vtctx->q_head && wait){ pthread_cond_wait(>cv_sample_sent, >lock); } - + if(!vtctx->q_head){ pthread_mutex_unlock(>lock); *buf = NULL; return 0; } - + BufNode* info = vtctx->q_head; vtctx->q_head = vtctx->q_head->next; if(!vtctx->q_head){ vtctx->q_tail = NULL; } - + pthread_mutex_unlock(>lock); - + CMSampleBufferRef buffer = info->cm_buffer; free(info); - + vtctx->frame_ct_out++; *buf = buffer; - + return 0; } @@ -133,19 +133,19 @@ static void vtenc_q_push(VTEncContext* vtctx, CMSampleBufferRef buffer){ CFRetain(buffer); info->cm_buffer = buffer; info->next = NULL; - + pthread_mutex_lock(>lock); pthread_cond_signal(>cv_sample_sent); - + if(!vtctx->q_head){ vtctx->q_head = vtctx->q_tail = info; pthread_mutex_unlock(>lock); return; } - + vtctx->q_tail->next = info; vtctx->q_tail = info; - + pthread_mutex_unlock(>lock); } @@ -177,13 +177,13 @@ static int get_params_info( { size_t total_size = 0; size_t ps_count; - + OSStatus status = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(vid_fmt, 0, NULL, NULL, _count, NULL); if(status){ av_log(avctx, AV_LOG_ERROR, "Error getting parameter set count: %d\n", status); return AVERROR_EXTERNAL; } - + for(size_t i = 0; i < ps_count; i++){ const uint8_t* ps; size_t ps_size; @@ -192,7 +192,7 @@ static int get_params_info( av_log(avctx, AV_LOG_ERROR, "Error getting parameter set size for index %zd: %d\n", i, status); return AVERROR_EXTERNAL; } - + total_size += ps_size + sizeof(start_code); } @@ -212,7 +212,7 @@ static int copy_param_sets( av_log(avctx, AV_LOG_ERROR, "Error getting parameter set count for copying: %d\n", status); return AVERROR_EXTERNAL; } - + size_t offset = 0; for(size_t i = 0; i < ps_count; i++){ const uint8_t* ps; @@ -222,20 +222,20 @@ static int copy_param_sets( av_log(avctx, AV_LOG_ERROR, "Error getting parameter set data for index %zd: %d\n", i, status); return AVERROR_EXTERNAL; } - + size_t next_offset = offset + sizeof(start_code) + ps_size; if(dst_size < next_offset){ av_log(avctx, AV_LOG_ERROR, "Error: buffer too small for parameter sets.\n"); return AVERROR_BUFFER_TOO_SMALL; } - + memcpy(dst + offset, start_code, sizeof(start_code)); offset += sizeof(start_code); - + memcpy(dst + offset, ps, ps_size); offset = next_offset; } - + return 0; } @@ -246,7 +246,7 @@ static int set_extradata(AVCodecContext* avctx, CMSampleBufferRef sample_buffer) av_log(avctx, AV_LOG_ERROR, "No video format.\n"); return AVERROR_EXTERNAL; } - + size_t total_size; int status; status = get_params_info(avctx, vid_fmt, _size); @@ -254,19 +254,19 @@ static int set_extradata(AVCodecContext* avctx, CMSampleBufferRef sample_buffer) av_log(avctx, AV_LOG_ERROR, "Could not get parameter
[FFmpeg-devel] [PATCH v2 02/10] vtenc: Enable hardware encoding on OSX.
From: Rick KernUse correct dictionary key/value to enable hardware encoding on OSX. Signed-off-by: Rick Kern --- libavcodec/vtenc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c index 06c5360..f497c38 100644 --- a/libavcodec/vtenc.c +++ b/libavcodec/vtenc.c @@ -500,6 +500,7 @@ static av_cold int vtenc_init(AVCodecContext* avctx){ ); CFDictionarySetValue(enc_info, kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder, kCFBooleanTrue); +CFDictionarySetValue(enc_info, kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, kCFBooleanTrue); status = VTCompressionSessionCreate( kCFAllocatorDefault, -- 2.4.9 (Apple Git-60) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 10/10] vtenc: Fixed mixed declarations and code.
From: Rick KernMoved all declarations to the top of their block. Signed-off-by: Rick Kern --- libavcodec/vtenc.c | 409 ++--- 1 file changed, 260 insertions(+), 149 deletions(-) diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c index 78a918b..a8cc340 100644 --- a/libavcodec/vtenc.c +++ b/libavcodec/vtenc.c @@ -67,17 +67,18 @@ typedef struct VTEncContext{ } VTEncContext; static void set_async_error(VTEncContext* vtctx, int err){ +BufNode* info; + pthread_mutex_lock(>lock); vtctx->async_error = err; -BufNode* info = vtctx->q_head; +info = vtctx->q_head; vtctx->q_head = vtctx->q_tail = NULL; while(info){ -CFRelease(info->cm_buffer); - BufNode* next = info->next; +CFRelease(info->cm_buffer); free(info); info = next; } @@ -86,6 +87,8 @@ static void set_async_error(VTEncContext* vtctx, int err){ } static int vtenc_q_pop(VTEncContext* vtctx, bool wait, CMSampleBufferRef* buf){ +BufNode* info; + pthread_mutex_lock(>lock); if(vtctx->async_error){ @@ -110,7 +113,7 @@ static int vtenc_q_pop(VTEncContext* vtctx, bool wait, CMSampleBufferRef* buf){ return 0; } -BufNode* info = vtctx->q_head; +info = vtctx->q_head; vtctx->q_head = vtctx->q_head->next; if(!vtctx->q_head){ vtctx->q_tail = NULL; @@ -141,12 +144,12 @@ static void vtenc_q_push(VTEncContext* vtctx, CMSampleBufferRef buffer){ pthread_cond_signal(>cv_sample_sent); if(!vtctx->q_head){ -vtctx->q_head = vtctx->q_tail = info; -pthread_mutex_unlock(>lock); -return; +vtctx->q_head = info; +} +else{ +vtctx->q_tail->next = info; } -vtctx->q_tail->next = info; vtctx->q_tail = info; pthread_mutex_unlock(>lock); @@ -172,22 +175,21 @@ static void vtenc_free_block(void* opaque, uint8_t* data){ *In all cases, *dst_size is set to the number of bytes used starting *at *dst. */ - -static int get_params_info( +static int get_params_size( AVCodecContext* avctx, CMVideoFormatDescriptionRef vid_fmt, size_t* size) { size_t total_size = 0; size_t ps_count; - +size_t i; OSStatus status = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(vid_fmt, 0, NULL, NULL, _count, NULL); if(status){ av_log(avctx, AV_LOG_ERROR, "Error getting parameter set count: %d\n", status); return AVERROR_EXTERNAL; } -for(size_t i = 0; i < ps_count; i++){ +for(i = 0; i < ps_count; i++){ const uint8_t* ps; size_t ps_size; status = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(vid_fmt, i, , _size, NULL, NULL); @@ -211,22 +213,26 @@ static int copy_param_sets( { size_t ps_count; OSStatus status = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(vid_fmt, 0, NULL, NULL, _count, NULL); +size_t offset = 0; +size_t i; + if(status){ av_log(avctx, AV_LOG_ERROR, "Error getting parameter set count for copying: %d\n", status); return AVERROR_EXTERNAL; } -size_t offset = 0; -for(size_t i = 0; i < ps_count; i++){ +for(i = 0; i < ps_count; i++){ const uint8_t* ps; size_t ps_size; +size_t next_offset; + status = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(vid_fmt, i, , _size, NULL, NULL); if(status){ av_log(avctx, AV_LOG_ERROR, "Error getting parameter set data for index %zd: %d\n", i, status); return AVERROR_EXTERNAL; } -size_t next_offset = offset + sizeof(start_code) + ps_size; +next_offset = offset + sizeof(start_code) + ps_size; if(dst_size < next_offset){ av_log(avctx, AV_LOG_ERROR, "Error: buffer too small for parameter sets.\n"); return AVERROR_BUFFER_TOO_SMALL; @@ -244,15 +250,16 @@ static int copy_param_sets( static int set_extradata(AVCodecContext* avctx, CMSampleBufferRef sample_buffer){ CMVideoFormatDescriptionRef vid_fmt; +size_t total_size; +int status; + vid_fmt = CMSampleBufferGetFormatDescription(sample_buffer); if(!vid_fmt){ av_log(avctx, AV_LOG_ERROR, "No video format.\n"); return AVERROR_EXTERNAL; } -size_t total_size; -int status; -status = get_params_info(avctx, vid_fmt, _size); +status = get_params_size(avctx, vid_fmt, _size); if(status){ av_log(avctx, AV_LOG_ERROR, "Could not get parameter sets.\n"); return status; @@ -280,9 +287,8 @@ static av_cold void vtenc_output_callback( VTEncodeInfoFlags flags, CM_NULLABLE CMSampleBufferRef sample_buffer) { -av_assert0(ctx); AVCodecContext* avctx = (AVCodecContext*)ctx; -VTEncContext* vtctx = (VTEncContext*)avctx->priv_data; +VTEncContext* vtctx = avctx->priv_data;
[FFmpeg-devel] [PATCH v2 00/10] Added VideoToolbox H.264 Encoder.
From: Rick KernUpdated patch with requested changes. Rick Kern (10): Added VideoToolbox H.264 encoder. vtenc: Enable hardware encoding on OSX. vtenc: Removed trailing whitespace. vtenc: Fixed iOS compilation. vtenc: Check for min iOS/OSX versions. Better VideoToolbox check in configure. vtenc: check condition after conditional variable unblocks. vtenc: better allocation failure checking. vtenc: check for NULL CMSampleBufferRef in encoder callback. vtenc: Fixed mixed declarations and code. MAINTAINERS|1 + configure |4 + libavcodec/Makefile|1 + libavcodec/allcodecs.c |1 + libavcodec/vtenc.c | 1212 5 files changed, 1219 insertions(+) create mode 100644 libavcodec/vtenc.c -- 2.4.9 (Apple Git-60) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 04/10] vtenc: Fixed iOS compilation.
From: Rick KernRemoved dictionary keys that aren't supported on iOS builds. Signed-off-by: Rick Kern --- libavcodec/vtenc.c | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c index b363492..7132411 100644 --- a/libavcodec/vtenc.c +++ b/libavcodec/vtenc.c @@ -499,8 +499,10 @@ static av_cold int vtenc_init(AVCodecContext* avctx){ ); +#if !TARGET_OS_IPHONE CFDictionarySetValue(enc_info, kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder, kCFBooleanTrue); CFDictionarySetValue(enc_info, kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, kCFBooleanTrue); +#endif status = VTCompressionSessionCreate( kCFAllocatorDefault, @@ -515,6 +517,7 @@ static av_cold int vtenc_init(AVCodecContext* avctx){ >session ); +#if !TARGET_OS_IPHONE if(status != 0 || !vtctx->session){ CFDictionaryRemoveValue(enc_info, kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder); @@ -531,6 +534,7 @@ static av_cold int vtenc_init(AVCodecContext* avctx){ >session ); } +#endif if(status || !vtctx->session){ av_log(avctx, AV_LOG_ERROR, "Error: cannot create compression session: %d\n", status); -- 2.4.9 (Apple Git-60) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 05/10] vtenc: Check for min iOS/OSX versions.
From: Rick Kernconfigure was checking for the SDK version being used to compile. Now it compares against the minimum deployment target. Signed-off-by: Rick Kern --- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index e465424..718f285 100755 --- a/configure +++ b/configure @@ -5477,9 +5477,9 @@ enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -l enabled vtenc && { { check_header VideoToolbox/VideoToolbox.h || die "ERROR: VideoToolbox/VideoToolbox.h not found." } && - { check_header "Availability.h" && - { check_cpp_condition "Availability.h" "defined(__IPHONE_8_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_8_0" || - check_cpp_condition "Availability.h" "defined(__MAC_10_9) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_9" + { { check_header "Availability.h" || die "Availability.h missing"; }&& + { check_cpp_condition "Availability.h" "defined(__IPHONE_8_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0" || + check_cpp_condition "Availability.h" "defined(__MAC_10_9) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_9" } || die "VideoToolbox requires Mac OSX 10.9+ or iOS 8.0+" } -- 2.4.9 (Apple Git-60) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 09/10] vtenc: check for NULL CMSampleBufferRef in encoder callback.
From: Rick KernThe CMSampleBufferRef passed into the encoder can be NULL. Added check. Signed-off-by: Rick Kern --- libavcodec/vtenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c index 583244c..78a918b 100644 --- a/libavcodec/vtenc.c +++ b/libavcodec/vtenc.c @@ -285,11 +285,11 @@ static av_cold void vtenc_output_callback( VTEncContext* vtctx = (VTEncContext*)avctx->priv_data; if(vtctx->async_error){ -CFRelease(sample_buffer); +if(sample_buffer) CFRelease(sample_buffer); return; } -if(status){ +if(status || !sample_buffer){ av_log(avctx, AV_LOG_ERROR, "Error encoding frame: %d\n", status); set_async_error(vtctx, AVERROR_EXTERNAL); return; -- 2.4.9 (Apple Git-60) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 08/10] vtenc: better allocation failure checking.
From: Rick KernSome memory allocations were unchecked. Signed-off-by: Rick Kern --- libavcodec/vtenc.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c index f0d8289..583244c 100644 --- a/libavcodec/vtenc.c +++ b/libavcodec/vtenc.c @@ -118,17 +118,20 @@ static int vtenc_q_pop(VTEncContext* vtctx, bool wait, CMSampleBufferRef* buf){ pthread_mutex_unlock(>lock); -CMSampleBufferRef buffer = info->cm_buffer; +*buf = info->cm_buffer; free(info); vtctx->frame_ct_out++; -*buf = buffer; return 0; } static void vtenc_q_push(VTEncContext* vtctx, CMSampleBufferRef buffer){ BufNode* info = (BufNode*)malloc(sizeof(BufNode)); +if(!info){ +set_async_error(vtctx, AVERROR(ENOMEM)); +return; +} CFRetain(buffer); info->cm_buffer = buffer; @@ -499,6 +502,8 @@ static av_cold int vtenc_init(AVCodecContext* avctx){ ); +if(!enc_info) return AVERROR(ENOMEM); + #if !TARGET_OS_IPHONE CFDictionarySetValue(enc_info, kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder, kCFBooleanTrue); CFDictionarySetValue(enc_info, kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, kCFBooleanTrue); @@ -543,6 +548,8 @@ static av_cold int vtenc_init(AVCodecContext* avctx){ SInt32 bit_rate = avctx->bit_rate; CFNumberRef bit_rate_num = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, _rate); +if(!bit_rate_num) return AVERROR(ENOMEM); + status = VTSessionSetProperty(vtctx->session, kVTCompressionPropertyKey_AverageBitRate, bit_rate_num); CFRelease(bit_rate_num); -- 2.4.9 (Apple Git-60) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 07/10] vtenc: check condition after conditional variable unblocks.
From: Rick KernCondition was not being verified after conditional variable unblocked. Signed-off-by: Rick Kern --- libavcodec/vtenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c index 7132411..f0d8289 100644 --- a/libavcodec/vtenc.c +++ b/libavcodec/vtenc.c @@ -100,7 +100,7 @@ static int vtenc_q_pop(VTEncContext* vtctx, bool wait, CMSampleBufferRef* buf){ return 0; } -if(!vtctx->q_head && wait){ +while(!vtctx->q_head && !vtctx->async_error && wait){ pthread_cond_wait(>cv_sample_sent, >lock); } -- 2.4.9 (Apple Git-60) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 06/10] Better VideoToolbox check in configure.
From: Rick Kern--- configure | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/configure b/configure index 718f285..f99fbd9 100755 --- a/configure +++ b/configure @@ -5474,17 +5474,7 @@ enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -l check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 || check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || die "ERROR: openssl not found"; } -enabled vtenc && { { check_header VideoToolbox/VideoToolbox.h || - die "ERROR: VideoToolbox/VideoToolbox.h not found." - } && - { { check_header "Availability.h" || die "Availability.h missing"; }&& - { check_cpp_condition "Availability.h" "defined(__IPHONE_8_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0" || - check_cpp_condition "Availability.h" "defined(__MAC_10_9) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_9" - } || - die "VideoToolbox requires Mac OSX 10.9+ or iOS 8.0+" - } - } - +enabled vtenc && require VideoToolbox VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox enabled qtkit_indev && { check_header_oc QTKit/QTKit.h || disable qtkit_indev; } if enabled gnutls; then -- 2.4.9 (Apple Git-60) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 01/10] Added VideoToolbox H.264 encoder.
From: Rick KernEnable with configure --enable-vtenc and encode using -codec:v vtenc_h264. Signed-off-by: Rick Kern --- MAINTAINERS|1 + configure | 14 + libavcodec/Makefile|1 + libavcodec/allcodecs.c |1 + libavcodec/vtenc.c | 1089 5 files changed, 1106 insertions(+) create mode 100644 libavcodec/vtenc.c diff --git a/MAINTAINERS b/MAINTAINERS index 3735742..28782d2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -286,6 +286,7 @@ Codecs: vp8 David Conrad, Jason Garrett-Glaser, Ronald Bultje vp9 Ronald Bultje, Clément Bœsch vqavideo.cMike Melanson + vtenc.c Rick Kern wavpack.c Kostya Shishkov wmaprodec.c Sascha Sommer wmavoice.cRonald S. Bultje diff --git a/configure b/configure index 9a736ce..e465424 100755 --- a/configure +++ b/configure @@ -286,6 +286,7 @@ External library support: --disable-sdldisable sdl [autodetect] --disable-securetransport disable Secure Transport, needed for TLS support on OSX if openssl and gnutls are not used [autodetect] + --enable-vtenc enable VideoToolbox encoding support [no] --enable-x11grab enable X11 grabbing (legacy) [no] --disable-xlib disable xlib [autodetect] --disable-zlib disable zlib [autodetect] @@ -1473,6 +1474,7 @@ EXTERNAL_LIBRARY_LIST=" schannel sdl securetransport +vtenc x11grab xlib zlib @@ -2609,6 +2611,7 @@ libzvbi_teletext_decoder_deps="libzvbi" nvenc_encoder_deps="nvenc" nvenc_h264_encoder_deps="nvenc" nvenc_hevc_encoder_deps="nvenc" +vtenc_h264_encoder_deps="vtenc" # demuxers / muxers ac3_demuxer_select="ac3_parser" @@ -5471,6 +5474,17 @@ enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -l check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 || check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || die "ERROR: openssl not found"; } +enabled vtenc && { { check_header VideoToolbox/VideoToolbox.h || + die "ERROR: VideoToolbox/VideoToolbox.h not found." + } && + { check_header "Availability.h" && + { check_cpp_condition "Availability.h" "defined(__IPHONE_8_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_8_0" || + check_cpp_condition "Availability.h" "defined(__MAC_10_9) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_9" + } || + die "VideoToolbox requires Mac OSX 10.9+ or iOS 8.0+" + } + } + enabled qtkit_indev && { check_header_oc QTKit/QTKit.h || disable qtkit_indev; } if enabled gnutls; then diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 68a573f..afb38e4 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -116,6 +116,7 @@ OBJS-$(CONFIG_TEXTUREDSP) += texturedsp.o OBJS-$(CONFIG_TEXTUREDSPENC) += texturedspenc.o OBJS-$(CONFIG_TPELDSP) += tpeldsp.o OBJS-$(CONFIG_VIDEODSP)+= videodsp.o +OBJS-$(CONFIG_VTENC) += vtenc.o OBJS-$(CONFIG_VP3DSP) += vp3dsp.o OBJS-$(CONFIG_VP56DSP) += vp56dsp.o OBJS-$(CONFIG_VP8DSP) += vp8dsp.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 9f60d7c..6465df0 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -605,6 +605,7 @@ void avcodec_register_all(void) REGISTER_ENCODER(HEVC_QSV, hevc_qsv); REGISTER_ENCODER(LIBKVAZAAR,libkvazaar); REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv); +REGISTER_ENCODER(VTENC_H264,vtenc_h264); /* parsers */ REGISTER_PARSER(AAC,aac); diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c new file mode 100644 index 000..06c5360 --- /dev/null +++ b/libavcodec/vtenc.c @@ -0,0 +1,1089 @@ +/* + * copyright (c) 2015 Rick Kern + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A
Re: [FFmpeg-devel] UDP constant bitrate feature (cbr)
> Only for strict CBR streams which FFmpeg cannot know a priori. That's > why the only correct way is to index the stream as it's received and > play out at a smooth rate like multicat does. I am not sure what you are referencing with regards to multicat. Is this an output option? Smooth output streams are needed in other applications then just relaying a stream. Why can't I find the term multicat in any of the code or documentation? Zach On Wed, Nov 18, 2015 at 10:37 AM, Zach Swenawrote: > Yea, how it is supposed to happen isn't complicated. To be of any help, I > have to wrap my mind around how FFmpeg currently times the output stream. > That mechanism currently does not produce as stable of a transmission rate > as multiplexer and decoder hardware requires. Since there is a bounty > available for this, it would be nice if someone more qualified could tackle > this problem. Until someone steps up, I will be poking at it from my end. > I am used to reading c++ intead of c code, so my reading is still a little > slow. Fixing this problem will open up new possibilities on how I can use > FFmpeg. > > Zach > > On Wed, Nov 18, 2015 at 9:03 AM, Michael Niedermayer < > mich...@niedermayer.cc> wrote: > >> On Tue, Nov 17, 2015 at 03:06:27PM -0800, Zach Swena wrote: >> > Hi Pavel, >> > >> > I can confirm that there is a problem with the UDP packet engine in >> > FFmpeg. FFmpeg has excessive jitter in it's UDP streaming output to the >> > point where hardware decoders can't handle it. My solution was to >> buffer >> > to disk and have my own program read and send the datagrams via a very >> > tight event loop. While increasing the PCR period is not a bad thing, >> > FFmpeg really should stream at a more consistant rate. Can someone >> explain >> > the theory behind how the UDP rate control is currently implemented in >> > FFmpeg? PCR sounds like a good way to tell when to send a packet, >> except >> > not every packet contains one. If FFmpeg uses PCR to tell how long to >> wait >> > to send a packet, then do the packets in between go at line speed? I >> plan >> > on taking a look at the code that does this, but I would really >> appreciate >> > it if someone who knows the code could explain the theory as I usually >> deal >> > with a slightly different dev setup. >> >> i suggest you read the mpeg specs, they detail when things should be >> sent down to each byte IIRC >> also IIRC its not that complicated, more like timestamp + bytepos/rate >> >> >> [...] >> -- >> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB >> >> I know you won't believe me, but the highest form of Human Excellence is >> to question oneself and others. -- Socrates >> >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> >> > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] AAC sequence header data setup if stream copy
On 18.11.2015 19:37, Michael Niedermayer wrote: [...] the first field of the context must be a AVClass updated patch attached -- Maksym Veremeyenko From 665751883fd515c753ada7bbf4d24c89a24f3d30 Mon Sep 17 00:00:00 2001 From: Maksym VeremeyenkoDate: Wed, 18 Nov 2015 23:44:08 +0200 Subject: [PATCH] AAC sequence header data setup if stream copy --- ffmpeg.c |1 + libavformat/flvenc.c | 54 ++ 2 files changed, 55 insertions(+), 0 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index c4e9280..a976f61 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -2970,6 +2970,7 @@ static int transcode_init(void) enc_ctx->audio_service_type = dec_ctx->audio_service_type; enc_ctx->block_align= dec_ctx->block_align; enc_ctx->initial_padding= dec_ctx->delay; +enc_ctx->profile= dec_ctx->profile; #if FF_API_AUDIOENC_DELAY enc_ctx->delay = dec_ctx->delay; #endif diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index e217ba8..cff130c 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -28,6 +28,9 @@ #include "flv.h" #include "internal.h" #include "metadata.h" +#include "libavutil/opt.h" +#include "libavcodec/put_bits.h" +#include "libavcodec/aacenctab.h" static const AVCodecTag flv_video_codec_ids[] = { @@ -58,6 +61,7 @@ static const AVCodecTag flv_audio_codec_ids[] = { }; typedef struct FLVContext { +AVClass *av_class; int reserved; int64_t duration_offset; int64_t filesize_offset; @@ -68,6 +72,10 @@ typedef struct FLVContext { AVCodecContext *video_enc; double framerate; AVCodecContext *data_enc; + +uint8_t *aac_seq_header_data; +int aac_seq_header_length; +int flags; } FLVContext; typedef struct FLVStreamContext { @@ -452,6 +460,37 @@ static int flv_write_header(AVFormatContext *s) if (enc->codec_id == AV_CODEC_ID_AAC) { avio_w8(pb, get_audio_flags(s, enc)); avio_w8(pb, 0); // AAC sequence header +if (!enc->extradata_size && flv->aac_seq_header_data) +{ +avio_write(pb, flv->aac_seq_header_data, flv->aac_seq_header_length); + +av_log(s, AV_LOG_WARNING, "AAC sequence header length=%d\n", flv->aac_seq_header_length); +} +else if (!enc->extradata_size && !flv->aac_seq_header_data && flv->flags & 1) +{ +PutBitContext pbc; +int samplerate_index; +int channels = flv->audio_enc->channels - (flv->audio_enc->channels == 8 ? 1 : 0); +uint8_t data[2]; + +for (samplerate_index = 0; samplerate_index < 16; samplerate_index++) +if (flv->audio_enc->sample_rate == mpeg4audio_sample_rates[samplerate_index]) +break; + +init_put_bits(, data, sizeof(data)); +put_bits(, 5, flv->audio_enc->profile + 1); //profile +put_bits(, 4, samplerate_index); //sample rate index +put_bits(, 4, channels); +put_bits(, 1, 0); //frame length - 1024 samples +put_bits(, 1, 0); //does not depend on core coder +put_bits(, 1, 0); //is not extension +flush_put_bits(); + +avio_w8(pb, data[0]); +avio_w8(pb, data[1]); + +av_log(s, AV_LOG_WARNING, "AAC sequence header: %02x %02x.\n", data[0], data[1]); +} avio_write(pb, enc->extradata, enc->extradata_size); } else { avio_w8(pb, enc->codec_tag | FLV_FRAME_KEY); // flags @@ -655,6 +694,20 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) return pb->error; } +static const AVOption options[] = { +{ "flvflags", "FLV muxer flags", offsetof(FLVContext, flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" }, +{ "aac_seq_header_detect", "Put AAC sequence header based on stream data", 0, AV_OPT_TYPE_CONST, {.i64 = 1}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" }, +{ "aac_seq_header_data", "Put AAC sequence header data specified", offsetof(FLVContext, aac_seq_header_data), AV_OPT_TYPE_BINARY, {.str = NULL}, .flags = AV_OPT_FLAG_ENCODING_PARAM }, +{ NULL }, +}; + +static const AVClass flv_muxer_class = { +.class_name = "flv muxer", +.item_name = av_default_item_name, +.option = options, +.version= LIBAVUTIL_VERSION_INT, +}; + AVOutputFormat ff_flv_muxer = { .name = "flv", .long_name = NULL_IF_CONFIG_SMALL("FLV (Flash Video)"), @@ -671,4 +724,5 @@ AVOutputFormat ff_flv_muxer = { },
Re: [FFmpeg-devel] [PATCHv2] avutil/libm: correct isnan, isinf compat hacks
On Tue, Nov 17, 2015 at 04:54:10PM -0500, Ganesh Ajjanagadde wrote: > isnan and isinf are actually macros as per the standard. In particular, > the existing implementation has incorrect signature. Furthermore, this > results in undefined behavior for e.g double values outside float range > as per the standard. > > This patch corrects the undefined behavior for all usage within FFmpeg. > > Note that long double is not handled as it is not used in FFmpeg. > Furthermore, even if at some point long double gets used, it is likely > not needed to modify the macro in practice for usage in FFmpeg. See > below for analysis. > > Getting long double to work strictly per the spec is significantly harder > since a long double may be an IEEE 128 bit quad (very rare), 80 bit > extended precision value (on GCC/Clang), or simply double (on recent > Microsoft). > On the other hand, any potential future usage of long double is likely > for precision (when a platform offers extra precision) and not for range, > since > the range anyway varies and is not as portable as IEEE 754 single/double > precision. In such cases, the implicit cast to a double is well defined > and isinf and isnan should work as intended. > > Reviewed-by: Michael Niedermayer> Signed-off-by: Ganesh Ajjanagadde > --- > libavutil/libm.h | 34 -- > 1 file changed, 32 insertions(+), 2 deletions(-) probably ok maybe wait a day or 2 before pushing so people can test it on more obscure platforms thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I do not agree with what you have to say, but I'll defend to the death your right to say it. -- Voltaire signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2] avutil/libm: correct isnan, isinf compat hacks
On Wed, Nov 18, 2015 at 2:58 PM, Michael Niedermayerwrote: > On Tue, Nov 17, 2015 at 04:54:10PM -0500, Ganesh Ajjanagadde wrote: >> isnan and isinf are actually macros as per the standard. In particular, >> the existing implementation has incorrect signature. Furthermore, this >> results in undefined behavior for e.g double values outside float range >> as per the standard. >> >> This patch corrects the undefined behavior for all usage within FFmpeg. >> >> Note that long double is not handled as it is not used in FFmpeg. >> Furthermore, even if at some point long double gets used, it is likely >> not needed to modify the macro in practice for usage in FFmpeg. See >> below for analysis. >> >> Getting long double to work strictly per the spec is significantly harder >> since a long double may be an IEEE 128 bit quad (very rare), 80 bit >> extended precision value (on GCC/Clang), or simply double (on recent >> Microsoft). >> On the other hand, any potential future usage of long double is likely >> for precision (when a platform offers extra precision) and not for range, >> since >> the range anyway varies and is not as portable as IEEE 754 single/double >> precision. In such cases, the implicit cast to a double is well defined >> and isinf and isnan should work as intended. >> >> Reviewed-by: Michael Niedermayer >> Signed-off-by: Ganesh Ajjanagadde >> --- >> libavutil/libm.h | 34 -- >> 1 file changed, 32 insertions(+), 2 deletions(-) > > probably ok > maybe wait a day or 2 before pushing so people can test it on more > obscure platforms > > thx ok, will wait for 2 days for the hypot hack as well. Thanks. > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > I do not agree with what you have to say, but I'll defend to the death your > right to say it. -- Voltaire > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] UDP constant bitrate feature (cbr)
Are you referring to this seperate applciation? https://github.com/mmalecki/multicat/blob/master/trunk/README While using that makes sense for Pavel's application, why should FFmpeg produce a problematic UDP stream in the first place? For applications like I need that involve encoding the stream in the first place, why should I have to use a seperate program to make the output stream complient? FFmpeg should keep track of the number of bytes between pcr and smoothly output the stream regardless of what the input is. I would argue that this very much is a bug, not a feature. Just because an external applciation can fix the problem in some instances doesn't mean it isn't a problem in the first place. Zach On Wed, Nov 18, 2015 at 11:14 AM, Zach Swenawrote: > > Only for strict CBR streams which FFmpeg cannot know a priori. That's > > why the only correct way is to index the stream as it's received and > > play out at a smooth rate like multicat does. > > I am not sure what you are referencing with regards to multicat. Is this > an output option? Smooth output streams are needed in other applications > then just relaying a stream. Why can't I find the term multicat in any of > the code or documentation? > > Zach > > On Wed, Nov 18, 2015 at 10:37 AM, Zach Swena > wrote: > >> Yea, how it is supposed to happen isn't complicated. To be of any help, >> I have to wrap my mind around how FFmpeg currently times the output >> stream. That mechanism currently does not produce as stable of a >> transmission rate as multiplexer and decoder hardware requires. Since >> there is a bounty available for this, it would be nice if someone more >> qualified could tackle this problem. Until someone steps up, I will be >> poking at it from my end. I am used to reading c++ intead of c code, so my >> reading is still a little slow. Fixing this problem will open up new >> possibilities on how I can use FFmpeg. >> >> Zach >> >> On Wed, Nov 18, 2015 at 9:03 AM, Michael Niedermayer < >> mich...@niedermayer.cc> wrote: >> >>> On Tue, Nov 17, 2015 at 03:06:27PM -0800, Zach Swena wrote: >>> > Hi Pavel, >>> > >>> > I can confirm that there is a problem with the UDP packet engine in >>> > FFmpeg. FFmpeg has excessive jitter in it's UDP streaming output to >>> the >>> > point where hardware decoders can't handle it. My solution was to >>> buffer >>> > to disk and have my own program read and send the datagrams via a very >>> > tight event loop. While increasing the PCR period is not a bad thing, >>> > FFmpeg really should stream at a more consistant rate. Can someone >>> explain >>> > the theory behind how the UDP rate control is currently implemented in >>> > FFmpeg? PCR sounds like a good way to tell when to send a packet, >>> except >>> > not every packet contains one. If FFmpeg uses PCR to tell how long to >>> wait >>> > to send a packet, then do the packets in between go at line speed? I >>> plan >>> > on taking a look at the code that does this, but I would really >>> appreciate >>> > it if someone who knows the code could explain the theory as I usually >>> deal >>> > with a slightly different dev setup. >>> >>> i suggest you read the mpeg specs, they detail when things should be >>> sent down to each byte IIRC >>> also IIRC its not that complicated, more like timestamp + bytepos/rate >>> >>> >>> [...] >>> -- >>> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB >>> >>> I know you won't believe me, but the highest form of Human Excellence is >>> to question oneself and others. -- Socrates >>> >>> ___ >>> ffmpeg-devel mailing list >>> ffmpeg-devel@ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >>> >> > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 02/13] Remove --mips32r5 configure option
Having a configure option with the same name as a MIPS ISA is confusing, so better to remove it. This option was being used to add some optimizations to a specific core (p5600). We will add the optimizations just when the p5600 core has been detected, in a later patch. Signed-off-by: Vicente Olivert Riera--- Changes v1 -> v2: - Nothing. configure | 20 +--- 1 files changed, 1 insertions(+), 19 deletions(-) diff --git a/configure b/configure index 0905ec2..83b2a64 100755 --- a/configure +++ b/configure @@ -378,7 +378,6 @@ Optimization options (experts only): --disable-neon disable NEON optimizations --disable-inline-asm disable use of inline assembly --disable-yasm disable use of nasm/yasm assembly - --disable-mips32r5 disable MIPS32R5 optimizations --disable-mips64r6 disable MIPS64R6 optimizations --disable-mipsdspdisable MIPS DSP ASE R1 optimizations --disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations @@ -1625,7 +1624,6 @@ ARCH_EXT_LIST_ARM=" ARCH_EXT_LIST_MIPS=" mipsfpu mips32r2 -mips32r5 mips64r6 mipsdsp mipsdspr2 @@ -2105,7 +2103,6 @@ mipsfpu_deps="mips" mipsdsp_deps="mips" mipsdspr2_deps="mips" mips32r2_deps="mips" -mips32r5_deps="mips" mips64r6_deps="mips" msa_deps="mips" mmi_deps="mips" @@ -4061,7 +4058,6 @@ elif enabled mips; then case $cpu in 24kc) -disable mips32r5 disable mips64r6 disable mipsfpu disable mipsdsp @@ -4069,33 +4065,28 @@ elif enabled mips; then disable msa ;; 24kf*) -disable mips32r5 disable mips64r6 disable mipsdsp disable mipsdspr2 disable msa ;; 24kec|34kc|1004kc) -disable mips32r5 disable mips64r6 disable mipsfpu disable mipsdspr2 disable msa ;; 24kef*|34kf*|1004kf*) -disable mips32r5 disable mips64r6 disable mipsdspr2 disable msa ;; 74kc) -disable mips32r5 disable mips64r6 disable mipsfpu disable msa ;; 74kf) -disable mips32r5 disable mips64r6 disable msa ;; @@ -4107,7 +4098,6 @@ elif enabled mips; then check_cflags "-mtune=p5600" ;; i6400) -disable mips32r5 disable mipsdsp disable mipsdspr2 disable mipsfpu @@ -4118,7 +4108,6 @@ elif enabled mips; then loongson*) disable mipsfpu disable mips32r2 -disable mips32r5 disable mips64r6 disable mipsdsp disable mipsdspr2 @@ -4143,14 +4132,12 @@ elif enabled mips; then esac ;; generic) -disable mips32r5 disable mips64r6 disable msa ;; *) disable mipsfpu disable mips32r2 -disable mips32r5 disable mips64r6 disable mipsdsp disable mipsdspr2 @@ -4953,14 +4940,11 @@ elif enabled mips; then elif enabled mipsdsp || enabled mipsdspr2; then add_cflags "-mips32r2 -mfp32" add_asflags "-mips32r2 -mfp32" -elif enabled mips32r5 || enabled mips64r6; then +elif enabled mips64r6; then check_cflags "-mfp64" check_ldflags "-mfp64" fi -enabled mips32r5 && check_cflags "-mips32r5 -msched-weight -mload-store-pairs -funroll-loops" && - check_ldflags "-mips32r5" && - check_inline_asm mips32r5 '"ulw $t0, ($t1)"' enabled mips64r6 && check_cflags "-mips64r6 -msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mips64r6" && check_inline_asm mips64r6 '"aui $t0, $t1, 1"' @@ -4973,7 +4957,6 @@ elif enabled mips; then enabled msa && check_cflags "-mmsa" && check_ldflags "-mmsa" && check_inline_asm msa '"addvi.b $w0, $w1, 1"' -enabled mips32r5 && add_asflags "-mips32r5 -mfp64" enabled mips64r6 && add_asflags "-mips64r6 -mfp64" enabled msa && add_asflags "-mmsa" @@ -6044,7 +6027,6 @@ if enabled arm; then fi if enabled mips; then echo "MIPS FPU enabled ${mipsfpu-no}" -echo "MIPS32R5 enabled ${mips32r5-no}" echo "MIPS64R6 enabled ${mips64r6-no}" echo "MIPS DSP R1 enabled ${mipsdsp-no}" echo "MIPS DSP R2 enabled ${mipsdspr2-no}" -- 1.7.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 01/13] Rename mipsdspr1 to mipsdsp
Signed-off-by: Vicente Olivert Riera--- Changes v1 -> v2: - Remove a block of code for mipsdspr2 which wasn't intended to be in this patch and it was causing a syntax error in the configure script. Highlighted by Michael Niedermayer: https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183444.html Makefile |2 +- arch.mak |2 +- configure | 28 ++-- libavcodec/aacenc.c |2 +- libavcodec/mips/Makefile |4 ++-- libavcodec/mips/ac3dsp_mips.c |4 ++-- libavcodec/mips/mpegaudiodsp_mips_fixed.c |2 +- libavcodec/mpegaudiodec_template.c|4 ++-- libavcodec/mpegaudiodsp.c |2 +- libavcodec/mpegaudiodsp.h |2 +- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 306f060..6c53ceb 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,7 @@ SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \ HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS\ ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \ ALTIVEC-OBJS MMX-OBJS YASM-OBJS \ - MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSPR1-OBJS MSA-OBJS \ + MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \ MMI-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS define RESET diff --git a/arch.mak b/arch.mak index 98fde4a..08f78b4 100644 --- a/arch.mak +++ b/arch.mak @@ -5,7 +5,7 @@ OBJS-$(HAVE_VFP) += $(VFP-OBJS) $(VFP-OBJS-yes) OBJS-$(HAVE_NEON)+= $(NEON-OBJS)$(NEON-OBJS-yes) OBJS-$(HAVE_MIPSFPU) += $(MIPSFPU-OBJS)$(MIPSFPU-OBJS-yes) -OBJS-$(HAVE_MIPSDSPR1) += $(MIPSDSPR1-OBJS) $(MIPSDSPR1-OBJS-yes) +OBJS-$(HAVE_MIPSDSP) += $(MIPSDSP-OBJS)$(MIPSDSP-OBJS-yes) OBJS-$(HAVE_MIPSDSPR2) += $(MIPSDSPR2-OBJS) $(MIPSDSPR2-OBJS-yes) OBJS-$(HAVE_MSA) += $(MSA-OBJS)$(MSA-OBJS-yes) OBJS-$(HAVE_MMI) += $(MMI-OBJS) $(MMI-OBJS-yes) diff --git a/configure b/configure index 9a736ce..0905ec2 100755 --- a/configure +++ b/configure @@ -380,7 +380,7 @@ Optimization options (experts only): --disable-yasm disable use of nasm/yasm assembly --disable-mips32r5 disable MIPS32R5 optimizations --disable-mips64r6 disable MIPS64R6 optimizations - --disable-mipsdspr1 disable MIPS DSP ASE R1 optimizations + --disable-mipsdspdisable MIPS DSP ASE R1 optimizations --disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations --disable-msadisable MSA optimizations --disable-mipsfpudisable floating point MIPS optimizations @@ -1627,7 +1627,7 @@ ARCH_EXT_LIST_MIPS=" mips32r2 mips32r5 mips64r6 -mipsdspr1 +mipsdsp mipsdspr2 msa " @@ -2102,7 +2102,7 @@ setend_deps="arm" map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM mipsfpu_deps="mips" -mipsdspr1_deps="mips" +mipsdsp_deps="mips" mipsdspr2_deps="mips" mips32r2_deps="mips" mips32r5_deps="mips" @@ -4064,14 +4064,14 @@ elif enabled mips; then disable mips32r5 disable mips64r6 disable mipsfpu -disable mipsdspr1 +disable mipsdsp disable mipsdspr2 disable msa ;; 24kf*) disable mips32r5 disable mips64r6 -disable mipsdspr1 +disable mipsdsp disable mipsdspr2 disable msa ;; @@ -4101,14 +4101,14 @@ elif enabled mips; then ;; p5600) disable mips64r6 -disable mipsdspr1 +disable mipsdsp disable mipsdspr2 check_cflags "-mtune=p5600" ;; i6400) disable mips32r5 -disable mipsdspr1 +disable mipsdsp disable mipsdspr2 disable mipsfpu @@ -4120,7 +4120,7 @@ elif enabled mips; then disable mips32r2 disable mips32r5 disable mips64r6 -disable mipsdspr1 +disable mipsdsp disable mipsdspr2 disable msa enable local_aligned_8 local_aligned_16 local_aligned_32 @@ -4152,7 +4152,7 @@ elif enabled mips; then disable mips32r2 disable mips32r5 disable mips64r6 -disable mipsdspr1 +disable mipsdsp disable mipsdspr2 disable msa ;; @@ -4944,13 +4944,13 @@ elif enabled mips; then enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"' # Enable minimum ISA based on selected options -if enabled mips64 && (enabled mipsdspr1 || enabled mipsdspr2); then +if enabled mips64 && (enabled
Re: [FFmpeg-devel] [PATCHv2] avformat/mp3dec, rmdec: check return value of ffio_ensure_seekback
On Tue, 17 Nov 2015 17:39:31 -0500 Ganesh Ajjanagaddewrote: > ffio_ensure_seekback can fail due to e.g ENOMEM. This return value is > checked here and a diagnostic is logged. > > All usage of ffio_ensure_seekback in the codebase now has the return value > checked. > > Signed-off-by: Ganesh Ajjanagadde > --- > libavformat/mp3dec.c | 6 -- > libavformat/rmdec.c | 3 ++- > 2 files changed, 6 insertions(+), 3 deletions(-) > > diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c > index 32ca00c..a14bccd 100644 > --- a/libavformat/mp3dec.c > +++ b/libavformat/mp3dec.c > @@ -380,11 +380,13 @@ static int mp3_read_header(AVFormatContext *s) > uint32_t header, header2; > int frame_size; > if (!(i&1023)) > -ffio_ensure_seekback(s->pb, i + 1024 + 4); > +if ((ret = ffio_ensure_seekback(s->pb, i + 1024 + 4)) < 0) > +av_log(s, AV_LOG_WARNING, "ffio_ensure_seekback(): %s\n", > av_err2str(ret)); > frame_size = check(s->pb, off + i, ); > if (frame_size > 0) { > avio_seek(s->pb, off, SEEK_SET); > -ffio_ensure_seekback(s->pb, i + 1024 + frame_size + 4); > +if ((ret = ffio_ensure_seekback(s->pb, i + 1024 + frame_size + > 4)) < 0) > +av_log(s, AV_LOG_WARNING, "ffio_ensure_seekback(): %s\n", > av_err2str(ret)); > if (check(s->pb, off + i + frame_size, ) >= 0 && > (header & SAME_HEADER_MASK) == (header2 & SAME_HEADER_MASK)) > { > diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c > index 4ec78ef..1cf0548 100644 > --- a/libavformat/rmdec.c > +++ b/libavformat/rmdec.c > @@ -576,7 +576,8 @@ static int rm_read_header(AVFormatContext *s) > size = avio_rb32(pb); > codec_pos = avio_tell(pb); > > -ffio_ensure_seekback(pb, 4); > +if ((ret = ffio_ensure_seekback(pb, 4)) < 0) > +av_log(s, AV_LOG_WARNING, "ffio_ensure_seekback(): %s\n", > av_err2str(ret)); > v = avio_rb32(pb); > if (v == MKBETAG('M', 'L', 'T', 'I')) { > int number_of_streams = avio_rb16(pb); So why do you not just add the message to the function itself? I also question the usefulness of the message. In such cases of OOM everything goes to hell anyway. No reason to bloat the code with error printing. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 07/13] MIPS i6400 core is not mips32r2, so disable mips32r2
Signed-off-by: Vicente Olivert Riera--- Changes v1 -> v2: - Nothing. configure |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/configure b/configure index d14b02b..ca5c784 100755 --- a/configure +++ b/configure @@ -4098,6 +4098,7 @@ elif enabled mips; then add_asflags "-mfp64" ;; i6400) +disable mips32r2 disable mipsdsp disable mipsdspr2 check_cflags "-mtune=i6400 -mabi=64" && -- 1.7.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 08/13] Add mips64r2 architecture variant
Signed-off-by: Vicente Olivert Riera--- Changes v1 -> v2: - Nothing. configure | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/configure b/configure index ca5c784..761c4cb 100755 --- a/configure +++ b/configure @@ -1623,6 +1623,7 @@ ARCH_EXT_LIST_ARM=" ARCH_EXT_LIST_MIPS=" mipsfpu mips32r2 +mips64r2 mips64r6 mipsdsp mipsdspr2 @@ -2102,6 +2103,7 @@ mipsfpu_deps="mips" mipsdsp_deps="mips" mipsdspr2_deps="mips" mips32r2_deps="mips" +mips64r2_deps="mips" mips64r6_deps="mips" msa_deps="mips" mmi_deps="mips" @@ -4057,6 +4059,7 @@ elif enabled mips; then case $cpu in 24kc) +disable mips64r2 disable mips64r6 disable mipsfpu disable mipsdsp @@ -4064,32 +4067,38 @@ elif enabled mips; then disable msa ;; 24kf*) +disable mips64r2 disable mips64r6 disable mipsdsp disable mipsdspr2 disable msa ;; 24kec|34kc|1004kc) +disable mips64r2 disable mips64r6 disable mipsfpu disable mipsdspr2 disable msa ;; 24kef*|34kf*|1004kf*) +disable mips64r2 disable mips64r6 disable mipsdspr2 disable msa ;; 74kc) +disable mips64r2 disable mips64r6 disable mipsfpu disable msa ;; 74kf) +disable mips64r2 disable mips64r6 disable msa ;; p5600) +disable mips64r2 disable mips64r6 disable mipsdsp disable mipsdspr2 @@ -4099,6 +4108,7 @@ elif enabled mips; then ;; i6400) disable mips32r2 +disable mips64r2 disable mipsdsp disable mipsdspr2 check_cflags "-mtune=i6400 -mabi=64" && @@ -4109,6 +4119,7 @@ elif enabled mips; then loongson*) disable mipsfpu disable mips32r2 +disable mips64r2 disable mips64r6 disable mipsdsp disable mipsdspr2 @@ -4139,6 +4150,7 @@ elif enabled mips; then *) disable mipsfpu disable mips32r2 +disable mips64r2 disable mips64r6 disable mipsdsp disable mipsdspr2 -- 1.7.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 06/13] MIPS i6400 core does have an FPU, so not disable it
Signed-off-by: Vicente Olivert Riera--- Changes v1 -> v2: - Fix a grammar mistake in the commit log. Change "do has" by "does have". Thanks to Moritz Barsnick: https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183437.html configure |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/configure b/configure index d0685f3..d14b02b 100755 --- a/configure +++ b/configure @@ -4100,7 +4100,6 @@ elif enabled mips; then i6400) disable mipsdsp disable mipsdspr2 -disable mipsfpu check_cflags "-mtune=i6400 -mabi=64" && check_cflags "-mfp64 -msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64" && -- 1.7.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 09/13] Add mips32r6 architecture variant
Signed-off-by: Vicente Olivert Riera--- Changes v1 -> v2: - Nothing. configure | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 761c4cb..b31567e 100755 --- a/configure +++ b/configure @@ -1624,6 +1624,7 @@ ARCH_EXT_LIST_MIPS=" mipsfpu mips32r2 mips64r2 +mips32r6 mips64r6 mipsdsp mipsdspr2 @@ -2103,6 +2104,7 @@ mipsfpu_deps="mips" mipsdsp_deps="mips" mipsdspr2_deps="mips" mips32r2_deps="mips" +mips32r6_deps="mips" mips64r2_deps="mips" mips64r6_deps="mips" msa_deps="mips" @@ -4059,6 +4061,7 @@ elif enabled mips; then case $cpu in 24kc) +disable mips32r6 disable mips64r2 disable mips64r6 disable mipsfpu @@ -4067,6 +4070,7 @@ elif enabled mips; then disable msa ;; 24kf*) +disable mips32r6 disable mips64r2 disable mips64r6 disable mipsdsp @@ -4074,6 +4078,7 @@ elif enabled mips; then disable msa ;; 24kec|34kc|1004kc) +disable mips32r6 disable mips64r2 disable mips64r6 disable mipsfpu @@ -4081,23 +4086,27 @@ elif enabled mips; then disable msa ;; 24kef*|34kf*|1004kf*) +disable mips32r6 disable mips64r2 disable mips64r6 disable mipsdspr2 disable msa ;; 74kc) +disable mips32r6 disable mips64r2 disable mips64r6 disable mipsfpu disable msa ;; 74kf) +disable mips32r6 disable mips64r2 disable mips64r6 disable msa ;; p5600) +disable mips32r6 disable mips64r2 disable mips64r6 disable mipsdsp @@ -4108,6 +4117,7 @@ elif enabled mips; then ;; i6400) disable mips32r2 +disable mips32r6 disable mips64r2 disable mipsdsp disable mipsdspr2 @@ -4119,6 +4129,7 @@ elif enabled mips; then loongson*) disable mipsfpu disable mips32r2 +disable mips32r6 disable mips64r2 disable mips64r6 disable mipsdsp @@ -4150,6 +4161,7 @@ elif enabled mips; then *) disable mipsfpu disable mips32r2 +disable mips32r6 disable mips64r2 disable mips64r6 disable mipsdsp -- 1.7.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 12/13] Improve detection of MIPS ISAs, FPU and ASEs (DSP, MSA)
Signed-off-by: Vicente Olivert Riera--- Changes v1 -> v2: - Add a block of code for mipsdspr2 which was previously placed in the first patch of this series causing a syntax error in the configure script. https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183444.html configure | 83 +++- 1 files changed, 65 insertions(+), 18 deletions(-) diff --git a/configure b/configure index 7d87e5c..be1ac99 100755 --- a/configure +++ b/configure @@ -4952,27 +4952,74 @@ elif enabled mips; then enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"' # Enable minimum ISA based on selected options -if enabled mips64 && (enabled mipsdsp || enabled mipsdspr2); then -add_cflags "-mips64r2" -add_asflags "-mips64r2" -elif enabled mips64 && enabled mipsfpu && disabled loongson2 && disabled loongson3; then -add_cflags "-mips64" -add_asflags "-mips64" -elif enabled mipsdsp || enabled mipsdspr2; then -add_cflags "-mips32r2 -mfp32" -add_asflags "-mips32r2 -mfp32" +if enabled mips64; then +if enabled mips64r6; then +check_cflags "-mips64r6" && +check_ldflags "-mips64r6" && +add_asflags "-mips64r6" && +check_inline_asm mips64r6 '"dlsa $0, $0, $0, 1"' +elif enabled mips64r2; then +check_cflags "-mips64r2" && +check_ldflags "-mips64r2" && +add_asflags "-mips64r2" && +check_inline_asm mips64r2 '"dext $0, $0, 0, 1"' +else +check_cflags "-mips64" && +check_ldflags "-mips64" && +add_asflags "-mips64" && +check_inline_asm mips64r1 '"daddi $0, $0, 0"' +fi +else +if enabled mips32r6; then +check_cflags "-mips32r6" && +check_ldflags "-mips32r6" && +add_asflags "-mips32r6" && +check_inline_asm mips32r6 '"aui $0, $0, 0"' +elif enabled mips32r2; then +check_cflags "-mips32r2" && +check_ldflags "-mips32r2" && +add_asflags "-mips32r2" && +check_inline_asm mips32r2 '"ext $0, $0, 0, 1"' +else +check_cflags "-mips32" && +check_ldflags "-mips32" && +add_asflags "-mips32" && +check_inline_asm mips32r1 '"addi $0, $0, 0"' +fi +fi + +# MIPS FPU +if enabled mipsfpu; then +add_cflags "-mhard-float" && +add_asflags "-mhard-float" && +check_inline_asm mipsfpu '"cvt.d.l $f0, $f2"' fi -enabled mipsdsp && add_cflags "-mdsp" && add_asflags "-mdsp" && - check_inline_asm mipsdsp '"addu.qb $t0, $t1, $t2"' -enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" && - check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"' -enabled mipsfpu && add_cflags "-mhard-float" && add_asflags "-mhard-float" && - check_inline_asm mipsfpu '"madd.d $f0, $f2, $f4, $f6"' -enabled msa && check_cflags "-mmsa" && check_ldflags "-mmsa" && - check_inline_asm msa '"addvi.b $w0, $w1, 1"' +# MSA and DSP support require ISA revision level 2 or greater +if enabled mips32r2 || enabled mips64r2 || enabled mips32r6 || enabled mips64r6; then +# MSA must be used with -mfp64 and -mhard-float +if enabled mipsfpu; then +if enabled msa; then +check_cflags "-mfp64 -mmsa" && +check_ldflags "-mfp64 -mmsa" && +add_asflags "-mfp64 -mmsa" && +check_inline_asm msa '"addvi.b $w0, $w1, 1"' +fi +else +disable msa +fi -enabled msa && add_asflags "-mmsa" +if enabled mipsdsp; then +check_cflags "-mdsp" && +add_asflags "-mdsp" && +check_inline_asm mipsdsp '"addu.qb $t0, $t1, $t2"' +fi +if enabled mipsdspr2; then +check_cflags "-mdspr2" && +add_asflags "-mdspr2" && +check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"' +fi +fi elif enabled parisc; then -- 1.7.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 05/13] Add MIPS i6400 core optimizations
Signed-off-by: Vicente Olivert Riera--- Changes v1 -> v2: - Nothing. configure |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 8598fe1..d0685f3 100755 --- a/configure +++ b/configure @@ -4101,9 +4101,10 @@ elif enabled mips; then disable mipsdsp disable mipsdspr2 disable mipsfpu - -check_cflags "-mtune=i6400 -mabi=64" -check_ldflags "-mabi=64" +check_cflags "-mtune=i6400 -mabi=64" && +check_cflags "-mfp64 -msched-weight -mload-store-pairs -funroll-loops" && +check_ldflags "-mabi=64" && +add_asflags "-mfp64" ;; loongson*) disable mipsfpu -- 1.7.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 03/13] Add MIPS p5600 core optimizations
Signed-off-by: Vicente Olivert Riera--- Changes v1 -> v2: - Nothing. configure |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 83b2a64..ea129be 100755 --- a/configure +++ b/configure @@ -4094,8 +4094,9 @@ elif enabled mips; then disable mips64r6 disable mipsdsp disable mipsdspr2 - -check_cflags "-mtune=p5600" +check_cflags "-mtune=p5600" && +check_cflags "-mfp64 -msched-weight -mload-store-pairs -funroll-loops" && +add_asflags "-mfp64" ;; i6400) disable mipsdsp -- 1.7.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 13/13] Add support for MIPS R6
Understanding the mips32r6 and mips64r6 ISAs in the configure script is not enough. In order to have full support for MIPS R6 in FFmpeg we need to be able to build it, and for that we need to make sure we don't use incompatible assembler code which makes the build fail. Ifdefing the offending code is sufficient to fix the problem. Signed-off-by: Vicente Olivert Riera--- Changes v1 -> v2: - Nothing. libavcodec/mips/aaccoder_mips.c |4 libavcodec/mips/aacdec_mips.h |2 ++ libavcodec/mips/aacpsdsp_mips.c |4 libavcodec/mips/aacpsy_mips.h |2 ++ libavcodec/mips/aacsbr_mips.c |4 libavcodec/mips/aacsbr_mips.h |2 ++ libavcodec/mips/ac3dsp_mips.c |6 +- libavcodec/mips/acelp_filters_mips.c |4 libavcodec/mips/acelp_vectors_mips.c |4 libavcodec/mips/amrwbdec_mips.c |2 ++ libavcodec/mips/amrwbdec_mips.h |2 ++ libavcodec/mips/celp_filters_mips.c |4 libavcodec/mips/celp_math_mips.c |4 libavcodec/mips/compute_antialias_float.h |2 ++ libavcodec/mips/fft_mips.c|4 libavcodec/mips/iirfilter_mips.c |4 libavcodec/mips/lsp_mips.h|2 ++ libavcodec/mips/mpegaudiodsp_mips_fixed.c | 10 ++ libavcodec/mips/mpegaudiodsp_mips_float.c | 10 ++ libavcodec/mips/sbrdsp_mips.c |4 libavutil/mips/float_dsp_mips.c |4 21 files changed, 83 insertions(+), 1 deletions(-) diff --git a/libavcodec/mips/aaccoder_mips.c b/libavcodec/mips/aaccoder_mips.c index e8e1e62..2385ed2 100644 --- a/libavcodec/mips/aaccoder_mips.c +++ b/libavcodec/mips/aaccoder_mips.c @@ -66,6 +66,7 @@ #include "libavcodec/aacenc_utils.h" #if HAVE_INLINE_ASM +#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6 typedef struct BandCodingPath { int prev_idx; float cost; @@ -2412,10 +2413,12 @@ static void search_for_ms_mips(AACEncContext *s, ChannelElement *cpe) #include "libavcodec/aaccoder_trellis.h" +#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */ #endif /* HAVE_INLINE_ASM */ void ff_aac_coder_init_mips(AACEncContext *c) { #if HAVE_INLINE_ASM +#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6 AACCoefficientsEncoder *e = c->coder; int option = c->options.coder; @@ -2429,5 +2432,6 @@ void ff_aac_coder_init_mips(AACEncContext *c) { #if HAVE_MIPSFPU e->search_for_ms= search_for_ms_mips; #endif /* HAVE_MIPSFPU */ +#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */ #endif /* HAVE_INLINE_ASM */ } diff --git a/libavcodec/mips/aacdec_mips.h b/libavcodec/mips/aacdec_mips.h index 054a9fb..0c2b243 100644 --- a/libavcodec/mips/aacdec_mips.h +++ b/libavcodec/mips/aacdec_mips.h @@ -61,6 +61,7 @@ #include "libavutil/mips/asmdefs.h" #if HAVE_INLINE_ASM && HAVE_MIPSFPU +#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6 static inline float *VMUL2_mips(float *dst, const float *v, unsigned idx, const float *scale) { @@ -246,6 +247,7 @@ static inline float *VMUL4S_mips(float *dst, const float *v, unsigned idx, #define VMUL4 VMUL4_mips #define VMUL2S VMUL2S_mips #define VMUL4S VMUL4S_mips +#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */ #endif /* HAVE_INLINE_ASM && HAVE_MIPSFPU */ #endif /* AVCODEC_MIPS_AACDEC_FLOAT_H */ diff --git a/libavcodec/mips/aacpsdsp_mips.c b/libavcodec/mips/aacpsdsp_mips.c index 695f9ef..83fdc2f 100644 --- a/libavcodec/mips/aacpsdsp_mips.c +++ b/libavcodec/mips/aacpsdsp_mips.c @@ -188,6 +188,7 @@ static void ps_hybrid_synthesis_deint_mips(float out[2][38][64], } #if HAVE_MIPSFPU +#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6 static void ps_add_squares_mips(float *dst, const float (*src)[2], int n) { int i; @@ -442,6 +443,7 @@ static void ps_stereo_interpolate_mips(float (*l)[2], float (*r)[2], : "memory" ); } +#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */ #endif /* HAVE_MIPSFPU */ #endif /* HAVE_INLINE_ASM */ @@ -451,10 +453,12 @@ void ff_psdsp_init_mips(PSDSPContext *s) s->hybrid_analysis_ileave = ps_hybrid_analysis_ileave_mips; s->hybrid_synthesis_deint = ps_hybrid_synthesis_deint_mips; #if HAVE_MIPSFPU +#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6 s->add_squares= ps_add_squares_mips; s->mul_pair_single= ps_mul_pair_single_mips; s->decorrelate= ps_decorrelate_mips; s->stereo_interpolate[0] = ps_stereo_interpolate_mips; +#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */ #endif /* HAVE_MIPSFPU */ #endif /* HAVE_INLINE_ASM */ } diff --git a/libavcodec/mips/aacpsy_mips.h b/libavcodec/mips/aacpsy_mips.h index 596dcad..a216df6 100644 --- a/libavcodec/mips/aacpsy_mips.h +++ b/libavcodec/mips/aacpsy_mips.h @@ -59,6 +59,7 @@ #include "libavutil/mips/asmdefs.h" #if HAVE_INLINE_ASM && HAVE_MIPSFPU && ( PSY_LAME_FIR_LEN == 21 ) +#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
[FFmpeg-devel] [PATCH v2 11/13] Remove the MIPS "generic" core in favor of "*"
There is no point to have a "generic" core when we can catch all unsupported cores with the "*" option, so remove it. Signed-off-by: Vicente Olivert Riera--- Changes v1 -> v2: - Nothing. configure |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/configure b/configure index fc3d559..7d87e5c 100755 --- a/configure +++ b/configure @@ -4154,10 +4154,6 @@ elif enabled mips; then ;; esac ;; -generic) -disable mips64r6 -disable msa -;; *) disable mipsfpu disable mips32r2 -- 1.7.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 01/13] Rename mipsdspr1 to mipsdsp
Dear Michael Niedermayer, On 11/17/2015 09:17 PM, Michael Niedermayer wrote: > On Mon, Nov 16, 2015 at 02:57:07PM +, Vicente Olivert Riera wrote: > [...] >> index 9a736ce..0461a97 100755 >> --- a/configure >> +++ b/configure >> @@ -380,7 +380,7 @@ Optimization options (experts only): >>--disable-yasm disable use of nasm/yasm assembly >>--disable-mips32r5 disable MIPS32R5 optimizations >>--disable-mips64r6 disable MIPS64R6 optimizations >> - --disable-mipsdspr1 disable MIPS DSP ASE R1 optimizations >> + --disable-mipsdspdisable MIPS DSP ASE R1 optimizations >>--disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations >>--disable-msadisable MSA optimizations >>--disable-mipsfpudisable floating point MIPS optimizations >> @@ -1627,7 +1627,7 @@ ARCH_EXT_LIST_MIPS=" >> mips32r2 >> mips32r5 >> mips64r6 >> -mipsdspr1 >> +mipsdsp >> mipsdspr2 >> msa >> " >> @@ -2102,7 +2102,7 @@ setend_deps="arm" >> map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM >> >> mipsfpu_deps="mips" >> -mipsdspr1_deps="mips" >> +mipsdsp_deps="mips" >> mipsdspr2_deps="mips" >> mips32r2_deps="mips" >> mips32r5_deps="mips" >> @@ -4064,14 +4064,14 @@ elif enabled mips; then >> disable mips32r5 >> disable mips64r6 >> disable mipsfpu >> -disable mipsdspr1 >> +disable mipsdsp >> disable mipsdspr2 >> disable msa >> ;; >> 24kf*) >> disable mips32r5 >> disable mips64r6 >> -disable mipsdspr1 >> +disable mipsdsp >> disable mipsdspr2 >> disable msa >> ;; >> @@ -4101,14 +4101,14 @@ elif enabled mips; then >> ;; >> p5600) >> disable mips64r6 >> -disable mipsdspr1 >> +disable mipsdsp >> disable mipsdspr2 >> >> check_cflags "-mtune=p5600" >> ;; >> i6400) >> disable mips32r5 >> -disable mipsdspr1 >> +disable mipsdsp >> disable mipsdspr2 >> disable mipsfpu >> >> @@ -4120,7 +4120,7 @@ elif enabled mips; then >> disable mips32r2 >> disable mips32r5 >> disable mips64r6 >> -disable mipsdspr1 >> +disable mipsdsp >> disable mipsdspr2 >> disable msa >> enable local_aligned_8 local_aligned_16 local_aligned_32 >> @@ -4152,7 +4152,7 @@ elif enabled mips; then >> disable mips32r2 >> disable mips32r5 >> disable mips64r6 >> -disable mipsdspr1 >> +disable mipsdsp >> disable mipsdspr2 >> disable msa >> ;; >> @@ -4944,13 +4944,13 @@ elif enabled mips; then >> enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"' >> >> # Enable minimum ISA based on selected options >> -if enabled mips64 && (enabled mipsdspr1 || enabled mipsdspr2); then >> +if enabled mips64 && (enabled mipsdsp || enabled mipsdspr2); then >> add_cflags "-mips64r2" >> add_asflags "-mips64r2" >> elif enabled mips64 && enabled mipsfpu && disabled loongson2 && >> disabled loongson3; then >> add_cflags "-mips64" >> add_asflags "-mips64" >> -elif enabled mipsdspr1 || enabled mipsdspr2; then >> +elif enabled mipsdsp || enabled mipsdspr2; then >> add_cflags "-mips32r2 -mfp32" >> add_asflags "-mips32r2 -mfp32" >> elif enabled mips32r5 || enabled mips64r6; then >> @@ -4964,8 +4964,8 @@ elif enabled mips; then >> enabled mips64r6 && check_cflags "-mips64r6 -msched-weight >> -mload-store-pairs -funroll-loops" && >> check_ldflags "-mips64r6" && >> check_inline_asm mips64r6 '"aui $t0, $t1, 1"' >> -enabled mipsdspr1 && add_cflags "-mdsp" && add_asflags "-mdsp" && >> - check_inline_asm mipsdspr1 '"addu.qb $t0, $t1, $t2"' >> +enabled mipsdsp && add_cflags "-mdsp" && add_asflags "-mdsp" && >> + check_inline_asm mipsdsp '"addu.qb $t0, $t1, $t2"' >> enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" && >> check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"' >> enabled mipsfpu && add_cflags "-mhard-float" && add_asflags >> "-mhard-float" && >> @@ -4977,6 +4977,12 @@ elif enabled mips; then >> enabled mips64r6 && add_asflags "-mips64r6 -mfp64" >> enabled msa && add_asflags "-mmsa" >> >> +if enabled mipsdspr2; then >> +check_cflags "-mdspr2" && >> +add_asflags "-mdspr2" && >> +check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"' >> +fi >> +fi >> elif enabled parisc; then > > ./configure: 4986: ./configure: Syntax error: "elif" unexpected > > [...] > I will have a look. Regards, Vincent.
Re: [FFmpeg-devel] [PATCH] avformat/dashenc: Add framerate to dash manifest
Second patchset addresses feedback after discussion with Martin. It is now accounting for the fact that avg_frame_rate may not always be set. On Wed, Nov 18, 2015 at 1:13 AM, Bryan Huhwrote: > DASH manifest should have framerate specified as an attribute in the > AdaptationSet element and Representation elements. Though ISO/IEC > 23009-1:2014 doesn't seem to define frameRate as a required attribute, > it is at least optional, and DASH-IF IOP 3.0 seems to require it. See > section 3.2.4 of http://dashif.org/w/2015/04/DASH-IF-IOP-v3.0.pdf > > In the event that avg_frame_rate is not set in the muxer, we ignore the > frameRate tag altogther. > --- > libavformat/dashenc.c | 31 +++ > 1 files changed, 27 insertions(+), 4 deletions(-) > > diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c > index 7a93214..9c2b4dd 100644 > --- a/libavformat/dashenc.c > +++ b/libavformat/dashenc.c > @@ -24,10 +24,12 @@ > #include > #endif > > +#include "libavutil/avassert.h" > #include "libavutil/avstring.h" > #include "libavutil/intreadwrite.h" > #include "libavutil/mathematics.h" > #include "libavutil/opt.h" > +#include "libavutil/rational.h" > #include "libavutil/time_internal.h" > > #include "avc.h" > @@ -94,6 +96,8 @@ typedef struct DASHContext { > const char *single_file_name; > const char *init_seg_name; > const char *media_seg_name; > +AVRational min_frame_rate, max_frame_rate; > +int ambiguous_frame_rate; > } DASHContext; > > static int dash_write(void *opaque, uint8_t *buf, int buf_size) > @@ -503,7 +507,11 @@ static int write_manifest(AVFormatContext *s, int > final) > } > > if (c->has_video) { > -avio_printf(out, "\t\t segmentAlignment=\"true\" bitstreamSwitching=\"true\">\n"); > +avio_printf(out, "\t\t segmentAlignment=\"true\" bitstreamSwitching=\"true\""); > +if (c->max_frame_rate.num && !c->ambiguous_frame_rate) > +avio_printf(out, " %s=\"%d/%d\"", > (av_cmp_q(c->min_frame_rate, c->max_frame_rate) < 0) ? "maxFrameRate" : > "frameRate", c->max_frame_rate.num, c->max_frame_rate.den); > +avio_printf(out, ">\n"); > + > for (i = 0; i < s->nb_streams; i++) { > AVStream *st = s->streams[i]; > OutputStream *os = >streams[i]; > @@ -511,7 +519,11 @@ static int write_manifest(AVFormatContext *s, int > final) > if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO) > continue; > > -avio_printf(out, "\t\t\t mimeType=\"video/mp4\" codecs=\"%s\"%s width=\"%d\" height=\"%d\">\n", i, > os->codec_str, os->bandwidth_str, st->codec->width, st->codec->height); > +avio_printf(out, "\t\t\t mimeType=\"video/mp4\" codecs=\"%s\"%s width=\"%d\" height=\"%d\"", i, > os->codec_str, os->bandwidth_str, st->codec->width, st->codec->height); > +if (st->avg_frame_rate.num) > +avio_printf(out, " frameRate=\"%d/%d\"", > st->avg_frame_rate.num, st->avg_frame_rate.den); > +avio_printf(out, ">\n"); > + > output_segment_list(>streams[i], out, c); > avio_printf(out, "\t\t\t\n"); > } > @@ -552,6 +564,7 @@ static int dash_write_header(AVFormatContext *s) > c->single_file = 1; > if (c->single_file) > c->use_template = 0; > +c->ambiguous_frame_rate = 0; > > av_strlcpy(c->dirname, s->filename, sizeof(c->dirname)); > ptr = strrchr(c->dirname, '/'); > @@ -655,10 +668,20 @@ static int dash_write_header(AVFormatContext *s) > // already before being handed to this muxer, so we don't have > mismatches > // between the MPD and the actual segments. > s->avoid_negative_ts = ctx->avoid_negative_ts; > -if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) > +if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { > +AVRational avg_frame_rate = s->streams[i]->avg_frame_rate; > +if (avg_frame_rate.num > 0) { > +if (av_cmp_q(avg_frame_rate, c->min_frame_rate) < 0) > +c->min_frame_rate = avg_frame_rate; > +if (av_cmp_q(c->max_frame_rate, avg_frame_rate) < 0) > +c->max_frame_rate = avg_frame_rate; > +} else { > +c->ambiguous_frame_rate = 1; > +} > c->has_video = 1; > -else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) > +} else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { > c->has_audio = 1; > +} > > set_codec_str(s, st->codec, os->codec_str, sizeof(os->codec_str)); > os->first_pts = AV_NOPTS_VALUE; > -- > 1.7.1 > > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/dashenc: Add framerate to dash manifest
DASH manifest should have framerate specified as an attribute in the AdaptationSet element and Representation elements. Though ISO/IEC 23009-1:2014 doesn't seem to define frameRate as a required attribute, it is at least optional, and DASH-IF IOP 3.0 seems to require it. See section 3.2.4 of http://dashif.org/w/2015/04/DASH-IF-IOP-v3.0.pdf In the event that avg_frame_rate is not set in the muxer, we ignore the frameRate tag altogther. --- libavformat/dashenc.c | 31 +++ 1 files changed, 27 insertions(+), 4 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 7a93214..9c2b4dd 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -24,10 +24,12 @@ #include #endif +#include "libavutil/avassert.h" #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" #include "libavutil/mathematics.h" #include "libavutil/opt.h" +#include "libavutil/rational.h" #include "libavutil/time_internal.h" #include "avc.h" @@ -94,6 +96,8 @@ typedef struct DASHContext { const char *single_file_name; const char *init_seg_name; const char *media_seg_name; +AVRational min_frame_rate, max_frame_rate; +int ambiguous_frame_rate; } DASHContext; static int dash_write(void *opaque, uint8_t *buf, int buf_size) @@ -503,7 +507,11 @@ static int write_manifest(AVFormatContext *s, int final) } if (c->has_video) { -avio_printf(out, "\t\t\n"); +avio_printf(out, "\t\tmax_frame_rate.num && !c->ambiguous_frame_rate) +avio_printf(out, " %s=\"%d/%d\"", (av_cmp_q(c->min_frame_rate, c->max_frame_rate) < 0) ? "maxFrameRate" : "frameRate", c->max_frame_rate.num, c->max_frame_rate.den); +avio_printf(out, ">\n"); + for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; OutputStream *os = >streams[i]; @@ -511,7 +519,11 @@ static int write_manifest(AVFormatContext *s, int final) if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO) continue; -avio_printf(out, "\t\t\t\n", i, os->codec_str, os->bandwidth_str, st->codec->width, st->codec->height); +avio_printf(out, "\t\t\tcodec_str, os->bandwidth_str, st->codec->width, st->codec->height); +if (st->avg_frame_rate.num) +avio_printf(out, " frameRate=\"%d/%d\"", st->avg_frame_rate.num, st->avg_frame_rate.den); +avio_printf(out, ">\n"); + output_segment_list(>streams[i], out, c); avio_printf(out, "\t\t\t\n"); } @@ -552,6 +564,7 @@ static int dash_write_header(AVFormatContext *s) c->single_file = 1; if (c->single_file) c->use_template = 0; +c->ambiguous_frame_rate = 0; av_strlcpy(c->dirname, s->filename, sizeof(c->dirname)); ptr = strrchr(c->dirname, '/'); @@ -655,10 +668,20 @@ static int dash_write_header(AVFormatContext *s) // already before being handed to this muxer, so we don't have mismatches // between the MPD and the actual segments. s->avoid_negative_ts = ctx->avoid_negative_ts; -if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) +if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { +AVRational avg_frame_rate = s->streams[i]->avg_frame_rate; +if (avg_frame_rate.num > 0) { +if (av_cmp_q(avg_frame_rate, c->min_frame_rate) < 0) +c->min_frame_rate = avg_frame_rate; +if (av_cmp_q(c->max_frame_rate, avg_frame_rate) < 0) +c->max_frame_rate = avg_frame_rate; +} else { +c->ambiguous_frame_rate = 1; +} c->has_video = 1; -else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) +} else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { c->has_audio = 1; +} set_codec_str(s, st->codec, os->codec_str, sizeof(os->codec_str)); os->first_pts = AV_NOPTS_VALUE; -- 1.7.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/genh: Fix tools/probetest failure
On Tue, Nov 17, 2015 at 07:04:05PM +0100, Paul B Mahol wrote: > On 11/17/15, Michael Niedermayerwrote: > > From: Michael Niedermayer > > > > Signed-off-by: Michael Niedermayer > > --- > > libavformat/genh.c |2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/libavformat/genh.c b/libavformat/genh.c > > index 260e320..d8723d5 100644 > > --- a/libavformat/genh.c > > +++ b/libavformat/genh.c > > @@ -32,6 +32,8 @@ static int genh_probe(AVProbeData *p) > > { > > if (AV_RL32(p->buf) != MKTAG('G','E','N','H')) > > return 0; > > +if (AV_RL32(p->buf+4) <= 0 || AV_RL32(p->buf+4) > 0x) // channels > > +return 0; > > > > return AVPROBE_SCORE_MAX / 3 * 2; > > } > > -- > > 1.7.9.5 > > > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > ok applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have often repented speaking, but never of holding my tongue. -- Xenocrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] avutil/mem: Add av_fast_mallocz()
From: Michael NiedermayerSigned-off-by: Michael Niedermayer --- libavutil/mem.c |4 libavutil/mem.h | 15 +++ 2 files changed, 19 insertions(+) diff --git a/libavutil/mem.c b/libavutil/mem.c index 323b183..8dfaad8 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -501,3 +501,7 @@ void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size) ff_fast_malloc(ptr, size, min_size, 0); } +void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size) +{ +ff_fast_malloc(ptr, size, min_size, 1); +} diff --git a/libavutil/mem.h b/libavutil/mem.h index a8eb14e..d25b322 100644 --- a/libavutil/mem.h +++ b/libavutil/mem.h @@ -385,6 +385,21 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); /** + * Allocate a buffer, reusing the given one if large enough. + * + * All newly allocated space is initially cleared + * Contrary to av_fast_realloc the current buffer contents might not be + * preserved and on error the old buffer is freed, thus no special + * handling to avoid memleaks is necessary. + * + * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer + * @param size size of the buffer *ptr points to + * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and + * *size 0 if an error occurred. + */ +void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size); + +/** * @} */ -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/dashenc: Add framerate to dash manifest
On Wed, Nov 18, 2015 at 01:13:14AM -0800, Bryan Huh wrote: > DASH manifest should have framerate specified as an attribute in the > AdaptationSet element and Representation elements. Though ISO/IEC > 23009-1:2014 doesn't seem to define frameRate as a required attribute, > it is at least optional, and DASH-IF IOP 3.0 seems to require it. See > section 3.2.4 of http://dashif.org/w/2015/04/DASH-IF-IOP-v3.0.pdf > > In the event that avg_frame_rate is not set in the muxer, we ignore the > frameRate tag altogther. > --- > libavformat/dashenc.c | 31 +++ > 1 files changed, 27 insertions(+), 4 deletions(-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB What does censorship reveal? It reveals fear. -- Julian Assange signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/h264, videotoolbox: do not return invalid frames on failure
On Wed, 18 Nov 2015 15:09:48 +0100 Michael Niedermayerwrote: > On Tue, Nov 17, 2015 at 03:19:29PM +0100, wm4 wrote: > > If videotoolbox_common_end_frame failed, then the AVFrame was returned > > to the API user with the dummy buffer (in AVFrame.buf[0]) still set, and > > the decode call indicating success. > > > > These "half-set" AVFrames with dummy buffer are a videotoolbox specific > > hack, because the decoder requires an allocated AVFrame for its internal > > logic. Videotoolbox on the other hand allocates its frame itself > > internally, and outputs it only on end_frame. At this point, the dummy > > buffer is replaced with the real frame (unless decoding fails). > > --- > > Better solutions welcome. For now, this fixes the API returning garbage > > which can crash or confuse API users, > > --- > > libavcodec/h264_refs.c| 3 ++- > > libavcodec/videotoolbox.c | 2 ++ > > 2 files changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c > > index 619f2ed..9d0641a 100644 > > --- a/libavcodec/h264_refs.c > > +++ b/libavcodec/h264_refs.c > > @@ -515,7 +515,8 @@ void ff_h264_remove_all_refs(H264Context *h) > > > > if (h->short_ref_count && !h->last_pic_for_ec.f->data[0]) { > > ff_h264_unref_picture(h, >last_pic_for_ec); > > -ff_h264_ref_picture(h, >last_pic_for_ec, h->short_ref[0]); > > +if (h->short_ref[0]->f->buf[0]) > > +ff_h264_ref_picture(h, >last_pic_for_ec, h->short_ref[0]); > > } > > no objections from me, but ive no means to test videotoolbox nor am > i a videotoolbox developer or maintainer The real question is whether it's really allowed to turn the AVFrame into a frame with no data at this point. It seemed to be fine, but crashed uninit at the point above (can't ref an unrefed picture; thus the additional check to prevent the assert firing). ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avcodec/h264_slice: Clear top_borders on allocation
From: Michael NiedermayerIn case of bitstream errors the deblock filter and slices can access uninitialized top_borders from previous slices which did not fill them as they stoped halfway due to error or where entirely missing Found-by: Tyson Smith Signed-off-by: Michael Niedermayer --- libavcodec/h264_slice.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index eceda8a..2eaffa5 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -171,9 +171,9 @@ static int alloc_scratch_buffers(H264SliceContext *sl, int linesize) // (= 21x21 for h264) av_fast_malloc(>edge_emu_buffer, >edge_emu_buffer_allocated, alloc_size * 2 * 21); -av_fast_malloc(>top_borders[0], >top_borders_allocated[0], +av_fast_mallocz(>top_borders[0], >top_borders_allocated[0], h->mb_width * 16 * 3 * sizeof(uint8_t) * 2); -av_fast_malloc(>top_borders[1], >top_borders_allocated[1], +av_fast_mallocz(>top_borders[1], >top_borders_allocated[1], h->mb_width * 16 * 3 * sizeof(uint8_t) * 2); if (!sl->bipred_scratchpad || !sl->edge_emu_buffer || -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv2] avformat/mp3dec, rmdec: check return value of ffio_ensure_seekback
On Wed, Nov 18, 2015 at 7:31 AM, wm4wrote: > On Tue, 17 Nov 2015 17:39:31 -0500 > Ganesh Ajjanagadde wrote: > >> ffio_ensure_seekback can fail due to e.g ENOMEM. This return value is >> checked here and a diagnostic is logged. >> >> All usage of ffio_ensure_seekback in the codebase now has the return value >> checked. >> >> Signed-off-by: Ganesh Ajjanagadde >> --- >> libavformat/mp3dec.c | 6 -- >> libavformat/rmdec.c | 3 ++- >> 2 files changed, 6 insertions(+), 3 deletions(-) >> >> diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c >> index 32ca00c..a14bccd 100644 >> --- a/libavformat/mp3dec.c >> +++ b/libavformat/mp3dec.c >> @@ -380,11 +380,13 @@ static int mp3_read_header(AVFormatContext *s) >> uint32_t header, header2; >> int frame_size; >> if (!(i&1023)) >> -ffio_ensure_seekback(s->pb, i + 1024 + 4); >> +if ((ret = ffio_ensure_seekback(s->pb, i + 1024 + 4)) < 0) >> +av_log(s, AV_LOG_WARNING, "ffio_ensure_seekback(): %s\n", >> av_err2str(ret)); >> frame_size = check(s->pb, off + i, ); >> if (frame_size > 0) { >> avio_seek(s->pb, off, SEEK_SET); >> -ffio_ensure_seekback(s->pb, i + 1024 + frame_size + 4); >> +if ((ret = ffio_ensure_seekback(s->pb, i + 1024 + frame_size + >> 4)) < 0) >> +av_log(s, AV_LOG_WARNING, "ffio_ensure_seekback(): %s\n", >> av_err2str(ret)); >> if (check(s->pb, off + i + frame_size, ) >= 0 && >> (header & SAME_HEADER_MASK) == (header2 & SAME_HEADER_MASK)) >> { >> diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c >> index 4ec78ef..1cf0548 100644 >> --- a/libavformat/rmdec.c >> +++ b/libavformat/rmdec.c >> @@ -576,7 +576,8 @@ static int rm_read_header(AVFormatContext *s) >> size = avio_rb32(pb); >> codec_pos = avio_tell(pb); >> >> -ffio_ensure_seekback(pb, 4); >> +if ((ret = ffio_ensure_seekback(pb, 4)) < 0) >> +av_log(s, AV_LOG_WARNING, "ffio_ensure_seekback(): %s\n", >> av_err2str(ret)); >> v = avio_rb32(pb); >> if (v == MKBETAG('M', 'L', 'T', 'I')) { >> int number_of_streams = avio_rb16(pb); > > So why do you not just add the message to the function itself? Because a client may not like the generic message, see e.g the message printed in avformat/apngdec. Handling of the error may vary from context to context, again see the apngdec example where the client does something else in addition to error printing. > > I also question the usefulness of the message. In such cases of OOM > everything goes to hell anyway. No reason to bloat the code with error > printing. Taking that logic a bit further, why bother returning ENOMEM? If the ENOMEM being returned by ensure_seekback is not checked, the information is just silently discarded or garbled with further errors down the road. Anyway, I do not consider it a bloat: the buffer allocated can be big (see in mp3dec > 1024 bytes). A user has a right to know when things "go to hell". Envisioning what may happen, ffmpeg crashes due to OOM, upon which a coredump takes place. That crash happens in a somewhat random location, since OOM handling is a heuristic and determining which process should be killed is an intractable problem. Thus at the time when the core dump is written out, it is not guaranteed that the context is the one where the allocation failed first. Then there are issues of overcommit where malloc may return a non-NULL pointer but OOM happens upon a dereference. Such issues are beyond the scope of error handling, as nothing can be done in such cases anyway. Warning the user when a reasonably large allocation failed in my view is not bloat. It is giving them as much information as we can. Also think of it from a debugging perspective: it can help us find places where the alloc size was unreasonable. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] AAC sequence header data setup if stream copy
Hi, FLV remuxed from MPEG-TS stream does not contains *AAC sequence header* as result no audio with some RTMP servers like *crtmpserver* and YouTube. I am not a first who faced with such problem: http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2014-May/157791.html http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2014-June/158342.html Proposed solution differ from *Tudor SUCIU* a bit. It use the same idea but implementation was taken from *ff_aac_put_audio_specific_config*. Attached patch implement setting *AAC sequence header* in two ways. First way is just to set given bytes into that header: ffmpeg -re -f mpegts -i /usr/local/src/2015-11-15/M1_award.ts -acodec copy -vcodec copy -bsf:a aac_adtstoasc -aac_seq_header_data "1190" -flags +global_header -f flv rtmp://127.0.0.1/live/demo 11 90 is a two bytes of *AAC sequence header* that describe AAC/LC+48000Hz+stereo another way is just build it from encoder parameters: ffmpeg -re -f mpegts -i /usr/local/src/2015-11-15/M1_award.ts -acodec copy -vcodec copy -bsf:a aac_adtstoasc -flvflags aac_seq_header_detect -flags +global_header -f flv rtmp://127.0.0.1/live/demo but it require copying *profile* value from decoder context in ffmpeg.c: diff --git a/ffmpeg.c b/ffmpeg.c index c4e9280..a976f61 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -2970,6 +2970,7 @@ static int transcode_init(void) enc_ctx->audio_service_type = dec_ctx->audio_service_type; enc_ctx->block_align= dec_ctx->block_align; enc_ctx->initial_padding= dec_ctx->delay; +enc_ctx->profile= dec_ctx->profile; #if FF_API_AUDIOENC_DELAY enc_ctx->delay = dec_ctx->delay; #endif both methods makes possible to work with *crtmpserver* and YouTube by simple remuxing streams for publishing -- Maksym Veremeyenko From afdc10c4f496d1e72a3b955513cf6891767d731a Mon Sep 17 00:00:00 2001 From: Maksym VeremeyenkoDate: Tue, 17 Nov 2015 20:02:22 +0200 Subject: [PATCH] AAC sequence header data setup if stream copy --- ffmpeg.c |1 + libavformat/flvenc.c | 53 ++ 2 files changed, 54 insertions(+), 0 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index c4e9280..a976f61 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -2970,6 +2970,7 @@ static int transcode_init(void) enc_ctx->audio_service_type = dec_ctx->audio_service_type; enc_ctx->block_align= dec_ctx->block_align; enc_ctx->initial_padding= dec_ctx->delay; +enc_ctx->profile= dec_ctx->profile; #if FF_API_AUDIOENC_DELAY enc_ctx->delay = dec_ctx->delay; #endif diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index e217ba8..6380fd7 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -28,6 +28,9 @@ #include "flv.h" #include "internal.h" #include "metadata.h" +#include "libavutil/opt.h" +#include "libavcodec/put_bits.h" +#include "libavcodec/aacenctab.h" static const AVCodecTag flv_video_codec_ids[] = { @@ -68,6 +71,10 @@ typedef struct FLVContext { AVCodecContext *video_enc; double framerate; AVCodecContext *data_enc; + +uint8_t *aac_seq_header_data; +int aac_seq_header_length; +int flags; } FLVContext; typedef struct FLVStreamContext { @@ -452,6 +459,37 @@ static int flv_write_header(AVFormatContext *s) if (enc->codec_id == AV_CODEC_ID_AAC) { avio_w8(pb, get_audio_flags(s, enc)); avio_w8(pb, 0); // AAC sequence header +if (!enc->extradata_size && flv->aac_seq_header_data) +{ +avio_write(pb, flv->aac_seq_header_data, flv->aac_seq_header_length); + +av_log(s, AV_LOG_WARNING, "AAC sequence header length=%d\n", flv->aac_seq_header_length); +} +else if (!enc->extradata_size && !flv->aac_seq_header_data && flv->flags & 1) +{ +PutBitContext pbc; +int samplerate_index; +int channels = flv->audio_enc->channels - (flv->audio_enc->channels == 8 ? 1 : 0); +uint8_t data[2]; + +for (samplerate_index = 0; samplerate_index < 16; samplerate_index++) +if (flv->audio_enc->sample_rate == mpeg4audio_sample_rates[samplerate_index]) +break; + +init_put_bits(, data, sizeof(data)); +put_bits(, 5, flv->audio_enc->profile + 1); //profile +put_bits(, 4, samplerate_index); //sample rate index +put_bits(, 4, channels); +put_bits(, 1, 0); //frame length - 1024 samples +put_bits(, 1, 0); //does not depend on core coder +put_bits(, 1, 0); //is not extension +
Re: [FFmpeg-devel] [PATCH] movenc-test: Pad the packet data start with 0s
On 11/17/2015 4:00 PM, Derek Buitenhuis wrote: > This way, it never starts with 0xFFF0, and never trips the > ADTS "Detection" code in movenc.c. > > Signed-off-by: Derek Buitenhuis> --- > libavformat/movenc-test.c | 4 ++-- > tests/ref/fate/movenc | 40 > 2 files changed, 22 insertions(+), 22 deletions(-) Ping. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: Add option to use gmp
I previously had an option for gcrypt too but it seemed to not work (FFmpeg crashed, iirc), so I just gave up on it. On 18 November 2015 at 05:41, Matt Oliverwrote: > On 15 November 2015 at 01:09, Ricardo Constantino > wrote: > >> Enables RTMP(T)E support with SChannel >> >> (Not sure if this is the right way to enable this) >> >> Signed-off-by: Ricardo Constantino >> --- >> configure | 6 +- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/configure b/configure >> index 9a736ce..6c658f2 100755 >> --- a/configure >> +++ b/configure >> @@ -199,6 +199,8 @@ External library support: >>--enable-chromaprint enable audio fingerprinting with chromaprint >> [no] >>--enable-fontconfig enable fontconfig, useful for drawtext filter >> [no] >>--enable-frei0r enable frei0r video filtering [no] >> + --enable-gmp enable gmp, needed for rtmp(t)e support >> + with SChannel [no] >>--enable-gnutls enable gnutls, needed for https support >> if openssl is not used [no] >>--disable-iconv disable iconv [autodetect] >> @@ -1395,6 +1397,7 @@ EXTERNAL_LIBRARY_LIST=" >> crystalhd >> decklink >> frei0r >> +gmp >> gnutls >> iconv >> ladspa >> @@ -1946,7 +1949,6 @@ CONFIG_EXTRA=" >> frame_thread_encoder >> g722dsp >> gcrypt >> -gmp >> golomb >> gplv3 >> h263dsp >> @@ -4759,6 +4761,7 @@ die_license_disabled nonfree nvenc >> enabled gpl && die_license_disabled_gpl nonfree libfdk_aac >> enabled gpl && die_license_disabled_gpl nonfree openssl >> >> +die_license_disabled version3 gmp >> die_license_disabled version3 libopencore_amrnb >> die_license_disabled version3 libopencore_amrwb >> die_license_disabled version3 libsmbclient >> @@ -5325,6 +5328,7 @@ enabled avisynth && { { check_lib2 >> "windows.h" LoadLibrary; } || >> enabled chromaprint && require chromaprint chromaprint.h >> chromaprint_get_version -lchromaprint >> enabled decklink && { check_header DeckLinkAPI.h || die "ERROR: >> DeckLinkAPI.h header not found"; } >> enabled frei0r&& { check_header frei0r.h || die "ERROR: >> frei0r.h header not found"; } >> +enabled gmp && require2 gmp gmp.h mpz_export -lgmp >> enabled gnutls&& require_pkg_config gnutls gnutls/gnutls.h >> gnutls_global_init >> enabled ladspa&& { check_header ladspa.h || die "ERROR: >> ladspa.h header not found"; } >> enabled libiec61883 && require libiec61883 libiec61883/iec61883.h >> iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883 >> -- >> 2.6.3 >> > > The Diffie-Hellmann code can be compiled using either gmp or gcrypt so > command line options to enable either of those should probably be provided. > > However currently configure seems to auto check and enable both gmp and > gcrypt if gnutls is enabled (line 5476) with no user visible option to > disable this behavior (or atleast to select which of the external libs > should be used). Currently if both dependencies are available then both > will be automatically linked despite only 1 being used and this behavior > doesnt appear to be visible to the user so it seems a bit hacky to me. It > also appears to be just plain wrong as gmp is used by default over gcrypt > despite gmp being LGPL v3 (gcrypt and gnutls are v2.1) and it is not > checking if version 3 is enabled. So currently a v3 lib is being stealth > linked without version3 being enabled or any user input/output. > > If the existing method is to be used then the same thing will have to be > done to enable either gmp or gcrypt if schannel is enabled aswell with the > additiotn of a version check. However I think that making user visible > options to select the use of either gmp or gcrypt is probably the better > option which would mean the removal of the existing automatic enabling if > gcrypt is used. This may result in changed behavior though for people > compiling the lib that just assume previous behavior and so would need a > version bump. > > Once people provide feedback on which option is preferable then ill write > up a patch. > > > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffprobe: do not exit in case the demuxer returns AVERROR(EAGAIN)
On Tue, Nov 17, 2015 at 05:20:08PM +0100, Stefano Sabatini wrote: > On date Tuesday 2015-11-17 17:12:46 +0100, wm4 encoded: > > On Tue, 17 Nov 2015 17:00:29 +0100 > > Stefano Sabatiniwrote: > [...] > > > No, just in case ret == AVERROR(EAGAIN), in all other failure cases it > > > will exit the loop immediately. > > > > > > BTW, the same problem affects some API usage examples. > > > > Yeah, I got that wrong - but even with EAGAIN, is there a guarantee? > > I don't know. Note that this is also the same strategy applied by > ffplay and ffmpeg (in this case it will wait with a usleep). We could > abort in case a threshold count value is reached, but that would be > probably overkill. iam not aware of any inf loops with EAGAIN [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec: add OpenJPEG 2.x compatibility
On 11/17/2015 3:27 PM, Michael Bradshaw wrote: > Attached patch adds support for OpenJPEG 2.0/2.1. Please review. This seems like quite a large change. Does it perhaps warrant its own file/decoder name? - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] aac_fixed: fix overflow in sbr_sum_square_c
On 16.11.2015 02:59, Michael Niedermayer wrote: > On Fri, Nov 13, 2015 at 10:32:47PM +0100, Andreas Cadhalpun wrote: >> Because these samples aren't tested with the aac_fixed decoder: >> * aac/ct_faac-adts.aac is only used to test the aac demuxer. >> * aac/al07_96.mp4 is for some reason only tested with the aac decoder. >> >> There the overflow happens on lines like: >> che->ch[0].ret[j] = >> (int32_t)av_clipl_int32((int64_t)che->ch[0].ret[j]<<7)+0x8000; >> > >> I guess the +0x8000 was meant to be inside av_clipl_int32. > > could be > also there was a different patch about a overflow in that > 0729 11:58 Nedeljko Babic (1.8K) [FFmpeg-devel] [PATCH] > avcodec/aacdec_fixed: Fix integer overflow > that case was a bug elsewhere though > > in that light, my first question, is, is the overflowing value used > (aka affects the decoder output) ? Simply removing the '+0x8000' doesn't change the framecrc output for these two samples, so I guess the answer is no. Best regards, Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] aacsbr_fixed: avoid division by zero in sbr_gain_calc
On Thu, Nov 19, 2015 at 12:31:17AM +0100, Andreas Cadhalpun wrote: > On 16.11.2015 13:46, Michael Niedermayer wrote: > > On Fri, Nov 13, 2015 at 11:19:44PM +0100, Andreas Cadhalpun wrote: > >> Well, unfortunately just rejecting 0 in sbr_dequant is no solution, > >> because, as you noticed, that only happens via underflow. > > > > a value that has underflowed should be 0, so underflow affecting > > anything implies 0 as result and so a check for 0 would cover all > > underflows > > I think i misunderstand somehow > > The problem is that this code manipulates SoftFloat.exp directly. > > >> One could check for exponents smaller than MIN_EXP, but since > > > > exponents must not be smaller than MIN_EXP. > > no *_sf function should set such an exponent. code directly writing > > exponents has to check for exp < MIN_EXP > > This code doesn't... > > > that could in principle be done by using a _sf function which allows > > such exponents on input and clears it up on output > > A function av_exp2_sf properly calculating 2^v for a Softfloat v could > be used to fix this problem. > > >> the exponent can get smaller during the calculations in sbr_gain_calc, > >> that wouldn't necessarily avoid the division by 0. > >> > > > >> Additionally both sbr_dequant and sbr_gain_calc are void functions, > >> so can't easily return errors. > > > > iam not sure i understand your concern ? > > the resturn type is easy changeable or flag could be added to the > > context indicating an error or a simpler hack could be used to > > fix this in the releases with a more complete cleanup in master > > Changing the return type means changing also the return types of the > functions calling this function and also for the aac float decoder, > which does not fail in this case... and that gives a clue for the > proper solution, see below. > > > but maybe iam missing something why you consider this to be a bad > > solution ? > > I guess what we both missed is that the actual problem is that the > calculation of noise_facs in the aac_fixed decoder is utterly broken: > > First they are set in read_sbr_noise, which only sets mant and not exp, > so for example: > noise_facs[1][0] = {mant = 29, exp = 0} > > Then in sbr_dequant we have (comments mine): > for (e = 1; e <= sbr->data[ch].bs_num_noise; e++) > for (k = 0; k < sbr->n_q; k++){ > // This should calculate the same as the aac float decoder: > // sbr->data[ch].noise_facs[e][k] = > // exp2f(NOISE_FLOOR_OFFSET - sbr->data[ch].noise_facs[e][k]); > sbr->data[ch].noise_facs[e][k].exp = NOISE_FLOOR_OFFSET - \ > sbr->data[ch].noise_facs[e][k].mant + 1; > sbr->data[ch].noise_facs[e][k].mant = 0x2000; > } > > Thus we get: > noise_facs[1][0].exp = 6 - 29 + 1 = -22; > noise_facs[1][0].mant = 0x2000; > Together: > noise_facs[1][0] = {mant = 536870912, exp = -22} > > So far so good. However, the next time sbr_dequant is called this breaks: > noise_facs[1][0].exp = 6 - 536870912 + 1 = -536870905; > > This is obviously completely bogus. yes > Instead this code needs a function like av_exp2_sf. no, thats not the problem this code is missing error checks and only adding error checks will fix that there is read_sbr_noise() which reads data there is sbr_dequant() which converts the data from "read data" to lets call it "dequantized data" what you describe sounds like that sbr_dequant() is called on top of the output from sbr_dequant(), that sounds like a error condition for both fixed and float [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is what and why we do it that matters, not just one of them. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffprobe: do not exit in case the demuxer returns AVERROR(EAGAIN)
On Thu, Nov 19, 2015 at 02:36:19AM +0100, Michael Niedermayer wrote: > On Thu, Nov 19, 2015 at 01:25:53AM +0100, Andreas Cadhalpun wrote: > > On 18.11.2015 15:07, Michael Niedermayer wrote: > > > On Tue, Nov 17, 2015 at 05:20:08PM +0100, Stefano Sabatini wrote: > > >> On date Tuesday 2015-11-17 17:12:46 +0100, wm4 encoded: > > >>> On Tue, 17 Nov 2015 17:00:29 +0100 > > >>> Stefano Sabatiniwrote: > > >> [...] > > No, just in case ret == AVERROR(EAGAIN), in all other failure cases it > > will exit the loop immediately. > > > > BTW, the same problem affects some API usage examples. > > >>> > > >>> Yeah, I got that wrong - but even with EAGAIN, is there a guarantee? > > >> > > >> I don't know. Note that this is also the same strategy applied by > > >> ffplay and ffmpeg (in this case it will wait with a usleep). We could > > >> abort in case a threshold count value is reached, but that would be > > >> probably overkill. > > > > > > iam not aware of any inf loops with EAGAIN > > > > Well, I am. I even sent patches fixing that, but you had objections. [1] > > FFM is used as a ring buffer between processes > if you try to read a ffm file that is not connected to any process > writing into it then that could wait via EAGAIN forever > that is a problem > > A fix would require to extend the ffm format slightly i think > a simple fix would be for the muxer to write teh current date in the > file and the demuxer to skip EAGAIN and fail if the read data differs > by more than a small amout from the current date or something similar > > if you dont want to work on this, please say so, then ill look into > it > other ideas are of course welcome another even simpler idea would be to add a user option to switch the ring buffer behavior off/on that would solve the EAGAIN issue for randomly fed files into random applications too it would not help in the ring buffer case when the producer crashes or fails for other reasons [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many things microsoft did are stupid, but not doing something just because microsoft did it is even more stupid. If everything ms did were stupid they would be bankrupt already. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffprobe: do not exit in case the demuxer returns AVERROR(EAGAIN)
On Thu, Nov 19, 2015 at 01:25:53AM +0100, Andreas Cadhalpun wrote: > On 18.11.2015 15:07, Michael Niedermayer wrote: > > On Tue, Nov 17, 2015 at 05:20:08PM +0100, Stefano Sabatini wrote: > >> On date Tuesday 2015-11-17 17:12:46 +0100, wm4 encoded: > >>> On Tue, 17 Nov 2015 17:00:29 +0100 > >>> Stefano Sabatiniwrote: > >> [...] > No, just in case ret == AVERROR(EAGAIN), in all other failure cases it > will exit the loop immediately. > > BTW, the same problem affects some API usage examples. > >>> > >>> Yeah, I got that wrong - but even with EAGAIN, is there a guarantee? > >> > >> I don't know. Note that this is also the same strategy applied by > >> ffplay and ffmpeg (in this case it will wait with a usleep). We could > >> abort in case a threshold count value is reached, but that would be > >> probably overkill. > > > > iam not aware of any inf loops with EAGAIN > > Well, I am. I even sent patches fixing that, but you had objections. [1] FFM is used as a ring buffer between processes if you try to read a ffm file that is not connected to any process writing into it then that could wait via EAGAIN forever that is a problem A fix would require to extend the ffm format slightly i think a simple fix would be for the muxer to write teh current date in the file and the demuxer to skip EAGAIN and fail if the read data differs by more than a small amout from the current date or something similar if you dont want to work on this, please say so, then ill look into it other ideas are of course welcome > So ffprobe can already hang in an infinite EAGAIN loop that happens > within avformat_find_stream_info. > > Best regards, > Andreas > > 1: https://ffmpeg.org/pipermail/ffmpeg-devel/2015-March/170009.html > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] UDP constant bitrate feature (cbr)
Hi, On Wed, Nov 18, 2015 at 9:28 PM, Zach Swenawrote: > Are you referring to this seperate applciation? > > https://github.com/mmalecki/multicat/blob/master/trunk/README > Probably what was meant was http://www.videolan.org/projects/multicat.html , but that might be a git svn clone of it. > > ...I would argue that this very > much is a bug, not a feature. Just because an external applciation can fix > the problem in some instances doesn't mean it isn't a problem in the first > place. > I do not think anyone in this thread was noting that using another application is the preferred solution and that it shouldn't be improved in FFmpeg. Just that multicat is doing what is considered to be correct (and if any fixes are going to be done they should be done in that manner). Best regards, Jan Ekström ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/6] lavf/tee: use lavf API for applying bitstream filters
--- libavformat/tee.c | 43 ++- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/libavformat/tee.c b/libavformat/tee.c index af52a49..c527854 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -405,45 +405,6 @@ fail: return ret; } -static int filter_packet(void *log_ctx, AVPacket *pkt, - AVFormatContext *fmt_ctx, AVBitStreamFilterContext *bsf_ctx) -{ -AVCodecContext *enc_ctx = fmt_ctx->streams[pkt->stream_index]->codec; -int ret = 0; - -while (bsf_ctx) { -AVPacket new_pkt = *pkt; -ret = av_bitstream_filter_filter(bsf_ctx, enc_ctx, NULL, - _pkt.data, _pkt.size, - pkt->data, pkt->size, - pkt->flags & AV_PKT_FLAG_KEY); -if (ret == 0 && new_pkt.data != pkt->data) { -if ((ret = av_copy_packet(_pkt, pkt)) < 0) -break; -ret = 1; -} - -if (ret > 0) { -av_packet_unref(pkt); -new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, - av_buffer_default_free, NULL, 0); -if (!new_pkt.buf) -break; -} -if (ret < 0) { -av_log(log_ctx, AV_LOG_ERROR, -"Failed to filter bitstream with filter %s for stream %d in file '%s' with codec %s\n", -bsf_ctx->filter->name, pkt->stream_index, fmt_ctx->filename, -avcodec_get_name(enc_ctx->codec_id)); -} -*pkt = new_pkt; - -bsf_ctx = bsf_ctx->next; -} - -return ret; -} - static int tee_write_trailer(AVFormatContext *avf) { TeeContext *tee = avf->priv_data; @@ -496,8 +457,8 @@ static int tee_write_packet(AVFormatContext *avf, AVPacket *pkt) pkt2.duration = av_rescale_q(pkt->duration, tb, tb2); pkt2.stream_index = s2; -filter_packet(avf2, , avf2, tee->slaves[i].bsfs[s2]); -if ((ret = av_interleaved_write_frame(avf2, )) < 0) +if ((ret = av_apply_bitstream_filters(avf2, , tee->slaves[i].bsfs[s2])) < 0 || +(ret = av_interleaved_write_frame(avf2, )) < 0) if (!ret_all) ret_all = ret; } -- 2.6.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/6] ffmpeg: use lavf API for applying bitstream filters
--- ffmpeg.c | 46 -- ffmpeg.h | 1 - ffmpeg_opt.c | 6 +- 3 files changed, 9 insertions(+), 44 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index c4e9280..cae680d 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -683,47 +683,10 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) if (bsfc) av_packet_split_side_data(pkt); -while (bsfc) { -AVPacket new_pkt = *pkt; -AVDictionaryEntry *bsf_arg = av_dict_get(ost->bsf_args, - bsfc->filter->name, - NULL, 0); -int a = av_bitstream_filter_filter(bsfc, avctx, - bsf_arg ? bsf_arg->value : NULL, - _pkt.data, _pkt.size, - pkt->data, pkt->size, - pkt->flags & AV_PKT_FLAG_KEY); -if(a == 0 && new_pkt.data != pkt->data) { -uint8_t *t = av_malloc(new_pkt.size + AV_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so cannot overflow -if(t) { -memcpy(t, new_pkt.data, new_pkt.size); -memset(t + new_pkt.size, 0, AV_INPUT_BUFFER_PADDING_SIZE); -new_pkt.data = t; -new_pkt.buf = NULL; -a = 1; -} else -a = AVERROR(ENOMEM); -} -if (a > 0) { -pkt->side_data = NULL; -pkt->side_data_elems = 0; -av_packet_unref(pkt); -new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, - av_buffer_default_free, NULL, 0); -if (!new_pkt.buf) -exit_program(1); -} else if (a < 0) { -new_pkt = *pkt; -av_log(NULL, AV_LOG_ERROR, "Failed to open bitstream filter %s for stream %d with codec %s", - bsfc->filter->name, pkt->stream_index, - avctx->codec ? avctx->codec->name : "copy"); -print_error("", a); -if (exit_on_error) -exit_program(1); -} -*pkt = new_pkt; - -bsfc = bsfc->next; +if ((ret = av_apply_bitstream_filters(s, pkt, bsfc)) < 0) { +print_error("", ret); +if (exit_on_error) +exit_program(1); } if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { @@ -4190,7 +4153,6 @@ static int transcode(void) av_dict_free(>sws_dict); av_dict_free(>swr_opts); av_dict_free(>resample_opts); -av_dict_free(>bsf_args); } } } diff --git a/ffmpeg.h b/ffmpeg.h index 82ab1ee..6eeb152 100644 --- a/ffmpeg.h +++ b/ffmpeg.h @@ -452,7 +452,6 @@ typedef struct OutputStream { AVDictionary *sws_dict; AVDictionary *swr_opts; AVDictionary *resample_opts; -AVDictionary *bsf_args; char *apad; OSTFinished finished;/* no more packets should be written for this stream */ int unavailable; /* true if the steram is unavailable (possibly temporarily) */ diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 131dd89..ca1640c 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1255,7 +1255,11 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e bsfc_prev->next = bsfc; else ost->bitstream_filters = bsfc; -av_dict_set(>bsf_args, bsfc->filter->name, arg, 0); +if (arg) +if (!(bsfc->args = av_strdup(arg))) { +av_log(NULL, AV_LOG_FATAL, "Bitstream filter memory allocation failed\n"); +exit_program(1); +} bsfc_prev = bsfc; bsf = next; -- 2.6.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/6] lavf: add API to apply a list of bsfs to a packet
--- libavformat/avformat.h | 8 libavformat/utils.c| 49 + 2 files changed, 57 insertions(+) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 5283085..96d3cfd 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2738,6 +2738,14 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, int avformat_queue_attached_pictures(AVFormatContext *s); +/** + * Apply a list of bitstream filters to a packet. + * + * @return >=0 on success; + * AVERROR code on failure + */ +int av_apply_bitstream_filters(AVFormatContext *s, AVPacket *pkt, + AVBitStreamFilterContext *bsfc); /** * @} diff --git a/libavformat/utils.c b/libavformat/utils.c index 9399489..3ed7935 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4630,3 +4630,52 @@ uint8_t *ff_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, sd->size = size; return data; } + +int av_apply_bitstream_filters(AVFormatContext *s, AVPacket *pkt, + AVBitStreamFilterContext *bsfc) +{ +int ret = 0; +AVStream *st = s->streams[pkt->stream_index]; +while (bsfc) { +AVPacket new_pkt = *pkt; +int a = av_bitstream_filter_filter(bsfc, st->codec, NULL, + _pkt.data, _pkt.size, + pkt->data, pkt->size, + pkt->flags & AV_PKT_FLAG_KEY); +if(a == 0 && new_pkt.data != pkt->data) { +uint8_t *t = av_malloc(new_pkt.size + AV_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so cannot overflow +if (t) { +memcpy(t, new_pkt.data, new_pkt.size); +memset(t + new_pkt.size, 0, AV_INPUT_BUFFER_PADDING_SIZE); +new_pkt.data = t; +new_pkt.buf = NULL; +a = 1; +} else { +a = AVERROR(ENOMEM); +} +} +if (a > 0) { +new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, + av_buffer_default_free, NULL, 0); +if (new_pkt.buf) { +pkt->side_data = NULL; +pkt->side_data_elems = 0; +av_packet_unref(pkt); +} else { +av_freep(_pkt.data); +a = AVERROR(ENOMEM); +} +} +if (a < 0) { +av_log(s, AV_LOG_ERROR, "Failed to open bitstream filter %s for stream %d with codec %s", + bsfc->filter->name, pkt->stream_index, + st->codec->codec ? st->codec->codec->name : "copy"); +ret = a; +break; +} +*pkt = new_pkt; + +bsfc = bsfc->next; +} +return ret; +} -- 2.6.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] sbr_qmf_analysis: sanitize input for 32-bit imdct
If the input contains too many too large values, the imdct can overflow. Even if it didn't, the output would be larger than the valid range of 29 bits. Note that this is a very delicate limit: Allowing values up to 1<<25 does not prevent input larger than 1<<29 from arriving at sbr_sum_square, while limiting values to 1<<23 breaks the fate-aac-fixed-al_sbr_hq_cm_48_5.1 test. Signed-off-by: Andreas Cadhalpun--- Nedeljko, do you have an explanation why larger input values here are invalid? By the way, the imdct calculations in imdct_and_windowing and sbr_qmf_synthesis can also overflow, so maybe need a similar check. --- libavcodec/aacsbr_template.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c index 66f4159..f48ddd0 100644 --- a/libavcodec/aacsbr_template.c +++ b/libavcodec/aacsbr_template.c @@ -1153,6 +1153,9 @@ static void sbr_qmf_analysis(AVFloatDSPContext *dsp, FFTContext *mdct, INTFLOAT z[320], INTFLOAT W[2][32][32][2], int buf_idx) { int i; +#if USE_FIXED +int j; +#endif memcpy(x, x+1024, (320-32)*sizeof(x[0])); memcpy(x+288, in, 1024*sizeof(x[0])); for (i = 0; i < 32; i++) { // numTimeSlots*RATE = 16*2 as 960 sample frames @@ -1160,6 +1163,21 @@ static void sbr_qmf_analysis(AVFloatDSPContext *dsp, FFTContext *mdct, dsp->vector_fmul_reverse(z, sbr_qmf_window_ds, x, 320); sbrdsp->sum64x5(z); sbrdsp->qmf_pre_shuffle(z); +#if USE_FIXED +for (j = 64; j < 128; j++) { +if (z[j] > 1<<24) { +av_log(NULL, AV_LOG_WARNING, + "sbr_qmf_analysis: value %09d too large, setting to %09d\n", + z[j], 1<<24); +z[j] = 1<<24; +} else if (z[j] < -(1<<24)) { +av_log(NULL, AV_LOG_WARNING, + "sbr_qmf_analysis: value %09d too small, setting to %09d\n", + z[j], -(1<<24)); +z[j] = -(1<<24); +} +} +#endif mdct->imdct_half(mdct, z, z+64); sbrdsp->qmf_post_shuffle(W[buf_idx][i], z); x += 32; -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] aac_fixed: fix overflow in sbr_sum_square_c
On 16.11.2015 15:39, Nedeljko Babic wrote: >>> On 11.11.2015 13:46, Michael Niedermayer wrote: >> Comments fro AAC and SBR experts very welcome! > > This code was developed a while ago, but based on informations that I have > this part of code was analysed regarding possibility of overflow and > conclusion > was that there is no valid way for causing overflow here. I would be very interested in details about this analysis of yours. My investigation of this code leads me to believe that actually the potential input range for sbr_sum_square is several orders of magnitude larger than what fits into an int32_t, but since that type is used, lots of overflows are happening, most during the imdct calculation. > And regarding valid range, if I remember correctly it should be 29, not 32. Well, the input range should be 29-bits, because otherwise this function can overflow. So if you say that larger values are invalid, I suggest to assert that they don't happen. See attached patch. To prevent triggering these asserts, one can force the input to be small enough. Doing that early enough also avoids overflows along the way. I'll send a separate patch for that. Best regards, Andreas >From 0555a4aa4a9398e7abc787760b67032fbb00e7e6 Mon Sep 17 00:00:00 2001 From: Andreas CadhalpunDate: Thu, 19 Nov 2015 00:37:52 +0100 Subject: [PATCH] sbrdsp_fixed: assert that input values for sbr_sum_square_c are valid Larger values can cause overflows, leading to this function returning a negative value. Signed-off-by: Andreas Cadhalpun --- libavcodec/sbrdsp_fixed.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/sbrdsp_fixed.c b/libavcodec/sbrdsp_fixed.c index 5b7b7a6..f4e3de0 100644 --- a/libavcodec/sbrdsp_fixed.c +++ b/libavcodec/sbrdsp_fixed.c @@ -38,9 +38,14 @@ static SoftFloat sbr_sum_square_c(int (*x)[2], int n) int i, nz, round; for (i = 0; i < n; i += 2) { +// Larger values are inavlid and could cause overflows of accu. +av_assert2(FFABS(x[i + 0][0]) >> 29 == 0); accu += (int64_t)x[i + 0][0] * x[i + 0][0]; +av_assert2(FFABS(x[i + 0][1]) >> 29 == 0); accu += (int64_t)x[i + 0][1] * x[i + 0][1]; +av_assert2(FFABS(x[i + 1][0]) >> 29 == 0); accu += (int64_t)x[i + 1][0] * x[i + 1][0]; +av_assert2(FFABS(x[i + 1][1]) >> 29 == 0); accu += (int64_t)x[i + 1][1] * x[i + 1][1]; } -- 2.6.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] UDP constant bitrate feature (cbr)
On 18 November 2015 at 19:28, Zach Swenawrote: > Are you referring to this seperate applciation? > > https://github.com/mmalecki/multicat/blob/master/trunk/README > > While using that makes sense for Pavel's application, why should FFmpeg > produce a problematic UDP stream in the first place? For applications like > I need that involve encoding the stream in the first place, why should I > have to use a seperate program to make the output stream complient? FFmpeg > should keep track of the number of bytes between pcr and smoothly output > the stream regardless of what the input is. I would argue that this very > much is a bug, not a feature. Just because an external applciation can fix > the problem in some instances doesn't mean it isn't a problem in the first > place. Because FFmpeg again cannot know a priori whether the input signal is fully VBV compliant for use within MPEGTS. An RTMP feed is an example of a feed which certainly isn't and so FFmpeg has to make some numbers up in order to make a valid TS. Such guessing might work in the file world but in the standards compliant MPEGTS world it is guaranteed to cause problems. Kieran ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] mxfdec: check edit_rate also for physical_track
On 16.11.2015 09:02, tim nicholson wrote: > On 15/11/15 18:07, Andreas Cadhalpun wrote: >> Previously only the edit_rate of material_track was checked. >> If it's negative, it causes assertion failures in av_rescale_rnd. >> >> Signed-off-by: Andreas Cadhalpun>> --- >> libavformat/mxfdec.c | 10 ++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c >> index 99c8fed..429f46a 100644 >> --- a/libavformat/mxfdec.c >> +++ b/libavformat/mxfdec.c >> @@ -1776,6 +1776,16 @@ static int >> mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_t >> continue; >> } >> >> +if (physical_track->edit_rate.num <= 0 || >> +physical_track->edit_rate.den <= 0) { >> +av_log(mxf->fc, AV_LOG_WARNING, >> + "Invalid edit rate (%d/%d) found on structural" >> + " component #%d, defaulting to 25/1\n", >> + physical_track->edit_rate.num, >> + physical_track->edit_rate.den, i); >> +physical_track->edit_rate = (AVRational){25, 1}; >> +} >> + >> for (k = 0; k < >> physical_track->sequence->structural_components_count; k++) { >> if (!(mxf_tc = mxf_resolve_timecode_component(mxf, >> _track->sequence->structural_components_refs[k]))) >> continue; >> > > LGTM, Pushed. > but I am curious as to where you have seen examples of negative > edit rates. I've fuzzed with afl [1] and noticed the assertion failures. Best regards, Andreas 1: http://lcamtuf.coredump.cx/afl/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/pthread_slice: Remove rets_count
From: Michael NiedermayerIt appears rets_count is redundant Signed-off-by: Michael Niedermayer --- libavcodec/pthread_slice.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libavcodec/pthread_slice.c b/libavcodec/pthread_slice.c index f2c05d8..e887428 100644 --- a/libavcodec/pthread_slice.c +++ b/libavcodec/pthread_slice.c @@ -50,7 +50,6 @@ typedef struct SliceThreadContext { action_func2 *func2; void *args; int *rets; -int rets_count; int job_count; int job_size; @@ -100,7 +99,7 @@ static void* attribute_align_arg worker(void *v) ret = c->func ? c->func(avctx, (char*)c->args + our_job*c->job_size): c->func2(avctx, c->args, our_job, self_id); if (c->rets) -c->rets[our_job%c->rets_count] = ret; +c->rets[our_job%c->job_count] = ret; pthread_mutex_lock(>current_job_lock); our_job = c->current_job++; @@ -165,10 +164,8 @@ static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, i c->func = func; if (ret) { c->rets = ret; -c->rets_count = job_count; } else { c->rets = NULL; -c->rets_count = 1; } c->current_execute++; pthread_cond_broadcast(>current_job_cond); -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] aac_fixed: fix overflow in sbr_sum_square_c
On Wed, Nov 18, 2015 at 7:01 PM, Andreas Cadhalpunwrote: > On 16.11.2015 15:39, Nedeljko Babic wrote: On 11.11.2015 13:46, Michael Niedermayer wrote: >>> Comments fro AAC and SBR experts very welcome! >> >> This code was developed a while ago, but based on informations that I have >> this part of code was analysed regarding possibility of overflow and >> conclusion >> was that there is no valid way for causing overflow here. > > I would be very interested in details about this analysis of yours. > My investigation of this code leads me to believe that actually the potential > input range for sbr_sum_square is several orders of magnitude larger than what > fits into an int32_t, but since that type is used, lots of overflows are > happening, > most during the imdct calculation. > >> And regarding valid range, if I remember correctly it should be 29, not 32. > > Well, the input range should be 29-bits, because otherwise this function can > overflow. > > So if you say that larger values are invalid, I suggest to assert that they > don't happen. See attached patch. > > To prevent triggering these asserts, one can force the input to be small > enough. > Doing that early enough also avoids overflows along the way. > I'll send a separate patch for that. I have not analyzed any of this stuff, but just a general suggestion to all here based on these aac related threads: Please document any weird ranges like the 29 bits above in the code either as asserts or as comments. It helps a lot in future analysis for an unfamiliar reader in verifying lack of overflow, etc. I mention this due to some back and forth I had regarding apedec: https://ffmpeg.org/pipermail/ffmpeg-devel/2015-October/180990.html. There it is entirely possible that I was just dumb and could not see the 24 bit thing easily, but here clearly in spite of a lot of thought the analysis is hard. > > Best regards, > Andreas > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffprobe: do not exit in case the demuxer returns AVERROR(EAGAIN)
On 18.11.2015 15:07, Michael Niedermayer wrote: > On Tue, Nov 17, 2015 at 05:20:08PM +0100, Stefano Sabatini wrote: >> On date Tuesday 2015-11-17 17:12:46 +0100, wm4 encoded: >>> On Tue, 17 Nov 2015 17:00:29 +0100 >>> Stefano Sabatiniwrote: >> [...] No, just in case ret == AVERROR(EAGAIN), in all other failure cases it will exit the loop immediately. BTW, the same problem affects some API usage examples. >>> >>> Yeah, I got that wrong - but even with EAGAIN, is there a guarantee? >> >> I don't know. Note that this is also the same strategy applied by >> ffplay and ffmpeg (in this case it will wait with a usleep). We could >> abort in case a threshold count value is reached, but that would be >> probably overkill. > > iam not aware of any inf loops with EAGAIN Well, I am. I even sent patches fixing that, but you had objections. [1] So ffprobe can already hang in an infinite EAGAIN loop that happens within avformat_find_stream_info. Best regards, Andreas 1: https://ffmpeg.org/pipermail/ffmpeg-devel/2015-March/170009.html ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] UDP constant bitrate feature (cbr)
> A proper ts remuxer is quite a different beast to what FFmpeg is > designed to do. As much as people try it can't be hacked into the > FFmpeg paradigm which is largely based around converting static files > of fixed codecs/resolutions in a nonrealtime environment from A to B. Why is there a udp stream output option then? Are you trying to say that this isn't a bug because FFmpeg isn't supposed to be able to stream? I am using FFmpeg mpeg2video as the encoder and multiplexing with mpegts. The data FFmpeg produces is fine, it just doesn't send it quite right. This isn't a multiplexing problem, it is a udp streaming option. I asked a simple question. Is udp.c supposed to work with any other multiplexer then mpegts? In my experience it doesn't. If that is by design, then it shouldn't be hard to fix this problem. If not, then it becomes a little more complicated. Zach On Wed, Nov 18, 2015 at 8:14 PM, Kieran Kunhyawrote: > > Of course if the user copies a video stream that isn't complaint there > will > > be problems if the decoder requires that. The issue here is two fold. > > First, the current udp transmission model can cause problems with > > networking equipment because of it's bursty nature. Second, FFmpeg can > > make an otherwise compliant stream fail to decode properly because of > these > > same UDP bursts. > > A proper ts remuxer is quite a different beast to what FFmpeg is > designed to do. As much as people try it can't be hacked into the > FFmpeg paradigm which is largely based around converting static files > of fixed codecs/resolutions in a nonrealtime environment from A to B. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 5/6] lavf: add API to append a bsf to a stream's list
--- libavformat/avformat.h | 9 + libavformat/utils.c| 20 2 files changed, 29 insertions(+) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 6e9ffe2..cedcb8f 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2776,6 +2776,15 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, int avformat_queue_attached_pictures(AVFormatContext *s); /** + * Add a bitstream filter to a stream. + * + * @return >0 on success; + * AVERROR code on failure + */ +int av_stream_add_bitstream_filter(AVStream *st, const char *name, + const char *args); + +/** * Apply a list of bitstream filters to a packet. * * @return >=0 on success; diff --git a/libavformat/utils.c b/libavformat/utils.c index 3ed7935..26311fe 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4631,6 +4631,26 @@ uint8_t *ff_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, return data; } +int av_stream_add_bitstream_filter(AVStream *st, const char *name, + const char *args) +{ +AVBitStreamFilterContext *bsfc = NULL; +AVBitStreamFilterContext **dest = >bsfc; +while (*dest && (*dest)->next) +dest = &(*dest)->next; + +if (!(bsfc = av_bitstream_filter_init(name))) { +av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", name); +return AVERROR(EINVAL); +} +if (args && !(bsfc->args = av_strdup(args))) { +av_bitstream_filter_close(bsfc); +return AVERROR(ENOMEM); +} +*dest = bsfc; +return 1; +} + int av_apply_bitstream_filters(AVFormatContext *s, AVPacket *pkt, AVBitStreamFilterContext *bsfc) { -- 2.6.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 6/6] lavf/matroska: add automatic bitstream filtering
--- libavformat/matroskaenc.c | 43 +++ 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 10cf0a0..41aa8e0 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -845,9 +845,6 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv, int j, ret; AVDictionaryEntry *tag; -// ms precision is the de-facto standard timescale for mkv files -avpriv_set_pts_info(st, 64, 1, 1000); - if (codec->codec_type == AVMEDIA_TYPE_ATTACHMENT) { mkv->have_attachments = 1; return 0; @@ -1388,11 +1385,6 @@ static int mkv_write_header(AVFormatContext *s) else mkv->mode = MODE_MATROSKAv2; -if (s->avoid_negative_ts < 0) { -s->avoid_negative_ts = 1; -s->internal->avoid_negative_ts_use_pts = 1; -} - if (mkv->mode != MODE_WEBM || av_dict_get(s->metadata, "stereo_mode", NULL, 0) || av_dict_get(s->metadata, "alpha_mode", NULL, 0)) @@ -2098,6 +2090,35 @@ static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance) return 0; } +static int mkv_init(struct AVFormatContext *s) +{ +int i; + +if (s->avoid_negative_ts < 0) { +s->avoid_negative_ts = 1; +s->internal->avoid_negative_ts_use_pts = 1; +} + +for (i = 0; i < s->nb_streams; i++) { +// ms precision is the de-facto standard timescale for mkv files +avpriv_set_pts_info(s->streams[i], 64, 1, 1000); +} + +return 0; +} + +static int mkv_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +{ +int ret = 1; +AVStream *st = s->streams[pkt->stream_index]; + +if (st->codec->codec_id == AV_CODEC_ID_AAC) +if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) +ret = av_stream_add_bitstream_filter(st, "aac_adtstoasc", NULL); + +return ret; +} + static const AVCodecTag additional_audio_tags[] = { { AV_CODEC_ID_ALAC, 0X }, { AV_CODEC_ID_EAC3, 0X }, @@ -2160,6 +2181,7 @@ AVOutputFormat ff_matroska_muxer = { AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3, .video_codec = CONFIG_LIBX264_ENCODER ? AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4, +.init = mkv_init, .write_header = mkv_write_header, .write_packet = mkv_write_flush_packet, .write_trailer = mkv_write_trailer, @@ -2171,6 +2193,7 @@ AVOutputFormat ff_matroska_muxer = { }, .subtitle_codec= AV_CODEC_ID_ASS, .query_codec = mkv_query_codec, +.check_bitstream = mkv_check_bitstream, .priv_class= _class, }; #endif @@ -2192,9 +2215,11 @@ AVOutputFormat ff_webm_muxer = { .audio_codec = CONFIG_LIBOPUS_ENCODER ? AV_CODEC_ID_OPUS : AV_CODEC_ID_VORBIS, .video_codec = CONFIG_LIBVPX_VP9_ENCODER? AV_CODEC_ID_VP9 : AV_CODEC_ID_VP8, .subtitle_codec= AV_CODEC_ID_WEBVTT, +.init = mkv_init, .write_header = mkv_write_header, .write_packet = mkv_write_flush_packet, .write_trailer = mkv_write_trailer, +.check_bitstream = mkv_check_bitstream, .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT | AVFMT_ALLOW_FLUSH, .priv_class= _class, @@ -2217,9 +2242,11 @@ AVOutputFormat ff_matroska_audio_muxer = { .audio_codec = CONFIG_LIBVORBIS_ENCODER ? AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3, .video_codec = AV_CODEC_ID_NONE, +.init = mkv_init, .write_header = mkv_write_header, .write_packet = mkv_write_flush_packet, .write_trailer = mkv_write_trailer, +.check_bitstream = mkv_check_bitstream, .flags = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT | AVFMT_ALLOW_FLUSH, .codec_tag = (const AVCodecTag* const []){ -- 2.6.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] aacsbr_fixed: avoid division by zero in sbr_gain_calc
On 16.11.2015 13:46, Michael Niedermayer wrote: > On Fri, Nov 13, 2015 at 11:19:44PM +0100, Andreas Cadhalpun wrote: >> Well, unfortunately just rejecting 0 in sbr_dequant is no solution, >> because, as you noticed, that only happens via underflow. > > a value that has underflowed should be 0, so underflow affecting > anything implies 0 as result and so a check for 0 would cover all > underflows > I think i misunderstand somehow The problem is that this code manipulates SoftFloat.exp directly. >> One could check for exponents smaller than MIN_EXP, but since > > exponents must not be smaller than MIN_EXP. > no *_sf function should set such an exponent. code directly writing > exponents has to check for exp < MIN_EXP This code doesn't... > that could in principle be done by using a _sf function which allows > such exponents on input and clears it up on output A function av_exp2_sf properly calculating 2^v for a Softfloat v could be used to fix this problem. >> the exponent can get smaller during the calculations in sbr_gain_calc, >> that wouldn't necessarily avoid the division by 0. >> > >> Additionally both sbr_dequant and sbr_gain_calc are void functions, >> so can't easily return errors. > > iam not sure i understand your concern ? > the resturn type is easy changeable or flag could be added to the > context indicating an error or a simpler hack could be used to > fix this in the releases with a more complete cleanup in master Changing the return type means changing also the return types of the functions calling this function and also for the aac float decoder, which does not fail in this case... and that gives a clue for the proper solution, see below. > but maybe iam missing something why you consider this to be a bad > solution ? I guess what we both missed is that the actual problem is that the calculation of noise_facs in the aac_fixed decoder is utterly broken: First they are set in read_sbr_noise, which only sets mant and not exp, so for example: noise_facs[1][0] = {mant = 29, exp = 0} Then in sbr_dequant we have (comments mine): for (e = 1; e <= sbr->data[ch].bs_num_noise; e++) for (k = 0; k < sbr->n_q; k++){ // This should calculate the same as the aac float decoder: // sbr->data[ch].noise_facs[e][k] = // exp2f(NOISE_FLOOR_OFFSET - sbr->data[ch].noise_facs[e][k]); sbr->data[ch].noise_facs[e][k].exp = NOISE_FLOOR_OFFSET - \ sbr->data[ch].noise_facs[e][k].mant + 1; sbr->data[ch].noise_facs[e][k].mant = 0x2000; } Thus we get: noise_facs[1][0].exp = 6 - 29 + 1 = -22; noise_facs[1][0].mant = 0x2000; Together: noise_facs[1][0] = {mant = 536870912, exp = -22} So far so good. However, the next time sbr_dequant is called this breaks: noise_facs[1][0].exp = 6 - 536870912 + 1 = -536870905; This is obviously completely bogus. Instead this code needs a function like av_exp2_sf. Best regards, Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/6] lavf: add automatic bitstream filtering
This solves the problem discussed in https://ffmpeg.org/pipermail/ffmpeg-devel/2015-September/179238.html by allowing AVCodec::write_header to be delayed until after packets have been run through required bitstream filters in order to generate global extradata. It also provides a mechanism by which a muxer can add a bitstream filter to a stream automatically, rather than prompting the user to do so. --- libavformat/avformat.h | 37 + libavformat/mux.c | 47 +-- 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 96d3cfd..6e9ffe2 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -600,6 +600,29 @@ typedef struct AVOutputFormat { */ int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); enum AVCodecID data_codec; /**< default data codec */ +/** + * Initialize format. May allocate data here, and set any AVFormatContext or + * AVStream parameters that need to be set before packets are sent. + * This method must not write output. + * + * Any allocations made here must be freed in deinit(). + */ +int (*init)(struct AVFormatContext *); +/** + * Deinitialize format. If present, this is called whenever the muxer is being + * destroyed, regardless of whether or not the header has been written. + * + * If a trailer is being written, this is called after write_trailer(). + * + * This is called if init() fails as well. + */ +void (*deinit)(struct AVFormatContext *); +/** + * Set up any necessary bitstream filtering and extract any extra data needed + * for the global header. + * Return 0 if more packets from this stream must be checked; 1 if not. + */ +int (*check_bitstream)(struct AVFormatContext *, const AVPacket *pkt); } AVOutputFormat; /** * @} @@ -1177,6 +1200,18 @@ typedef struct AVStream { * Must not be accessed in any way by callers. */ AVStreamInternal *internal; + +/** + * bitstream filter to run on stream + * - encoding: Set by muxer or user using av_stream_add_bitstream_filter + * - decoding: unused + */ +AVBitStreamFilterContext *bsfc; + +/** + * internal check if check_bitstream should still be run on each packet + */ +int bitstream_checked; } AVStream; AVRational av_stream_get_r_frame_rate(const AVStream *s); @@ -1792,6 +1827,8 @@ typedef struct AVFormatContext { * Demuxing: Set by user. */ int (*open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options); + +int header_written; } AVFormatContext; int av_format_get_probe_score(const AVFormatContext *s); diff --git a/libavformat/mux.c b/libavformat/mux.c index 05d4170..e2f15c7 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -405,6 +405,11 @@ FF_ENABLE_DEPRECATION_WARNINGS *options = tmp; } +if (s->oformat->init && (ret = s->oformat->init(s)) < 0) { +s->oformat->deinit(s); +goto fail; +} + return 0; fail: @@ -456,7 +461,7 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options) if ((ret = init_muxer(s, options)) < 0) return ret; -if (s->oformat->write_header) { +if (s->oformat->write_header && !s->oformat->check_bitstream) { ret = s->oformat->write_header(s); if (ret >= 0 && s->pb && s->pb->error < 0) ret = s->pb->error; @@ -464,6 +469,7 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options) return ret; if (s->flush_packets && s->pb && s->pb->error >= 0 && s->flags & AVFMT_FLAG_FLUSH_PACKETS) avio_flush(s->pb); +s->header_written = 1; } if ((ret = init_pts(s)) < 0) @@ -1021,6 +1027,17 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) ret = AVERROR(EINVAL); goto fail; } + +if (s->oformat->check_bitstream) { +if (!st->bitstream_checked) { +if ((ret = s->oformat->check_bitstream(s, pkt)) < 0) +goto fail; +else if (ret == 1) +st->bitstream_checked = 1; +} +} + +av_apply_bitstream_filters(s, pkt, st->bsfc); } else { av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame FLUSH\n"); flush = 1; @@ -1037,10 +1054,22 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) if (ret <= 0) //FIXME cleanup needed for ret<0 ? return ret; +if (!s->header_written && s->oformat->write_header) { +ret = s->oformat->write_header(s); +if (ret >= 0 && s->pb && s->pb->error < 0) +ret = s->pb->error; +if
Re: [FFmpeg-devel] UDP constant bitrate feature (cbr)
> Because FFmpeg again cannot know a priori whether the input signal is > fully VBV compliant for use within MPEGTS. > An RTMP feed is an example of a feed which certainly isn't and so > FFmpeg has to make some numbers up in order to make a valid TS. > Such guessing might work in the file world but in the standards > compliant MPEGTS world it is guaranteed to cause problems. Of course if the user copies a video stream that isn't complaint there will be problems if the decoder requires that. The issue here is two fold. First, the current udp transmission model can cause problems with networking equipment because of it's bursty nature. Second, FFmpeg can make an otherwise compliant stream fail to decode properly because of these same UDP bursts. As far as I know, using the udp output requires use of the -f mpegts muxer. Is that correct? Zach On Wed, Nov 18, 2015 at 2:38 PM, Kieran Kunhyawrote: > On 18 November 2015 at 19:28, Zach Swena > wrote: > > Are you referring to this seperate applciation? > > > > https://github.com/mmalecki/multicat/blob/master/trunk/README > > > > While using that makes sense for Pavel's application, why should FFmpeg > > produce a problematic UDP stream in the first place? For applications > like > > I need that involve encoding the stream in the first place, why should I > > have to use a seperate program to make the output stream complient? > FFmpeg > > should keep track of the number of bytes between pcr and smoothly output > > the stream regardless of what the input is. I would argue that this very > > much is a bug, not a feature. Just because an external applciation can > fix > > the problem in some instances doesn't mean it isn't a problem in the > first > > place. > > Because FFmpeg again cannot know a priori whether the input signal is > fully VBV compliant for use within MPEGTS. > An RTMP feed is an example of a feed which certainly isn't and so > FFmpeg has to make some numbers up in order to make a valid TS. > Such guessing might work in the file world but in the standards > compliant MPEGTS world it is guaranteed to cause problems. > > Kieran > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec: add OpenJPEG 2.x compatibility
On Wed, Nov 18, 2015 at 8:00 AM, Michael Niedermayerwrote: > On Tue, Nov 17, 2015 at 07:27:55AM -0800, Michael Bradshaw wrote: > > Hi, > > > > Attached patch adds support for OpenJPEG 2.0/2.1. Please review. > > > > Thanks, > > > > Michael Bradshaw > > > configure |5 > > libavcodec/libopenjpegdec.c | 173 > > libavcodec/libopenjpegenc.c | 269 > +--- > > 3 files changed, 382 insertions(+), 65 deletions(-) > > 4e7c94ca16fa09210c4d74a4cf589ae9db540e9a > 0001-avcodec-add-OpenJPEG-2.x-compatibility.patch > > From 1cdf996b7fdaed429731054e96f9e6b565c9436d Mon Sep 17 00:00:00 2001 > > From: Michael Bradshaw > > Date: Sun, 1 Nov 2015 19:11:12 -0800 > > Subject: [PATCH] avcodec: add OpenJPEG 2.x compatibility > > this seems breaking the decoder > > ./ffmpeg -i matrixbench_mpeg2.mpg -vcodec libopenjpeg -vframes 1 test.j2k > > ./ffmpeg -strict -2 -vcodec libopenjpeg -i test.j2k -f null - > > [libopenjpeg @ 0x28f3220] Error decoding codestream header. > [j2k_pipe @ 0x28d1bc0] decoding for stream 0 failed > [j2k_pipe @ 0x28d1bc0] Could not find codec parameters for stream 0 > (Video: jpeg2000, none): unspecified size > Consider increasing the value for the 'analyzeduration' and 'probesize' > options > test.j2k: could not find codec parameters Oops, misplaced a ! in some last minute cleanup. Fixed patch attached. 0001-avcodec-add-OpenJPEG-2.x-compatibility.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] UDP constant bitrate feature (cbr)
> Of course if the user copies a video stream that isn't complaint there will > be problems if the decoder requires that. The issue here is two fold. > First, the current udp transmission model can cause problems with > networking equipment because of it's bursty nature. Second, FFmpeg can > make an otherwise compliant stream fail to decode properly because of these > same UDP bursts. A proper ts remuxer is quite a different beast to what FFmpeg is designed to do. As much as people try it can't be hacked into the FFmpeg paradigm which is largely based around converting static files of fixed codecs/resolutions in a nonrealtime environment from A to B. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/h264_slice: Clear top_borders on allocation
On Wed, Nov 18, 2015 at 02:41:05PM +0100, Michael Niedermayer wrote: > From: Michael Niedermayer> > In case of bitstream errors the deblock filter and slices can access > uninitialized > top_borders from previous slices which did not fill them as they stoped > halfway due > to error or where entirely missing > > Found-by: Tyson Smith > Signed-off-by: Michael Niedermayer > --- > libavcodec/h264_slice.c |4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) patchset applied [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a person or equipment. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel