TT#77358 create helper function to determine RTP protocols

Change-Id: I6ee4a2c48c896fa9f3f00c9f90c0ae65c1ae3bae
changes/88/38688/1
Richard Fuchs 6 years ago
parent 9ff3d666b8
commit 641fd160ca

@ -1848,7 +1848,7 @@ static void __update_media_protocol(struct call_media *media, struct call_media
/* allow override of outgoing protocol even if we know it already */
/* but only if this is an RTP-based protocol */
if (flags->transport_protocol
&& other_media->protocol && other_media->protocol->rtp) {
&& proto_is_rtp(other_media->protocol)) {
media->protocol = flags->transport_protocol;
return;
}
@ -2232,7 +2232,7 @@ void call_destroy(struct call *c) {
STR_FMT(&md->type), \
md->protocol ? md->protocol->name : "(unknown)"
if (md->protocol && md->protocol->rtp) {
if (proto_is_rtp(md->protocol)) {
rtp_pt = __rtp_stats_codec(md);
if (!rtp_pt)
ilog(LOG_INFO, MLL_PREFIX "unknown codec", MLL_COMMON);

@ -1119,7 +1119,7 @@ void kernelize(struct packet_stream *stream) {
ZERO(stream->kernel_stats);
if (stream->media->protocol && stream->media->protocol->rtp) {
if (proto_is_rtp(stream->media->protocol)) {
GList *values, *l;
struct rtp_stats *rs;
@ -1416,9 +1416,7 @@ static void media_packet_rtp(struct packet_handler_ctx *phc)
{
phc->payload_type = -1;
if (G_UNLIKELY(!phc->mp.media->protocol))
return;
if (G_UNLIKELY(!phc->mp.media->protocol->rtp))
if (G_UNLIKELY(!proto_is_rtp(phc->mp.media->protocol)))
return;
if (G_LIKELY(!phc->rtcp && !rtp_payload(&phc->mp.rtp, &phc->mp.payload, &phc->s))) {

@ -1114,7 +1114,7 @@ static int __rtp_payload_types(struct stream_params *sp, struct sdp_media *media
struct sdp_attribute *attr;
int ret = 0;
if (!sp->protocol || !sp->protocol->rtp)
if (!proto_is_rtp(sp->protocol))
return 0;
/* first go through a=rtpmap and build a hash table of attrs */
@ -1479,7 +1479,7 @@ static int replace_format_str(struct sdp_chopper *chop,
static int replace_codec_list(struct sdp_chopper *chop,
struct sdp_media *media, struct call_media *cm)
{
if (cm->protocol && !cm->protocol->rtp)
if (proto_is_not_rtp(cm->protocol))
return replace_format_str(chop, media, cm);
if (cm->codecs_prefs_recv.length == 0)
@ -2140,7 +2140,7 @@ int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call_monologu
chopper_append_c(chop, "a=inactive\r\n");
}
if (call_media->protocol && call_media->protocol->rtp) {
if (proto_is_rtp(call_media->protocol)) {
if (MEDIA_ISSET(call_media, RTCP_MUX)
&& (flags->opmode == OP_ANSWER
|| (flags->opmode == OP_OFFER

@ -190,5 +190,18 @@ INLINE struct local_intf *get_interface_from_address(const struct logical_intf *
}
*/
INLINE int proto_is_rtp(const struct transport_protocol *protocol) {
// known to be RTP? therefore unknown is not RTP
if (!protocol)
return 0;
return protocol->rtp ? 1 : 0;
}
INLINE int proto_is_not_rtp(const struct transport_protocol *protocol) {
// known not to be RTP? therefore unknown might be RTP
if (!protocol)
return 0;
return protocol->rtp ? 0 : 1;
}
#endif

Loading…
Cancel
Save