You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is found that when calling ChunkingHandler::OnFlushRequest with 2 different stream indexes, BufferWriter::WriteToFile will crash due to dereferencing a null pointer.
Setup
The setup was MediaHandler(derived class)->ChunkingHandler->MP4Muxer
MediaHandler takes 2 streams(video+audio), then feed into the one ChunkingHandler and one MP4Muxer, since a muxed MP4 stream is required.
When calling MediaHandler::FlushAllDownStream, it is found that SingleSegmentSegmenter::DoFinalize was called before SingleSegmentSegmenter::DoFinalizeSegment. In DoFinalize, temp_file_ was released already, therefore in DoFinalizeSegment, temp_file_.get() is a null pointer, and leads to the crash in BufferWriter::WriteToFile.
Is this a wrong usage of ChunkingHandler/MP4Muxer, or a bug in MP4Muxer?
More Information
Call stacks when calling DoFinalize and DoFinalizeSegment:
#0 0x00007fffeffb0dc7 in shaka::media::mp4::SingleSegmentSegmenter::DoFinalize() () #1 0x00007fffeffae0a9 in shaka::media::mp4::Segmenter::Finalize() () #2 0x00007fffeffa48ca in shaka::media::mp4::MP4Muxer::Finalize() () #3 0x00007fffeffa41ea in shaka::media::Muxer::OnFlushRequest(unsigned long) () #4 0x00007fffeffe706a in shaka::media::MediaHandler::FlushDownstream(unsigned long) () #5 0x00007fffeff9b62b in shaka::media::ChunkingHandler::OnFlushRequest(unsigned long) () #6 0x00007fffeffe716c in shaka::media::MediaHandler::FlushAllDownstreams() ()
#0 0x00007fffeffe5710 in shaka::media::BufferWriter::WriteToFile(shaka::File*) () #1 0x00007fffeffb1be6 in shaka::media::mp4::SingleSegmentSegmenter::DoFinalizeSegment() () #2 0x00007fffeffb0400 in shaka::media::mp4::Segmenter::FinalizeSegment(unsigned long, shaka::media::SegmentInfo const&) () #3 0x00007fffeffa42d5 in shaka::media::mp4::MP4Muxer::FinalizeSegment(unsigned long, shaka::media::SegmentInfo const&) () #4 0x00007fffeffe8b61 in shaka::media::Muxer::Process(std::unique_ptr<shaka::media::StreamData, std::default_deleteshaka::media::StreamData >) () #5 0x00007fffeffe6846 in shaka::media::MediaHandler::Dispatch(std::unique_ptr<shaka::media::StreamData, std::default_deleteshaka::media::StreamData >) () #6 0x00007fffeff9b229 in shaka::media::ChunkingHandler::OnFlushRequest(unsigned long) () #7 0x00007fffeffe6eac in shaka::media::MediaHandler::FlushAllDownstreams() ()
MP4Muxer is called a muxer, but it actually only supports one stream. We'd like to add support for muxing a/v streams in muxers, but it is low priority.
Issue
It is found that when calling ChunkingHandler::OnFlushRequest with 2 different stream indexes, BufferWriter::WriteToFile will crash due to dereferencing a null pointer.
Setup
The setup was
MediaHandler(derived class)->ChunkingHandler->MP4Muxer
MediaHandler takes 2 streams(video+audio), then feed into the one ChunkingHandler and one MP4Muxer, since a muxed MP4 stream is required.
When calling MediaHandler::FlushAllDownStream, it is found that SingleSegmentSegmenter::DoFinalize was called before SingleSegmentSegmenter::DoFinalizeSegment. In DoFinalize, temp_file_ was released already, therefore in DoFinalizeSegment, temp_file_.get() is a null pointer, and leads to the crash in BufferWriter::WriteToFile.
Is this a wrong usage of ChunkingHandler/MP4Muxer, or a bug in MP4Muxer?
More Information
Call stacks when calling DoFinalize and DoFinalizeSegment:
shaka-packager version: 858fcd8
The text was updated successfully, but these errors were encountered: