PatidarNikunj / mp4parser

Automatically exported from code.google.com/p/mp4parser
0 stars 0 forks source link

InputStream.skip (n) throws IOException in Android if n is a negative number. #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the following code in Android environment will generate an IOException.

   AACTrackImpl aacTrack = new AACTrackImpl(new FileInputStream (aacFilePath));

What is the expected output? What do you see instead?

Exception is generated with the following stack trace
Exception stack trace

        java.io.IOException ("count < 0")
    at com.googlecode.mp4parser.authoring.tracks.AACTrackImpl.<init>(AACTrackImpl.java:77)

What version of the product are you using? On what operating system?
Android 2.3 (Gingerbread)

Please provide any additional information below.

Per Java API 
http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html#skip(long)
method skip(n)does not handle negative n number.

Original issue reported on code.google.com by chiayu...@gmail.com on 16 May 2012 at 8:58

GoogleCodeExporter commented 9 years ago
Hi chiayu,

you are completely right. That cannot work per specification but Magnus who 
implemented it tested it to my knowledge on Windows and it seems to work on 
windows nevertheless (He is a C++ guy just having a vacation in Java land). 
Hmmmm - what ever. I changed it to use mark() and reset() and added a test. I 
will change the implementation to use Channels and NIO as the rest of the code 
in the next days (It's good work for a 4h flight on Saturday). 
The preliminary fix is in the trunk. I don't want to release it in this state, 
I want to fix the other implementations (e.g. H264) first.

Best Regards,
Sebastian

Original comment by Sebastian.Annies on 17 May 2012 at 9:10

GoogleCodeExporter commented 9 years ago
Should be done for all except EC3Track. I'll close that issue now since AAC - 
which is the ticket about - is done. 

Original comment by Sebastian.Annies on 27 May 2012 at 6:14