Browse Source

TT#136957 refactor __send_timer_send_common

Change-Id: I4114ada4f9c789660ca7bc0a994799e37e1cb5fd
pull/1487/head
Richard Fuchs 4 years ago
parent
commit
c6e7cc5d32
1 changed files with 21 additions and 11 deletions
  1. +21
    -11
      daemon/media_player.c

+ 21
- 11
daemon/media_player.c View File

@ -181,18 +181,19 @@ static void send_timer_rtcp(struct send_timer *st, struct ssrc_ctx *ssrc_out) {
} }
static void __send_timer_send_common(struct send_timer *st, struct codec_packet *cp) {
if (!st->sink->selected_sfd)
goto out;
static bool __send_timer_send_1(struct rtp_header *rh, struct packet_stream *sink, struct codec_packet *cp) {
struct stream_fd *sink_fd = sink->selected_sfd;
if (!sink_fd || sink_fd->socket.fd == -1)
return false;
log_info_stream_fd(st->sink->selected_sfd);
log_info_stream_fd(sink->selected_sfd);
struct rtp_header *rh = cp->rtp;
if (rh) { if (rh) {
ilog(LOG_DEBUG, "Forward to sink endpoint: local %s -> remote %s%s%s " ilog(LOG_DEBUG, "Forward to sink endpoint: local %s -> remote %s%s%s "
"(RTP seq %u TS %u SSRC %x)", "(RTP seq %u TS %u SSRC %x)",
endpoint_print_buf(&st->sink->selected_sfd->socket.local),
FMT_M(endpoint_print_buf(&st->sink->endpoint)),
endpoint_print_buf(&sink_fd->socket.local),
FMT_M(endpoint_print_buf(&sink->endpoint)),
ntohs(rh->seq_num), ntohs(rh->seq_num),
ntohl(rh->timestamp), ntohl(rh->timestamp),
ntohl(rh->ssrc)); ntohl(rh->ssrc));
@ -200,11 +201,20 @@ static void __send_timer_send_common(struct send_timer *st, struct codec_packet
} }
else else
ilog(LOG_DEBUG, "Forward to sink endpoint: local %s -> remote %s%s%s", ilog(LOG_DEBUG, "Forward to sink endpoint: local %s -> remote %s%s%s",
endpoint_print_buf(&st->sink->selected_sfd->socket.local),
FMT_M(endpoint_print_buf(&st->sink->endpoint)));
endpoint_print_buf(&sink_fd->socket.local),
FMT_M(endpoint_print_buf(&sink->endpoint)));
socket_sendto(&sink_fd->socket,
cp->s.s, cp->s.len, &sink->endpoint);
log_info_pop();
return true;
}
socket_sendto(&st->sink->selected_sfd->socket,
cp->s.s, cp->s.len, &st->sink->endpoint);
static void __send_timer_send_common(struct send_timer *st, struct codec_packet *cp) {
if (!__send_timer_send_1(cp->rtp, st->sink, cp))
goto out;
if (cp->ssrc_out && cp->rtp) { if (cp->ssrc_out && cp->rtp) {
atomic64_inc(&cp->ssrc_out->packets); atomic64_inc(&cp->ssrc_out->packets);


Loading…
Cancel
Save