Browse Source

MT#63317 rename determine_sink_handler

and annotate some functions

Change-Id: I26cfe17f9bb93c1cc87b8365b3eed10fc03956f4
pull/2008/head
Richard Fuchs 4 months ago
parent
commit
acb0e47a1a
2 changed files with 22 additions and 10 deletions
  1. +7
    -9
      daemon/media_socket.c
  2. +15
    -1
      include/media_socket.h

+ 7
- 9
daemon/media_socket.c View File

@ -106,8 +106,6 @@ static __thread ports_release_q ports_to_release = TYPED_GQUEUE_INIT;
static ports_release_q ports_to_release_glob = TYPED_GQUEUE_INIT;
static mutex_t ports_to_release_glob_lock = MUTEX_STATIC_INIT;
static const struct streamhandler *__determine_handler(struct packet_stream *in, struct sink_handler *);
static int __k_null(struct rtpengine_srtp *s, struct packet_stream *);
static int __k_srtp_encrypt(struct rtpengine_srtp *s, struct packet_stream *);
static int __k_srtp_decrypt(struct rtpengine_srtp *s, struct packet_stream *);
@ -1607,19 +1605,19 @@ static const char *kernelize_target(kernelize_state *s, struct packet_stream *st
|| MEDIA_ISSET(media, RTCP_GEN) || (mqtt_publish_scope() != MPS_NONE)) ? 1 : 0;
// Grab the first stream handler for our decryption function.
// __determine_handler is in charge of only returning a NULL decrypter if it is
// determine_sink_handler is in charge of only returning a NULL decrypter if it is
// in fact a pure passthrough for all sinks.
const struct streamhandler *handler = NULL;
for (__auto_type l = stream->rtp_sinks.head; l; l = l->next) {
handler = __determine_handler(stream, l->data);
handler = determine_sink_handler(stream, l->data);
if (handler)
break;
}
if (!handler) {
for (__auto_type l = stream->rtcp_sinks.head; l; l = l->next) {
handler = __determine_handler(stream, l->data);
handler = determine_sink_handler(stream, l->data);
if (handler)
break;
}
@ -1758,7 +1756,7 @@ static const char *kernelize_one(kernelize_state *s,
FMT_M(endpoint_print_buf(&stream->endpoint)),
endpoint_print_buf(&stream->selected_sfd->socket.local));
const struct streamhandler *handler = __determine_handler(stream, sink_handler);
const struct streamhandler *handler = determine_sink_handler(stream, sink_handler);
if (!handler->out->kernel)
return "protocol not supported by kernel module";
@ -2090,7 +2088,7 @@ err:
/* must be called with call->master_lock held in R, and in->lock held */
// `sh` can be null
static const struct streamhandler *__determine_handler(struct packet_stream *in, struct sink_handler *sh) {
const struct streamhandler *determine_sink_handler(struct packet_stream *in, struct sink_handler *sh) {
const struct transport_protocol *in_proto, *out_proto;
bool must_recrypt = false;
struct packet_stream *out = sh ? sh->sink : NULL;
@ -2437,7 +2435,7 @@ static int media_packet_decrypt(struct packet_handler_ctx *phc)
{
LOCK(&phc->in_srtp->lock);
struct sink_handler *first_sh = phc->sinks->length ? phc->sinks->head->data : NULL;
const struct streamhandler *sh = __determine_handler(phc->in_srtp, first_sh);
const struct streamhandler *sh = determine_sink_handler(phc->in_srtp, first_sh);
rewrite_arg header;
if (G_LIKELY(!phc->rtcp)) {
@ -2469,7 +2467,7 @@ static int media_packet_decrypt(struct packet_handler_ctx *phc)
static void media_packet_set_encrypt(struct packet_handler_ctx *phc, struct sink_handler *sh)
{
LOCK(&phc->in_srtp->lock);
__determine_handler(phc->in_srtp, sh);
determine_sink_handler(phc->in_srtp, sh);
// XXX use an array with index instead of if/else
if (G_LIKELY(!phc->rtcp))


+ 15
- 1
include/media_socket.h View File

@ -339,14 +339,28 @@ int __hunt_ssrc_ctx_idx(uint32_t ssrc, struct ssrc_entry_call *list[RTPE_NUM_SSR
struct ssrc_entry_call *__hunt_ssrc_ctx(uint32_t ssrc, struct ssrc_entry_call *list[RTPE_NUM_SSRC_TRACKING],
unsigned int start_idx);
__attribute__((nonnull(1, 2)))
void media_packet_copy(struct media_packet *, const struct media_packet *);
__attribute__((nonnull(1)))
void media_packet_release(struct media_packet *);
__attribute__((nonnull(1)))
int media_socket_dequeue(struct media_packet *mp, struct packet_stream *sink);
__attribute__((nonnull(1)))
const struct streamhandler *determine_sink_handler(struct packet_stream *in, struct sink_handler *);
__attribute__((nonnull(1)))
const struct streamhandler *determine_handler(const struct transport_protocol *in_proto,
struct call_media *out_media, bool must_recrypt);
__attribute__((nonnull(2, 3)))
int media_packet_encrypt(rewrite_func encrypt_func, struct packet_stream *out, struct media_packet *mp);
const struct transport_protocol *transport_protocol(const str *s);
//void play_buffered(struct packet_stream *sink, struct codec_packet *cp, int buffered);
__attribute__((nonnull(1)))
void play_buffered(struct jb_packet *cp);
INLINE int proto_is_rtp(const struct transport_protocol *protocol) {


Loading…
Cancel
Save