Skip to content

membrane_mp4_plugin: CMAF muxer crashes due to empty samples queue #931

Open
membraneframework/membrane_mp4_plugin
#120
@samrat

Description

@samrat

I had a crash in my pipeline due to the samples queue being empty:

2025-01-12T00:44:02.857445272Z 00:44:02.852 [error] <0.5234.0>/:sink/:hls_sink_bin/{:cmaf_muxer, :video} Error occured in Membrane Element:
2025-01-12T00:44:02.857481490Z ** (KeyError) key :dts not found in: nil
2025-01-12T00:44:02.857485278Z
2025-01-12T00:44:02.857488584Z If you are using the dot syntax, such as map.field, make sure the left-hand side of the dot is a map
2025-01-12T00:44:02.857514193Z     (membrane_mp4_plugin 0.35.2) lib/membrane_mp4/muxer/cmaf/track_samples_queue.ex:306: Membrane.MP4.Muxer.CMAF.TrackSamplesQueue.collectable_end_timestamp/1
2025-01-12T00:44:02.857518231Z     (membrane_mp4_plugin 0.35.2) lib/membrane_mp4/muxer/cmaf/segment_helper.ex:291: Membrane.MP4.Muxer.CMAF.SegmentHelper.collect_samples_for_video_track/3
2025-01-12T00:44:02.857522168Z     (membrane_mp4_plugin 0.35.2) lib/membrane_mp4/muxer/cmaf/segment_helper.ex:209: Membrane.MP4.Muxer.CMAF.SegmentHelper.push_video_chunk/4
2025-01-12T00:44:02.857525654Z     (membrane_mp4_plugin 0.35.2) lib/membrane_mp4/muxer/cmaf/segment_helper.ex:67: Membrane.MP4.Muxer.CMAF.SegmentHelper.do_collect_segment_samples/3
2025-01-12T00:44:02.857529161Z     (membrane_mp4_plugin 0.35.2) lib/membrane_mp4/muxer/cmaf.ex:357: Membrane.MP4.Muxer.CMAF.handle_buffer/4
2025-01-12T00:44:02.857532638Z     (membrane_core 1.1.2) lib/membrane/core/callback_handler.ex:139: Membrane.Core.CallbackHandler.exec_callback/4
2025-01-12T00:44:02.857535904Z     (membrane_core 1.1.2) lib/membrane/core/callback_handler.ex:69: Membrane.Core.CallbackHandler.exec_and_handle_callback/5
2025-01-12T00:44:02.857539440Z     (elixir 1.17.3) lib/enum.ex:2531: Enum."-reduce/3-lists^foldl/2-0-"/3
2025-01-12T00:44:02.857561843Z
2025-01-12T00:44:02.857565320Z

Would it make sense to add a check to verify that sample is non-nil here as well(similar to the check in the other collectable_end_timestamp clause)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions