Skip to content

Conversation

@kingdomcoding
Copy link
Contributor

A fix for audio- only streams.

For cases like below where the video pad of the hls_sink_bin has nothing passed into it:

child(:rtmp_source, %Membrane.RTMP.SourceBin{client_ref: client_ref})
|> via_out(:audio)
|> child(:rtmp_in_aac_parser, Membrane.AAC.Parser)
|> child(:rtmp_in_aac_decoder, Membrane.AAC.FDK.Decoder),
child(
  :hls_sink_bin,
  %Membrane.HTTPAdaptiveStream.SinkBin{
    manifest_name: manifest_name,
    manifest_module: Membrane.HTTPAdaptiveStream.HLS,
    storage: %Membrane.HTTPAdaptiveStream.Storages.FileStorage{
      directory: directory
    },
    hls_mode: hls_mode,
    mp4_parameters_in_band?: true,
    target_window_duration: Membrane.Time.seconds(20)
  }
),
# AUDIO BUILDER
get_child(:rtmp_in_aac_decoder)
|> child(:hls_out_aac_encoder, Membrane.AAC.FDK.Encoder)
|> via_in(Pad.ref(:input, :audio),
  options: [encoding: :AAC, segment_duration: Membrane.Time.milliseconds(2000)]
)
|> get_child(:hls_sink_bin),

# FAKE VIDEO BUILDER
get_child(:rtmp_source) |> via_out(:video)
|> child(:fake_sink, Membrane.Fake.Sink.Buffers)

Copy link
Contributor

@Karolk99 Karolk99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Thanks for your valuable contribution. I'll merge this after adding a test for the audio stream only.

@Karolk99 Karolk99 merged commit 35c1210 into membraneframework:master Jan 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants