I have a streaming app which is able to receive a video stream via raw h264 or h265 (HEVC). I render the stream via AVSampleBufferDisplayLayer. I uploaded my app via TestFlight and some users mentioned that the h265 freezes sometimes. I started to investigate the issue and it turned out the h265 stream sometimes freezes but without any errors. Even the AVSampleBufferDisplayLayer status is returning ".rendering" and "isReadyForMoreMediaData" is returning true. The stream only continues after I receive an I-Frame/ Key-Frame. It is a real time streaming app and the problem occurs when I lose a frame during the streaming session (which can happen regularly). I connect to a 3rd Party streaming server so I can't change I-Frame interval. On h264 when I lose a frame then the stream will get pixelated until I receive the next I-Frame (which is expected) but for some reason the stream freezes when I lose a frame via h265. Are there any settings which I can apply to the "CMSampleBuffer" via the "CFDictionarySetValue" to avoid this?
I built a small sample app to reproduce the problem. It is available here
https://bitbucket.org/grill2010/hevcdecodertest/src/master/
The project will render a HEVC stream (stream length is only a few seconds in total). The sample app includes two buttons "Start decoding" and "Start Decoding with lost frame". If you click "Start decoding" the stream will be rendered correctly but if you click "Start Decoding with lost frame" you see that it will freeze immediately the app simulates a frame loss.