filoe / cscore

An advanced audio library, written in C#. Provides tons of features. From playing/recording audio to decoding/encoding audio streams/files to processing audio data in realtime (e.g. applying custom effects during playback, create visualizations,...). The possibilities are nearly unlimited.
Other
2.15k stars 451 forks source link

AacDecoder requires at least 3 frames to decode #386

Closed Prazlin closed 4 years ago

Prazlin commented 4 years ago

I'm decoding AAC encoded audio data from an rtsp stream using AacDecoder. I copy the data into a Memory Stream, ms, and pass ms to the AacDecoder constructor. It works when ms contains at least 3 frames of data, but when it has less than this number I get the exception

CSCore.MediaFoundation.MediaFoundationException occurred HResult=0xC00D36C4 Message=Interops::MFCreateSourceReaderFromByteStream caused an error: 0xc00d36c4, "The byte stream type of the given URL is unsupported.".

I want to be able to decode the frames as fast as possible after they are received over the rtsp stream and not have to buffer at least 3 frames before decoding.

filoe commented 4 years ago

Try to use the Ffmpeg implementation. Can't do anything about what's going on inside of the mediafoundation.