Browse Source

MT#56128 simplify sdp_manipulations_add case

Operating on an empty queue is essentially a no-op, so there's no point
in doing an extra check first to see if the queue is empty. Remove this
extra check for the CMD_ADD case.

Change-Id: I3c7524cd407fb350a46bdf8d3a91014158c6bf44
pull/1694/head
Richard Fuchs 2 years ago
parent
commit
4089005074
3 changed files with 6 additions and 14 deletions
  1. +0
    -1
      daemon/call_interfaces.c
  2. +5
    -11
      daemon/sdp.c
  3. +1
    -2
      include/sdp.h

+ 0
- 1
daemon/call_interfaces.c View File

@ -630,7 +630,6 @@ INLINE void ng_sdp_attr_manipulations(struct sdp_ng_flags *flags, bencode_item_t
switch (__csh_lookup(&command_type)) {
/* CMD_ADD / CMD_SUBST commands */
case CSH_LOOKUP("substitute"):
ht = &sm->subst_commands;


+ 5
- 11
daemon/sdp.c View File

@ -302,7 +302,6 @@ static int sdp_manipulate_check(enum command_type command_type,
if (!sdp_manipulations)
return 0;
GQueue * q_ptr = NULL;
GHashTable * ht = NULL;
switch (command_type) {
@ -317,12 +316,6 @@ static int sdp_manipulate_check(enum command_type command_type,
return 1;
break;
case CMD_ADD:
q_ptr = &sdp_manipulations->add_commands;
if (q_ptr->head)
return 1;
break;
case CMD_REM:;
if (!attr_name || !attr_name->len)
break;
@ -346,6 +339,9 @@ static int sdp_manipulate_check(enum command_type command_type,
static void sdp_manipulations_add(struct sdp_chopper *chop,
struct sdp_manipulations * sdp_manipulations) {
if (!sdp_manipulations)
return;
GQueue * q_ptr = &sdp_manipulations->add_commands;
for (GList *l = q_ptr->head; l; l = l->next)
@ -3170,8 +3166,7 @@ int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call_monologu
/* ADD arbitrary SDP manipulations for a session sessions */
struct sdp_manipulations *sdp_manipulations = sdp_manipulations_get_by_id(flags, MT_UNKNOWN);
if (sdp_manipulate_check(CMD_ADD, sdp_manipulations, NULL))
sdp_manipulations_add(chop, sdp_manipulations);
sdp_manipulations_add(chop, sdp_manipulations);
for (k = session->media_streams.head; k; k = k->next) {
sdp_media = k->data;
@ -3246,8 +3241,7 @@ int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call_monologu
/* ADD arbitrary SDP manipulations for audio/video media sessions */
sdp_manipulations = sdp_manipulations_get_by_id(flags, sdp_media->media_type_id);
if (sdp_manipulate_check(CMD_ADD, sdp_manipulations, NULL))
sdp_manipulations_add(chop, sdp_manipulations);
sdp_manipulations_add(chop, sdp_manipulations);
media_index++;
}


+ 1
- 2
include/sdp.h View File

@ -8,8 +8,7 @@
#include "media_socket.h"
enum command_type {
CMD_ADD = 0,
CMD_REM,
CMD_REM = 1,
CMD_SUBST,
};


Loading…
Cancel
Save