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 demand type to allow for the default demand size syntax #768

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/membrane/element/action.ex
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ defmodule Membrane.Element.Action do
guaranteed not to receive more data than demanded.

Demand size can be either a non-negative integer, that overrides existing demand,
or a function that is passed current demand, and is to return the new demand.
or a function that is passed current demand, and is to return the new demand. In case only pad
is specified, the demand size defaults to 1.

Allowed only when playback is playing.
"""
@type demand :: {:demand, {Pad.ref(), demand_size}}
@type demand :: {:demand, {Pad.ref(), demand_size} | Pad.ref()}
@type demand_size :: pos_integer | (pos_integer() -> non_neg_integer())

@typedoc """
Expand Down