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

Warn on demand on pad with EoS #851

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changelog

## 1.1.2
* Remove 'failed to insert a metric' stalker warning [#849](https://github.com/membraneframework/membrane_core/pull/849)
* Remove 'failed to insert a metric' stalker warning [#849](https://github.com/membraneframework/membrane_core/pull/849)

## 1.1.1
* Fix 'table identifier does not refer to an existing ETS table' error when inserting metrics into the observability ETS. [#835](https://github.com/membraneframework/membrane_core/pull/835)
Expand Down
16 changes: 15 additions & 1 deletion lib/membrane/core/element/action_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,12 @@ defmodule Membrane.Core.Element.ActionHandler do
@impl CallbackHandler
def handle_action(
{:demand, {pad_ref, size}},
_cb,
cb,
_params,
%State{type: type} = state
)
when is_pad_ref(pad_ref) and is_demand_size(size) and type in [:sink, :filter, :endpoint] do
:ok = maybe_warn_on_demand_action(pad_ref, size, cb, state)
delay_supplying_demand(pad_ref, size, state)
end

Expand Down Expand Up @@ -481,4 +482,17 @@ defmodule Membrane.Core.Element.ActionHandler do
end

defp handle_outgoing_event(_pad_ref, _event, state), do: state

defp maybe_warn_on_demand_action(pad_ref, demand_size, callback, state) do
if PadModel.get_data!(state, pad_ref, :end_of_stream?) do
Membrane.Logger.warning("""
Action :demand with value #{inspect(demand_size)} for pad #{inspect(pad_ref)} was returned \
from callback #{inspect(callback)}, but stream on this pad has already ended, callback \
c:handle_end_of_stream/3 for this pad has been called and no more buffers will arrive on \
this pad.
""")
end

:ok
end
end
Loading