diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-11-04 14:05:12 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-11-04 14:05:12 +0000 |
commit | 3bacd4082e2d3a2dd5b8b13635df956aa4f415cd (patch) | |
tree | dd3bc244b8a45aacb932109dc8c12d1f21769d55 /channels/chan_skinny.c | |
parent | 1d3ce2ae5f81e30ec0704efe840bc2c9a24c7e8a (diff) |
Expand codec bitfield from 32 bits to 64 bits.
Reviewboard: https://reviewboard.asterisk.org/r/416/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@227580 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_skinny.c')
-rw-r--r-- | channels/chan_skinny.c | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 011db2046..354414e23 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -141,7 +141,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static const char tdesc[] = "Skinny Client Control Protocol (Skinny)"; static const char config[] = "skinny.conf"; -static int default_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW; +static format_t default_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW; static struct ast_codec_pref default_prefs; enum skinny_codecs { @@ -1229,9 +1229,9 @@ struct skinny_subchannel { int instance; \ int group; \ int needdestroy; \ - int confcapability; \ + format_t confcapability; \ struct ast_codec_pref confprefs; \ - int capability; \ + format_t capability; \ struct ast_codec_pref prefs; \ int nonCodecCapability; \ int onhooktime; \ @@ -1309,9 +1309,9 @@ struct skinny_addon { int registered; \ int lastlineinstance; \ int lastcallreference; \ - int confcapability; \ + format_t confcapability; \ struct ast_codec_pref confprefs; \ - int capability; \ + format_t capability; \ int earlyrtp; \ int transfer; \ int callwaiting; \ @@ -1371,7 +1371,7 @@ struct skinnysession { AST_LIST_ENTRY(skinnysession) list; }; -static struct ast_channel *skinny_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause); +static struct ast_channel *skinny_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause); static AST_LIST_HEAD_STATIC(sessions, skinnysession); static int skinny_devicestate(void *data); @@ -2704,7 +2704,7 @@ static enum ast_rtp_glue_result skinny_get_rtp_peer(struct ast_channel *c, struc } -static int skinny_set_rtp_peer(struct ast_channel *c, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, int codecs, int nat_active) +static int skinny_set_rtp_peer(struct ast_channel *c, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, format_t codecs, int nat_active) { struct skinny_subchannel *sub; struct skinny_line *l; @@ -2748,7 +2748,7 @@ static int skinny_set_rtp_peer(struct ast_channel *c, struct ast_rtp_instance *r fmt = ast_codec_pref_getsize(&l->prefs, ast_best_codec(l->capability)); if (skinnydebug) - ast_verb(1, "Setting payloadType to '%d' (%d ms)\n", fmt.bits, fmt.cur_ms); + ast_verb(1, "Setting payloadType to '%s' (%d ms)\n", ast_getformatname(fmt.bits), fmt.cur_ms); req->data.startmedia.conferenceId = htolel(sub->callid); req->data.startmedia.passThruPartyId = htolel(sub->callid); @@ -4021,9 +4021,9 @@ static struct ast_frame *skinny_rtp_read(struct skinny_subchannel *sub) if (ast) { /* We already hold the channel lock */ if (f->frametype == AST_FRAME_VOICE) { - if (f->subclass != ast->nativeformats) { - ast_debug(1, "Oooh, format changed to %d\n", f->subclass); - ast->nativeformats = f->subclass; + if (f->subclass.codec != ast->nativeformats) { + ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(f->subclass.codec)); + ast->nativeformats = f->subclass.codec; ast_set_read_format(ast, ast->readformat); ast_set_write_format(ast, ast->writeformat); } @@ -4054,9 +4054,13 @@ static int skinny_write(struct ast_channel *ast, struct ast_frame *frame) return 0; } } else { - if (!(frame->subclass & ast->nativeformats)) { - ast_log(LOG_WARNING, "Asked to transmit frame type %d, while native formats is %d (read/write = %d/%d)\n", - frame->subclass, ast->nativeformats, ast->readformat, ast->writeformat); + if (!(frame->subclass.codec & ast->nativeformats)) { + char buf[256]; + ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n", + ast_getformatname(frame->subclass.codec), + ast_getformatname_multiple(buf, sizeof(buf), ast->nativeformats), + ast_getformatname(ast->readformat), + ast_getformatname(ast->writeformat)); return -1; } } @@ -4400,8 +4404,12 @@ static struct ast_channel *skinny_new(struct skinny_line *l, int state, const ch // Should throw an error tmp->nativeformats = default_capability; fmt = ast_best_codec(tmp->nativeformats); - if (skinnydebug) - ast_verb(1, "skinny_new: tmp->nativeformats=%d fmt=%d\n", tmp->nativeformats, fmt); + if (skinnydebug) { + char buf[256]; + ast_verb(1, "skinny_new: tmp->nativeformats=%s fmt=%s\n", + ast_getformatname_multiple(buf, sizeof(buf), tmp->nativeformats), + ast_getformatname(fmt)); + } if (sub->rtp) { ast_channel_set_fd(tmp, 0, ast_rtp_instance_fd(sub->rtp, 0)); } @@ -4746,7 +4754,7 @@ static int handle_keypad_button_message(struct skinny_req *req, struct skinnyses ast_log(LOG_WARNING, "Unsupported digit %d\n", digit); } - f.subclass = dgt; + f.subclass.integer = dgt; f.src = "skinny"; @@ -5301,6 +5309,7 @@ static int handle_capabilities_res_message(struct skinny_req *req, struct skinny uint32_t count = 0; int codecs = 0; int i; + char buf[256]; count = letohl(req->data.caps.count); if (count > SKINNY_MAX_CAPABILITIES) { @@ -5319,7 +5328,7 @@ static int handle_capabilities_res_message(struct skinny_req *req, struct skinny } d->capability = d->confcapability & codecs; - ast_verb(0, "Device capability set to '%d'\n", d->capability); + ast_verb(0, "Device capability set to '%s'\n", ast_getformatname_multiple(buf, sizeof(buf), d->capability)); AST_LIST_TRAVERSE(&d->lines, l, list) { ast_mutex_lock(&l->lock); l->capability = l->confcapability & d->capability; @@ -5646,7 +5655,7 @@ static int handle_open_receive_channel_ack_message(struct skinny_req *req, struc fmt = ast_codec_pref_getsize(&l->prefs, ast_best_codec(l->capability)); if (skinnydebug) - ast_verb(1, "Setting payloadType to '%d' (%d ms)\n", fmt.bits, fmt.cur_ms); + ast_verb(1, "Setting payloadType to '%s' (%d ms)\n", ast_getformatname(fmt.bits), fmt.cur_ms); req->data.startmedia.conferenceId = htolel(sub->callid); req->data.startmedia.passThruPartyId = htolel(sub->callid); @@ -6576,9 +6585,9 @@ static int skinny_devicestate(void *data) return get_devicestate(l); } -static struct ast_channel *skinny_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause) +static struct ast_channel *skinny_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause) { - int oldformat; + format_t oldformat; struct skinny_line *l; struct ast_channel *tmpc = NULL; @@ -6588,7 +6597,7 @@ static struct ast_channel *skinny_request(const char *type, int format, const st oldformat = format; if (!(format &= AST_FORMAT_AUDIO_MASK)) { - ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", format); + ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(tmp, sizeof(tmp), format)); return NULL; } |