Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/decord/runtime/ndarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace runtime {
class NDArray {
public:
// pts of the frame
int pts=-1;
int64_t pts=-1;
// internal container type
struct Container;
/*! \brief default constructor */
Expand Down
17 changes: 16 additions & 1 deletion src/video/video_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,25 @@ void VideoReader::SkipFramesImpl(int64_t num)
auto pts = FramesToPTS(frame_pos);
decoder_->SuggestDiscardPTS(pts);


int64_t pop_retries = 0;
const int64_t MAX_POP_RETRIES_PER_FRAME = 10000;
int64_t initial_num = num;

while (num > 0) {
PushNext();
ret = decoder_->Pop(&frame);
if (!ret) continue;
if (!ret) {
pop_retries++;
if (pop_retries > MAX_POP_RETRIES_PER_FRAME) {
LOG(INFO) << "[" << filename_ << "] Failed to skip frames effectively at frame " << curr_frame_
<< ". Decoder did not respond after " << MAX_POP_RETRIES_PER_FRAME
<< " attempts. Video might be corrupted or seeking failed. Aborting skip operation."
<< " Attempted to skip " << initial_num << " frames, skipped " << (initial_num - num) << ".";
break;
}
continue;
}
++curr_frame_;
// LOG(INFO) << "skip: " << num;
--num;
Expand Down