Question

I'm currently working on the Java Multimedia IO Project and was testing the RIFFInputStream, but as I was testing I ran into a NegativeArraySizeException; the following is the output from the debug console;

RIFF Stream type: AVI 
Chunks contained in this stream: 

LIST::hdrl
    avih
    LIST
    LIST
LIST::INFO
    ISFT
Exception in thread "main" java.lang.NegativeArraySizeException
    at javax.io.RIFFList.<init>(RIFFList.java:25)
    at javax.io.RIFFInputStream.next(RIFFInputStream.java:58)
    at javax.io.RIFFInputStream.next(RIFFInputStream.java:56)
    at Test.main(Test.java:25)

When I first received this exception I downloaded a RIFF viewer, the viewer listed the following chunks;

RIFF:AVI 
    LIST:hdrl
        avih
        LIST:strl
        LIST:strl
        JUNK
    LIST:INFO
        ISFT
    JUNK
    LIST:movi
    idx1

So what's happening looks to be the RIFFList constructor code is having trouble building the movi list. What I would like to know is why is it receiving a negative number from the stream?

Thanks, Liam.

Was it helpful?

Solution

I have found the problem and have fixed it.

The problem, I found after re-reading the RIFF standards, was that when a chunks data is uneven a padding byte will be added but that byte does not show up on the chunks size, so all I did in the RIFFList init code was I told it to add one to the position number if the chunk it was reading was uneven.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top