decoder: use atomic int instead of mutex for access time

Prevents main thread from getting hung up if the decoder is doing something slow
This commit is contained in:
itsmattkc
2022-10-10 18:54:45 -07:00
parent cae71f011d
commit bb63b6968c
2 changed files with 1 additions and 13 deletions
-12
View File
@@ -45,7 +45,6 @@ Decoder::Decoder() :
void Decoder::IncrementAccessTime(qint64 t)
{
QMutexLocker locker(&mutex_);
last_accessed_ += t;
}
@@ -156,7 +155,6 @@ Decoder::RetrieveAudioStatus Decoder::RetrieveAudio(SampleBuffer &dest, const Ti
qint64 Decoder::GetLastAccessedTime()
{
QMutexLocker locker(&mutex_);
return last_accessed_;
}
@@ -215,16 +213,6 @@ DecoderPtr Decoder::CreateFromID(const QString &id)
return nullptr;
}
int64_t Decoder::GetTimeInTimebaseUnits(const rational &time, const rational &timebase, int64_t start_time)
{
return Timecode::time_to_timestamp(time, timebase);
}
rational Decoder::GetTimestampInTimeUnits(int64_t time, const rational &timebase, int64_t start_time)
{
return Timecode::timestamp_to_time(time, timebase);
}
void Decoder::SignalProcessingProgress(int64_t ts, int64_t duration)
{
if (duration != AV_NOPTS_VALUE && duration != 0) {
+1 -1
View File
@@ -315,7 +315,7 @@ private:
QMutex mutex_;
qint64 last_accessed_;
std::atomic_int64_t last_accessed_;
TexturePtr cached_texture_;
rational cached_time_;