99 lines
3.9 KiB
Diff
99 lines
3.9 KiB
Diff
--- asterisk-driver/chan_oh323.c.orig 2008-03-21 15:06:22.000000000 +0200
|
|
+++ asterisk-driver/chan_oh323.c 2008-03-21 15:17:00.000000000 +0200
|
|
@@ -966,7 +966,7 @@
|
|
|
|
/******************************************************************************/
|
|
|
|
-static struct ast_channel *oh323_request(const char *type, int format, void *data, int *cause);
|
|
+static struct ast_channel *oh323_request(const char *type, const struct ast_codec_pref *formats, void *data, int *cause);
|
|
static int oh323_text(struct ast_channel *c, const char *text);
|
|
static int oh323_call(struct ast_channel *c, char *dest, int timeout);
|
|
static int oh323_hangup(struct ast_channel *c);
|
|
@@ -2425,11 +2425,11 @@
|
|
}
|
|
|
|
/* Check for format changes */
|
|
- if (f->subclass != i->owner->nativeformats) {
|
|
+ if (!(f->subclass & ast_codec_pref_bits(&i->owner->nativeformats))) {
|
|
ast_log(LOG_NOTICE, "%s: Format changed to %s (native %s).\n",
|
|
c->name,
|
|
ast_getformatname(f->subclass),
|
|
- ast_getformatname(c->nativeformats));
|
|
+ ast_codec_pref_dump(buf, sizeof(buf), &c->nativeformats));
|
|
if (ast_set_write_format(c, f->subclass) < 0) {
|
|
ast_mutex_unlock(&oh323_tab_lock);
|
|
return(-1);
|
|
@@ -2830,8 +2830,8 @@
|
|
|
|
/* Set our native format */
|
|
/* XXX: Only one should be selected */
|
|
- tmp->nativeformats = oh323_capability;
|
|
- fmt = oh323_codec_choose(tmp->nativeformats);
|
|
+ ast_codec_pref_append_missing2(&tmp->nativeformats, oh323_capability);
|
|
+ fmt = oh323_codec_choose(ast_codec_pref_index_audio(&tmp->nativeformats, 0));
|
|
/*fmt = ast_best_codec(tmp->nativeformats);*/
|
|
|
|
tmp->writeformat = fmt;
|
|
@@ -2943,23 +2943,16 @@
|
|
* This function limits the number of outbound H.323 calls.
|
|
* Return NULL on error, the pointer to the channel on success.
|
|
*/
|
|
-static struct ast_channel *oh323_request(const char *type, int format, void *data, int *cause)
|
|
+static struct ast_channel *oh323_request(const char *type, const struct ast_codec_pref *formats, void *data, int *cause)
|
|
{
|
|
- int i=0, count, simcount, oldformat;
|
|
+ int i=0, count, simcount;
|
|
struct ast_channel *c;
|
|
char *dest = data;
|
|
+ char tmp[100];
|
|
|
|
if (option_debug)
|
|
ast_log(LOG_DEBUG, "In oh323_request: type=%s, format=%d, data=%s.\n",
|
|
- type, format, (char *)data);
|
|
-
|
|
- /* Check the format requested */
|
|
- oldformat = format;
|
|
- format &= oh323_full_capability;
|
|
- if (!format) {
|
|
- ast_log(LOG_ERROR, "Asked to get a channel of unsupported format '%d'\n", format);
|
|
- return NULL;
|
|
- }
|
|
+ type, ast_codec_pref_bits(formats), (char *)data);
|
|
|
|
ast_mutex_lock(&oh323_tab_lock);
|
|
|
|
@@ -3019,12 +3012,12 @@
|
|
oh323_tab[i]->owner = c;
|
|
|
|
/* Specify our native formats */
|
|
- c->nativeformats = format;
|
|
- c->rawwriteformat = format;
|
|
- c->rawreadformat = format;
|
|
+ memcpy(&c->nativeformats, formats, sizeof(*formats));
|
|
+ c->rawwriteformat =
|
|
+ c->rawreadformat = ast_codec_pref_index_audio(formats, 0);
|
|
if (option_debug)
|
|
ast_log(LOG_DEBUG, "%s: Native format changed to %s.\n",
|
|
- c->name, ast_getformatname(format));
|
|
+ c->name, ast_codec_pref_dump(tmp, sizeof(tmp), formats));
|
|
|
|
ast_mutex_unlock(&oh323_tab_lock);
|
|
return c;
|
|
@@ -3455,7 +3448,7 @@
|
|
ast_log(LOG_DEBUG, "Setting channel '%s' native format to %s!\n",
|
|
oh323_tab[i]->owner->name,
|
|
ast_getformatname(oh323_tab[i]->capability));
|
|
- oh323_tab[i]->owner->nativeformats = oh323_tab[i]->capability;
|
|
+ ast_codec_pref_append_missing2(&oh323_tab[i]->owner->nativeformats, oh323_tab[i]->capability);
|
|
}
|
|
|
|
/* Set environment variables */
|
|
@@ -3528,7 +3521,7 @@
|
|
ast_log(LOG_DEBUG, "Setting channel '%s' native format to %s!\n",
|
|
oh323_tab[i]->owner->name,
|
|
ast_getformatname(oh323_tab[i]->capability));
|
|
- oh323_tab[i]->owner->nativeformats = oh323_tab[i]->capability;
|
|
+ ast_codec_pref_append_missing2(&oh323_tab[i]->owner->nativeformats, oh323_tab[i]->capability);
|
|
if (oh323_tab[i]->tx_smooth) {
|
|
ast_smoother_free(oh323_tab[i]->tx_smooth);
|
|
oh323_tab[i]->tx_smooth = NULL;
|