Skip to content

Crash connecting to udp endpoints that don't exist #317

@ispysoftware

Description

@ispysoftware

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);
        }
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions