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

Update the rtsp_to_hls demo #283

Merged
merged 5 commits into from
Nov 13, 2024
Merged

Update the rtsp_to_hls demo #283

merged 5 commits into from
Nov 13, 2024

Conversation

Noarkhh
Copy link
Contributor

@Noarkhh Noarkhh commented Aug 26, 2024

No description provided.

@Noarkhh Noarkhh requested a review from mat-hek August 28, 2024 10:36
@@ -63,34 +84,22 @@ defmodule Membrane.Demo.RtspToHls.Pipeline do
generate_best_effort_timestamps: %{framerate: {30, 1}}
Copy link
Member

Choose a reason for hiding this comment

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

is that needed?

Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if we should put the server code in the lib directory since this demo is called rtsp_to_hls 🤔 Maybe we should keep all the server stuff in server.exs?

@Noarkhh Noarkhh requested a review from mat-hek November 8, 2024 16:20
Comment on lines +34 to +35
[:audio, :video]
|> Enum.filter(fn media_type -> Enum.any?(tracks, &(&1.type == media_type)) end)
Copy link
Member

Choose a reason for hiding this comment

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

So we just support one audio and one video track? If so, I'd just add audio_track and video_track fields to the state, it should be much simpler

Copy link
Contributor Author

@Noarkhh Noarkhh Nov 13, 2024

Choose a reason for hiding this comment

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

I don't really think so, since we also support only video (and only audio) streams, I tried doing this and a lot of branching arises

Comment on lines 49 to 58
spec: [
child(:hls, %Membrane.HTTPAdaptiveStream.SinkBin{
target_window_duration: Membrane.Time.seconds(120),
manifest_module: Membrane.HTTPAdaptiveStream.HLS,
storage: %Membrane.HTTPAdaptiveStream.Storages.FileStorage{
directory: state.output_path
}
})
| track_specs
]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
spec: [
child(:hls, %Membrane.HTTPAdaptiveStream.SinkBin{
target_window_duration: Membrane.Time.seconds(120),
manifest_module: Membrane.HTTPAdaptiveStream.HLS,
storage: %Membrane.HTTPAdaptiveStream.Storages.FileStorage{
directory: state.output_path
}
})
| track_specs
]
hls =
child(:hls, %Membrane.HTTPAdaptiveStream.SinkBin{
target_window_duration: Membrane.Time.seconds(120),
manifest_module: Membrane.HTTPAdaptiveStream.HLS,
storage: %Membrane.HTTPAdaptiveStream.Storages.FileStorage{
directory: state.output_path
}
})
[spec: [hls | track_specs]]

def handle_child_notification({:new_track, ssrc, _track}, :source, _ctx, state) do
Logger.warning("new_rtp_stream Unsupported stream connected")
def handle_child_notification({:new_track, ssrc, track}, :source, _ctx, state) do
if Enum.member?(state.tracks_left_to_link, track.type) do
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if Enum.member?(state.tracks_left_to_link, track.type) do
if track.type in state.tracks_left_to_link do

@Noarkhh Noarkhh merged commit 1226a0d into master Nov 13, 2024
1 check passed
@Noarkhh Noarkhh deleted the update-rtsp-to-hls branch November 13, 2024 14:17
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