|
|
|
@ -2315,7 +2315,15 @@ int media_packet_encrypt(rewrite_func encrypt_func, struct packet_stream *out, s |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
static int __media_packet_encrypt(struct packet_handler_ctx *phc) { |
|
|
|
// return: -1 = error, 0 = ok, 1 = pass to kernel for sending |
|
|
|
static int __media_packet_encrypt(struct packet_handler_ctx *phc, struct sink_handler *sh) { |
|
|
|
if (phc->rtcp) { |
|
|
|
// can the kernel handle this for us? |
|
|
|
if (PS_ISSET(phc->mp.stream, KERNELIZED) && !PS_ISSET(phc->mp.stream, NO_KERNEL_SUPPORT) |
|
|
|
&& sh->kernel_output_idx >= 0) |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|
int ret = media_packet_encrypt(phc->encrypt_func, phc->out_srtp, &phc->mp); |
|
|
|
if (ret & 0x02) |
|
|
|
phc->update = true; |
|
|
|
@ -2917,7 +2925,7 @@ static int stream_packet(struct packet_handler_ctx *phc) { |
|
|
|
g_queue_push_tail(&mirror_phc.mp.packets_out, codec_packet_dup(p)); |
|
|
|
} |
|
|
|
|
|
|
|
ret = __media_packet_encrypt(&mirror_phc); |
|
|
|
ret = __media_packet_encrypt(&mirror_phc, mirror_sh); |
|
|
|
if (ret) |
|
|
|
goto next_mirror; |
|
|
|
|
|
|
|
@ -2941,11 +2949,24 @@ next_mirror: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ret = __media_packet_encrypt(phc); |
|
|
|
ret = __media_packet_encrypt(phc, sh); |
|
|
|
errno = ENOTTY; |
|
|
|
if (ret) |
|
|
|
if (ret == -1) |
|
|
|
goto err_next; |
|
|
|
|
|
|
|
if (ret == 1) { |
|
|
|
for (GList *l = phc->mp.packets_out.head; l; l = l->next) { |
|
|
|
struct codec_packet *p = l->data; |
|
|
|
__re_address_translate_ep(&p->kernel_send_info.local, |
|
|
|
&phc->mp.stream->selected_sfd->socket.local); |
|
|
|
__re_address_translate_ep(&p->kernel_send_info.src_addr, |
|
|
|
&sh->sink->selected_sfd->socket.local); |
|
|
|
__re_address_translate_ep(&p->kernel_send_info.dst_addr, |
|
|
|
&sh->sink->endpoint); |
|
|
|
p->kernel_send_info.destination_idx = sh->kernel_output_idx; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
mutex_lock(&sink->out_lock); |
|
|
|
|
|
|
|
if (!sink->advertised_endpoint.port |
|
|
|
|