Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.

Commit 8f61df7

Browse files
committed
Adjust hls_endpoint to multiple video tracks to one hls_sink_bin
1 parent ff3dce9 commit 8f61df7

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/membrane_rtc_engine/endpoints/hls_endpoint.ex

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
if Enum.all?(
2-
[Membrane.H264.FFmpeg, Membrane.HTTPAdaptiveStream.SinkBin, Membrane.AAC.FDK],
2+
[Membrane.H264.FFmpeg.Common, Membrane.HTTPAdaptiveStream.SinkBin, Membrane.AAC.FDK.Encoder],
33
&Code.ensure_loaded?/1
44
) do
55
defmodule Membrane.RTC.Engine.Endpoint.HLS do
@@ -60,7 +60,7 @@ if Enum.all?(
6060
end
6161

6262
def handle_notification(
63-
{:track_playable, content_type},
63+
{:track_playable, {content_type, _track_id}},
6464
{:hls_sink_bin, stream_id},
6565
_ctx,
6666
state
@@ -128,17 +128,17 @@ if Enum.all?(
128128
|> to({:opus_decoder, track_id})
129129
|> to({:aac_encoder, track_id})
130130
|> to({:aac_parser, track_id})
131-
|> via_in(Pad.ref(:input, :audio), options: [encoding: :AAC])
131+
|> via_in(Pad.ref(:input, {:audio, track_id}), options: [encoding: :AAC])
132132
|> to({:hls_sink_bin, stream_id})
133133
]
134134
}
135135

136-
defp hls_links_and_children(link_builder, :AAC, _track_id, stream_id),
136+
defp hls_links_and_children(link_builder, :AAC, track_id, stream_id),
137137
do: %ParentSpec{
138138
children: %{},
139139
links: [
140140
link_builder
141-
|> via_in(Pad.ref(:input, :audio), options: [encoding: :AAC])
141+
|> via_in(Pad.ref(:input, {:audio, track_id}), options: [encoding: :AAC])
142142
|> to({:hls_sink_bin, stream_id})
143143
]
144144
}
@@ -155,7 +155,7 @@ if Enum.all?(
155155
links: [
156156
link_builder
157157
|> to({:video_parser, track_id})
158-
|> via_in(Pad.ref(:input, :video), options: [encoding: :H264])
158+
|> via_in(Pad.ref(:input, {:video, track_id}), options: [encoding: :H264])
159159
|> to({:hls_sink_bin, stream_id})
160160
]
161161
}

mix.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"ex_dtls": {:hex, :ex_dtls, "0.7.0", "db12a04c7b20d9be844c9639e6777677a3c52204e8034a9dc97e8d4002439cc8", [:mix], [{:membrane_core, "~> 0.7.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:unifex, "~> 0.7.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "0d28f09a57b21663cff03701a7abfbf2508489f7b57c788e57e5b459636478e0"},
1717
"ex_libnice": {:hex, :ex_libnice, "0.6.0", "3387c0504c65759f552df1f62f887c05f409b8d727f56a7b2e80f716851538ad", [:mix], [{:bunch, "~> 1.3.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:mdns, "~> 1.0.12", [hex: :mdns, repo: "hexpm", optional: false]}, {:unifex, "~> 0.7.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "a5591050f026d8fcc234a10a1bfda23abfa18465b147d69541bee5f07e72bd45"},
1818
"ex_libsrtp": {:hex, :ex_libsrtp, "0.3.0", "964cf207fc44357b9ef103ade78e99004de70df8ee44bf1c8f6a18051d0d3667", [:mix], [{:bunch, "~> 1.3", [hex: :bunch, repo: "hexpm", optional: false]}, {:unifex, "~> 0.7.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "62c2c40f6481ee670c864d26aa6496ad851c9b694bbd5367111bc93f3be2e44a"},
19-
"ex_sdp": {:git, "https://github.com/membraneframework/ex_sdp.git", "6dae654c4a5c029afe8ac056cec1177ea5527888", []},
19+
"ex_sdp": {:hex, :ex_sdp, "0.6.0", "861242806e781af6d19bd47f89e1535521d628bdb36e9151275da7ccb498d9ac", [:mix], [{:bunch, "~> 1.3", [hex: :bunch, repo: "hexpm", optional: false]}, {:uuid, "~> 1.1", [hex: :uuid, repo: "hexpm", optional: false]}], "hexpm", "8193c39ce2e4e4cf95ed71c820c7c0f014de2a86a3cd338d6053bea33afefb5b"},
2020
"fast_tls": {:hex, :fast_tls, "1.1.13", "828cdc75e1e8fce8158846d2b971d8b4fe2b2ddcc75b759e88d751079bf78afd", [:rebar3], [{:p1_utils, "1.0.23", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "d1f422af40c7777fe534496f508ee86515cb929ad10f7d1d56aa94ce899b44a0"},
2121
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
2222
"heap": {:hex, :heap, "2.0.2", "d98cb178286cfeb5edbcf17785e2d20af73ca57b5a2cf4af584118afbcf917eb", [:mix], [], "hexpm", "ba9ea2fe99eb4bcbd9a8a28eaf71cbcac449ca1d8e71731596aace9028c9d429"},
@@ -33,7 +33,7 @@
3333
"membrane_caps_video_raw": {:hex, :membrane_caps_video_raw, "0.1.0", "6aa751b0c338ea6672540b7ec7ad2be0d23bad931b8a8776757da9b279070a3b", [:mix], [], "hexpm", "3f60d65189bd9e3b0ab77e0ebf2e0c1b04d0fd6f67c546fc1d54d9958c362ce4"},
3434
"membrane_cmaf_format": {:hex, :membrane_cmaf_format, "0.4.0", "200d3d77bc6087ebfb6487fd15af63287bf8034a0ab5b0ab8531e597a681ff6a", [:mix], [{:membrane_core, "~> 0.8.0", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm", "d67beeb35640ccac3d995af65d5a9290558b4e4b6e647635705db6dfbf68e5b5"},
3535
"membrane_common_c": {:hex, :membrane_common_c, "0.9.0", "696c631acd34e3e7eea66e1da84fc6b37e51465f44b193f2fead3c2bcad59aed", [:mix], [{:membrane_core, "~> 0.7.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:shmex, "~> 0.4.0", [hex: :shmex, repo: "hexpm", optional: false]}, {:unifex, "~> 0.7.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "5f94b0a9667a988e8abe3b863d902e6cf6ea7e2047820855a3d863ef82b3c190"},
36-
"membrane_core": {:git, "https://github.com/membraneframework/membrane_core.git", "3ebe82b5c987e3202fa5a00089c9ffcd8147c20b", []},
36+
"membrane_core": {:git, "https://github.com/membraneframework/membrane_core.git", "55a0f211df4b65b5b3dfaf59ea9976a2af13b875", []},
3737
"membrane_dtls_plugin": {:hex, :membrane_dtls_plugin, "0.6.0", "f237ad3f3432cb9ba9bda7a8a90c154f6d511c519c32b4b217c36268a9e76ce4", [:mix], [{:ex_dtls, "~> 0.7.0", [hex: :ex_dtls, repo: "hexpm", optional: false]}, {:membrane_core, "~> 0.7.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:membrane_ice_plugin, "~> 0.7.0", [hex: :membrane_ice_plugin, repo: "hexpm", optional: false]}], "hexpm", "f4e53b4153e6c95646daab0756b03044bac8c0a1393316b91e0b66f22f83a14a"},
3838
"membrane_element_fake": {:hex, :membrane_element_fake, "0.5.0", "7dd39d0b3dd65f8fd81717029691e04b40fbab46b0a7eedc195a45c51ef977d1", [:mix], [{:membrane_core, "~> 0.7.0", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm", "e9d1d47fd2ae2c6b86cbf920298339e6f8e30bc41fec4714b5a7f688b21680f7"},
3939
"membrane_element_tee": {:hex, :membrane_element_tee, "0.5.0", "d83c405e1492a4cf9829cc453356c28af97fb87b8a86caf4e7dc1dd88208a417", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:membrane_core, "~> 0.7.0", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm", "d11b50615ea854bc8f753647b1f102b59468eeb6cf6b32f81c434f30eb03b489"},
@@ -48,10 +48,10 @@
4848
"membrane_rtp_format": {:hex, :membrane_rtp_format, "0.3.1", "c6920fdb58660d90e264fcf3587dbb5994fb2f3643d234e59608c82598baebaf", [:mix], [], "hexpm", "d225f453715d165ded7dcb287c45360a4d653ac4a6d3ff70b4acdd244c45fa84"},
4949
"membrane_rtp_h264_plugin": {:hex, :membrane_rtp_h264_plugin, "0.7.1", "3efcdd7f00b0e417ceb2fa4bfe2f101dd1f0f62f0e185c3a350817b9ea981a57", [:mix], [{:bunch, "~> 1.2", [hex: :bunch, repo: "hexpm", optional: false]}, {:membrane_caps_video_h264, "~> 0.2.0", [hex: :membrane_caps_video_h264, repo: "hexpm", optional: false]}, {:membrane_core, "~> 0.8.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:membrane_rtp_format, "~> 0.3.0", [hex: :membrane_rtp_format, repo: "hexpm", optional: false]}], "hexpm", "ad8d94410d7f464a0cdb26cd8b3f2fd58e619837308cef9ae2e1838a50cb2589"},
5050
"membrane_rtp_opus_plugin": {:hex, :membrane_rtp_opus_plugin, "0.3.0", "7def707a66c7129c836d8bd8747c6a7bf6efc0fed824a0ae53e108d1d0c234c9", [:mix], [{:membrane_core, "~> 0.7.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:membrane_opus_format, "~> 0.3.0", [hex: :membrane_opus_format, repo: "hexpm", optional: false]}, {:membrane_rtp_format, "~> 0.3.0", [hex: :membrane_rtp_format, repo: "hexpm", optional: false]}], "hexpm", "f7e56aebe2fec41dba1c14881312d27a2f65def70173acaac9bd6bf84f2963a8"},
51-
"membrane_rtp_plugin": {:git, "https://github.com/membraneframework/membrane_rtp_plugin.git", "56efe855d20e6dfa41d01360aa0efbd9197647a0", []},
51+
"membrane_rtp_plugin": {:git, "https://github.com/membraneframework/membrane_rtp_plugin.git", "d24e0421f803c27af06e122f3cf520d237beaf18", []},
5252
"membrane_rtp_vp8_plugin": {:hex, :membrane_rtp_vp8_plugin, "0.1.0", "c7c6c97137e25edc20048543d0c9b6a8cc3923e6833b48da05c19400f0093f80", [:mix], [{:membrane_core, "~> 0.7.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:membrane_rtp_format, "~> 0.3.1", [hex: :membrane_rtp_format, repo: "hexpm", optional: false]}, {:membrane_vp8_format, "~> 0.2.0", [hex: :membrane_vp8_format, repo: "hexpm", optional: false]}], "hexpm", "2fcefdde252f5137f343e30bc23c6ff7b89184ff9745e2cf2f462efde5082960"},
5353
"membrane_vp8_format": {:hex, :membrane_vp8_format, "0.2.0", "869e03676e6ebd6ea7149dca304bc4719161669760257bef7240640cc68d263b", [:mix], [{:membrane_core, "~> 0.7.0", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm", "ac90d4f1aa301a7172f10031ef8497c70ca4e9a81f81f7925bc7d4248983fd94"},
54-
"membrane_webrtc_plugin": {:git, "https://github.com/membraneframework/membrane_webrtc_plugin.git", "6145b5c7af8f1e7532cf8ef53cde3254d3cbc7e1", []},
54+
"membrane_webrtc_plugin": {:git, "https://github.com/membraneframework/membrane_webrtc_plugin.git", "2a301cc4b0e916134c18d971f9267a61fa9c9327", []},
5555
"nimble_parsec": {:hex, :nimble_parsec, "1.2.0", "b44d75e2a6542dcb6acf5d71c32c74ca88960421b6874777f79153bbbbd7dccc", [:mix], [], "hexpm", "52b2871a7515a5ac49b00f214e4165a40724cf99798d8e4a65e4fd64ebd002c1"},
5656
"numbers": {:hex, :numbers, "5.2.4", "f123d5bb7f6acc366f8f445e10a32bd403c8469bdbce8ce049e1f0972b607080", [:mix], [{:coerce, "~> 1.0", [hex: :coerce, repo: "hexpm", optional: false]}, {:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "eeccf5c61d5f4922198395bf87a465b6f980b8b862dd22d28198c5e6fab38582"},
5757
"p1_utils": {:hex, :p1_utils, "1.0.23", "7f94466ada69bd982ea7bb80fbca18e7053e7d0b82c9d9e37621fa508587069b", [:rebar3], [], "hexpm", "47f21618694eeee5006af1c88731ad86b757161e7823c29b6f73921b571c8502"},

0 commit comments

Comments
 (0)