Skip to content

fix a bug when video decoding fails and empty frames are returned #1506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 21, 2019

Conversation

stephenyan1231
Copy link
Contributor

when video decoding fails, no frame is returned.
function max will fail during the call max(i for i in frames if i < start_offset) when frames is empty.

Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the catch!

@@ -137,12 +137,14 @@ def _read_from_stream(container, start_offset, end_offset, pts_unit, stream, str
pass
# ensure that the results are sorted wrt the pts
result = [frames[i] for i in sorted(frames) if start_offset <= frames[i].pts <= end_offset]
if start_offset > 0 and start_offset not in frames:
if len(frames) > 0 and start_offset > 0 and start_offset not in frames:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this check in here is not necessary. Only the second one if len(preceding_framses) > 0) is actually necessary I believe.

@fmassa fmassa merged commit 2804c12 into pytorch:master Oct 21, 2019
@fmassa fmassa mentioned this pull request Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants