Problems specifying toilet capacity of Realtimer

I have a pipeline which I see fail intermittently on startup due to a toilet overflow of a realtimer element. The downstream element of the realtimer is a rtmp sink. In my pipeline I have specified the toilet capacity with via_in to the realtimer as shown in the docs:
# shortened for brevity
|> child(:h264_encoder, %Membrane.H264.FFmpeg.Encoder{preset: :ultrafast})
|> child(:h264_parser, %Membrane.H264.FFmpeg.Parser{
framerate: {30, 1},
alignment: :au,
attach_nalus?: true,
skip_until_keyframe?: false
})
|> child(:video_payloader, Membrane.MP4.Payloader.H264)
|> via_in(:input, toilet_capacity: 500)
|> child(:video_realtimer, Membrane.Realtimer)
|> via_in(:video)
|> get_child(:rtmp_sink),
################################################################
# shortened for brevity
|> child(:aac_encoder, Membrane.AAC.FDK.Encoder)
|> child(:aac_parser, %Membrane.AAC.Parser{
in_encapsulation: :ADTS,
out_encapsulation: :ADTS
})
|> via_in(:input, toilet_capacity: 500)
|> child(:audio_realtimer, Membrane.Realtimer)
|> via_in(:audio)
|> get_child(:rtmp_sink)
# shortened for brevity
|> child(:h264_encoder, %Membrane.H264.FFmpeg.Encoder{preset: :ultrafast})
|> child(:h264_parser, %Membrane.H264.FFmpeg.Parser{
framerate: {30, 1},
alignment: :au,
attach_nalus?: true,
skip_until_keyframe?: false
})
|> child(:video_payloader, Membrane.MP4.Payloader.H264)
|> via_in(:input, toilet_capacity: 500)
|> child(:video_realtimer, Membrane.Realtimer)
|> via_in(:video)
|> get_child(:rtmp_sink),
################################################################
# shortened for brevity
|> child(:aac_encoder, Membrane.AAC.FDK.Encoder)
|> child(:aac_parser, %Membrane.AAC.Parser{
in_encapsulation: :ADTS,
out_encapsulation: :ADTS
})
|> via_in(:input, toilet_capacity: 500)
|> child(:audio_realtimer, Membrane.Realtimer)
|> via_in(:audio)
|> get_child(:rtmp_sink)
However, I see the reported toilet size as 200 instead of the specified value when the pipeline. crashes:
10:58:09.755 [error] <0.591.0>/:audio_realtimer/ Toilet overflow.

Reached the size of 201, which is above toilet capacity (200)
when storing data from output working in push mode. It means that some element in the pipeline
processes the stream too slow or doesn't process it at all.
To have control over amount of buffers being produced, consider using output in pull mode
(see `Membrane.Pad.mode_t`).
You can also try changing the `toilet_capacity` in `Membrane.ChildrenSpec.via_in/3`.
10:58:09.755 [error] <0.591.0>/:audio_realtimer/ Toilet overflow.

Reached the size of 201, which is above toilet capacity (200)
when storing data from output working in push mode. It means that some element in the pipeline
processes the stream too slow or doesn't process it at all.
To have control over amount of buffers being produced, consider using output in pull mode
(see `Membrane.Pad.mode_t`).
You can also try changing the `toilet_capacity` in `Membrane.ChildrenSpec.via_in/3`.
Any thoughts on why the config isn't bubbling down to the realtimer?
2 Replies
Wojciech_Barczynski
It seems like :audio_realtimer is terminating :rtmp_sink due to toilet overflow (between :audio_realtimer and :rtmp_sink) and :rtmp_sink produces the message. Try setting :rtmp_sink toilet_capacity in via_in(:audio) |> child(:audio_realtimer, Membrane.Realtimer) |> via_in(:audio, toilet_capacity: 500) |> get_child(:rtmp_sink)
nickdichev_fw
nickdichev_fw2y ago
Thanks, that solves it! I am a bit confused on why there is such a large "toilet" accumulating on the rtmp sink as the pipeline starts up. I notice when I test against a local rtmp server running locally it will never overflow, however, when I point it at a server in the cloud (IVS) it will intermittently backup. Maybe some sort of delay with the tls handshake? Will have to take a deeper look!
Want results from more Discord servers?
Add your server