Skip to content

Commit

Permalink
fixe merge
Browse files Browse the repository at this point in the history
  • Loading branch information
nicotyze committed Sep 10, 2024
1 parent 8b0de44 commit 799fa2b
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 31 deletions.
2 changes: 1 addition & 1 deletion cmake/modules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ set(MODULES
wincons
winwave
x11
x11_grab
x11grab

CACHE STRING "List of modules like 'turn;pipewire;alsa'"
)
Expand Down
1 change: 0 additions & 1 deletion include/baresip.h
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,6 @@ const char *video_get_disp_dev(const struct video *v);
int video_debug(struct re_printf *pf, const struct video *v);
struct stream *video_strm(const struct video *v);
const struct vidcodec *video_codec(const struct video *vid, bool tx);
void video_encode_refresh(struct video *v);
void video_sdp_attr_decode(struct video *v);
void video_req_keyframe(struct video *vid);

Expand Down
2 changes: 1 addition & 1 deletion modules/avcodec/sdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int avcodec_h264_fmtp_enc(struct mbuf *mb, const struct sdp_format *fmt,

conf_get_str(conf_cur(), "avcodec_profile_level_id",
profile_level_id, sizeof(profile_level_id));
conf_get_str(conf_cur(), "video_fmtp_append",
conf_get_str(conf_cur(), "avcodec_fmtp_append",
append, sizeof(append));

if (str_isset(profile_level_id)) {
Expand Down
2 changes: 1 addition & 1 deletion modules/ice/ice.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ static int cand_gather_relayed(struct mnat_media *m, struct comp *comp,
err = turnc_alloc(&turnc, stun_conf(icem_stun(m->icem)),
IPPROTO_UDP, comp->sock, layer, &m->sess->srv,
username, password,
60, NULL, turnc_handler, comp);
60, turnc_handler, comp);
if (err)
return err;

Expand Down
6 changes: 3 additions & 3 deletions modules/turn/turn.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static void turn_handler(int err, uint16_t scode, const char *reason,
err = turnc_alloc(&other->turnc, NULL,
IPPROTO_UDP, other->sock, LAYER,
&m->sess->srv, m->sess->user, m->sess->pass,
TURN_DEFAULT_LIFETIME, &token,
TURN_DEFAULT_LIFETIME,
turn_handler, other);
}
else
Expand Down Expand Up @@ -250,7 +250,7 @@ static void tcp_estab_handler(void *arg)
err = turnc_alloc(&comp->turnc, NULL, IPPROTO_TCP, comp->tc, 0,
&m->sess->srv,
m->sess->user, m->sess->pass,
TURN_DEFAULT_LIFETIME, NULL, turn_handler, comp);
TURN_DEFAULT_LIFETIME, turn_handler, comp);
if (err) {
m->sess->estabh(err, 0, NULL, m->sess->arg);
}
Expand Down Expand Up @@ -284,7 +284,7 @@ static int media_start(struct mnat_sess *sess, struct mnat_media *m)
err |= turnc_alloc(&comp->turnc, NULL,
IPPROTO_UDP, comp->sock, LAYER,
&sess->srv, sess->user, sess->pass,
TURN_DEFAULT_LIFETIME, NULL,
TURN_DEFAULT_LIFETIME,
turn_handler, comp);
break;

Expand Down
7 changes: 1 addition & 6 deletions src/bfcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,7 @@ int bfcp_start(struct bfcp *bfcp)
return 0;
}

floorctrl = sdp_media_rattr(bfcp->sdpm, "floorctrl");

if (floorctrl )
if (str_str(floorctrl, "s")) {
bfcp_send_hello(bfcp);
}
err = bfcp_send_hello(bfcp);

return err;
}
18 changes: 10 additions & 8 deletions src/call.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,10 @@ static int update_streams(struct call *call)
else
video_stop(call->video);

if (stream_is_ready(video_strm(call->slides)))
if (stream_is_ready(video_strm(call->slides))){
err |= bfcp_start(call->bfcp);
err |= video_update(call->slides, call->peer_uri);
}
else
video_stop(call->slides);

