Video freezing with FairPlay streaming on iOS 18

Since iOS/iPadOs/tvOS 18 then we have run into a new problem with streaming of FairPlay encrypted video. On the affected streams then the audio plays perfectly but the video freezes for periods of a few seconds, so it will freeze for 5s or so, then be OK for a few seconds then freeze again.

It is entirely reproducible when all the following are true

  • the video streams were produced by a particular encoder (or particular settings, not sure on that)
  • the video must be encrypted
  • device is running some variety of iOS 18 (or iPadOS or tvOS)
  • the device is an affected device

Known devices are

  • AppleTV 4K 2nd Gen
  • iPad Pro 11" 1st and 2nd gen

Devices known not to show the problem are

  • all other AppleTV models
  • iPhone 13 Pro and 16 Pro

If we stream the same content, but unencrypted, then it plays perfectly, or if you play the encrypted stream on, say, tvOS 17.

When the freezing occurs then we can see in the console logs repeating blocks of lines like the following

default	18:08:46.578582+0000	videocodecd	AppleAVD: AppleAVDDecodeFrameResponse(): Frame# 5771 DecodeFrame failed with error 0x0000013c
default	18:08:46.578756+0000	videocodecd	AppleAVD: AppleAVDDecodeFrameInternal(): failed - error: 316
default	18:08:46.579018+0000	videocodecd	AppleAVD: AppleAVDDecodeFrameInternal(): avdDec - Frame#   5771, DecodeFrame failed with error: 0x13c
default	18:08:46.579169+0000	videocodecd	AppleAVD: AppleAVDDisplayCallback(): Asking fig to drop frame # 5771 with err -12909 - internalStatus: 315

also more relevant looking lines:

default	18:17:39.122019+0000	kernel	AppleAVD: avdOutbox0ISR(): FRM DONE (cid:  2.0, fno:    10970, codecT: 1) FAILED!!
default	18:17:39.122155+0000	videocodecd	AppleAVD: AppleAVDDisplayCallback(): Asking fig to drop frame # 10970 with err -12909 - internalStatus: 315
default	18:17:39.122221+0000	kernel	AppleAVD: ## client[ 2.0] @ frm    10970, errStatus: 0x10
default	18:17:39.122338+0000	kernel	AppleAVD: decodeFailIdentify(): VP error bit 4 has EP3B0 error
default	18:17:39.122401+0000	kernel	AppleAVD: processHWResponse(): clientID 2.0 frameNumber 10970 error 315, offsetIndex 10, isHwErr 1

So it would seem to me that one of the following must be happening:

  • When these particular HLS files are encrypted then the data is being corrupted in some way that played back on iOS 17 and earlier but now won't on 18+, or
  • There's a regression in iOS 18 that means that this particular format of video data is corrupted on decryption

If anyone has seen similar behaviour, or has any ideas how to identify which of the two scenarios it is, please say. Unfortunately we don't have control of the servers so can't make changes there unless we can identify they are definitely the cause of the problem.

Thanks, Simon.

Answered by DTS Engineer in 815235022

From the first set of error messages, you can conclude that the decoder thinks your video has an invalid frame.

Step 1 of a solution is to validate that your video is actually correctly formed.

Start by running the media stream validator, and fix all the "must-fix" and "should-fix" errors you find.

Also, check that your content meets all the requirements listed here.

The debugging challenge is always that content with serious errors may appear to play correctly in some OS versions or under some environmental conditions, but fail on others. The fact that some content used to play correctly isn't a guarantee that there isn't anything wrong with it. Validation tools are the source of truth.

If your content validates successfully and playback is still exhibiting issues, step 2 is to file a bug report with a URL to a reasonably reproducible case, so that the playback engineering team can look into what's gone wrong.

From the first set of error messages, you can conclude that the decoder thinks your video has an invalid frame.

Step 1 of a solution is to validate that your video is actually correctly formed.

Start by running the media stream validator, and fix all the "must-fix" and "should-fix" errors you find.

Also, check that your content meets all the requirements listed here.

The debugging challenge is always that content with serious errors may appear to play correctly in some OS versions or under some environmental conditions, but fail on others. The fact that some content used to play correctly isn't a guarantee that there isn't anything wrong with it. Validation tools are the source of truth.

If your content validates successfully and playback is still exhibiting issues, step 2 is to file a bug report with a URL to a reasonably reproducible case, so that the playback engineering team can look into what's gone wrong.

Video freezing with FairPlay streaming on iOS 18
 
 
Q