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

Fixes #9, by killing the ffmpeg process if it does not exit within 1 second #13

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

JPasterkampRotec
Copy link

@JPasterkampRotec JPasterkampRotec commented Feb 14, 2025

  • Added a editorconfig because this project was written with spaces instead of tabs, so spaces should be enforced in everyone's editor.
  • Passing cancellation token into Stream.ReadAsync.
  • Killing the ffmpeg process if it will not cancel within 1 second.

Most visual studio installations default to tabs, while the original creator of this solution seems to use spaces. By adding this editor config everyone will automatically use spaces in this solution.
This does not cancel the reading in most cases sadly, but it is good practice to always pass in cancellation tokens.
Since the cancellation token does not  stop the Stream.ReadAsync when the inputsource is offline,  we manually kill the ffmpeg process after 1 second of lenience. This causes the ReadAsync method to return 0 bytes, allowing the stream to end.
@JPasterkampRotec
Copy link
Author

JPasterkampRotec commented Feb 14, 2025

I tried linking this pull request to this issue but don't know how

@tinohager
Copy link
Member

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