Allocate CMBlockBuffers using a memory pool.

Bug: webrtc:5258
Change-Id: Iae7549d618f797f4dc413671f0f2e53ed23be3e7
Reviewed-on: https://webrtc-review.googlesource.com/c/107738
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25383}
This commit is contained in:
Kári Tristan Helgason
2018-10-26 10:59:28 +02:00
committed by Commit Bot
parent c35096d975
commit 0d247729a6
3 changed files with 26 additions and 11 deletions

View File

@ -71,12 +71,23 @@ void decompressionOutputCallback(void *decoderRef,
// Decoder.
@implementation RTCVideoDecoderH264 {
CMVideoFormatDescriptionRef _videoFormat;
CMMemoryPoolRef _memoryPool;
VTDecompressionSessionRef _decompressionSession;
RTCVideoDecoderCallback _callback;
OSStatus _error;
}
- (instancetype)init {
self = [super init];
if (self) {
_memoryPool = CMMemoryPoolCreate(nil);
}
return self;
}
- (void)dealloc {
CMMemoryPoolInvalidate(_memoryPool);
CFRelease(_memoryPool);
[self destroyDecompressionSession];
[self setVideoFormat:nullptr];
}
@ -129,7 +140,8 @@ void decompressionOutputCallback(void *decoderRef,
if (!webrtc::H264AnnexBBufferToCMSampleBuffer((uint8_t *)inputImage.buffer.bytes,
inputImage.buffer.length,
_videoFormat,
&sampleBuffer)) {
&sampleBuffer,
_memoryPool)) {
return WEBRTC_VIDEO_CODEC_ERROR;
}
RTC_DCHECK(sampleBuffer);