Zeugma440 / atldotnet

Fully managed, portable and easy-to-use C# library to read and edit audio data and metadata (tags) from various audio formats, playlists and CUE sheets
MIT License
466 stars 63 forks source link

EBML and MKA printing (apparently?) debugging exception into Console? #276

Closed datvm closed 2 months ago

datvm commented 2 months ago

First of all, thank you very much for fixing #275, everything works great now and I can even get the duration of a WebM file without SpawnDev.EBML.

The problem

When using ATL with this file (this is the output file from MediaRecorder, then I applied this fix on the client-side Javascript):

recording_withduration.zip

I could get the correct Duration but in Console, the following output is printed. It is not an exception thrown. I think it's a Console.WriteLine call somewhere within the library. Note that with the attached code, the Duration is printed out after the exception.

Index was outside the bounds of the array.
   at ATL.AudioData.EBMLReader.readVint(Boolean raw)
   at ATL.AudioData.EBMLReader.seekElement(Int64 id, ISet`1 criteria)
   at ATL.AudioData.EBMLReader.seekElement(Int64 id)
   at ATL.AudioData.IO.MKA.attachZone(EBMLReader reader, ReadTagParams readTagParams, UInt32 id, String zoneName)
   at ATL.AudioData.IO.MKA.readTags(EBMLReader reader, ReadTagParams readTagParams)
   at ATL.AudioData.IO.MKA.read(Stream source, ReadTagParams readTagParams)
   at ATL.AudioData.IO.MKA.Read(Stream source, SizeInfo sizeNfo, ReadTagParams readTagParams)
   at ATL.AudioData.AudioDataManager.read(Stream source, ReadTagParams readTagParams)
   at ATL.AudioData.AudioDataManager.read(Stream source, Boolean readEmbeddedPictures, Boolean readAllMetaFrames, Boolean prepareForWriting)
   at ATL.AudioData.AudioDataManager.ReadFromFile(Boolean readEmbeddedPictures, Boolean readAllMetaFrames)
Index was outside the bounds of the array.
   at ATL.AudioData.EBMLReader.readVint(Boolean raw)
   at ATL.AudioData.EBMLReader.seekElement(Int64 id, ISet`1 criteria)
   at ATL.AudioData.EBMLReader.seekElement(Int64 id)
   at ATL.AudioData.IO.MKA.attachZone(EBMLReader reader, ReadTagParams readTagParams, UInt32 id, String zoneName)
   at ATL.AudioData.IO.MKA.readTags(EBMLReader reader, ReadTagParams readTagParams)
   at ATL.AudioData.IO.MKA.read(Stream source, ReadTagParams readTagParams)
   at ATL.AudioData.IO.MKA.Read(Stream source, SizeInfo sizeNfo, ReadTagParams readTagParams)
   at ATL.AudioData.AudioDataManager.read(Stream source, ReadTagParams readTagParams)
   at ATL.AudioData.AudioDataManager.read(Stream source, Boolean readEmbeddedPictures, Boolean readAllMetaFrames, Boolean prepareForWriting)
   at ATL.AudioData.AudioDataManager.ReadFromFile(Boolean readEmbeddedPictures, Boolean readAllMetaFrames)
3

Environment

Details

N/A

Code To Reproduce Issue [ Good To Have ]

try
{
    await using var stream = File.OpenRead(Path);
    var track = new Track(stream);

    Console.WriteLine(track.Duration);
    Console.WriteLine(track.Album);
    Console.WriteLine(track.Title);
}
catch (Exception ex)
{
    Console.WriteLine("ATL parse error");
    Console.WriteLine(ex);
}
Zeugma440 commented 2 months ago

Found and solved the issue. Thanks again for your detailed report.

FYI, ATL has been designed so that most unexpected stuff that happens during processing won't escalate Exceptions to the client app. Instead, the library returns the values it could read and displays the stacktrace to the Console and/or ATL's logging system.

NB : With next update, you normally won't need any prior fix to get the duration of an MKA / WEBM file that doesn't have the Info / Duration element.

Zeugma440 commented 2 months ago

The fix is available on today's v6.04. Please close the issue if it works on your side.

datvm commented 2 months ago

Oops sorry I forgot about this. Closed, thanks a lot 👍