Skip to content

throw System.IndexOutOfRangeException #25

@MikiraSora

Description

@MikiraSora
System.IndexOutOfRangeException
  HResult=0x80131508
  Message=索引超出了数组界限。
  Source=MP3Sharp
  StackTrace:
   at MP3Sharp.Decoding.Decoders.LayerI.SubbandLayer1.ReadAllocation(Bitstream stream, Header header, Crc16 crc) in C:\Users\mikir\Source\Repos\MP3Sharp\MP3Sharp\Decoding\Decoders\LayerI\SubbandLayer1.cs:line 69
   at MP3Sharp.Decoding.Decoders.LayerIDecoder.ReadAllocation() in C:\Users\mikir\Source\Repos\MP3Sharp\MP3Sharp\Decoding\Decoders\LayerIDecoder.cs:line 87
   at MP3Sharp.Decoding.Decoders.LayerIDecoder.DecodeFrame() in C:\Users\mikir\Source\Repos\MP3Sharp\MP3Sharp\Decoding\Decoders\LayerIDecoder.cs:line 47
   at MP3Sharp.Decoding.Decoder.DecodeFrame(Header header, Bitstream stream) in C:\Users\mikir\Source\Repos\MP3Sharp\MP3Sharp\Decoding\Decoder.cs:line 134
   at MP3Sharp.MP3Stream.ReadFrame() in C:\Users\mikir\Source\Repos\MP3Sharp\MP3Sharp\MP3Stream.cs:line 246
   at MP3Sharp.MP3Stream.Read(Byte[] buffer, Int32 offset, Int32 count) in C:\Users\mikir\Source\Repos\MP3Sharp\MP3Sharp\MP3Stream.cs:line 201
   at ConsoleApp1.Program.Main(String[] args) in C:\Users\mikir\source\repos\MP3Sharp\ConsoleApp1\Program.cs:line 22

Test code Program.cs

using MP3Sharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            using var stream = new MP3Stream(@"F:\track.mp3");
            // Create the buffer.
            var buffer = new byte[4096];
            // read the entire mp3 file.
            int bytesReturned = 1;
            int totalBytesRead = 0;
            while (bytesReturned > 0)
            {
                bytesReturned = stream.Read(buffer, 0, buffer.Length);
                totalBytesRead += bytesReturned;
            }
            // close the stream after we're done with it.
            stream.Close();
        }
    }
}

track.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions