sannies / mp4parser

A Java API to read, write and create MP4 files
Apache License 2.0
2.76k stars 567 forks source link

Bug: Null pointer dereference in StreamingSampleImpl.addSampleExtension #398

Open tezcatli opened 4 years ago

tezcatli commented 4 years ago

I'm trying to build an android app which generates streamable mp4 from h264 data coming from the embedded decoder (i haven't managed to have a streamble mp4 from the native android muxer).

I have the following issue by using FragmentedMp4Writer:

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference at org.mp4parser.streaming.input.StreamingSampleImpl.addSampleExtension(StreamingSampleImpl.java:60) at org.mp4parser.streaming.input.h264.H264NalConsumingTrack.createSample(H264NalConsumingTrack.java:229) at org.mp4parser.streaming.input.h264.H264NalConsumingTrack.consumeNal(H264NalConsumingTrack.java:76) at org.mp4parser.streaming.input.h264.H264AnnexBTrack.call(H264AnnexBTrack.java:34)

Apparently, it happened that createPictureOrderCountType0SampleExtension returned null (consequence of sps.pic_order_cnt_type=2) and that this case is not managed by addSample

I'm using mp4parser version 1.9.41, I've joined also the raw h264 stream (i can play it with vlc) which triggers this error (fortest purpose, it's a still image)

toto.zip