AnsweredAssumed Answered

AMF h.264 decode woes (GetDPBSize() undefined)

Question asked by ffranck on Jul 24, 2015
Latest reply on Jul 28, 2015 by ffranck

Hi Gurus,

 

Hope you can help me here.

I'm trying to accomplish a setup where the following pipeline runs:  BGRA -> h.264 encode -> transmit over network -> h.264 decode -> BGRA.  The first three steps are done, and the x.264 frames are being received by the remote system (I know this because I can dump them to a file and review them with ffplay).  However, I can't seem to get the decode stage to work.

 

I'm setting up a decode pipeline based loosely on the simpleDecode.cpp example from the SDK:

 

1)  I create a DataStream:

    void *data = malloc(1024 * 1024);
    dataStream = AMFDataStream::Create(data, 1024 * 1024);

 

2)  I receive frames which I then write to dataStream:

    dataStream->Write(buffer->value, buffer->length);

 

3)  When I've collected one hundred frames, I initialize the h.264 parser:

    if (100 == recvframes) {
        parser = BitStreamParser::Create(dataStream, BitStreamH264AnnexB, context);

 

4)  When that parser returns data from a QueryOutput() call, I feed that data to the decoder:

    res = parser->QueryOutput(&data); // read compressed frame into buffer
    if (NULL == data) {
        continue;
    } else if (AMF_EOF == res) {
        break;// end of file
    }

    res = decoder->SubmitInput(data);

 

However, that call to SubmitInput() results in an exception and an error message in the output pane of Visual Studio:

1DFC [H264Parser]   Error: ..\..\..\..\..\impl\components\VideoStreamParser\parsers\h264\H264Parser.cpp(2947):GetDPBSize() undefined level_idc=0
1DFC [h264parser_util]   Error: ..\..\..\..\..\impl\components\VideoStreamParser\parsers\h264\h264_util.cpp(91):Assertion failed:false
AMD Decode Init Test.exe has triggered a breakpoint.

 

I have been searching the forums for hints, and AMF fails to decode live h.264 stream. seems to be the closest-related thread, however, the fix there seems to be to stall parsing in a live stream until keyframes with required info come by.  In my case, I can setup the system such that I have access to the entire h.264 stream being streamed, from the very first frame, and thus should not be starting in the middle of a stream.

 

Any hints as to what I may be doing wrong?  Please let me know you need me to post more specifics about my code.

 

Thanks,

/Franck

Outcomes