pyatv: Protocol socket hangs after receiving large artwork

Describe the bug

When requesting large artwork images from the Apple TV, the protocol can sometimes completely hang up. No further state updates are sent, and no further commands from pyatv (play, pause) are processed.

There is likely something about the protocol we are missing. The Apple TV transmits a complete and valid artwork image, and only then does the connection hang. I found modifying messages.py I could get artwork sizes well over -1 x 400px, but these almost always guaranteed a hang. At 400, most content works, but some seems to fail intermittently.

To Reproduce

To re-produce this, I went to Netflix and attempted to watch “The Killing of a Sacred Deer”. This produced a 135 KB artwork file, which triggered a hang reliably. Other Netflix content (such as “Better Call Saul” came in at 112 KB and did not trigger the hang.

I modified the code to request larger artwork sizes, and this also reliably triggered a hang with Music app cover images.

Expected behavior

System Setup (please complete the following information):

  • OS: macOS
  • Python: 3.7.5
  • pyatv: 0.5.0
  • Apple TV: Apple TV 4K tvOS 13.4 (17L256)

Additional context

Most likely there is something we’re missing in the protocol—maybe some kind of acknowledgment we have to send. It’s possible it’s also a device bug.

Has anyone had luck using atvproxy to capture when control center requests artwork? This might be illuminating.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 23 (23 by maintainers)

Commits related to this issue

Most upvoted comments

I created #703 that I will use to implement transactions when I get some time. Maybe later today.