More ticket #876:
- fixed crash when null-audio is used with switchboard git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2742 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
23ea21a50c
commit
d65f78cf1f
|
@ -597,6 +597,10 @@ PJ_DEF(pj_status_t) pjmedia_aud_stream_create(const pjmedia_aud_param *prm,
|
|||
|
||||
PJ_ASSERT_RETURN(prm && prm->dir && p_aud_strm, PJ_EINVAL);
|
||||
PJ_ASSERT_RETURN(aud_subsys.pf, PJMEDIA_EAUD_INIT);
|
||||
PJ_ASSERT_RETURN(prm->dir==PJMEDIA_DIR_CAPTURE ||
|
||||
prm->dir==PJMEDIA_DIR_PLAYBACK ||
|
||||
prm->dir==PJMEDIA_DIR_CAPTURE_PLAYBACK,
|
||||
PJ_EINVAL);
|
||||
|
||||
/* Must make copy of param because we're changing device ID */
|
||||
pj_memcpy(¶m, prm, sizeof(param));
|
||||
|
@ -631,6 +635,8 @@ PJ_DEF(pj_status_t) pjmedia_aud_stream_create(const pjmedia_aud_param *prm,
|
|||
f = play_f;
|
||||
}
|
||||
|
||||
PJ_ASSERT_RETURN(f != NULL, PJ_EBUG);
|
||||
|
||||
/* For now, rec_id and play_id must belong to the same factory */
|
||||
PJ_ASSERT_RETURN((param.dir != PJMEDIA_DIR_CAPTURE_PLAYBACK) ||
|
||||
(rec_f == play_f),
|
||||
|
|
|
@ -1720,26 +1720,39 @@ PJ_DEF(pj_status_t) pjsua_conf_connect( pjsua_conf_port_id source,
|
|||
}
|
||||
|
||||
if (need_reopen) {
|
||||
pjmedia_aud_param param;
|
||||
if (pjsua_var.cap_dev != NULL_SND_DEV_ID) {
|
||||
pjmedia_aud_param param;
|
||||
|
||||
/* Create parameter based on peer info */
|
||||
status = create_aud_param(¶m, pjsua_var.cap_dev,
|
||||
pjsua_var.play_dev,
|
||||
peer_info.clock_rate,
|
||||
peer_info.channel_count,
|
||||
peer_info.samples_per_frame,
|
||||
peer_info.bits_per_sample);
|
||||
/* Create parameter based on peer info */
|
||||
status = create_aud_param(¶m, pjsua_var.cap_dev,
|
||||
pjsua_var.play_dev,
|
||||
peer_info.clock_rate,
|
||||
peer_info.channel_count,
|
||||
peer_info.samples_per_frame,
|
||||
peer_info.bits_per_sample);
|
||||
if (status != PJ_SUCCESS) {
|
||||
pjsua_perror(THIS_FILE, "Error opening sound device", status);
|
||||
return status;
|
||||
}
|
||||
|
||||
/* And peer format */
|
||||
if (peer_info.format.id != PJMEDIA_FORMAT_PCM) {
|
||||
param.flags |= PJMEDIA_AUD_DEV_CAP_EXT_FORMAT;
|
||||
param.ext_fmt = peer_info.format;
|
||||
}
|
||||
/* And peer format */
|
||||
if (peer_info.format.id != PJMEDIA_FORMAT_PCM) {
|
||||
param.flags |= PJMEDIA_AUD_DEV_CAP_EXT_FORMAT;
|
||||
param.ext_fmt = peer_info.format;
|
||||
}
|
||||
|
||||
status = open_snd_dev(¶m);
|
||||
if (status != PJ_SUCCESS) {
|
||||
pjsua_perror(THIS_FILE, "Error opening sound device", status);
|
||||
return status;
|
||||
status = open_snd_dev(¶m);
|
||||
if (status != PJ_SUCCESS) {
|
||||
pjsua_perror(THIS_FILE, "Error opening sound device", status);
|
||||
return status;
|
||||
}
|
||||
} else {
|
||||
/* Null-audio */
|
||||
status = pjsua_set_snd_dev(pjsua_var.cap_dev, pjsua_var.play_dev);
|
||||
if (status != PJ_SUCCESS) {
|
||||
pjsua_perror(THIS_FILE, "Error opening sound device", status);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue