Skip to content

Commit

Permalink
Import main files from old repo
Browse files Browse the repository at this point in the history
  • Loading branch information
c-g-owen committed Sep 7, 2021
1 parent dba969e commit fe79256
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ AVS_RELEASE := 0
AVS_VERSION := 0.0.$(VER_PATCH)
endif

MK_COMPONENTS := toolchain contrib avs tools test android iosx dist
MK_COMPONENTS := toolchain contrib avs tools test android iosx dist scan


#--- Configuration ---
Expand Down
7 changes: 7 additions & 0 deletions include/avs_econn.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,18 @@ struct econn_message {

struct econn;

enum group_part_muted_state {
MUTED_STATE_UNKNOWN,
MUTED_STATE_MUTED,
MUTED_STATE_UNMUTED
};

/* member of participant list */
struct econn_group_part {
char *userid;
char *clientid;
bool authorized;
enum group_part_muted_state muted_state;
uint32_t ssrca;
uint32_t ssrcv;

Expand Down
29 changes: 29 additions & 0 deletions mk/scan.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# Makefile Snippet for make scan
#
#


SCAN_DIR :=$(BUILD_BASE)/scan
SCAN_EXE := $(shell which scan-build)

ifeq ($(SCAN_EXE),)
LLVM_ROOT := /usr/local/Cellar/llvm
LLVM_VER := $(shell ls -1 $(LLVM_ROOT) | tail -1)
SCAN_EXE := $(LLVM_ROOT)/$(LLVM_VER)/bin/scan-build
endif

.PHONY: scan

scan:
@mkdir -p $(SCAN_DIR)
@$(MAKE) avs_clean
@$(MAKE) contrib
@$(SCAN_EXE) -o $(SCAN_DIR) make $(JOBS) avs


.PHONY: scan_clean

scan_clean:
@rm -rf $(SCAN_DIR)

23 changes: 21 additions & 2 deletions src/ccall/ccall.c
Original file line number Diff line number Diff line change
Expand Up @@ -1550,6 +1550,8 @@ static void ecall_confpart_handler(struct ecall *ecall,

struct userinfo *u = find_userinfo_by_hash(ccall, p->userid, p->clientid);
if (u) {
bool muted;

if (first && u->se_approved) {
info("ccall(%p): setting %s.%s as keygenerator\n",
ccall,
Expand All @@ -1571,12 +1573,30 @@ static void ecall_confpart_handler(struct ecall *ecall,
ccall->someone_left = true;
u->incall_prev = false;
sync_decoders = true;
list_changed = true;
}

u->incall_now = true;
u->ssrca = p->ssrca;
u->ssrcv = p->ssrcv;
list_changed = true;

switch (p->muted_state) {
case MUTED_STATE_UNKNOWN:
muted = u->muted;
break;
case MUTED_STATE_MUTED:
muted = true;
break;
case MUTED_STATE_UNMUTED:
muted = false;
break;
}

if (muted != u->muted) {
u->muted = muted;
list_changed = true;
}

u->listpos = listpos;
listpos++;
}
Expand All @@ -1599,7 +1619,6 @@ static void ecall_confpart_handler(struct ecall *ecall,
missing_parts = true;
u->listpos = listpos;
listpos++;
continue;
}

}
Expand Down
27 changes: 24 additions & 3 deletions src/econn_fmt/msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ static int econn_parts_encode(struct json_object *jobj,
re_snprintf(ssrc, sizeof(ssrc), "%u", part->ssrcv);
jzon_add_str(jpart, "ssrc_video", "%s", ssrc);

switch(part->muted_state) {
case MUTED_STATE_UNMUTED:
jzon_add_bool(jpart, "muted", false);
break;

case MUTED_STATE_MUTED:
jzon_add_bool(jpart, "muted", true);
break;

default:
break;
}

json_object_array_add(jparts, jpart);
}

Expand Down Expand Up @@ -121,6 +134,7 @@ static bool part_decode_handler(const char *key, struct json_object *jobj,
struct econn_group_part *part;
struct list *partl = arg;
const char *ssrc;
bool muted;
int err;

part = mem_zalloc(sizeof(*part), part_destructor);
Expand All @@ -135,6 +149,16 @@ static bool part_decode_handler(const char *key, struct json_object *jobj,
if (err)
goto out;

err = jzon_bool(&muted, jobj, "muted");
if (err) {
err = 0;
part->muted_state = MUTED_STATE_UNKNOWN;
}
else {
part->muted_state =
muted ? MUTED_STATE_MUTED : MUTED_STATE_UNMUTED;
}

ssrc = jzon_str(jobj, "ssrc_audio");
if (ssrc)
sscanf(ssrc, "%u", &part->ssrca);
Expand Down Expand Up @@ -950,7 +974,6 @@ int econn_message_decode(struct econn_message **msgp,
err = jzon_int(&status, jobj, "status");
if (err) {
status = 0;
err = 0;
}

msg->u.confconn.status = (enum econn_confconn_status) status;
Expand All @@ -959,15 +982,13 @@ int econn_message_decode(struct econn_message **msgp,
err = jzon_bool(&selective_audio, jobj, "selective_audio");
if (err) {
selective_audio = false;
err = 0;
}
msg->u.confconn.selective_audio = selective_audio;

/* selective_video is optional, missing = false */
err = jzon_bool(&selective_video, jobj, "selective_video");
if (err) {
selective_video = false;
err = 0;
}
msg->u.confconn.selective_video = selective_video;

Expand Down
1 change: 1 addition & 0 deletions src/peerflow/peerflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2086,6 +2086,7 @@ bool peerflow_is_gathered(const struct iflow *iflow)
return false;

state = pf->peerConn->ice_gathering_state();
info("pf(%p): is_gathered state %d\n", iflow, state);

return pf->gathered;
}
Expand Down
5 changes: 4 additions & 1 deletion src/peerflow/stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ class NetStatsCallback : public rtc::RefCountedObject<webrtc::RTCStatsCollectorC
uint32_t apkts_sent = 0, vpkts_sent = 0;
int err;

lock_write_get(lock_);
err = str_dup(&tmp, stats);
if (err)
return;

lock_write_get(lock_);
//info("peerflow(%p): OnStatsDelivered err=%d len=%d stats=%s\n", pf_, err, (int)str_len(tmp), stats);
mem_deref(current_stats_);
current_stats_ = tmp;
Expand Down

0 comments on commit fe79256

Please sign in to comment.