Skip to content

client: handle FLV onMetaData script tags from direct publishers - #26

Merged
gregadams merged 10 commits into
masterfrom
ga/critical_mode_drops_rtmp_connection
Aug 28, 2026
Merged

gregadams merged 10 commits into
masterfrom
ga/critical_mode_drops_rtmp_connection

Conversation

@gregadams

@gregadams gregadams commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor
  • client_handle_flv_buffer() handler failures are intentionally ignored now, while parse failures are still surfaced via the parse status.
  • Added client_handle_flv_script_data() which decodes the onMetaData AMF payload of a MSG_NOTIFY FLV tag into client->metadata and sets new_metadata, so the updated framerate is actually propagated to subscribers via client_maybe_update_metadata() instead of being silently dropped (previously subscribers always got the hardcoded framerate = 30.0 from client_set_default_metadata).

Work for pexip/mcu#50793

* ret now starts as PEX_RTMP_SERVER_STATUS_OK; the genuine parse failure explicitly sets PEX_RTMP_SERVER_STATUS_PARSE_FAILED before goto done, and the loop bails out early if a message handler fails.
* Added client_handle_flv_script_data() which decodes the onMetaData AMF payload of a MSG_NOTIFY FLV tag into client->metadata and sets new_metadata, so the updated framerate is actually propagated to subscribers via client_maybe_update_metadata() instead of being silently dropped (previously subscribers always got the hardcoded framerate = 30.0 from client_set_default_metadata).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the direct-FLV ingestion path for publishers so that FLV MSG_NOTIFY script-data (onMetaData) is decoded and applied to the publisher’s metadata, ensuring updated values (e.g., framerate) are propagated to subscribers. It also tightens error handling in the FLV tag parsing loop by explicitly reporting parse failures and aborting early when message handling fails.

Changes:

  • Initialize client_handle_flv_buffer() status as PEX_RTMP_SERVER_STATUS_OK, explicitly set PARSE_FAILED on tag-header parse failure, and stop processing further tags if a handler returns an error.
  • Add client_handle_flv_script_data() to decode FLV onMetaData AMF payload into client->metadata and mark new_metadata for propagation.
  • Handle FLV MSG_NOTIFY tags in the FLV parsing loop by invoking the new metadata decoding path.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/client.c
Comment thread src/client.c Outdated
Comment thread src/client.c
gregadams and others added 3 commits August 26, 2026 13:59
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@camilo-celis camilo-celis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing analysis on the MCU issue ... Not sure how u digged that one out 😆

Not too familiar with all various use cases, so just left question assuming we want to be as defensive as possible.

Comment thread src/client.c Outdated
Comment thread src/client.c Outdated
Comment thread src/client.c Outdated
Comment thread src/client.c

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/client.c
Comment thread src/client.c Outdated
Co-authored-by: havardgraff <1926313+havardgraff@users.noreply.github.com>

@camilo-celis camilo-celis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

Comment thread src/client.c

Copilot AI commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

@camilo-celis I've opened a new pull request, #27, to work on those changes. Once the pull request is ready, I'll request review from you.

@camilo-celis camilo-celis changed the title Work for Issue pexip/mcu#50793 client: handle FLV onMetaData script tags from direct publishers Aug 27, 2026
@gregadams
gregadams merged commit 62058dd into master Aug 28, 2026
camilo-celis pushed a commit that referenced this pull request Sep 7, 2026
* Work for Issue pexip/mcu#50793

* `client_handle_flv_buffer()` handler failures are intentionally ignored now, while parse failures are still surfaced via the parse status.
* Added client_handle_flv_script_data() which decodes the onMetaData AMF payload of a MSG_NOTIFY FLV tag into client->metadata and sets new_metadata, so the updated framerate is actually propagated to subscribers via client_maybe_update_metadata() instead of being silently dropped (previously subscribers always got the hardcoded framerate = 30.0 from client_set_default_metadata).

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Remove erroneous bracket.

* Fixup handling of amf_dec_load_object call as it never returns NULL, but we have to verify it has be decoded correctly.

* Fixup amf_enc_write_int to write a double if AMF0 as it has no integer type.

* Parse status and per-subscriber send status tracked separately.

* Now merge updates into client->metadata instead of replacing and loosing old values.

* Move AMF payload validation helper to amf.c

Co-authored-by: havardgraff <1926313+havardgraff@users.noreply.github.com>

* Fixup windows static builds now the define is being passed down correctly.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: havardgraff <1926313+havardgraff@users.noreply.github.com>
(cherry picked from commit 62058dd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants