fixed crash when file contains no valid frames #601
This commit is contained in:
@@ -668,7 +668,7 @@ void Cacher::CacheVideoWorker() {
|
||||
qWarning() << clip->name() << "frame had no PTS value";
|
||||
av_frame_free(&decoded_frame);
|
||||
|
||||
if (retrieve_code == AVERROR_EOF && retrieved_frame == nullptr) {
|
||||
if (retrieve_code == AVERROR_EOF && retrieved_frame == nullptr && !queue.isEmpty()) {
|
||||
// if we reached the end of the file, it's not an error but there are no more frames to retrieve
|
||||
// some formats EOF before the end of the duration that Olive calculates. In this event, we simply
|
||||
// return the last frame we retrieved
|
||||
|
||||
@@ -93,3 +93,8 @@ int ClipQueue::size()
|
||||
{
|
||||
return queue.size();
|
||||
}
|
||||
|
||||
bool ClipQueue::isEmpty()
|
||||
{
|
||||
return queue.isEmpty();
|
||||
}
|
||||
|
||||
@@ -159,6 +159,15 @@ public:
|
||||
*/
|
||||
int size();
|
||||
|
||||
/**
|
||||
* @brief Returns whether the queue is empty of not.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* **TRUE** if the queue is empty and contains no frames, **FALSE** if not.
|
||||
*/
|
||||
bool isEmpty();
|
||||
|
||||
private:
|
||||
QVector<AVFrame*> queue;
|
||||
QMutex queue_lock;
|
||||
|
||||
Reference in New Issue
Block a user