memorypool: implemented arenas
A pool can allocate/destroy any amount of arenas during runtime, meaning it won't run out of memory but we still get the advantages of one large allocation as opposed to hundreds of small allocations.
This commit is contained in:
@@ -94,11 +94,10 @@ bool FFmpegDecoder::Open()
|
||||
FFmpegFramePool* frame_pool = frame_pool_map_.value(stream().get());
|
||||
|
||||
if (!frame_pool) {
|
||||
frame_pool = new FFmpegFramePool();
|
||||
frame_pool->SetParams(our_instance_->stream()->codecpar->width,
|
||||
our_instance_->stream()->codecpar->height,
|
||||
static_cast<AVPixelFormat>(our_instance_->stream()->codecpar->format));
|
||||
frame_pool->Allocate(256);
|
||||
frame_pool = new FFmpegFramePool(256,
|
||||
our_instance_->stream()->codecpar->width,
|
||||
our_instance_->stream()->codecpar->height,
|
||||
static_cast<AVPixelFormat>(our_instance_->stream()->codecpar->format));
|
||||
frame_pool_map_.insert(stream().get(), frame_pool);
|
||||
}
|
||||
|
||||
@@ -346,7 +345,8 @@ SampleBufferPtr FFmpegDecoder::RetrieveAudio(const rational &timecode, const rat
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WaveInput input(GetConformedFilename(params));
|
||||
QString wav_fn = GetConformedFilename(params);
|
||||
WaveInput input(wav_fn);
|
||||
|
||||
if (input.open()) {
|
||||
const AudioRenderingParams& input_params = input.params();
|
||||
@@ -361,6 +361,8 @@ SampleBufferPtr FFmpegDecoder::RetrieveAudio(const rational &timecode, const rat
|
||||
return sample_buffer;
|
||||
}
|
||||
|
||||
qCritical() << "Failed to open cached file" << wav_fn;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user