Browse Source

TT#50652 split out packet dequeuing and sending function

Change-Id: I303bcfb8869699554ff7381c68767c56fdcdda87
changes/40/27640/7
Richard Fuchs 7 years ago
parent
commit
6ba60d5b54
2 changed files with 22 additions and 13 deletions
  1. +20
    -13
      daemon/media_socket.c
  2. +2
    -0
      include/media_socket.h

+ 20
- 13
daemon/media_socket.c View File

@ -1572,6 +1572,25 @@ out:
}
// appropriate locks must be held
int media_socket_dequeue(struct media_packet *mp, struct packet_stream *sink) {
struct codec_packet *p;
while ((p = g_queue_pop_head(&mp->packets_out))) {
__C_DBG("Forward to sink endpoint: %s:%d", sockaddr_print_buf(&sink->endpoint.address),
sink->endpoint.port);
int ret = socket_sendto(&sink->selected_sfd->socket,
p->s.s, p->s.len, &sink->endpoint);
codec_packet_free(p);
if (ret == -1)
return -1;
}
return 0;
}
/* called lock-free */
static int stream_packet(struct packet_handler_ctx *phc) {
/**
@ -1696,19 +1715,7 @@ static int stream_packet(struct packet_handler_ctx *phc) {
goto drop;
}
struct codec_packet *p;
ret = 0;
while ((p = g_queue_pop_head(&phc->mp.packets_out))) {
__C_DBG("Forward to sink endpoint: %s:%d", sockaddr_print_buf(&phc->sink->endpoint.address),
phc->sink->endpoint.port);
ret = socket_sendto(&phc->sink->selected_sfd->socket, p->s.s, p->s.len, &phc->sink->endpoint);
codec_packet_free(p);
if (ret == -1)
break;
}
ret = media_socket_dequeue(&phc->mp, phc->sink);
mutex_unlock(&phc->sink->out_lock);


+ 2
- 0
include/media_socket.h View File

@ -130,6 +130,8 @@ void __unkernelize(struct packet_stream *);
void unkernelize(struct packet_stream *);
void __stream_unconfirm(struct packet_stream *);
int media_socket_dequeue(struct media_packet *mp, struct packet_stream *sink);
/* XXX shouldn't be necessary */
/*
INLINE struct local_intf *get_interface_from_address(const struct logical_intf *lif,


Loading…
Cancel
Save