check profiles
This commit is contained in:
parent
8a48f8d46d
commit
9b8d85a96f
1 changed files with 10 additions and 7 deletions
|
|
@ -26,13 +26,14 @@
|
|||
|
||||
#include <libaac.h>
|
||||
|
||||
#include "libavcodec/defs.h"
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/internal.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/log.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "avcodec.h"
|
||||
#include "defs.h"
|
||||
#include "audio_frame_queue.h"
|
||||
#include "codec_internal.h"
|
||||
#include "encode.h"
|
||||
|
|
@ -116,6 +117,10 @@ static av_cold int libaac_encode_init(AVCodecContext *avctx)
|
|||
case AV_PROFILE_AAC_ELD:
|
||||
cfg.profile = AAC_ELD;
|
||||
break;
|
||||
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "unsupported profile, supported profiles are LC, HE, HEv2, LD and ELD\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
cfg.tns = s->tns;
|
||||
cfg.frameSize = s->frame_length;
|
||||
|
|
@ -168,10 +173,9 @@ static int libaac_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
|||
|
||||
if (!frame)
|
||||
{
|
||||
int isFlush = s->encoder->in_buf_offset <= 0;
|
||||
av_log(avctx, AV_LOG_TRACE, "frame_queue_count: %d, frame_queue_size: %d, in_buf: %d, is_flush: %d, flush_delay: %d\n", s->afq.frame_count, s->afq.remaining_samples, s->encoder->in_buf_offset, isFlush, s->flush_delay);
|
||||
av_log(avctx, AV_LOG_TRACE, "flush_delay: %d\n", s->flush_delay);
|
||||
|
||||
if (isFlush && s->flush_delay <= 0)
|
||||
if (s->flush_delay <= 0)
|
||||
return 0;
|
||||
|
||||
/* Flushing */
|
||||
|
|
@ -180,8 +184,7 @@ static int libaac_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
|||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (isFlush)
|
||||
s->flush_delay -= avctx->frame_size;
|
||||
s->flush_delay -= avctx->frame_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -189,7 +192,7 @@ static int libaac_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
|||
if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
|
||||
return ret;
|
||||
|
||||
int encodeSize = (avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? 4 : 2) * avctx->ch_layout.nb_channels * frame->nb_samples;
|
||||
int encodeSize = av_get_bytes_per_sample(avctx->sample_fmt) * avctx->ch_layout.nb_channels * frame->nb_samples;
|
||||
av_log(avctx, AV_LOG_TRACE, "encode size: %d\n", encodeSize);
|
||||
|
||||
if ((ret = aac_encode(s->encoder, frame->data[0], encodeSize, pkt->data, (unsigned int *)&pkt->size)) < 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue