CiNcH83 / bravia_atv2

BRAVIA Android TV Knowledge Base
58 stars 1 forks source link

Wrong input selected when turning on Apple TV 4K #8

Open CiNcH83 opened 5 years ago

CiNcH83 commented 5 years ago

Whenever the Apple TV 4K is being turned on, which in turn turns on Sony BRAVIA TV and Teufel Cinebar 52 THX soundbar via CEC, the input is erroneously switched to the soundbar (on HDMI3) instead of the Apple TV 4K (on HDMI2).

I took the time and debugged the CEC communication from a BRAVIA point of view...

Wiring Schema

 __________________          ____________
| BRAVIA     HDMI1 |_       |            |
| XF9005     HDMI2 |________| AppleTV 4K |
|        HDMI3/ARC |____    |____________|
|            HDMI4 |_   |    ____________
|__________________|    |___|   Teufel   |
                            | Cinebar 52 |
                            |____________|

The soundbar is only acting as ARC audio output device as its HDMI switch does not support 4K HDR (HDMI 1.4 only). So no HDMI input of the soundbar is in use.

Please consider that the problem only occurs when the BRAVIA is turned on from deep sleep. When turning the BRAVIA off, it does not immediately enter deep sleep.

CEC Communication

(1) After turning on the Apple TV 4K, it almost immediately starts to issue <Active Source> commands in order for it to become the active source:

02-09 13:49:46.648  1640  1640 I HdmiCecController: [R]:<Active Source> src: 4, dst: 15, params: 20 00
02-09 13:49:46.650  1640  1640 I HdmiCecController: [R]:<Active Source> src: 4, dst: 15, params: 20 00

(Apple TV 4K as playback device has the logical address 4, soundbar as audio system logical address 5. 15 (0xF) is the broadcast address. So dst: 15 is processed by all devices.)

Input however isn't switched to the Apple TV 4K on HDMI2.

(2) Only after that do the devices report their physical addresses (Apple TV 4K=HDMI2=0x2000, Teufel Cinebar 52 THX=HDMI3=0x3000):

02-09 13:49:48.098  1640  1640 I HdmiCecController: [R]:<Report Physical Address> src: 4, dst: 15, params: 20 00 04
02-09 13:49:48.099  1640  1640 I HdmiCecLocalDeviceTv: Ignored while tv is transient to or in standby: <Report Physical Address> src: 4, dst: 15, params: 20 00 04
02-09 13:49:48.233  1640  1640 I HdmiCecController: [R]:<Report Physical Address> src: 5, dst: 15, params: 30 00 05
02-09 13:49:48.239  1640  1640 I HdmiCecLocalDeviceTv: Ignored while tv is transient to or in standby: <Report Physical Address> src: 5, dst: 15, params: 30 00 05

It looks like the BRAVIA isn't yet ready to process CEC commands (see Ignored while tv is transient to or in standby message) which is probably the reason why the previous <Active Source> commands (see (1)) from the Apple TV 4K did not have any effect.

Q: Why does the Apple TV 4K try to set the active source before reporting the physical address?

(3) The Apple TV 4K now seems to realize that it hasn't become the active source and asks who the active source is:

02-09 13:49:48.297  1640  1640 I HdmiCecController: [R]:<Request Active Source> src: 4, dst: 15

Q: Why does it do that? What is the Apple TV 4K doing with the information?

(4) The Teufel Cinebar 52 THX answers:

02-09 13:49:48.418  1640  1640 I HdmiCecController: [R]:<Active Source> src: 5, dst: 15, params: 30 00

Q: Why does the soundbar answer even though nothing is connected to its HDMI switch? Does not make any sense. In this configuration, the Cinebar is only sink, but no source.

(5) The BRAVIA is now ready for the <Active Source> command, switching to the soundbar on HDMI3 as the soundbar pretends that it has something to stream by making itself the active source (see (4)):

02-09 13:49:58.041  3173  3173 I com.sony.dtv.braviasyncservice.BraviaSyncService: MSG_NOTIFY_ACTIVE_SOURCE_CHANGED logicalAddress:82
02-09 13:49:58.049  3131  3150 D TIS_ExternalTis: onChange: device:Hardware: physical_address: 0x3000 port_id: 3 inputId:com.sony.dtv.tvinput.external/.ExternalTvInputService/HW4
02-09 13:49:58.057  3131  3150 I TIS_ExternalTis: onChanged: input change request from connected HDMI device. Change input

Weird thing is that BRAVIA Sync pretends the active source to be on logical address 82 which does not exist.

The problem can more easily be reproduced the following way:

With the Apple TV and the BRAVIA turned on, unplug and replug the HDMI cable between the two. Just like resuming the TV from standby, this also triggers the input to be switched to the soundbar connected to the HDMI3/ARC port instead of the Apple TV on HDMI2. [video]

Possible Solutions

The issue can possibly be fixed in all three devices...

Apple TV 4K Apple TV 4K could issue the <Active Source> at a later time, giving the BRAVIA the time to properly resume from standby. Moreover the Apple TV 4K should not query the active source (by issuing a <Request Active Source> command) in case it doesn't become the active source itself. What is it doing with the information anyway?

Teufel Cinebar 52 THX The soundbar should not pretend to be the active source when receiving a <Request Active Source> query in case nothing is being connected to its internal HDMI switch.

BRAVIA The BRAVIA should by ready quicker after turning it on, processing the initial <Active Source> commands by the Apple TV 4K. This would result in the Apple TV 4K not issuing a <Request Active Source> command which in turn would not result in an input switch to the soundbar.