From 7770359e8abd67e220eaca719eedae265f45caae Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Fri, 3 Apr 2020 21:58:30 -0400 Subject: [PATCH] [mod_av] Don't require .ext for streaming rtmp:// and rtsp:// formats --- src/mod/applications/mod_av/avformat.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index d45f584b2d..c979e8cce6 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -1601,11 +1601,11 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa disable_write_buffer = 1; } - if ((ext = strrchr((char *)path, '.')) == 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Format\n"); - return SWITCH_STATUS_GENERR; - } else if (handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "youtube"))) { + if (handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "youtube"))) { format = "flv"; + if ((ext = strrchr((char *)path, '.')) == 0) { + ext = ".flv"; + } // meh really silly format for the user / pass libav..... if (handle->mm.auth_username && handle->mm.auth_password) { @@ -1616,8 +1616,14 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa } else if (handle->stream_name && !strcasecmp(handle->stream_name, "rtsp")) { format = "rtsp"; + if ((ext = strrchr((char *)path, '.')) == 0) { + ext = ".rtsp"; + } switch_snprintf(file, sizeof(file), "rtsp://%s", path); disable_write_buffer = 1; + } else if ((ext = strrchr((char *)path, '.')) == 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Format\n"); + return SWITCH_STATUS_GENERR; }