Skip to content

command: namespace bitmap overlays by owner#18133

Open
dnyanesh1011 wants to merge 1 commit into
mpv-player:masterfrom
dnyanesh1011:overlay-owner-fix
Open

command: namespace bitmap overlays by owner#18133
dnyanesh1011 wants to merge 1 commit into
mpv-player:masterfrom
dnyanesh1011:overlay-owner-fix

Conversation

@dnyanesh1011

Copy link
Copy Markdown

Fixes #17534

Bitmap overlays created with overlay-add currently use a global ID namespace shared by all clients. As a result, different clients using the same overlay ID can overwrite each other's overlays

Track bitmap overlays by (owner, id) instead of treating overlay IDs as globally unique. This allows multiple clients to use the same overlay IDs without interference

Additionally, remove bitmap overlays when their owning client is destroyed, matching the cleanup behavior of osd-overlay overlays

Tested by:

  • Built successfully with Meson/Ninja on Windows (UCRT64)
  • Verified overlay add/remove code paths compile and link correctly

@CounterPillow

Copy link
Copy Markdown
Contributor

Tested by:

  • Built successfully with Meson/Ninja on Windows (UCRT64)
  • Verified overlay add/remove code paths compile and link correctly

So you didn't run the code?

Comment thread player/command.c Outdated
Comment on lines +5563 to +5569
while (cmd->num_overlays > 0) {
talloc_free(cmd->overlays[0].source);

MP_TARRAY_REMOVE_AT(cmd->overlays,
cmd->num_overlays,
0);
}

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.

this isn't even indented properly, what are you doing?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in the latest push, thanks

@dnyanesh1011

dnyanesh1011 commented Jun 16, 2026

Copy link
Copy Markdown
Author

I didn't perform a runtime test of the overlay functionality

@CounterPillow

Copy link
Copy Markdown
Contributor

I only compile-tested this

Why?

Signed-off-by: dnyanesh1011 <dnyaneshwarxi@gmail.com>
@Dudemanguy

Copy link
Copy Markdown
Member

I only compile-tested this

At least have the courtesy to test if it actually fixes the issue that you claim it fixes before submitting the PR.

@llyyr

llyyr commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

your commit has cosmetic changes mixed in, please ask your LLM to keep only required changes. Also ask it to generate a test case to actually verify the code it spit out works according to itself at least

@dnyanesh1011

Copy link
Copy Markdown
Author

I created a minimal IPC-based reproduction and runtime-tested the patch

test:

opened two independent IPC clients connected to the same mpv instance
client A created bitmap overlay ID 42
client B created bitmap overlay ID 42 at a different position

result:

Both overlays were visible simultaneously demonstrating that identical IDs from different clients no longer collide

Cleanup test:

Closed client A's IPC connection

result:

client A's overlay was removed automatically
client B's overlay remained visible

This matches the intended behavior described in #17534

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.

Consider making overlay_id client local

4 participants