FFmpeg.AutoGen icon indicating copy to clipboard operation
FFmpeg.AutoGen copied to clipboard

Crash connecting to udp endpoints that don't exist

Open ispysoftware opened this issue 11 months ago • 5 comments

Hello! This throws a fatal abort exception that i can't catch in managed code. Any workarounds? Doesn't fail hard in ffplay or ffmpeg.exe

Wasn't happening on ffmpeg 6

public static bool TestUDP()
{
    ffmpeg.RootPath = @"D:\Projects\UDPTest\ffmpeg";
    ffmpeg.av_log_set_level(ffmpeg.AV_LOG_VERBOSE);
    int timeoutSeconds = 5;
    string url = "udp://127.0.0.1:56000";
    ffmpeg.avformat_network_init();

    AVFormatContext* formatContext = null;
    AVDictionary* options = null;
    bool success = false;

    try
    {
        int timeoutMicroseconds = timeoutSeconds * 1000000;
        int result = ffmpeg.avformat_open_input(&formatContext, url, null, &options); //<-- fatal crash
        success = (result >= 0);
        return success;
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Exception: {ex.Message}");
        return false;
    }
    finally
    {

        if (formatContext != null)
        {
            ffmpeg.avformat_close_input(&formatContext);
        }
    }

}

ispysoftware avatar Feb 25 '25 05:02 ispysoftware

it might be related to https://github.com/BtbN/FFmpeg-Builds/issues/412

edit 2 - doesn't seem to happen on release build so not critical

ispysoftware avatar Feb 25 '25 05:02 ispysoftware

Did you figure out how to prevent the program from crashing when running it in debug mode?

ulig123 avatar Mar 10 '25 14:03 ulig123

@ulig123 no

ispysoftware avatar Mar 10 '25 23:03 ispysoftware

most probably managed/unmanaged threads, they can crash in debug but also in release but less often

Ruslan-B avatar Apr 07 '25 09:04 Ruslan-B

Related ticket

SuRGeoNix avatar Sep 03 '25 21:09 SuRGeoNix