Skip to content
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

Fix CameraManager.GetCamera() hanging and FrameConverter crashing #11

Merged
merged 3 commits into from
Dec 17, 2021
Merged

Fix CameraManager.GetCamera() hanging and FrameConverter crashing #11

merged 3 commits into from
Dec 17, 2021

Conversation

Speykious
Copy link
Owner

Maybe it would have been more organized to separate these in 2 different PRs, but the changes made are so small I just decided to do it that way.

This PR fixe #9.
It turns out that I don't even need to call ffmpeg.avformat_find_stream_info(). From the documentation:

Read packets of a media file to get stream information. This is useful for file formats with no headers such as MPEG. This function also computes the real framerate in case of MPEG-2 repeat frame mode. The logical file position is not changed by this function; examined packets may be buffered for later processing.
It looks like it just works now. The camera gets retrieved but the Width and Height are at 0.
I wonder if I should make a warning, or have some way of detecting if the camera can get decoded.

This PR also fixes #10.
As for the FrameConverter, all I did was throwing an ArgumentException if any of the Width/Height properties are at 0.

@Speykious Speykious requested a review from adryzz December 17, 2021 11:59
Copy link
Collaborator

@adryzz adryzz left a comment

Choose a reason for hiding this comment

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

LGTM

@adryzz adryzz merged commit 9359180 into Speykious:main Dec 17, 2021
@Speykious Speykious deleted the hang branch December 17, 2021 13:19
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.

Creating a FrameConverter with source width/height of 0 immediately crashes the program
2 participants