[asterisk-bugs] [JIRA] (ASTERISK-28019) Crash in ast_format_get_sample_rate when play an audio
Cirillo (JIRA)
noreply at issues.asterisk.org
Thu Aug 30 16:51:54 CDT 2018
[ https://issues.asterisk.org/jira/browse/ASTERISK-28019?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=244664#comment-244664 ]
Cirillo edited comment on ASTERISK-28019 at 8/30/18 4:50 PM:
-------------------------------------------------------------
Joshua,
I created a simple environment that reproduces the crash.
Apparently the error only occurs when I try playback an audio with speech engine created.
Because this I did a simple speech engine (res_speech_mock) to demonstrate the problem.
{code:title=test.conf}
[origmock]
exten => s,1,Answer()
same => n,Set(CHANNEL(hangup_handler_push)=handler-free,s,1(args))
same => n,SpeechCreate(mock)
same => n,Playback(encerrar_aguedarmairtarde)
same => n,Wait(1)
same => n,Hangup()
[destmock]
exten => _1111,1,Answer()
same => n,Wait(${RAND(20,600)})
same => n,Hangup()
[handler-free]
exten => s,1,SpeechDestroy()
same => n,Return()
{code}
{code:title=run.sh}
#!/bin/bash
CONT=1
CALLS=40000000
while [ $CONT -lt $CALLS ]; do
rasterisk -rx "originate Local/1111 at destmock extension s at origmock";
sleep 0.1
echo "CALL $CONT";
let CONT=CONT+1;
done
{code}
{code:title=res_speech_mock.c}
#include "asterisk.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include "asterisk/channel.h"
#include "asterisk/frame.h"
#include "asterisk/dsp.h"
#include "asterisk/module.h"
#include "asterisk/format.h"
#include "asterisk/config.h"
#include "asterisk/speech.h"
#include "asterisk/ast_version.h"
#include <asterisk/format_cache.h>
static const char *MOCK_CFG = "mock_speech.conf";
static struct ast_speech_engine mock_engine;
static struct ast_config* mock_load_asterisk_config(void)
{
struct ast_flags config_flags = { CONFIG_FLAG_WITHCOMMENTS };
return ast_config_load(MOCK_CFG, config_flags);
}
static int mock_create(struct ast_speech *speech, int format)
{
ast_speech_change_state(speech, AST_SPEECH_STATE_NOT_READY);
return 0;
}
static int mock_destroy(struct ast_speech *speech)
{
return 0;
}
static int mock_load_grammar(struct ast_speech *speech, char *grammar_name, char *grammar)
{
return 0;
}
static int mock_unload_grammar(struct ast_speech *speech, char *grammar_name)
{
return 0;
}
static int mock_activate_grammar(struct ast_speech *speech, char *grammar_name)
{
return 0;
}
static int mock_deactivate_grammar(struct ast_speech *speech, char *grammar_name)
{
return 0;
}
static int mock_write(struct ast_speech *speech, void *data, int len)
{
return 0;
}
static int mock_dtmf(struct ast_speech *speech, const char *dtmf)
{
return 0;
}
static int mock_start(struct ast_speech *speech)
{
ast_speech_change_state(speech, AST_SPEECH_STATE_READY);
return 0;
}
static int mock_change(struct ast_speech *speech, char *name, const char *value)
{
return 0;
}
static int mock_change_results_type(struct ast_speech *speech, enum ast_speech_results_type results_type)
{
return 0;
}
static struct ast_speech_result* mock_get(struct ast_speech *speech)
{
return speech->results;
}
static struct ast_speech_engine mock_engine = {
.name = "mock",
.create = mock_create,
.destroy = mock_destroy,
.load = mock_load_grammar,
.unload = mock_unload_grammar,
.activate = mock_activate_grammar,
.deactivate = mock_deactivate_grammar,
.write = mock_write,
.dtmf = mock_dtmf,
.start = mock_start,
.change = mock_change,
.change_results_type = mock_change_results_type,
.get = mock_get,
};
static int load_module(void)
{
ast_log(LOG_NOTICE, "Loading resourse module\n");
mock_engine.formats = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
if (!mock_engine.formats)
{
ast_log(LOG_ERROR, "Failed to alloc media format capabilities\n");
return AST_MODULE_LOAD_FAILURE;
}
ast_format_cap_append(mock_engine.formats, ast_format_slin, 0);
if (ast_speech_register(&mock_engine))
{
ast_log(LOG_ERROR, "Failed to register resource module\n");
return -1;
}
return 0;
}
static int unload_module(void)
{
ast_log(LOG_NOTICE, "Unloading resourse speech\n");
return ast_speech_unregister(mock_engine.name);
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Mock engine");
{code}
was (Author: cirillor at lbv.org.br):
Joshua,
I created a simple environment that reproduces the crash.
Apparently the error only occurs when I try playback an audio with speech engine created.
Because this I did a simple speech engine (res_speech_mock) to demonstrate the problem.
{code:title=test.conf}
[origmock]
exten => s,1,Answer()
same => n,Set(CHANNEL(hangup_handler_push)=handler-free,s,1(args))
same => n,SpeechCreate(mock)
same => n,Playback(message)
same => n,Wait(1)
same => n,Hangup()
[destmock]
exten => _1111,1,Answer()
same => n,Wait(${RAND(20,600)})
same => n,Hangup()
[handler-free]
exten => s,1,SpeechDestroy()
same => n,Return()
{code}
{code:title=run.sh}
#!/bin/bash
CONT=1
CALLS=40000000
while [ $CONT -lt $CALLS ]; do
rasterisk -rx "originate Local/1111 at destmock extension s at origmock";
sleep 0.1
echo "CALL $CONT";
let CONT=CONT+1;
done
{code}
{code:title=res_speech_mock.c}
#include "asterisk.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include "asterisk/channel.h"
#include "asterisk/frame.h"
#include "asterisk/dsp.h"
#include "asterisk/module.h"
#include "asterisk/format.h"
#include "asterisk/config.h"
#include "asterisk/speech.h"
#include "asterisk/ast_version.h"
#include <asterisk/format_cache.h>
static const char *MOCK_CFG = "mock_speech.conf";
static struct ast_speech_engine mock_engine;
static struct ast_config* mock_load_asterisk_config(void)
{
struct ast_flags config_flags = { CONFIG_FLAG_WITHCOMMENTS };
return ast_config_load(MOCK_CFG, config_flags);
}
static int mock_create(struct ast_speech *speech, int format)
{
ast_speech_change_state(speech, AST_SPEECH_STATE_NOT_READY);
return 0;
}
static int mock_destroy(struct ast_speech *speech)
{
return 0;
}
static int mock_load_grammar(struct ast_speech *speech, char *grammar_name, char *grammar)
{
return 0;
}
static int mock_unload_grammar(struct ast_speech *speech, char *grammar_name)
{
return 0;
}
static int mock_activate_grammar(struct ast_speech *speech, char *grammar_name)
{
return 0;
}
static int mock_deactivate_grammar(struct ast_speech *speech, char *grammar_name)
{
return 0;
}
static int mock_write(struct ast_speech *speech, void *data, int len)
{
return 0;
}
static int mock_dtmf(struct ast_speech *speech, const char *dtmf)
{
return 0;
}
static int mock_start(struct ast_speech *speech)
{
ast_speech_change_state(speech, AST_SPEECH_STATE_READY);
return 0;
}
static int mock_change(struct ast_speech *speech, char *name, const char *value)
{
return 0;
}
static int mock_change_results_type(struct ast_speech *speech, enum ast_speech_results_type results_type)
{
return 0;
}
static struct ast_speech_result* mock_get(struct ast_speech *speech)
{
return speech->results;
}
static struct ast_speech_engine mock_engine = {
.name = "mock",
.create = mock_create,
.destroy = mock_destroy,
.load = mock_load_grammar,
.unload = mock_unload_grammar,
.activate = mock_activate_grammar,
.deactivate = mock_deactivate_grammar,
.write = mock_write,
.dtmf = mock_dtmf,
.start = mock_start,
.change = mock_change,
.change_results_type = mock_change_results_type,
.get = mock_get,
};
static int load_module(void)
{
ast_log(LOG_NOTICE, "Loading resourse module\n");
mock_engine.formats = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
if (!mock_engine.formats)
{
ast_log(LOG_ERROR, "Failed to alloc media format capabilities\n");
return AST_MODULE_LOAD_FAILURE;
}
ast_format_cap_append(mock_engine.formats, ast_format_slin, 0);
if (ast_speech_register(&mock_engine))
{
ast_log(LOG_ERROR, "Failed to register resource module\n");
return -1;
}
return 0;
}
static int unload_module(void)
{
ast_log(LOG_NOTICE, "Unloading resourse speech\n");
return ast_speech_unregister(mock_engine.name);
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Mock engine");
{code}
> Crash in ast_format_get_sample_rate when play an audio
> ------------------------------------------------------
>
> Key: ASTERISK-28019
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-28019
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Applications/app_playback
> Affects Versions: 13.22.0
> Environment: > cat /proc/version
> Linux version 3.10.0-693.2.2.el7.x86_64 (builder at kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Sep 12 22:26:13 UTC 2017
> > rasterisk -V
> Asterisk 13.22.0
> Reporter: Cirillo
> Assignee: Unassigned
> Severity: Minor
> Labels: pjsip
> Attachments: core.ANTIBES-2018-08-21T09-02-21-0300-brief.txt, core.ANTIBES-2018-08-21T09-02-21-0300-full.txt, core.ANTIBES-2018-08-21T09-02-21-0300-locks.txt, core.ANTIBES-2018-08-21T09-02-21-0300-thread1.txt, encerrar_aguedarmairtarde.wav, full
>
>
> Asterisk crashed in ast_format_get_sample_rate when try play an audio.
> I already tried use SLIN, GSM, G711 (A-law and mu-law) codecs and in all cases the crash occurs.
> Dialplan:
> (...)
> same => n,Playback(./pt_BR/altrium/felicitacao/encerrar_aguedarmairtarde)
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list