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

* Bug fix for issue #14: Duplicate error events #15

Merged
merged 2 commits into from
Apr 28, 2019
Merged

* Bug fix for issue #14: Duplicate error events #15

merged 2 commits into from
Apr 28, 2019

Conversation

dm413
Copy link
Contributor

@dm413 dm413 commented Mar 30, 2019

See #14
When ffmpeg.exe reports an error (via a non-zero exit code), this library raised the Error event twice with the same message. Changed to only raise the event once.

See #14
When ffmpeg.exe reports an error (via a non-zero exit code), this library raised the Error event twice with the same message. Changed to only raise the event once.
@cmxl
Copy link
Owner

cmxl commented Apr 26, 2019

Why does it trigger the event twice?
I need to look into this one again.
But maybe you could elaborate on that one meanwhile.

@cmxl cmxl self-assigned this Apr 26, 2019
@cmxl cmxl self-requested a review April 26, 2019 18:59
@cmxl cmxl removed their assignment Apr 26, 2019
@cmxl
Copy link
Owner

cmxl commented Apr 26, 2019

Is it possible that this is an issue when cancelling the ffmpegprocess?
Have you ever encountered any other form of duplicate exceptions?
Would be great to have something reproducible and some simple tests to confirm.

Can you think of any situation where there was no ffmpeg error, but the process would have ended with and exitcode other than 0?

If it is readlly only when we cancelled the task, we should maybe check if the exitcode AND if a cancellation was requested here

@cmxl cmxl assigned cmxl and dm413 Apr 26, 2019
@cmxl cmxl added the wip Work in progress label Apr 26, 2019
@dm413
Copy link
Contributor Author

dm413 commented Apr 28, 2019

This has nothing to do with cancellation. It occurs on all errors from ffmpeg.exe.

The relevant code is in FFmpegProcess.ExecuteAsync()

await ffmpegProcess.WaitForExitAsync((exitCode) => OnException(messages, parameters, exitCode, caughtException), cancellationToken);
if (caughtException != null || ffmpegProcess.ExitCode != 0)
{
    OnException(messages, parameters, ffmpegProcess.ExitCode, caughtException);
}

The lamba expression gets passed to ProcessExtension.WaitForExitAsync(), which does:

if (process.ExitCode != 0)
    onException?.Invoke(process.ExitCode);

If the exit code is non-zero:

  1. The lambda expression passed to WaitForExitAsync will call OnException.
  2. The if statement will also call OnException

Unfortunately I am not familiar with XUnit. I played around with it for a while but didn't get anywhere. Running the FFmpeg.NET.Tests project just flashes a command window and exits. Google results say to run xunit.console, but that exe doesn't seem to be installed anywhere. Can you point me at a source of information about how to write and run tests?

@cmxl cmxl merged commit d342b74 into cmxl:master Apr 28, 2019
@cmxl
Copy link
Owner

cmxl commented Apr 28, 2019

dotnet sdk includes the xunit testrunner by default.
you could also run those tests via cmd -> dotnet test FFmpeg.NET.Tests.csproj

Edit:
This could help you @dm413: #18

cmxl added a commit that referenced this pull request Apr 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wip Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants