mirror of
https://github.com/danog/libtgvoip.git
synced 2024-12-02 09:37:52 +01:00
a6e6ed5825
Also make opus in-band FEC less aggressive
48 lines
1.3 KiB
Plaintext
48 lines
1.3 KiB
Plaintext
//
|
|
// libtgvoip is free and unencumbered public domain software.
|
|
// For more information, see http://unlicense.org or the UNLICENSE file
|
|
// you should have received with this source code distribution.
|
|
//
|
|
|
|
#import "TGVVideoRenderer.h"
|
|
#include "SampleBufferDisplayLayerRenderer.h"
|
|
#include "../../logging.h"
|
|
|
|
@implementation TGVVideoRenderer{
|
|
AVSampleBufferDisplayLayer* layer;
|
|
id<TGVVideoRendererDelegate> delegate;
|
|
tgvoip::video::SampleBufferDisplayLayerRenderer* nativeRenderer;
|
|
}
|
|
|
|
- (instancetype)initWithDisplayLayer:(AVSampleBufferDisplayLayer *)layer delegate:(nonnull id<TGVVideoRendererDelegate>)delegate{
|
|
self=[super init];
|
|
self->layer=layer;
|
|
self->delegate=delegate;
|
|
nativeRenderer=new tgvoip::video::SampleBufferDisplayLayerRenderer(self);
|
|
layer.videoGravity=AVLayerVideoGravityResizeAspect;
|
|
return self;
|
|
}
|
|
|
|
- (void)dealloc{
|
|
delete nativeRenderer;
|
|
}
|
|
|
|
- (tgvoip::video::VideoRenderer *)nativeVideoRenderer{
|
|
return nativeRenderer;
|
|
}
|
|
|
|
- (void)_enqueueBuffer: (CMSampleBufferRef)buffer reset: (BOOL)reset{
|
|
if(reset){
|
|
LOGV("Resetting layer");
|
|
[layer flush];
|
|
}
|
|
LOGV("Enqueue buffer");
|
|
[layer enqueueSampleBuffer:buffer];
|
|
NSError* error=[layer error];
|
|
if(error){
|
|
LOGE("enqueueSampleBuffer failed: %s", [error.description cStringUsingEncoding:NSUTF8StringEncoding]);
|
|
}
|
|
}
|
|
|
|
@end
|