Skip to content

[video_player] Migrate from platform channels to Pigeon-generated Dart FFI. - #1207

Open
gin7773 wants to merge 4 commits into
flutter-tizen:mainfrom
gin7773:ffi/video_player
Open

gin7773 wants to merge 4 commits into
flutter-tizen:mainfrom
gin7773:ffi/video_player

Conversation

@gin7773

@gin7773 gin7773 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Main changes:

  • Migrate from platform channels to Pigeon-generated Dart FFI.
    1. Host API calls now use the Pigeon C++ FFI path instead of BasicMessageChannel.
    2. The per-texture EventChannel is replaced by a Pigeon FFI event stream (videoEvents), with the texture id passed as the stream instance name.
  • Update pigeon to the C++ FFI generator branch (git ref 6259ba78, pigeon v29.0.11).

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T09:53:21.137998Z 530b82e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 584bad1fd8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +80 to +81
SetUpTizenVideoPlayerApiFfi(this);
SetUpVideoPlayerEventsVideoEventsFfi(this);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Supply a platform-thread dispatcher for both FFI registrations

With separate Dart/UI and platform threads, omitting the dispatcher makes the generated FFI wrappers execute inline on the Dart thread, while ScheduleSendPendingEvents() still delivers events through the captured GLib context. Consequently, OnCancel() can call ClearEventSink() concurrently with SendPendingEvents() invoking event_sink_->Success(), freeing the sink during dispatch. An ASan harness using the extracted player methods and generated sink reproduces this heap-use-after-free. The previous EventChannel handlers were serialized on the platform thread. Supply a main-context dispatcher for both registrations, or synchronize sink replacement/cancellation with event delivery.

Useful? React with 👍 / 👎.

return;
}
const auto& codec = PigeonFfiGetCodec();
on_event_(sink_id_, PigeonFfiEncodeMessage(codec, ::flutter::EncodableValue(event)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Detach native callbacks before hot restart destroys their isolate

When hot restart occurs with a live player, the native sink survives but the Dart isolate owning its NativeCallable.listener pointers is destroyed. Old players are only cleared when the next isolate calls VideoPlayerTizenPlugin::Initialize(), so a completion or error before that cleanup invokes an expired callback here and can terminate the process. Unlike the previous messenger-backed delivery, these raw callback pointers cannot safely outlive their originating isolate. Quiesce and detach native callbacks before isolate teardown, or use delivery that safely rejects notifications to dead isolates rather than relying on the next initialization.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant