[svn-commits] oej: branch oej/pinefrog-1.4 r252227 - in /team/oej/pinefrog-1.4: ./ channels...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Sat Mar 13 02:51:32 CST 2010
Author: oej
Date: Sat Mar 13 02:51:27 2010
New Revision: 252227
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=252227
Log:
Resetting branch, fixing some typos in new code
Modified:
team/oej/pinefrog-1.4/ (props changed)
team/oej/pinefrog-1.4/channels/chan_h323.c
team/oej/pinefrog-1.4/channels/chan_mgcp.c
team/oej/pinefrog-1.4/channels/chan_sip.c
team/oej/pinefrog-1.4/channels/chan_skinny.c
team/oej/pinefrog-1.4/configs/sip.conf.sample
team/oej/pinefrog-1.4/include/asterisk/frame.h
team/oej/pinefrog-1.4/include/asterisk/rtp.h
team/oej/pinefrog-1.4/main/channel.c
team/oej/pinefrog-1.4/main/rtp.c
Propchange: team/oej/pinefrog-1.4/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Mar 13 02:51:27 2010
@@ -1,1 +1,1 @@
-/branches/1.4:1-252036
+/branches/1.4:1-252225
Modified: team/oej/pinefrog-1.4/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinefrog-1.4/channels/chan_h323.c?view=diff&rev=252227&r1=252226&r2=252227
==============================================================================
--- team/oej/pinefrog-1.4/channels/chan_h323.c (original)
+++ team/oej/pinefrog-1.4/channels/chan_h323.c Sat Mar 13 02:51:27 2010
@@ -918,7 +918,11 @@
res = 0;
break;
case AST_CONTROL_SRCUPDATE:
- ast_rtp_new_source(pvt->rtp);
+ ast_rtp_update_source(pvt->rtp);
+ res = 0;
+ break;
+ case AST_CONTROL_SRCCHANGE:
+ ast_rtp_change_source(pvt->rtp);
res = 0;
break;
case AST_CONTROL_PROCEEDING:
Modified: team/oej/pinefrog-1.4/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinefrog-1.4/channels/chan_mgcp.c?view=diff&rev=252227&r1=252226&r2=252227
==============================================================================
--- team/oej/pinefrog-1.4/channels/chan_mgcp.c (original)
+++ team/oej/pinefrog-1.4/channels/chan_mgcp.c Sat Mar 13 02:51:27 2010
@@ -1442,7 +1442,10 @@
ast_moh_stop(ast);
break;
case AST_CONTROL_SRCUPDATE:
- ast_rtp_new_source(sub->rtp);
+ ast_rtp_update_source(sub->rtp);
+ break;
+ case AST_CONTROL_SRCCHANGE:
+ ast_rtp_change_source(sub->rtp);
break;
case -1:
transmit_notify_request(sub, "");
Modified: team/oej/pinefrog-1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinefrog-1.4/channels/chan_sip.c?view=diff&rev=252227&r1=252226&r2=252227
==============================================================================
--- team/oej/pinefrog-1.4/channels/chan_sip.c (original)
+++ team/oej/pinefrog-1.4/channels/chan_sip.c Sat Mar 13 02:51:27 2010
@@ -813,12 +813,11 @@
#define SIP_PAGE2_UDPTL_DESTINATION (1 << 28) /*!< 28: Use source IP of RTP as destination if NAT is enabled */
#define SIP_PAGE2_DIALOG_ESTABLISHED (1 << 29) /*!< 29: Has a dialog been established? */
#define SIP_PAGE2_RPORT_PRESENT (1 << 30) /*!< 30: Was rport received in the Via header? */
-#define SIP_PAGE2_CONSTANT_SSRC (1 << 31) /*!< 31: Don't change SSRC on reinvite */
#define SIP_PAGE2_FLAGS_TO_COPY \
(SIP_PAGE2_ALLOWSUBSCRIBE | SIP_PAGE2_ALLOWOVERLAP | SIP_PAGE2_VIDEOSUPPORT | \
SIP_PAGE2_T38SUPPORT | SIP_PAGE2_RFC2833_COMPENSATE | SIP_PAGE2_BUGGY_MWI | \
- SIP_PAGE2_UDPTL_DESTINATION | SIP_PAGE2_CONSTANT_SSRC)
+ SIP_PAGE2_UDPTL_DESTINATION)
/* SIP packet flags */
#define SIP_PKT_DEBUG (1 << 0) /*!< Debug this packet */
@@ -1052,7 +1051,8 @@
struct sip_invite_param *options; /*!< Options for INVITE */
int autoframing;
int hangupcause; /*!< Storage of hangupcause copied from our owner before we disconnect from the AST channel (only used at hangup) */
- struct ast_rtp_quality *qual; /*!< The latest quality report, for realtime storage */
+ struct ast_rtp_quality *audioqual; /*!< Audio: The latest quality report, for realtime storage */
+ struct ast_rtp_quality *videoqual; /*!< Video: The latest quality report, for realtime storage */
/*! When receiving an SDP offer, it is important to take note of what media types were offered.
* By doing this, even if we don't want to answer a particular media stream with something meaningful, we can
* still put an m= line in our answer with the port set to 0.
@@ -1376,6 +1376,7 @@
static int send_rtcp_events(const void *data);
static void start_rtcp_events(struct sip_pvt *dialog);
static void stop_media_flows(struct sip_pvt *p);
+static void qos_write_realtime(struct sip_pvt *dialog, struct ast_rtp_quality *qual);
/*--- Authentication stuff */
static int reply_digest(struct sip_pvt *p, struct sip_request *req, char *header, int sipmethod, char *digest, int digest_len);
@@ -2604,12 +2605,6 @@
if (option_debug > 2)
ast_log(LOG_DEBUG, "Destroying SIP peer %s\n", peer->name);
- if (peer->qual) {
- /* We have a quality report to write to realtime before we leave this world. */
- qos_write_realtime(peer->qual);
- free(peer->qual);
- peer->qual = NULL;
- }
/* Delete it, it needs to disappear */
if (peer->call) {
@@ -2967,9 +2962,6 @@
ast_rtp_set_rtptimeout(dialog->rtp, peer->rtptimeout);
ast_rtp_set_rtpholdtimeout(dialog->rtp, peer->rtpholdtimeout);
ast_rtp_set_rtpkeepalive(dialog->rtp, peer->rtpkeepalive);
- if (ast_test_flag(&dialog->flags[1], SIP_PAGE2_CONSTANT_SSRC)) {
- ast_rtp_set_constantssrc(dialog->rtp);
- }
/* Set Frame packetization */
ast_rtp_codec_setpref(dialog->rtp, &dialog->prefs);
dialog->autoframing = peer->autoframing;
@@ -2980,9 +2972,6 @@
ast_rtp_set_rtptimeout(dialog->vrtp, peer->rtptimeout);
ast_rtp_set_rtpholdtimeout(dialog->vrtp, peer->rtpholdtimeout);
ast_rtp_set_rtpkeepalive(dialog->vrtp, peer->rtpkeepalive);
- if (ast_test_flag(&dialog->flags[1], SIP_PAGE2_CONSTANT_SSRC)) {
- ast_rtp_set_constantssrc(dialog->vrtp);
- }
}
ast_string_field_set(dialog, peername, peer->name);
@@ -3305,6 +3294,19 @@
if (dumphistory)
sip_dump_history(p);
+
+ if (p->audioqual) {
+ /* We have a quality report to write to realtime before we leave this world. */
+ qos_write_realtime(p, p->audioqual);
+ free(p->audioqual);
+ p->audioqual = NULL;
+ }
+ if (p->videoqual) {
+ /* We have a quality report to write to realtime before we leave this world. */
+ qos_write_realtime(p, p->videoqual);
+ free(p->videoqual);
+ p->videoqual = NULL;
+ }
if (p->options)
free(p->options);
@@ -3888,6 +3890,7 @@
if (option_debug)
ast_log(LOG_DEBUG, "SIP answering channel: %s\n", ast->name);
+ ast_rtp_update_source(p->rtp);
res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL);
ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
start_rtcp_events(p);
@@ -3923,7 +3926,7 @@
if ((ast->_state != AST_STATE_UP) &&
!ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) &&
!ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
- ast_rtp_new_source(p->rtp);
+ ast_rtp_update_source(p->rtp);
if (!global_prematuremediafilter) {
p->invitestate = INV_EARLY_MEDIA;
transmit_provisional_response(p, "183 Session Progress", &p->initreq, 1);
@@ -4171,11 +4174,11 @@
res = -1;
break;
case AST_CONTROL_HOLD:
- ast_rtp_new_source(p->rtp);
+ ast_rtp_update_source(p->rtp);
ast_moh_start(ast, data, p->mohinterpret);
break;
case AST_CONTROL_UNHOLD:
- ast_rtp_new_source(p->rtp);
+ ast_rtp_update_source(p->rtp);
ast_moh_stop(ast);
break;
case AST_CONTROL_VIDUPDATE: /* Request a video frame update */
@@ -4186,7 +4189,10 @@
res = -1;
break;
case AST_CONTROL_SRCUPDATE:
- ast_rtp_new_source(p->rtp);
+ ast_rtp_update_source(p->rtp);
+ break;
+ case AST_CONTROL_SRCCHANGE:
+ ast_rtp_change_source(p->rtp);
break;
case -1:
res = -1;
@@ -13453,7 +13459,6 @@
{
struct ast_rtp_quality qual;
char *rtpqstring = NULL;
- char localjitter[10], remotejitter[10];
int qosrealtime = ast_check_realtime("rtpqos");
unsigned int duration; /* Duration in secs */
int readtrans = FALSE, writetrans = FALSE;
@@ -13477,11 +13482,11 @@
be great!
*/
if (option_debug) {
- if (readtrans && p->owner->readtrans->translator) {
- ast_log(LOG_DEBUG, "--- Read translator: %s Cost %d\n", p->owner->readtrans->translator->name, p->owner->readtrans->translator->cost);
+ if (readtrans && p->owner->readtrans->t) {
+ ast_log(LOG_DEBUG, "--- Read translator: %s Cost %d\n", p->owner->readtrans->t->name, p->owner->readtrans->t->cost);
}
- if (writetrans && p->owner->writetrans->translator) {
- ast_log(LOG_DEBUG, "--- Write translator: %s \n", p->owner->writetrans->translator->name, p->owner->writetrans->translator->cost);
+ if (writetrans && p->owner->writetrans->t) {
+ ast_log(LOG_DEBUG, "--- Write translator: %s Cost %d\n", p->owner->writetrans->t->name, p->owner->writetrans->t->cost);
}
}
}
@@ -13561,15 +13566,22 @@
monitor thread instead.
*/
if (reporttype == 1 && qosrealtime) {
- p->qual = ast_calloc(sizeof(struct ast_rtp_quality), 1)
- p->qual = qual;
- p->qual->end = ast_tvnow();
+ if (mediatype[0] == 'a') { /* Audio */
+ p->audioqual = ast_calloc(sizeof(struct ast_rtp_quality), 1);
+ (* p->audioqual) = qual;
+ p->audioqual->end = ast_tvnow();
+ } else if (mediatype[0] == 'v') { /* Video */
+ p->videoqual = ast_calloc(sizeof(struct ast_rtp_quality), 1);
+ (* p->videoqual) = qual;
+ p->videoqual->end = ast_tvnow();
+ }
}
}
/*! \brief Write quality report to realtime storage */
-void qos_write_realtime(struct ast_rtp_quality *qual)
-{
+void qos_write_realtime(struct sip_pvt *dialog, struct ast_rtp_quality *qual)
+{
+#ifdef REALTIME2
unsigned int duration; /* Duration in secs */
char buf_duration[10], buf_lssrc[30], buf_rssrc[30], buf_rtt[30];
char localjitter[10], remotejitter[10];
@@ -13587,13 +13599,13 @@
sprintf(buf_lssrc, "%u", qual->local_ssrc);
sprintf(buf_rssrc, "%u", qual->remote_ssrc);
sprintf(buf_rtt, "%f", qual->rtt);
- sprintf(buf_duration, "%ld", duration);
+ sprintf(buf_duration, "%u", duration);
ast_store_realtime("rtpqos",
- "channel", p->owner ? p->owner->name : "",
- "uniqueid", p->owner ? p->owner->uniqueid : "",
+ "channel", dialog->owner ? dialog->owner->name : "",
+ "uniqueid", dialog->owner ? dialog->owner->uniqueid : "",
"bridgedchan", qual->bridgedchan[0] ? qual->bridgedchan : "" ,
"bridgeduniqueid", qual->bridgeduniqueid[0] ? qual->bridgeduniqueid : "",
- "pvtcallid", p->callid,
+ "pvtcallid", dialog->callid,
"rtpmedia", mediatype,
"localssrc", buf_lssrc, "remotessrc", buf_rssrc,
"rtt", buf_rtt,
@@ -13604,6 +13616,7 @@
"duration", buf_duration,
NULL);
}
+#endif
}
/*! \brief Send RTCP manager events */
@@ -15311,14 +15324,6 @@
res = -1;
goto request_invite_cleanup;
}
- if (ast_test_flag(&p->flags[1], SIP_PAGE2_CONSTANT_SSRC)) {
- if (p->rtp) {
- ast_rtp_set_constantssrc(p->rtp);
- }
- if (p->vrtp) {
- ast_rtp_set_constantssrc(p->vrtp);
- }
- }
} else { /* No SDP in invite, call control session */
p->jointcapability = p->capability;
if (option_debug > 1)
@@ -17801,9 +17806,6 @@
} else if (!strcasecmp(v->name, "t38pt_usertpsource")) {
ast_set_flag(&mask[1], SIP_PAGE2_UDPTL_DESTINATION);
ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_UDPTL_DESTINATION);
- } else if (!strcasecmp(v->name, "constantssrc")) {
- ast_set_flag(&mask[1], SIP_PAGE2_CONSTANT_SSRC);
- ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_CONSTANT_SSRC);
} else
res = 0;
@@ -18886,8 +18888,6 @@
default_maxcallbitrate = DEFAULT_MAX_CALL_BITRATE;
} else if (!strcasecmp(v->name, "matchexterniplocally")) {
global_matchexterniplocally = ast_true(v->value);
- } else if (!strcasecmp(v->name, "constantssrc")) {
- ast_set2_flag(&global_flags[1], ast_true(v->value), SIP_PAGE2_CONSTANT_SSRC);
} else if (!strcasecmp(v->name, "shrinkcallerid")) {
if (ast_true(v->value)) {
global_shrinkcallerid = 1;
Modified: team/oej/pinefrog-1.4/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinefrog-1.4/channels/chan_skinny.c?view=diff&rev=252227&r1=252226&r2=252227
==============================================================================
--- team/oej/pinefrog-1.4/channels/chan_skinny.c (original)
+++ team/oej/pinefrog-1.4/channels/chan_skinny.c Sat Mar 13 02:51:27 2010
@@ -2868,7 +2868,10 @@
case AST_CONTROL_PROCEEDING:
break;
case AST_CONTROL_SRCUPDATE:
- ast_rtp_new_source(sub->rtp);
+ ast_rtp_update_source(sub->rtp);
+ break;
+ case AST_CONTROL_SRCCHANGE:
+ ast_rtp_change_source(sub->rtp);
break;
default:
ast_log(LOG_WARNING, "Don't know how to indicate condition %d\n", ind);
Modified: team/oej/pinefrog-1.4/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinefrog-1.4/configs/sip.conf.sample?view=diff&rev=252227&r1=252226&r2=252227
==============================================================================
--- team/oej/pinefrog-1.4/configs/sip.conf.sample (original)
+++ team/oej/pinefrog-1.4/configs/sip.conf.sample Sat Mar 13 02:51:27 2010
@@ -387,8 +387,6 @@
;canreinvite=update ; Yet a third option... use UPDATE for media path redirection,
; instead of INVITE. This can be combined with 'nonat', as
; 'canreinvite=update,nonat'. It implies 'yes'.
-
-;constantssrc=yes ; Don't change the RTP SSRC when our media stream changes
;----------------------------------------- REALTIME SUPPORT ------------------------
; For additional information on ARA, the Asterisk Realtime Architecture,
@@ -549,7 +547,6 @@
; maxcallbitrate maxcallbitrate
; rfc2833compensate mailbox
; t38pt_usertpsource username
-; constantssrc template
; fromdomain
; regexten
; fromuser
@@ -562,7 +559,6 @@
; sendrpid
; outboundproxy
; rfc2833compensate
-; constantssrc
; t38pt_usertpsource
; contactpermit ; Limit what a host may register as (a neat trick
; contactdeny ; is to register at the same IP as a SIP provider,
Modified: team/oej/pinefrog-1.4/include/asterisk/frame.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinefrog-1.4/include/asterisk/frame.h?view=diff&rev=252227&r1=252226&r2=252227
==============================================================================
--- team/oej/pinefrog-1.4/include/asterisk/frame.h (original)
+++ team/oej/pinefrog-1.4/include/asterisk/frame.h Sat Mar 13 02:51:27 2010
@@ -85,7 +85,8 @@
\arg \b HOLD Call is placed on hold
\arg \b UNHOLD Call is back from hold
\arg \b VIDUPDATE Video update requested
- \arg \b SRCUPDATE The source of media has changed
+ \arg \b SRCUPDATE The source of media has changed (RTP marker bit must change)
+ \arg \b SRCCHANGE Media source has changed (RTP marker bit and SSRC must change)
*/
@@ -290,6 +291,7 @@
AST_CONTROL_UNHOLD = 17, /*!< Indicate call is left from hold */
AST_CONTROL_VIDUPDATE = 18, /*!< Indicate video frame update */
AST_CONTROL_SRCUPDATE = 20, /*!< Indicate source of media has changed */
+ AST_CONTROL_SRCCHANGE = 21, /*!< Media has changed and requires a new RTP SSRC */
};
#define AST_SMOOTHER_FLAG_G729 (1 << 0)
Modified: team/oej/pinefrog-1.4/include/asterisk/rtp.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinefrog-1.4/include/asterisk/rtp.h?view=diff&rev=252227&r1=252226&r2=252227
==============================================================================
--- team/oej/pinefrog-1.4/include/asterisk/rtp.h (original)
+++ team/oej/pinefrog-1.4/include/asterisk/rtp.h Sat Mar 13 02:51:27 2010
@@ -213,16 +213,17 @@
adds processing and latency to the bridged call.
*/
void ast_rtcp_set_translation(struct ast_rtp *rtp, const char *writetranslator, const int writecost,
- const char *readtranslator, cost int readcost);
-
-
-
-
+ const char *readtranslator, const int readcost);
/*! \brief When changing sources, don't generate a new SSRC */
void ast_rtp_set_constantssrc(struct ast_rtp *rtp);
-void ast_rtp_new_source(struct ast_rtp *rtp);
+/*! \brief Indicate that we need to set the marker bit */
+void ast_rtp_update_source(struct ast_rtp *rtp);
+
+
+/*! \brief Indicate that we need to set the marker bit and change the ssrc */
+void ast_rtp_change_source(struct ast_rtp *rtp);
/*! \brief Setting RTP payload types from lines in a SDP description: */
void ast_rtp_pt_clear(struct ast_rtp* rtp);
Modified: team/oej/pinefrog-1.4/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinefrog-1.4/main/channel.c?view=diff&rev=252227&r1=252226&r2=252227
==============================================================================
--- team/oej/pinefrog-1.4/main/channel.c (original)
+++ team/oej/pinefrog-1.4/main/channel.c Sat Mar 13 02:51:27 2010
@@ -1990,6 +1990,7 @@
case AST_CONTROL_RINGING:
case AST_CONTROL_ANSWER:
case AST_CONTROL_SRCUPDATE:
+ case AST_CONTROL_SRCCHANGE:
/* Unimportant */
break;
default:
@@ -2589,6 +2590,7 @@
case AST_CONTROL_PROCEEDING:
case AST_CONTROL_VIDUPDATE:
case AST_CONTROL_SRCUPDATE:
+ case AST_CONTROL_SRCCHANGE:
case AST_CONTROL_RADIO_KEY:
case AST_CONTROL_RADIO_UNKEY:
case AST_CONTROL_OPTION:
@@ -2681,6 +2683,7 @@
case AST_CONTROL_PROCEEDING:
case AST_CONTROL_VIDUPDATE:
case AST_CONTROL_SRCUPDATE:
+ case AST_CONTROL_SRCCHANGE:
case AST_CONTROL_RADIO_KEY:
case AST_CONTROL_RADIO_UNKEY:
case AST_CONTROL_OPTION:
@@ -3385,6 +3388,7 @@
case AST_CONTROL_UNHOLD:
case AST_CONTROL_VIDUPDATE:
case AST_CONTROL_SRCUPDATE:
+ case AST_CONTROL_SRCCHANGE:
case -1: /* Ignore -- just stopping indications */
break;
@@ -4334,6 +4338,7 @@
case AST_CONTROL_UNHOLD:
case AST_CONTROL_VIDUPDATE:
case AST_CONTROL_SRCUPDATE:
+ case AST_CONTROL_SRCCHANGE:
ast_indicate_data(other, f->subclass, f->data, f->datalen);
if (jb_in_use) {
ast_jb_empty_and_reset(c0, c1);
Modified: team/oej/pinefrog-1.4/main/rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinefrog-1.4/main/rtp.c?view=diff&rev=252227&r1=252226&r2=252227
==============================================================================
--- team/oej/pinefrog-1.4/main/rtp.c (original)
+++ team/oej/pinefrog-1.4/main/rtp.c Sat Mar 13 02:51:27 2010
@@ -196,7 +196,6 @@
struct ast_codec_pref pref;
struct ast_rtp *bridged; /*!< Who we are Packet bridged to */
int set_marker_bit:1; /*!< Whether to set the marker bit or not */
- unsigned int constantssrc:1;
int isactive:2; /*!< Whether the RTP stream is active or not */
};
@@ -1459,6 +1458,7 @@
unsigned int *rtpheader;
struct rtpPayloadType rtpPT;
struct ast_rtp *bridged = NULL;
+ AST_LIST_HEAD_NOLOCK(, ast_frame) frames;
/* If time is up, kill it */
if (rtp->sending_digit)
@@ -1481,7 +1481,7 @@
}
if (res < hdrlen) {
- ast_log(LOG_WARNING, "RTP Read too short\n");
+ ast_log(LOG_WARNING, "RTP Read too short (%d, expecting %d)\n", res, hdrlen);
return &ast_null_frame;
}
@@ -1527,9 +1527,19 @@
ssrc = ntohl(rtpheader[2]);
if (!mark && rtp->rxssrc && rtp->rxssrc != ssrc) {
- if (option_debug || rtpdebug)
- ast_log(LOG_DEBUG, "Forcing Marker bit, because SSRC has changed\n");
- mark = 1;
+ struct ast_frame *f, srcupdate = {
+ AST_FRAME_CONTROL,
+ .subclass = AST_CONTROL_SRCCHANGE,
+ };
+
+ if (!mark) {
+ if (option_debug || rtpdebug) {
+ ast_log(LOG_DEBUG, "Forcing Marker bit, because SSRC has changed\n");
+ }
+ mark = 1;
+ }
+ f = ast_frisolate(&srcupdate);
+ AST_LIST_INSERT_TAIL(&frames, f, frame_list);
}
rtp->rxssrc = ssrc;
@@ -1542,7 +1552,7 @@
if (res < hdrlen) {
ast_log(LOG_WARNING, "RTP Read too short (%d, expecting %d)\n", res, hdrlen);
- return &ast_null_frame;
+ return AST_LIST_FIRST(&frames) ? AST_LIST_FIRST(&frames) : &ast_null_frame;
}
payloadtype = (seqno & 0x7f0000) >> 16;
padding = seqno & (1 << 29);
@@ -1589,8 +1599,6 @@
hdrlen += 4;
}
-
-
if (rtp_debug_test_addr(&sin))
ast_verbose("Got RTP packet from %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n",
@@ -1631,7 +1639,11 @@
} else {
ast_log(LOG_NOTICE, "Unknown RTP codec %d received from '%s'\n", payloadtype, ast_inet_ntoa(rtp->them.sin_addr));
}
- return f ? f : &ast_null_frame;
+ if (f) {
+ AST_LIST_INSERT_TAIL(&frames, f, frame_list);
+ return AST_LIST_FIRST(&frames);
+ }
+ return &ast_null_frame;
}
rtp->lastrxformat = rtp->f.subclass = rtpPT.code;
rtp->f.frametype = (rtp->f.subclass < AST_FORMAT_MAX_AUDIO) ? AST_FRAME_VOICE : AST_FRAME_VIDEO;
@@ -1647,7 +1659,8 @@
f->len = ast_tvdiff_ms(ast_samp2tv(rtp->dtmf_duration, rtp_get_rate(f->subclass)), ast_tv(0, 0));
rtp->resp = 0;
rtp->dtmf_timeout = rtp->dtmf_duration = 0;
- return f;
+ AST_LIST_INSERT_TAIL(&frames, f, frame_list);
+ return AST_LIST_FIRST(&frames);
}
}
@@ -1680,7 +1693,9 @@
rtp->f.subclass |= 0x1;
}
rtp->f.src = "RTP";
- return &rtp->f;
+
+ AST_LIST_INSERT_TAIL(&frames, &rtp->f, frame_list);
+ return AST_LIST_FIRST(&frames);
}
/* The following array defines the MIME Media type (and subtype) for each
@@ -2393,18 +2408,26 @@
return res;
}
-void ast_rtp_set_constantssrc(struct ast_rtp *rtp)
-{
- rtp->constantssrc = 1;
-}
-
-void ast_rtp_new_source(struct ast_rtp *rtp)
+void ast_rtp_update_source(struct ast_rtp *rtp)
{
if (rtp) {
rtp->set_marker_bit = 1;
- if (!rtp->constantssrc) {
- rtp->ssrc = ast_random();
- }
+ if (option_debug > 2) {
+ ast_log(LOG_DEBUG, "Setting the marker bit due to a source update\n");
+ }
+ }
+}
+
+void ast_rtp_change_source(struct ast_rtp *rtp)
+{
+ if (rtp) {
+ unsigned int ssrc = ast_random();
+
+ rtp->set_marker_bit = 1;
+ if (option_debug > 2) {
+ ast_log(LOG_DEBUG, "Changing ssrc from %u to %u due to a source change\n", rtp->ssrc, ssrc);
+ }
+ rtp->ssrc = ssrc;
}
}
More information about the svn-commits
mailing list