allow concurrent decoders for different blocks

This commit is contained in:
itsmattkc
2022-06-01 10:03:33 -07:00
parent eb9b1850ae
commit 8939a3aa66
4 changed files with 16 additions and 7 deletions
+1 -1
View File
@@ -335,7 +335,7 @@ void Decoder::UpdateLastAccessed()
uint qHash(Decoder::CodecStream stream, uint seed)
{
return qHash(stream.filename(), seed) ^ qHash(stream.stream(), seed);
return qHash(stream.filename(), seed) ^ qHash(stream.stream(), seed) ^ qHash(stream.block(), seed);
}
}
+2
View File
@@ -350,7 +350,9 @@ NodeValueTable NodeTraverser::GenerateBlockTable(const Track *track, const TimeR
NodeValueTable table;
if (active_block) {
block_stack_.push_back(active_block);
table = GenerateTable(active_block, Track::TransformRangeForBlock(active_block, range), track);
block_stack_.pop_back();
}
return table;
+7
View File
@@ -151,6 +151,11 @@ protected:
void ResolveJobs(NodeValue &value, const TimeRange &range);
Block *GetCurrentBlock() const
{
return block_stack_.empty() ? nullptr : block_stack_.back();
}
private:
void PreProcessRow(const TimeRange &range, NodeValueRow &row);
@@ -167,6 +172,8 @@ private:
const Node *transform_now_;
QTransform *transform_;
std::list<Block*> block_stack_;
};
}
+6 -6
View File
@@ -255,10 +255,10 @@ DecoderPtr RenderProcessor::ResolveDecoderFromInput(const QString& decoder_id, c
// No decoder
decoder.decoder = Decoder::CreateFromID(decoder_id);
decoder.last_modified = file_last_modified;
if (decoder.decoder->Open(stream)) {
decoder_cache_->insert(stream, decoder);
} else {
locker.unlock();
if (!decoder.decoder->Open(stream)) {
qWarning() << "Failed to open decoder for" << stream.filename()
<< "::" << stream.stream();
return nullptr;
@@ -421,7 +421,7 @@ void RenderProcessor::ProcessVideoFootage(TexturePtr destination, const FootageJ
qWarning() << "HAVEN'T GOTTEN DEFAULT INPUT COLORSPACE";
}
Decoder::CodecStream default_codec_stream(stream.filename(), stream_data.stream_index());
Decoder::CodecStream default_codec_stream(stream.filename(), stream_data.stream_index(), GetCurrentBlock());
QString decoder_id = stream.decoder();
@@ -443,7 +443,7 @@ void RenderProcessor::ProcessVideoFootage(TexturePtr destination, const FootageJ
frame_filename = Decoder::TransformImageSequenceFileName(stream.filename(), frame_number);
// Decoder will close automatically since it's a stream_ptr
decoder->Open(Decoder::CodecStream(frame_filename, stream_data.stream_index()));
decoder->Open(Decoder::CodecStream(frame_filename, stream_data.stream_index(), GetCurrentBlock()));
break;
}
}
@@ -489,7 +489,7 @@ void RenderProcessor::ProcessVideoFootage(TexturePtr destination, const FootageJ
void RenderProcessor::ProcessAudioFootage(SampleBuffer &destination, const FootageJob &stream, const TimeRange &input_time)
{
DecoderPtr decoder = ResolveDecoderFromInput(stream.decoder(), Decoder::CodecStream(stream.filename(), stream.audio_params().stream_index()));
DecoderPtr decoder = ResolveDecoderFromInput(stream.decoder(), Decoder::CodecStream(stream.filename(), stream.audio_params().stream_index(), nullptr));
if (decoder) {
const AudioParams& audio_params = GetCacheAudioParams();