mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-22 00:10:18 +00:00
Replace the old sublayer rather than adding the new one on top of the onscreen controls
This commit is contained in:
@@ -22,9 +22,7 @@
|
|||||||
|
|
||||||
- (void)reinitializeDisplayLayer
|
- (void)reinitializeDisplayLayer
|
||||||
{
|
{
|
||||||
if (displayLayer != nil) {
|
CALayer *oldLayer = displayLayer;
|
||||||
[displayLayer removeFromSuperlayer];
|
|
||||||
}
|
|
||||||
|
|
||||||
displayLayer = [[AVSampleBufferDisplayLayer alloc] init];
|
displayLayer = [[AVSampleBufferDisplayLayer alloc] init];
|
||||||
displayLayer.bounds = _view.bounds;
|
displayLayer.bounds = _view.bounds;
|
||||||
@@ -32,7 +30,13 @@
|
|||||||
displayLayer.position = CGPointMake(CGRectGetMidX(_view.bounds), CGRectGetMidY(_view.bounds));
|
displayLayer.position = CGPointMake(CGRectGetMidX(_view.bounds), CGRectGetMidY(_view.bounds));
|
||||||
displayLayer.videoGravity = AVLayerVideoGravityResizeAspect;
|
displayLayer.videoGravity = AVLayerVideoGravityResizeAspect;
|
||||||
|
|
||||||
[_view.layer addSublayer:displayLayer];
|
if (oldLayer != nil) {
|
||||||
|
// Switch out the old display layer with the new one
|
||||||
|
[_view.layer replaceSublayer:oldLayer with:displayLayer];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
[_view.layer addSublayer:displayLayer];
|
||||||
|
}
|
||||||
|
|
||||||
// We need some parameter sets before we can properly start decoding frames
|
// We need some parameter sets before we can properly start decoding frames
|
||||||
waitingForSps = true;
|
waitingForSps = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user