From 587eed89726c4892a307552df23b497605c31cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joni=20R=C3=A4s=C3=A4nen?= Date: Wed, 24 Aug 2022 16:05:38 +0300 Subject: [PATCH] examples: Fix zrtp multistream example, add missing iostream includes --- examples/receiving_hook.cc | 1 + examples/receiving_poll.cc | 1 - examples/rtcp_hook.cc | 2 ++ examples/sending_generic.cc | 2 ++ examples/srtp_user.cc | 2 ++ examples/srtp_zrtp.cc | 2 ++ examples/zrtp_multistream.cc | 9 ++++++--- 7 files changed, 15 insertions(+), 4 deletions(-) diff --git a/examples/receiving_hook.cc b/examples/receiving_hook.cc index ca1c35b9..c848a003 100644 --- a/examples/receiving_hook.cc +++ b/examples/receiving_hook.cc @@ -1,6 +1,7 @@ #include #include +#include /* There are two main ways of getting received RTP frames from uvgRTP. * This example demonstrates the usage of hook function to receive RTP frames. diff --git a/examples/receiving_poll.cc b/examples/receiving_poll.cc index e4b6a90d..e4605839 100644 --- a/examples/receiving_poll.cc +++ b/examples/receiving_poll.cc @@ -3,7 +3,6 @@ #include #include - /* This example demostrates using polling to receive RTP frames. Polling in * uvgRTP can be done with function pull_frame in media_streamer. This pull_frame * function can be used with or without a timeout argument. If used without a timeout diff --git a/examples/rtcp_hook.cc b/examples/rtcp_hook.cc index 40d19a1b..a289ef09 100644 --- a/examples/rtcp_hook.cc +++ b/examples/rtcp_hook.cc @@ -1,5 +1,7 @@ #include + #include +#include /* RTCP (RTP Control Protocol) is used to monitor the quality * of the RTP stream. This example demonstrates the usage of diff --git a/examples/sending_generic.cc b/examples/sending_generic.cc index 70961f95..74709254 100644 --- a/examples/sending_generic.cc +++ b/examples/sending_generic.cc @@ -1,5 +1,7 @@ #include + #include +#include /* Generic sending API means, that the user takes the responsibility * for RTP payload format. uvgRTP does help a little bit by offering diff --git a/examples/srtp_user.cc b/examples/srtp_user.cc index d435b9df..6968f62f 100644 --- a/examples/srtp_user.cc +++ b/examples/srtp_user.cc @@ -1,5 +1,7 @@ #include + #include +#include /* Encryption is also supported by uvgRTP. Encryption is facilitated * by Secure RTP (SRTP) protocol. In order to use SRTP, the encryption diff --git a/examples/srtp_zrtp.cc b/examples/srtp_zrtp.cc index da742151..aadaca1b 100644 --- a/examples/srtp_zrtp.cc +++ b/examples/srtp_zrtp.cc @@ -1,6 +1,8 @@ #include + #include #include +#include void thread_func(void) { diff --git a/examples/zrtp_multistream.cc b/examples/zrtp_multistream.cc index aa72fb86..da0b32f1 100644 --- a/examples/zrtp_multistream.cc +++ b/examples/zrtp_multistream.cc @@ -2,6 +2,8 @@ #include #include +#include + /* Zimmermann RTP (ZRTP) is a key management protocol for SRTP. Compared * to most approaches, using ZRTP can facilitate end-to-end encryption * of media traffic since the keys are exchanged peer-to-peer. @@ -30,7 +32,7 @@ constexpr uint16_t RECEIVER_AUDIO_PORT = 7778; constexpr int VIDEO_PAYLOAD_SIZE = 4000; constexpr int AUDIO_PAYLOAD_SIZE = 100; -constexpr auto EXAMPLE_RUN_TIME_S = std::chrono::seconds(5); +constexpr auto EXAMPLE_RUN_TIME_S = std::chrono::seconds(2); constexpr auto RECEIVER_WAIT_TIME_MS = std::chrono::milliseconds(50); constexpr auto AUDIO_FRAME_INTERVAL_MS = std::chrono::milliseconds(20); @@ -71,12 +73,13 @@ int main(void) // Enable SRTP and use ZRTP to manage keys for both sender and receiver*/ unsigned rce_flags = RCE_SRTP | RCE_SRTP_KMNGMNT_ZRTP; + unsigned rce_no_dh_flags = RCE_SRTP | RCE_SRTP_KMNGMNT_ZRTP | RCE_ZRTP_MULTISTREAM_NO_DH; // start the receivers in a separate thread std::thread a_receiver(receive_function, receiver_session, rce_flags, print_mutex, RTP_FORMAT_OPUS, RECEIVER_AUDIO_PORT, SENDER_AUDIO_PORT); - std::thread v_receiver(receive_function, receiver_session, rce_flags, print_mutex, + std::thread v_receiver(receive_function, receiver_session, rce_no_dh_flags, print_mutex, RTP_FORMAT_H265, RECEIVER_VIDEO_PORT, SENDER_VIDEO_PORT); @@ -89,7 +92,7 @@ int main(void) RTP_FORMAT_OPUS, SENDER_AUDIO_PORT, RECEIVER_AUDIO_PORT, AUDIO_PAYLOAD_SIZE, AUDIO_FRAME_INTERVAL_MS); - std::thread v_sender(sender_function, sender_session, rce_flags, print_mutex, + std::thread v_sender(sender_function, sender_session, rce_no_dh_flags, print_mutex, RTP_FORMAT_H265, SENDER_VIDEO_PORT, RECEIVER_VIDEO_PORT, VIDEO_PAYLOAD_SIZE, VIDEO_FRAME_INTERVAL_MS);