skillet
skillet
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
Thank you @Feliks ! I'll try it out today
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
Yes it worked for me!
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
Thanks guys. @Aske I will put something together for you to reproduce it
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
Here is a reworked end of stream handler:
@impl true
def handle_element_end_of_stream(
{:hackney, _url} = element,
_pad,
_context,
%{queue: queue} = state
) do
remove_hackney = [remove_children: [element]]

case LimitedQueue.pop(queue) do
{:ok, queue, next_track} ->
spec =
child({:hackney, next_track}, %Hackney.Source{
location: next_track,
hackney_opts: [follow_redirect: true]
})
|> get_child(:funnel)

{[remove_hackney | [spec: spec]], %{state | queue: queue}}

_ ->
{[remove_hackney | [notify_parent: :waiting]], state}
end
end
@impl true
def handle_element_end_of_stream(
{:hackney, _url} = element,
_pad,
_context,
%{queue: queue} = state
) do
remove_hackney = [remove_children: [element]]

case LimitedQueue.pop(queue) do
{:ok, queue, next_track} ->
spec =
child({:hackney, next_track}, %Hackney.Source{
location: next_track,
hackney_opts: [follow_redirect: true]
})
|> get_child(:funnel)

{[remove_hackney | [spec: spec]], %{state | queue: queue}}

_ ->
{[remove_hackney | [notify_parent: :waiting]], state}
end
end
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
But now that I think about it, I'm not sure the hackney source's end of stream handler is even being called. But the funnel's is
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
But even with this obvious problem, I'm still not sure why I'm getting that error. Seems that the AAC encoder is getting some data without a pts
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
Then in the :get_next_track handler I can check if it is waiting and kick it off again
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
Yeah I guess I need to check if the queue is empty in the end of stream handler and put it in some kind of waiting mode
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
I'm sure the hackney element's stream is ending much faster than I can generate new files so I'm not 100% sure how to handle that. I need it to gracefully wait for more files to be available
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
And here is the error I'm currently getting:
[error] GenServer #PID<0.830.0> terminating
** (ArithmeticError) bad argument in arithmetic expression
:erlang.-(nil, nil)
(membrane_aac_fdk_plugin 0.18.7) lib/membrane_aac_fdk_plugin/encoder.ex:281: Membrane.AAC.FDK.Encoder.validate_pts_integrity/2
(membrane_aac_fdk_plugin 0.18.7) lib/membrane_aac_fdk_plugin/encoder.ex:165: Membrane.AAC.FDK.Encoder.handle_buffer/4
(membrane_core 1.0.1) lib/membrane/core/callback_handler.ex:139: Membrane.Core.CallbackHandler.exec_callback/4
(membrane_core 1.0.1) lib/membrane/core/callback_handler.ex:69: Membrane.Core.CallbackHandler.exec_and_handle_callback/5
(elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
(membrane_core 1.0.1) lib/membrane/core/element.ex:232: Membrane.Core.Element.handle_info/2
(stdlib 5.2) gen_server.erl:1095: :gen_server.try_handle_info/3
(stdlib 5.2) gen_server.erl:1183: :gen_server.handle_msg/6
(stdlib 5.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
[error] GenServer #PID<0.830.0> terminating
** (ArithmeticError) bad argument in arithmetic expression
:erlang.-(nil, nil)
(membrane_aac_fdk_plugin 0.18.7) lib/membrane_aac_fdk_plugin/encoder.ex:281: Membrane.AAC.FDK.Encoder.validate_pts_integrity/2
(membrane_aac_fdk_plugin 0.18.7) lib/membrane_aac_fdk_plugin/encoder.ex:165: Membrane.AAC.FDK.Encoder.handle_buffer/4
(membrane_core 1.0.1) lib/membrane/core/callback_handler.ex:139: Membrane.Core.CallbackHandler.exec_callback/4
(membrane_core 1.0.1) lib/membrane/core/callback_handler.ex:69: Membrane.Core.CallbackHandler.exec_and_handle_callback/5
(elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
(membrane_core 1.0.1) lib/membrane/core/element.ex:232: Membrane.Core.Element.handle_info/2
(stdlib 5.2) gen_server.erl:1095: :gen_server.try_handle_info/3
(stdlib 5.2) gen_server.erl:1183: :gen_server.handle_msg/6
(stdlib 5.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
I've also tried with all the conversion elements inside the source bin
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
Sure thing!
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
@Feliks do I need to explicitly tell the pipeline to wait for its child bin to finish setup before playing?
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
right
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
basically the AI will be continually generating these files in the background and I will add them to the stream as they are delivered
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
Send it through the funnel to be added to an ongoing HLS stream
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
Ok, I'll give that a shot
62 replies
SMSoftware Mansion
Created by Feliks on 4/2/2024 in #membrane-help
Writing a `Bin` queuing content from multiple remote files
But I'm probably overlooking something
62 replies