diff --git a/examples/README.md b/examples/README.md index be8b93c..9ae5d81 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,20 +1,6 @@ # uvgRTP example codes -## Instructions for Windows - -1) Run prepare.bat in this directory to prepare testing environment for uvgRTP - * The script creates lib/ and include/ directories to project root directory -2) Build uvgRTP using QtCreator -3) When uvgRTP has been built, copy the libuvgrtp.a from the Qt build directory to lib/ created by the script -4) Open the example.pro and build & run it - * Make sure the Qt build directory for example.pro is located in the same directory as lib/ and include/ (projects root directory) or tweak the include/lib paths accordingly - -## Instructions for Linux - -``` -sudo make --directory=.. all install -g++ sending.cc -luvgrtp -lpthread && ./a.out -``` +This directory contains a collection of simple examples that demonstrate how to use uvgRTP ## Available examples @@ -38,6 +24,10 @@ NOTE: The hook should **not** be used for media processing. It should be rather [How to create an RTCP instance (hoooking)](rtcp_hook.cc) +[How to use SRTP with ZRTP](srtp_zrtp.cc) + +[How to use SRTP with user-managed keys](srtp_user.cc) + ### Memory ownership/deallocation If you have not enabled the system call dispatcher, you don't need to worry about these diff --git a/examples/binding.cc b/examples/binding.cc index 7490285..98df64c 100644 --- a/examples/binding.cc +++ b/examples/binding.cc @@ -18,9 +18,8 @@ int main(void) while (true) { std::unique_ptr buffer = std::unique_ptr(new uint8_t[PAYLOAD_MAXLEN]); - rtp_error_t ret = hevc->push_frame(std::move(buffer), PAYLOAD_MAXLEN, RTP_NO_FLAGS); - if (ret != RTP_OK) - fprintf(stderr, "failed to push hevc frame: %d\n", ret); + if (hevc->push_frame(std::move(buffer), PAYLOAD_MAXLEN, RTP_NO_FLAGS) != RTP_OK) + fprintf(stderr, "failed to push hevc frame\n"); std::this_thread::sleep_for(std::chrono::milliseconds(800)); } diff --git a/examples/deallocation_1.cc b/examples/deallocation_1.cc index d651281..66d9a09 100644 --- a/examples/deallocation_1.cc +++ b/examples/deallocation_1.cc @@ -23,9 +23,8 @@ int main(void) * We can no longer use buffer and must reallocate new memory chunk on the next iteration. * * The memory is deallocated automatically when system call dispatcher has finished processing the transaction */ - if (hevc->push_frame(std::move(buffer), PAYLOAD_MAXLEN, RTP_NO_FLAGS) != RTP_OK) { + if (hevc->push_frame(std::move(buffer), PAYLOAD_MAXLEN, RTP_NO_FLAGS) != RTP_OK) fprintf(stderr, "Failed to send RTP frame!"); - } } /* Session must be destroyed manually */ diff --git a/examples/example.pro b/examples/example.pro deleted file mode 100644 index bdd1665..0000000 --- a/examples/example.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = app -CONFIG += console c++11 -CONFIG -= app_bundle -CONFIG -= qt - -SOURCES += sending.cc -INCLUDEPATH = $$PWD/../include -LIBS += -L$$PWD/../lib -luvgrtp -lws2_32 -lpthread diff --git a/examples/prepare.bat b/examples/prepare.bat deleted file mode 100644 index f809b4d..0000000 --- a/examples/prepare.bat +++ /dev/null @@ -1,4 +0,0 @@ -mkdir ..\lib ..\include ..\include\uvgrtp ..\include\uvgrtp\formats -copy ..\src\*.hh ..\include\uvgrtp -copy ..\src\formats\*.hh ..\include\uvgrtp\formats -copy ..\src\formats\*.hh ..\include\uvgrtp\formats diff --git a/examples/receiving_poll.cc b/examples/receiving_poll.cc index cee4c47..005ec75 100644 --- a/examples/receiving_poll.cc +++ b/examples/receiving_poll.cc @@ -34,7 +34,7 @@ int main(void) while ((frame = hevc->pull_frame()) != nullptr) { /* When we receive a frame, the ownership of the frame belongs to us and * when we're done with it, we need to deallocate the frame */ - uvg_rtp::frame::dealloc_frame(frame); + (void)uvg_rtp::frame::dealloc_frame(frame); } ctx.destroy_session(sess); diff --git a/examples/sending.cc b/examples/sending.cc index fbe7c1c..1c19dd6 100644 --- a/examples/sending.cc +++ b/examples/sending.cc @@ -34,9 +34,8 @@ int main(void) /* Sending data is as simple as calling push_frame(). * * push_frame() will fragment the input buffer into payloads of 1500 bytes and send them to remote */ - if (hevc->push_frame(buffer, PAYLOAD_MAXLEN, RTP_NO_FLAGS) != RTP_OK) { + if (hevc->push_frame(buffer, PAYLOAD_MAXLEN, RTP_NO_FLAGS) != RTP_OK) fprintf(stderr, "Failed to send RTP frame!"); - } } /* Session must be destroyed manually */