Hi All,
We are developing app that uses a propietray network protocol to transfer video streams.
The stream is being de-mulpliexed, audio and video decoders are created and working but we are facing a strange hang while trying to create / use AVSampleBufferDisplayLayer in order to render the vide.
It hangs on the creation of the AVSampleBufferDisplayLayer instance. This happens on an iPhone 7 Plus and iPhoneX.
When the app hangs, the only way to make it display video again is to restart the device.
It happens freqently and blocking us from continue developing the app.
We tried to use the AVSampleBufferDisplayLayer using 2 different ways
Use it as a layer class
+ (Class) layerClass
{
return [AVSampleBufferDisplayLayer class];
}
And access [self layer] everytime we need to enqueue a decoded frame - Using this way cause the app to hangs on creation of the view
You can see a screenshot of the callstack here : https://bit.ly/2FZt43B
Hold an internal property of AVSampleBufferDisplayLayer*, allocate and initate it under initWithCoder or initWithFrame.
_videoLayer = [[AVSampleBufferDisplayLayer alloc] init];
_videoLayer.frame = self.bounds;
_videoLayer.videoGravity = AVLayerVideoGravityResizeAspect;
_videoLayer.backgroundColor = [[UIColor blackColor] CGColor];
[[self layer] addSublayer:_videoLayer];
Again, the app hangs on creation.
You can see a screenshot of the callstack here : https://bit.ly/2I1EIRA
Creation / access to the AVSampleBufferDisplayInstace is always done from the main thread
What is the correct way to work with AVSampleBufferDisplayLayer?
Any idea why it's hanging and how to prevent it?
Thanks