Repository navigation
fixed: claiming the active source on routing changes that don't select us - #768
Open
phycoforce wants to merge 2 commits into
Open
phycoforce wants to merge 2 commits into
phycoforce wants to merge 2 commits into
Conversation
SetActiveRoute() runs on the device that sent the <Routing Change> or <Routing Information>, but it called ActiveSourceSent() on that device instead of on the libCEC device the route leads to. The flag is only set for devices libCEC transmits <Active Source> for, so the test was always true and libCEC re-sent <Image View On> + <Active Source> on every routing change to its address, even while it was the active source and had already announced it.
…address A <Routing Change> whose original and new address are equal reports no change of route, so it does not mean that this device was selected. A Samsung HW-Q930F soundbar broadcasts one (5f:80:21:00:21:00) each time it settles its HDMI input while the TV powers on, and libCEC answered each with <Image View On> + <Active Source>. When another source had just woken the TV, this pulled the TV back to libCEC's input until the other source gave up. The sender is still marked as powered on, which the Philips handler relies on for the TV's 0.0.0.0 -> 0.0.0.0 routing change at power-up.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #767.
Two small changes to the generic routing-change handling, no vendor handlers touched:
CCECBusDevice::SetActiveRoute()runs on the device that sent the routing change, but testedActiveSourceSent()on that device instead of onnewRoute. The flag is only set on devices libCEC transmits for, so the test was always true and libCEC re-announced on every routing change to its address, even while it was already the active source and had said so. It now testsnewRoute->ActiveSourceSent(), which reads as the original intent: announce if we haven't since the TV's last power change (ResetActiveSourceSent()), or if we aren't the active source.CCECCommandHandler::HandleRoutingChange()skipsSetActiveRoute()when the original and new address are equal, and logs it at debug level. Such a routing change reports no change of route, so it doesn't mean this device was selected. The sender is still marked as powered on, which the Philips handler relies on for the TV's0.0.0.0 -> 0.0.0.0at power-up (its override runs first and is unchanged).<Set Stream Path>,<Routing Information>and activation at startup are unchanged.Tested
On real hardware: LibreELEC, Kodi 22.0-RC1, Pulse-Eight USB-CEC (firmware 12); LG OLED (2026) -> Samsung HW-Q930F on eARC (2.0.0.0) -> Kodi (2.1.0.0); Nintendo Switch 2 on another TV input (3.0.0.0). 8.1.7 with these two commits (master has no other code changes since 8.1.7), loaded into Kodi, CEC debug log on.
<Active Source>, the soundbar's no-op routing changes were logged as ignored (1 and 2 of them), and the TV was on the console after about 2 s both times. Stock 8.1.7: 24 and 12<Active Source>, and the TV ended on Kodi.<Set Stream Path>and ignored 5 no-op routing changes. Stock: 6 to 8<Active Source>per power-on.0f:80:30:00:21:00and answered<Set Stream Path>, as before.<Active Source>itself on the empty input, so this took the same path as above; picture and audio were back at once.<Active Source>at startup. The TV then routed to Kodi (0f:80:30:00:21:00), and libCEC didn't repeat itself (change 1). It also ignored the soundbar's5f:80:21:00:21:00(change 2). TV and soundbar both switched to Kodi.Console wake with this change (source, routing and system audio messages only; libCEC sent no
<Image View On>or<Active Source>for the rest of the minute):Not covered: TVs from other vendors, and a device that sends a same-address routing change when the user re-selects the input that is already showing. libCEC would no longer re-announce there, but the TV is already on that input.
Full debug logs for every run, stock and with this change: https://gist.github.com/phycoforce/d2cb9afbacb3ce9d02af8dc72361ca68