Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when calling FlushAllDownStream #325

Closed
l-law opened this issue Feb 2, 2018 · 1 comment
Closed

Segmentation fault when calling FlushAllDownStream #325

l-law opened this issue Feb 2, 2018 · 1 comment
Labels
status: archived Archived and locked; will not be updated

Comments

@l-law
Copy link
Contributor

l-law commented Feb 2, 2018

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:

#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() ()

shaka-packager version: 858fcd8

@kqyang
Copy link
Collaborator

kqyang commented Feb 2, 2018

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.

@kqyang kqyang closed this as completed Feb 7, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 19, 2018
@shaka-project shaka-project locked and limited conversation to collaborators Apr 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated
Projects
None yet
Development

No branches or pull requests

3 participants