Media (Intel® oneAPI Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
3027 Discussions

MFXAudioDECODE->DecodeFrameAsync keeps returning MFX_ERR_MORE_DATA



I'm trying to decode audio data encoded by MFXAudioENCODE->EncodeFrameAsync but MFXAudioDECODE->DecodeFrameAsync just keep returning MFX_ERR_MORE_DATA.

This is my code:

HRESULT AudioDecoder::Decode(BYTE *data/*data encoded by encoder(*/, INT64 dataLength/*data length(bitstream.datalength)*/, UINT64 timestamp/*timestamp(bitstream.datalength)*/)
{//This method will be called wheen encoded data generated. Audio data is being captured and encoded in realtime
    mfxStatus res;
    mfxAudioFrame frame;
    mfxBitstream bitstream;
    memset(&frame, 0, sizeof(mfxAudioFrame));
    memset(&bitstream, 0, sizeof(mfxBitstream));    
    bitstream.MaxLength = dataLength;
    bitstream.DecodeTimeStamp = timestamp;
    bitstream.TimeStamp = timestamp;
    bitstream.Data = data;
    frame.TimeStamp = timestamp;
    I tried to write the data into a file named xxx.acc in here and it can played by player.
    Complete name                            : C:\xxx.aac
    Format                                   : ADTS
    Format/Info                              : Audio Data Transport Stream
    File size                                : 206 KiB
    Overall bit rate mode                    : Variable

    Format                                   : AAC
    Format/Info                              : Advanced Audio Codec
    Format version                           : Version 2
    Format profile                           : LC
    Bit rate mode                            : Variable
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 46.875 FPS (1024 spf)
    Compression mode                         : Lossy
    Stream size                              : 206 KiB (100%)
    res = m_mFXAudioDECODE->DecodeFrameAsync(&bitstream, &frame, &m_syncpoint);//This function just keep returning MFX_ERR_MORE_DATA
    if (res) {
        if (res == MFX_ERR_MORE_DATA) {
            printf("Error: The function requires more data to generate any output{MFX_ERR_MORE_DATA[0x%08X(%d)]}.\n", res, res);
        else if (res == MFX_ERR_MORE_BITSTREAM) {
            printf("Error: The function requires more bitstream buffers to store output{MFX_ERR_MORE_BITSTREAM[0x%08X(%d)]}.\n", res, res);
        else if (res == MFX_ERR_NOT_ENOUGH_BUFFER) {
            printf("Error: The output bitstream buffer size is insufficient{MFX_ERR_NOT_ENOUGH_BUFFER[0x%08X(%d)]}.\n", res, res);
        else {
            printf("Error: cannot decode audio frame[0x%08X(%d)].\n", res, res);
    res = m_mFXSession.SyncOperation(m_syncpoint, INFINITE);
    if (res) {
        printf("Error: cannot sync operations[0x%08X(%d)].\n", res, res);
    return S_OK;

What's wrong with my code?
Thank you.

0 Kudos
0 Replies