Commit Graph

9 Commits

Author SHA1 Message Date
Jiejun Zhang 677701c6b3 lavc/audiotoolboxenc: fix noise in encoded audio
This fixes #6940

Although undocumented, AudioToolbox seems to require the data supplied
by the callback (i.e. ffat_encode_callback) being unchanged until the
next time the callback is called. In the old implementation, the
AVBuffer backing the frame is recycled after the frame is freed, and
somebody else (maybe the decoder) will write into the AVBuffer and
change the data. AudioToolbox then encodes some wrong data and noise
is produced. Retaining a frame reference solves this problem.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-03 17:32:55 -03:00
wm4 b945fed629 avcodec: add metadata to identify wrappers and hardware decoders
Explicitly identify decoder/encoder wrappers with a common name. This
saves API users from guessing by the name suffix. For example, they
don't have to guess that "h264_qsv" is the h264 QSV implementation, and
instead they can just check the AVCodec .codec and .wrapper_name fields.

Explicitly mark AVCodec entries that are hardware decoders or most
likely hardware decoders with new AV_CODEC_CAPs. The purpose is allowing
API users listing hardware decoders in a more generic way. The proposed
AVCodecHWConfig does not provide this information fully, because it's
concerned with decoder configuration, not information about the fact
whether the hardware is used or not.

AV_CODEC_CAP_HYBRID exists specifically for QSV, which can have software
implementations in case the hardware is not capable.

Based on a patch by Philip Langdale <philipl@overt.org>.

Merges Libav commit 47687a2f8a.
2017-12-14 19:37:56 +01:00
Rick Kern 143685a42b lavc/audiotoolboxenc: fix dropped frames on iOS
AudioConverterFillComplexBuffer() doesn't always call its callback. A frame
queue is used to prevent skipped audio samples.

Signed-off-by: Rick Kern <kernrj@gmail.com>
2016-06-16 21:02:41 -04:00
Rodger Combs 36770d8769 lavc/audiotoolboxenc: allow setting maxrate with pre-10.9 deployment targets
The build failure here is caused by the enum value not being defined, but
as long as we're on a newer SDK that has it, it's safe to use it even
when our deployment target is older. Setting the property will error, but
we're not failing on errors there.
2016-04-02 03:03:13 -05:00
Rodger Combs 0667327f3f lavc/audiotoolboxenc: fix iOS build 2016-04-02 03:03:13 -05:00
Rodger Combs c820e600ea lavc/audiotoolboxenc: fix a number of config issues
- size variables were used in a confusing way
- incorrect size var use led to channel layouts not being set properly
- channel layouts were incorrectly mapped for >2-channel AAC
- bitrates not accepted by the encoder were discarded instead of being clamped
- some minor style/indentation fixes
2016-04-02 03:03:13 -05:00
Rodger Combs 7524b67817 lavc/audiotoolboxenc: remove unneeded packet metadata
This isn't necessary here, and for some reason broke only multichannel
AAC encoding when a channel layout tag was set.
2016-04-02 03:03:13 -05:00
Dan Dennedy 28688d7c2b avcodec/audiotoolboxenc: Fix compile error on OS X 10.8.
Fixes error "libavcodec/audiotoolboxenc.c:294:50: error: use of undeclared
identifier 'kAudioCodecPropertyPacketSizeLimitForVBR'."

That was added to 10.9:
https://developer.apple.com/library/mac/releasenotes/General/APIDiffsMacOSX10_9/AudioUnit.html

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 16:35:44 +01:00
Rodger Combs 65cff81453 lavc: add AudioToolbox encoders
Fixes trac #4828
2016-03-22 12:43:14 -05:00