-
Notifications
You must be signed in to change notification settings - Fork 6
Create ExHLS Source #113
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
Create ExHLS Source #113
Conversation
varsill
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add some tests as well ;)
| end | ||
|
|
||
| @impl true | ||
| def handle_call(:get_tracks_info, _from, state) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[NIT] Perhaps let's add some comment saying that think function MUST be called before we "schedule" segment downloads as otherwise it might take quite long for it to complete (all the previously "scheduled" segments need to be downloaded first)
| variant_id = Client.get_variants(client) |> Enum.at(0) |> elem(0) | ||
| client = Client.choose_variant(client, variant_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to allow specifying the variant ;)
mix.exs
Outdated
| {:membrane_transcoder_plugin, path: "../membrane_transcoder_plugin", only: :test}, | ||
| {:membrane_realtimer_plugin, "~> 0.10.1", only: :test}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remember to revoke the Hex dependency
| ) | ||
|
|
||
| pipeline = Testing.Pipeline.start_link_supervised!(spec: spec) | ||
| Process.sleep(10_000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the final run I would prefer to read the whole playlist rather than expect that within 10s we will download some part of the stream, but we can leave it for now so that we don't need to prepare shorter fixtures.
| description: """ | ||
| Amount of time of stream, that will be buffered by #{inspect(__MODULE__)}. | ||
| Defaults to 1 second. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it defaults to 10s ;)
| Defaults to 1 second. | ||
| Due to implementation details, the amount of the buffered stream might | ||
| be slightly different than specyfied value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| be slightly different than specyfied value. | |
| be slightly different than specified value. |
| {:noreply, state} | ||
| end | ||
|
|
||
| defp choose_variant(state) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to define variant_selection_policy() here, where there is an implementation of this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have put it in HLS Source because it is a part of its public API and ClientGenServer is a private module
| # let's create Client and choose variant asnychronously | ||
| # beyond init/1, because it requires doing some HTTP requests | ||
| # so it can take some time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # let's create Client and choose variant asnychronously | |
| # beyond init/1, because it requires doing some HTTP requests | |
| # so it can take some time | |
| # let's create Client and choose variant asynchronously | |
| # beyond init/1, because it requires doing some HTTP requests | |
| # so it can take some time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have deleted this comment
| # let's create Client and choose variant asnychronously | ||
| # beyond init/1, because it requires doing some HTTP requests | ||
| # so it can take some time | ||
| self() |> send(:setup) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's just the matter of making sure that the parent of the GenServer doesn't need to wait for these HTTP requests, you can return {:ok, state, {:continue, term()} from the init() callback
varsill
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
closes membraneframework/membrane_core#978