only apply filter if filter is set

This commit is contained in:
Nicolas Gonzalez 2018-12-01 21:58:12 -06:00
parent e1c1eb6dc8
commit 97ac68745b

View File

@ -1274,27 +1274,23 @@ static int const RCTVideoUnset = -1;
CIFilter *filter = [CIFilter filterWithName:filterName]; CIFilter *filter = [CIFilter filterWithName:filterName];
_playerItem.videoComposition = [AVVideoComposition if (filter != nil) {
videoCompositionWithAsset:asset
applyingCIFiltersWithHandler:^(AVAsynchronousCIImageFilteringRequest *_Nonnull request) {
if (filter == nil) { _playerItem.videoComposition = [AVVideoComposition
videoCompositionWithAsset:asset
applyingCIFiltersWithHandler:^(AVAsynchronousCIImageFilteringRequest *_Nonnull request) {
[request finishWithImage:request.sourceImage context:nil]; CIImage *image = request.sourceImage.imageByClampingToExtent;
} else { [filter setValue:image forKey:kCIInputImageKey];
CIImage *image = request.sourceImage.imageByClampingToExtent; CIImage *output = [filter.outputImage imageByCroppingToRect:request.sourceImage.extent];
[filter setValue:image forKey:kCIInputImageKey]; [request finishWithImage:output context:nil];
CIImage *output = [filter.outputImage imageByCroppingToRect:request.sourceImage.extent];
[request finishWithImage:output context:nil]; }];
}
}
}];
} }