On Thu, Mar 24, 2016 at 12:54:07AM -0500, Rodger Combs wrote:
> - 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
> ---
> libavcodec/audiotoolboxenc.c | 194
> ++++++++++++++++++++++++++++++++++++++-----
> 1 file changed, 172 insertions(+), 22 deletions(-)
[...]
> @@ -220,16 +321,49 @@ static av_cold int ffat_init_encoder(AVCodecContext
> *avctx)
> }
> q = 127 - q * 9;
> AudioConverterSetProperty(at->converter,
> kAudioCodecPropertySoundQualityForVBR,
> - size, &q);
> + sizeof(q), &q);
> } else if (avctx->bit_rate > 0) {
> UInt32 rate = avctx->bit_rate;
> + UInt32 size;
> + status = AudioConverterGetPropertyInfo(at->converter,
> +
> kAudioConverterApplicableEncodeBitRates,
> + &size, NULL);
> + if (!status && size) {
> + UInt32 new_rate = rate;
> + int count;
> + int i;
> + AudioValueRange *ranges = malloc(size);
> + if (!ranges)
> + return AVERROR(ENOMEM);
> + AudioConverterGetProperty(at->converter,
> +
> kAudioConverterApplicableEncodeBitRates,
> + &size, ranges);
> + count = size / sizeof(AudioValueRange);
> + for (i = 0; i < count; i++) {
> + AudioValueRange *range = &ranges[i];
> + if (rate >= range->mMinimum && rate <= range->mMaximum) {
> + new_rate = rate;
> + break;
> + } else if (rate > range->mMaximum) {
> + new_rate = range->mMaximum;
> + } else {
> + new_rate = range->mMinimum;
> + break;
> + }
> + }
> + if (new_rate != rate) {
> + av_log(avctx, AV_LOG_WARNING,
> + "Bitrate %u not allowed; changing to %u\n", rate,
> new_rate);
> + rate = new_rate;
> + }
> + }
is it intended to use malloc() instead of av_malloc() here ?
and not free it ? or maybe i miss where its freed ...
[...]
--
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 [email protected] http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
