mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-14 00:24:05 +00:00
chan_pjsip: Fix an assertion for channels that lack formats on creation
ASTERISK-24222 #close Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/4017/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@424333 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -371,7 +371,6 @@ static struct ast_channel *chan_pjsip_new(struct ast_sip_session *session, int s
|
|||||||
{
|
{
|
||||||
struct ast_channel *chan;
|
struct ast_channel *chan;
|
||||||
struct ast_format_cap *caps;
|
struct ast_format_cap *caps;
|
||||||
struct ast_format *fmt;
|
|
||||||
RAII_VAR(struct chan_pjsip_pvt *, pvt, NULL, ao2_cleanup);
|
RAII_VAR(struct chan_pjsip_pvt *, pvt, NULL, ao2_cleanup);
|
||||||
struct ast_sip_channel_pvt *channel;
|
struct ast_sip_channel_pvt *channel;
|
||||||
struct ast_variable *var;
|
struct ast_variable *var;
|
||||||
@@ -418,16 +417,20 @@ static struct ast_channel *chan_pjsip_new(struct ast_sip_session *session, int s
|
|||||||
|
|
||||||
ast_channel_nativeformats_set(chan, caps);
|
ast_channel_nativeformats_set(chan, caps);
|
||||||
|
|
||||||
/*
|
if (!ast_format_cap_empty(caps)) {
|
||||||
* XXX Probably should pick the first audio codec instead
|
/*
|
||||||
* of simply the first codec. The first codec may be video.
|
* XXX Probably should pick the first audio codec instead
|
||||||
*/
|
* of simply the first codec. The first codec may be video.
|
||||||
fmt = ast_format_cap_get_format(caps, 0);
|
*/
|
||||||
ast_channel_set_writeformat(chan, fmt);
|
struct ast_format *fmt = ast_format_cap_get_format(caps, 0);
|
||||||
ast_channel_set_rawwriteformat(chan, fmt);
|
|
||||||
ast_channel_set_readformat(chan, fmt);
|
ast_channel_set_writeformat(chan, fmt);
|
||||||
ast_channel_set_rawreadformat(chan, fmt);
|
ast_channel_set_rawwriteformat(chan, fmt);
|
||||||
ao2_ref(fmt, -1);
|
ast_channel_set_readformat(chan, fmt);
|
||||||
|
ast_channel_set_rawreadformat(chan, fmt);
|
||||||
|
ao2_ref(fmt, -1);
|
||||||
|
}
|
||||||
|
|
||||||
ao2_ref(caps, -1);
|
ao2_ref(caps, -1);
|
||||||
|
|
||||||
if (state == AST_STATE_RING) {
|
if (state == AST_STATE_RING) {
|
||||||
|
Reference in New Issue
Block a user