Expand Down Expand Up @@ -856,6 +858,12 @@ int call_streams_alloc(struct call *call)
return err;

if (str_isset(call->cfg->bfcp.proto)) {
err = bfcp_alloc(&call->bfcp, call->sdp,
&call->cfg->bfcp, !call->got_offer,
acc->mnat, call->mnats);
if (err)
return err;

err = video_alloc(&call->slides, &call->streaml,
&strm_prm,
call->cfg, call->sdp,
Expand All @@ -869,12 +877,6 @@ int call_streams_alloc(struct call *call)

if (err)
return err;

err = bfcp_alloc(&call->bfcp, call->sdp,
&call->cfg->bfcp, !call->got_offer,
acc->mnat, call->mnats);
if (err)
return err;
}
}

Expand Down Expand Up @@ -2074,7 +2076,7 @@ static void call_handle_info_req(struct call *call, const struct sip_msg *req)
/* Poor-mans XML parsing */
if (0 == re_regex(body.p, body.l, "picture_fast_update")) {
debug("call: receive media control: fast_update=%d\n");
video_encode_refresh(call->video);
video_req_keyframe(call->video);
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ static struct config core_config = {
"", "",
640, 480,
1000000,
0,
0,
30,
true,
VID_FMT_YUV420P,
Expand Down Expand Up @@ -793,7 +795,7 @@ int config_print(struct re_printf *pf, const struct config *cfg)
rtp_receive_mode_str(cfg->avt.rxmode),

cfg->net.ifname,
net_af_str(cfg->net.af)
net_af_str(cfg->net.af),

cfg->bfcp.proto,
cfg->bfcp.floorctrl
Expand Down
1 change: 1 addition & 0 deletions src/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ void rtprecv_set_socket(struct rtp_receiver *rx, struct rtp_sock *rtp);
void rtprecv_set_ssrc(struct rtp_receiver *rx, uint32_t ssrc);
uint64_t rtprecv_ts_last(struct rtp_receiver *rx);
void rtprecv_set_ts_last(struct rtp_receiver *rx, uint64_t ts_last);
void rtprecv_set_estab(struct rtp_receiver *rx, bool estab);
void rtprecv_flush(struct rtp_receiver *rx);
void rtprecv_enable(struct rtp_receiver *rx, bool enable);
int rtprecv_get_ssrc(struct rtp_receiver *rx, uint32_t *ssrc);
Expand Down
12 changes: 11 additions & 1 deletion src/rtprecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ void rtprecv_handle_rtcp(const struct sa *src, struct rtcp_msg *msg,
return;
}

rx->ts_last = tmr_jiffies();
//rx->ts_last = tmr_jiffies();
mtx_unlock(rx->mtx);

pass_rtcp_work(rx, msg);
Expand Down Expand Up @@ -578,6 +578,16 @@ void rtprecv_set_ts_last(struct rtp_receiver *rx, uint64_t ts_last)
mtx_unlock(rx->mtx);
}

void rtprecv_set_estab(struct rtp_receiver *rx, bool estab)
{
if (!rx)
return;

mtx_lock(rx->mtx);
rx->rtp_estab = estab;
mtx_unlock(rx->mtx);
}


void rtprecv_flush(struct rtp_receiver *rx)
{
Expand Down
11 changes: 3 additions & 8 deletions src/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ static void stream_close(struct stream *strm, int err)
strm->terminated = true;
stream_enable(strm, false);
strm->errorh = NULL;
strm->rx.rtp_estab = false;

jbuf_flush(strm->rx.jbuf);
rtprecv_set_estab(strm->rx, false);
rtprecv_flush(strm->rx);

strm->rx = mem_deref(strm->rx);
if (errorh)
Expand Down Expand Up @@ -1562,12 +1562,7 @@ const struct sa *stream_raddr(const struct stream *strm)

uint64_t stream_rx_ts_last(const struct stream *strm)
{
if (!strm)
return 0;
if (!strm->rx.ts_last)
return 0;

return strm->rx.ts_last;
return rtprecv_ts_last(strm->rx);
}


Expand Down

0 comments on commit 799fa2b

Please sign in to comment.