decoder/renderer: no longer index automatically as part of the retrieve

functions

Indexing is a lengthy process and had a high chance of getting RenderWorkers
stuck doing it rather than being responsive to cache requests. This commit
introduces a system where workers never index media, but instead signal that
media is not ready to their RenderBackends which ensure that the media gets
indexed and re-queues the affected frames when those indexes are ready.
This commit is contained in:
itsmattkc
2020-02-19 11:44:29 +11:00
parent 5e75e9b3b0
commit 03bdf01357
28 changed files with 461 additions and 197 deletions
+15 -9
View File
@@ -52,6 +52,12 @@ class Decoder : public QObject
{
Q_OBJECT
public:
enum RetrieveState {
kReady,
kFailedToOpen,
kIndexUnavailable
};
Decoder();
Decoder(Stream* fs);
@@ -106,6 +112,11 @@ public:
*/
virtual bool Open() = 0;
/**
* @brief Determine whether the Decoder is able to retrieve data
*/
virtual RetrieveState GetRetrieveState(const rational& time) = 0;
/**
* @brief Retrieve video frame
*
@@ -127,7 +138,7 @@ public:
* A FramePtr of valid data at this timecode or nullptr if there was nothing to retrieve at the provided timecode or
* the media could not be opened.
*/
virtual FramePtr RetrieveVideo(const rational& timecode, const QAtomicInt* cancelled);
virtual FramePtr RetrieveVideo(const rational& timecode);
/**
* @brief Retrieve video frame
@@ -153,7 +164,7 @@ public:
* A FramePtr of valid data at this timecode of the requested length or nullptr if there was nothing to retrieve at
* the provided timecode or the media could not be opened.
*/
virtual FramePtr RetrieveAudio(const rational& timecode, const rational& length, const AudioRenderingParams& params, const QAtomicInt* cancelled);
virtual FramePtr RetrieveAudio(const rational& timecode, const rational& length, const AudioRenderingParams& params);
virtual bool SupportsVideo();
virtual bool SupportsAudio();
@@ -169,13 +180,6 @@ public:
*/
virtual void Close() = 0;
/**
* @brief Get a media file's internal timestamp
*
* Used to determine which frame will be served at a given time, useful for caching.
*/
virtual int64_t GetTimestampFromTime(const rational& time, const QAtomicInt* cancelled) = 0;
/**
* @brief Try to probe a Footage file by passing it through all available Decoders
*
@@ -237,4 +241,6 @@ private:
StreamPtr stream_;
};
Q_DECLARE_METATYPE(Decoder::RetrieveState)
#endif // DECODER_H