[Freeswitch-users] Problem with fs_encode

Anthony Minessale anthony.minessale at gmail.com
Fri Jun 23 23:03:27 UTC 2017


Also does removing just that change in switch_core_file.c from latest
version actually make it work?  It seems unlikely the next line in the file
looking for FPS field is no different really.




On Fri, Jun 23, 2017 at 6:01 PM, Michael Jerris <mike at jerris.com> wrote:

> can you drop a core file and see where its stuck?
>
> On Jun 23, 2017, at 6:57 PM, Guillermo Ruiz Camauer <grcamauer at gmail.com>
> wrote:
>
> I have created a small utility program based on fs_encode which will take
> ALL files in a directory and convert them from .WAV to .G729 and .PCMU
> formats.  The utility is called wavBatchEncode and takes just a directory
> path as an argument.
>
> This program was working very well until I upgraded FreeSwitch. Now the
> program seems to hang when it tries to write out the first converted
> files.  I have to KILL the program from another terminal.  It leaves 2 0
> byte files with .PCMU and .G729 extension.
>
>  I have run through a GIT bisect to find where things broke.  The last
> working version is Version 1.6.16 git ae1cdce 2017-04-11.
> The first broken version is 38621e47bad3b63f03a0a27f6ca9ed92f6969032.
>
> I then used GIT DIFF to see if I could see what had happened.  There are
> very few modifications between these two commits:
>
> root at fs3:/usr/src/freeswitch.git# git diff ae1cdce
> 38621e47bad3b63f03a0a27f6ca9ed92f6969032
> diff --git a/src/include/switch_module_interfaces.h
> b/src/include/switch_module_interfaces.h
> index e0a5c20..7ca027d 100644
> --- a/src/include/switch_module_interfaces.h
> +++ b/src/include/switch_module_interfaces.h
> @@ -329,6 +329,11 @@ typedef struct switch_mm_s {
>         switch_video_profile_t vprofile;
>         switch_video_encode_speed_t vencspd;
>         uint8_t try_hardware_encoder;
> +       int scale_w;
> +       int scale_h;
> +       switch_img_fmt_t fmt;
> +       char *auth_username;
> +       char *auth_password;
>  } switch_mm_t;
>
>  /*! an abstract representation of a file handle (some parameters based on
> compat with libsndfile) */
> diff --git a/src/mod/applications/mod_av/avformat.c
> b/src/mod/applications/mod_av/avformat.c
> index b944625..4b92801 100644
> --- a/src/mod/applications/mod_av/avformat.c
> +++ b/src/mod/applications/mod_av/avformat.c
> @@ -906,7 +906,7 @@ SWITCH_STANDARD_APP(record_av_function)
>                 char codec_str[256];
>                 const AVCodecDescriptor *desc;
>
> -               if (!strncmp(data, "rtmp://", 7)) {
> +               if (!strncmp(data, "rtmp://", 7) || !strncmp(data,
> "rtsp://", 7)) {
>                         fmt->video_codec = AV_CODEC_ID_H264;
>                         fmt->audio_codec = AV_CODEC_ID_AAC;
>                 }
> @@ -1694,9 +1694,20 @@ static switch_status_t av_file_open(switch_file_handle_t
> *handle, const char *pa
>                 return SWITCH_STATUS_GENERR;
>         } else if (handle->stream_name && (!strcasecmp(handle->stream_name,
> "rtmp") || !strcasecmp(handle->stream_name, "youtube"))) {
>                 format = "flv";
> -               switch_snprintf(file, sizeof(file), "rtmp://%s", path);
> +
> +               // meh really silly format for the user / pass libav.....
> +               if (handle->mm.auth_username && handle->mm.auth_password)
> {
> +                       switch_snprintf(file, sizeof(file), "rtmp://%s
> pubUser=%s pubPasswd=%s flashver=FMLE/3.0", path, handle->mm.auth_username,
> handle->mm.auth_password);
> +               } else {
> +                       switch_snprintf(file, sizeof(file), "rtmp://%s",
> path);
> +               }
> +
> +       } else if (handle->stream_name && !strcasecmp(handle->stream_name,
> "rtsp")) {
> +               format = "rtsp";
> +               switch_snprintf(file, sizeof(file), "rtsp://%s", path);
>         }
>
> +
>         ext++;
>
>         if ((context = (av_file_context_t *)switch_core_alloc(handle->memory_pool,
> sizeof(av_file_context_t))) == 0) {
> @@ -1783,7 +1794,7 @@ static switch_status_t av_file_open(switch_file_handle_t
> *handle, const char *pa
>         if (fmt->video_codec != AV_CODEC_ID_NONE) {
>                 const AVCodecDescriptor *desc;
>
> -               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, "rtsp") ||
> !strcasecmp(handle->stream_name, "youtube")))) {
>
>                         if (fmt->video_codec != AV_CODEC_ID_H264 ) {
>                                 fmt->video_codec = AV_CODEC_ID_H264; //
> force H264
> @@ -2525,6 +2536,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avformat_load)
>
>         supported_formats[i++] = "av";
>         supported_formats[i++] = "rtmp";
> +       supported_formats[i++] = "rtsp";
>         supported_formats[i++] = "mp4";
>         supported_formats[i++] = "m4a";
>         supported_formats[i++] = "mov";
> diff --git a/src/mod/applications/mod_av/mod_av.c
> b/src/mod/applications/mod_av/mod_av.c
> index 3d3bd82..141fcdc 100644
> --- a/src/mod/applications/mod_av/mod_av.c
> +++ b/src/mod/applications/mod_av/mod_av.c
> @@ -93,7 +93,7 @@ int mod_av_lockmgr_cb(void **m, enum AVLockOp op)
>  static void log_callback(void *ptr, int level, const char *fmt, va_list
> vl)
>  {
>         switch_log_level_t switch_level = SWITCH_LOG_DEBUG;
> -
> +       return;
>         /* naggy messages */
>         if (level == AV_LOG_DEBUG || level == AV_LOG_WARNING) return;
>
> diff --git a/src/switch_core_file.c b/src/switch_core_file.c
> index 46ee539..aff9442 100644
> --- a/src/switch_core_file.c
> +++ b/src/switch_core_file.c
> @@ -177,6 +177,14 @@ SWITCH_DECLARE(switch_status_t)
> switch_core_perform_file_open(const char *file,
>                         fh->mm.try_hardware_encoder = switch_true(val);
>                 }
>
> +               if ((val = switch_event_get_header(fh->params,
> "auth_username"))) {
> +                       fh->mm.auth_username =
> switch_core_strdup(fh->memory_pool, val);
> +               }
> +
> +               if ((val = switch_event_get_header(fh->params,
> "auth_password"))) {
> +                       fh->mm.auth_password =
> switch_core_strdup(fh->memory_pool, val);
> +               }
> +
>                 if ((val = switch_event_get_header(fh->params, "fps"))) {
>                         float ftmp = atof(val);
>                         if (ftmp > 0.0f) {
> (END)
>
>
> I believe that it is the changes in switch_core_file.c that break my
> utility program, but I can't be sure.  Just o add some detail, I have a
> Digium TCE400 card in my system which handles the G729 conversion.
>
> I have no idea of what those auth_username and auth_password parameters
> are, but that seems to break things for me.  Any idea of what I can do to
> get things working again?
>
> I have created a PasteBin with the code of my fs_encode derived utility:
> https://pastebin.freeswitch.org/view/a3d64c69  It is pretty short.
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>



-- 
Anthony Minessale II       ♬ @anthmfs  ♬ @FreeSWITCH  ♬

☞ http://freeswitch.org/http://cluecon.com/http://twitter.com/FreeSWITCH
☞ irc.freenode.net #freeswitch ☞ *http://freeswitch.org/g+
<http://freeswitch.org/g+>*

ClueCon Weekly Development Call
☎ sip:888 at conference.freeswitch.org  ☎ +19193869900

https://www.youtube.com/watch?v=9XXgW34t40s
https://www.youtube.com/watch?v=NLaDpGQuZDA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20170623/8f6c0be6/attachment.html>


More information about the FreeSWITCH-users mailing list