New upstream version 4.3.0
Bernhard Schmidt
4 years ago
0 | Copyright (c) 2010-2013 Belledonne Communications SARL <sales@belledonne-communications.com> | |
1 | Simon MORLAT (simon dot morlat at linphone dot org) is the author the oRTP library. | |
2 | ||
3 | Contributors: | |
4 | ||
5 | * Copyright (c) 2013 Vadim Zhukov <persgray@gmail.com> | |
6 | ||
7 | Permission to use, copy, modify, and distribute this software for any | |
8 | purpose with or without fee is hereby granted, provided that the above | |
9 | copyright notice and this permission notice appear in all copies. | |
10 | ||
11 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | ||
19 | - support of arc4random() | |
20 | - bugfix in b64.c for platforms where char is unsigned. | |
21 | ||
22 | ||
23 | * Lovadina Nicola < lovadina dot nicola dot 10272 at unimo dot it > worked on RTCP support. |
0 | - Simon MORLAT (simon dot morlat at linphone dot org) is the original author the oRTP library. | |
1 | ||
2 | ## Contributors: | |
3 | ||
4 | * Copyright (c) 2013 Vadim Zhukov <persgray@gmail.com> | |
5 | ||
6 | Permission to use, copy, modify, and distribute this software for any | |
7 | purpose with or without fee is hereby granted, provided that the above | |
8 | copyright notice and this permission notice appear in all copies. | |
9 | ||
10 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
11 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
12 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
13 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
14 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
15 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
16 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
17 | ||
18 | - support of arc4random() | |
19 | - bugfix in b64.c for platforms where char is unsigned. | |
20 | ||
21 | ||
22 | * Lovadina Nicola < lovadina dot nicola dot 10272 at unimo dot it > worked on RTCP support. |
0 | # Changelog | |
1 | All notable changes to this project will be documented in this file. | |
2 | ||
3 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |
4 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | |
5 | ||
6 | ## [Unreleased] | |
7 | ||
8 | ||
9 | ## [1.1.0] - 2019-09-18 | |
10 | ||
11 | ### Added | |
12 | - Immediate NACK handling, to handle retransmission of lost packets. | |
13 | ||
14 | ### Changed | |
15 | - License is now GNU GPLv3. | |
16 | ||
17 | ||
18 | ||
19 | ## [1.0.0] - 2017-01-10 | |
20 | ||
21 | ### Added | |
22 | - new adaptive jitter buffer algorithm, with improved performance. | |
23 | ||
24 | ### Changed | |
25 | - License is changed from LGPLv2 to GPLv2. | |
26 | ||
27 | ||
28 | ||
29 | ## [0.27.0] - 2016-06-01 | |
30 | ||
31 | ### Changed | |
32 | - bctoolbox is added as dependency. | |
33 | ||
34 | ### Fixed | |
35 | - DSCP handling on Windows. | |
36 | - IPv6 handling for Windows and Android. | |
37 | ||
38 | ||
39 | ## [0.25.0] - 2015-11-02 | |
40 | ||
41 | ### Added | |
42 | - AVPF generic NACK | |
43 | - Payload type definitions for real time text and codec2. | |
44 | ||
45 | ### Fixed | |
46 | - Various things. | |
47 | ||
48 | ||
49 | ## [0.24.1] - 2015-05-31 | |
50 | ||
51 | ### Added | |
52 | - TMMBR and TMMBN handling (RFC5104). | |
53 | ||
54 | ||
55 | ## [0.24.0] - 2015-03-11 | |
56 | ||
57 | ### Added | |
58 | - RTCP send algorithm as describe in RFC3550. | |
59 | - RTCP XR (RFC3611). | |
60 | - RTCP send algorithm for AVPF streams as described in RFC4585. | |
61 | ||
62 | ||
63 | ||
64 | ## [0.23.0] - 2014-02-19 | |
65 | ||
66 | ### Changed | |
67 | - network simulator improvements. | |
68 | - updated to use ZRTPCPP>=4 | |
69 | ||
70 | ### Fixed | |
71 | - security issues. | |
72 | ||
73 | ||
74 | ## [0.22.0] - 2012-05-27 | |
75 | ||
76 | ### Changed | |
77 | - Network simulator improvements for simulating random lost packets. | |
78 | ||
79 | ### Fixed | |
80 | - SRTP initialization. | |
81 | ||
82 | ||
83 | ## [0.19.0] - 2012-02-17 | |
84 | ||
85 | ### Added | |
86 | - ZRTP media encryption. | |
87 | ||
88 | ||
89 | ## [0.18.0] - 2011-12-22 | |
90 | ||
91 | ### Added | |
92 | - SRTP media encryption | |
93 | ||
94 | ||
95 | ## [0.17.0] - 2011-05-?? | |
96 | ||
97 | ### Added | |
98 | - rtp_session_get_round_trip_propagation() | |
99 | ||
100 | ### Fixed | |
101 | - RTCP support. | |
102 | ||
103 | ||
104 | ## [0.16.0] - 2010-05-10 | |
105 | ||
106 | ### Added | |
107 | - DSCP handling on Windows. | |
108 | - Accessors to struct PayloadType. | |
109 | - new payload type definitions. | |
110 | ||
111 | ### Changed | |
112 | - update stun api to support new RFC. | |
113 | ||
114 | ### Fixed | |
115 | - gcc warnings. | |
116 | ||
117 | ||
118 | ## [0.15.0] - 2008-10-13 | |
119 | ||
120 | ### Changed | |
121 | - reduce number of memory allocation: !! attention here ABI/API change !! | |
122 | If you are using mp=rtp_session_recvm_with_ts(), the payload data is no more pointed by mp->b_cont->b_rptr. | |
123 | Instead you can use the following to skip the header: | |
124 | rtp_get_payload(mp,mp->b_rptr); | |
125 | ||
126 | ### Fixed | |
127 | - telephone event presence detection bug. | |
128 | ||
129 | ||
130 | ## [0.14.3] - 2008-03-14 | |
131 | ||
132 | ### Added | |
133 | - new ortp_set_memory_functions() method. | |
134 | ||
135 | ### Changed | |
136 | - jitter buffer simplification and improvements | |
137 | ||
138 | ||
139 | ## [0.14.0] - 2007-07-27 | |
140 | ||
141 | ### Added | |
142 | - Number of channels in PayloadType (interface changed !). | |
143 | - srtp optional support (using libsrtp from http://srtp.sf.net) | |
144 | ||
145 | ### Changed | |
146 | - optimisations. | |
147 | ||
148 | ||
149 | ## [0.13.1] - 2007-04-11 | |
150 | ||
151 | ### Changed | |
152 | - do not recv rtcp packets from rtp_session_sendm_with_ts() when session is not send-only. | |
153 | - removed gtk-doc, using doxygen instead. | |
154 | ||
155 | ||
156 | ## [0.13.0] - 2007-01-23 | |
157 | ||
158 | ### Added | |
159 | - new telephone-event types. | |
160 | - pluggable transport layer. | |
161 | ||
162 | ### Changed | |
163 | - enables use of different RtpProfile for send and recv directions. | |
164 | ||
165 | ### Fixed | |
166 | - RTCP memory leak. | |
167 | ||
168 | ||
169 | ## [0.12.0] - 2006-11-09 | |
170 | ||
171 | ### Added | |
172 | - enable 0 ms jitter buffer (implies permissive dequeuing of packets). | |
173 | - enable optional connected mode: the udp socket is connect()ed so only | |
174 | packets coming from the connected destination are received. | |
175 | ||
176 | ### Changed | |
177 | - jitter buffer accuracy improved. | |
178 | ||
179 | ### Fixed | |
180 | - statistics. | |
181 | ||
182 | ||
183 | ## [0.11.0] - 2006-08-22 | |
184 | ||
185 | ### Added | |
186 | - rtp_session_set_dscp(), rtp_session_send_rtcp_APP(). | |
187 | ||
188 | ### Fixed | |
189 | - statistics. | |
190 | ||
191 | ||
192 | ## [0.10.0] - 2006-05-30 | |
193 | ||
194 | ### Added | |
195 | - new RTCP parser | |
196 | - new event api | |
197 | - stun helper routines | |
198 | - permissive algorithm for video packet enqueueing | |
199 | ||
200 |
0 | ############################################################################ | |
1 | # CMakeLists.txt | |
2 | # Copyright (C) 2014 Belledonne Communications, Grenoble France | |
3 | # | |
4 | ############################################################################ | |
5 | # | |
6 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; either version 2 | |
9 | # of the License, or (at your option) any later version. | |
10 | # | |
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | # | |
20 | ############################################################################ | |
21 | ||
22 | cmake_minimum_required(VERSION 3.0) | |
23 | project(oRTP VERSION 1.0.2) | |
24 | ||
25 | ||
26 | set(ORTP_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}) | |
27 | set(ORTP_MINOR_VERSION ${PROJECT_VERSION_MINOR}) | |
28 | set(ORTP_MICRO_VERSION ${PROJECT_VERSION_PATCH}) | |
29 | set(ORTP_VERSION ${PROJECT_VERSION}) | |
30 | set(ORTP_SO_VERSION "13") # incremented on January 10, 2017 | |
31 | ||
32 | ||
33 | option(ENABLE_SHARED "Build shared library." YES) | |
34 | option(ENABLE_STATIC "Build static library." YES) | |
35 | option(ENABLE_DOC "Enable documentation generation with Doxygen." YES) | |
36 | option(ENABLE_NTP_TIMESTAMP "Turn on NTP timestamping on packet reception." NO) | |
37 | option(ENABLE_PERF "Disable costly features to reduce cpu consumtion and increase performance." NO) | |
38 | option(ENABLE_STRICT "Build with strict compile options." YES) | |
39 | option(ENABLE_TESTS "Enable compilation of test programs." NO) | |
40 | option(ENABLE_DEBUG_LOGS "Turn on or off debug level logs." NO) | |
41 | set(WITH_THREAD_STACK_SIZE "0" CACHE STRING "Set thread stack size (0 is the OS default).") | |
42 | ||
43 | ||
44 | include(CheckIncludeFile) | |
45 | include(CheckFunctionExists) | |
46 | include(GNUInstallDirs) | |
47 | ||
48 | ||
49 | if(NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX) | |
50 | set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) | |
51 | message(STATUS "Setting install rpath to ${CMAKE_INSTALL_RPATH}") | |
52 | endif() | |
53 | ||
54 | set(MSVC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/MSVC") | |
55 | if(MSVC) | |
56 | list(APPEND CMAKE_REQUIRED_INCLUDES "${MSVC_INCLUDE_DIR}") | |
57 | endif() | |
58 | ||
59 | find_package(Threads) | |
60 | find_library(LIBM NAMES m) | |
61 | ||
62 | if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) | |
63 | include("${EP_bctoolbox_CONFIG_DIR}/BcToolboxConfig.cmake") | |
64 | else() | |
65 | find_package(BcToolbox 0.2.0 REQUIRED) | |
66 | endif() | |
67 | ||
68 | add_subdirectory(build) | |
69 | ||
70 | check_include_file(sys/uio.h HAVE_SYS_UIO_H) | |
71 | check_include_file(sys/audio.h HAVE_SYS_AUDIO_H) | |
72 | if(NOT ANDROID) | |
73 | check_include_file(sys/shm.h HAVE_SYS_SHM_H) | |
74 | endif() | |
75 | check_include_file(stdatomic.h HAVE_STDATOMIC_H) | |
76 | check_function_exists(arc4random HAVE_ARC4RANDOM) | |
77 | ||
78 | include(TestBigEndian) | |
79 | test_big_endian(WORDS_BIGENDIAN) | |
80 | if(WORDS_BIGENDIAN) | |
81 | set(ORTP_BIGENDIAN 1) | |
82 | endif() | |
83 | ||
84 | ||
85 | include_directories( | |
86 | include/ | |
87 | src/ | |
88 | ${CMAKE_CURRENT_BINARY_DIR} | |
89 | ) | |
90 | if(MSVC) | |
91 | include_directories(${MSVC_INCLUDE_DIR}) | |
92 | endif() | |
93 | ||
94 | ||
95 | set(ORTP_CPPFLAGS ${BCTOOLBOX_CPPFLAGS}) | |
96 | if(ENABLE_STATIC) | |
97 | list(APPEND ORTP_CPPFLAGS "-DORTP_STATIC") | |
98 | endif() | |
99 | if(ENABLE_PERF) | |
100 | set(PERF 1) | |
101 | endif() | |
102 | if(ENABLE_NTP_TIMESTAMP) | |
103 | set(ORTP_TIMESTAMP 1) | |
104 | list(APPEND ORTP_CPPFLAGS "-DORTP_TIMESTAMP") | |
105 | endif() | |
106 | if(ENABLE_DEBUG_LOGS) | |
107 | set(ORTP_DEBUG_MODE 1) | |
108 | endif() | |
109 | if(CMAKE_USE_PTHREADS_INIT) | |
110 | set(ORTP_DEFAULT_THREAD_STACK_SIZE ${WITH_THREAD_STACK_SIZE}) | |
111 | endif() | |
112 | if(APPLE) | |
113 | set(__APPLE_USE_RFC_3542 1) | |
114 | endif() | |
115 | if(ORTP_CPPFLAGS) | |
116 | add_definitions(${ORTP_CPPFLAGS}) | |
117 | endif() | |
118 | set(POSIXTIMER_INTERVAL 10000) | |
119 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ortp-config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/ortp-config.h) | |
120 | set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/ortp-config.h PROPERTIES GENERATED ON) | |
121 | add_definitions(-DHAVE_CONFIG_H) | |
122 | ||
123 | set(STRICT_OPTIONS_CPP ) | |
124 | set(STRICT_OPTIONS_C ) | |
125 | if(MSVC) | |
126 | if(ENABLE_STRICT) | |
127 | list(APPEND STRICT_OPTIONS_CPP "/WX") | |
128 | endif() | |
129 | else() | |
130 | list(APPEND STRICT_OPTIONS_CPP "-Wall" "-Wuninitialized") | |
131 | list(APPEND STRICT_OPTIONS_C "-Wdeclaration-after-statement" "-Wstrict-prototypes" "-Wno-error=strict-prototypes") | |
132 | if(CMAKE_C_COMPILER_ID STREQUAL "Clang") | |
133 | list(APPEND STRICT_OPTIONS_CPP "-Qunused-arguments" "-Wno-array-bounds") | |
134 | endif() | |
135 | if(APPLE) | |
136 | list(APPEND STRICT_OPTIONS_CPP "-Wno-error=unknown-warning-option" "-Qunused-arguments" "-Wno-tautological-compare" "-Wno-unused-function" "-Wno-array-bounds") | |
137 | endif() | |
138 | if(ENABLE_STRICT) | |
139 | list(APPEND STRICT_OPTIONS_CPP "-Werror" "-Wextra" "-Wno-unused-parameter" "-Wno-missing-field-initializers" "-fno-strict-aliasing") | |
140 | endif() | |
141 | endif() | |
142 | if(STRICT_OPTIONS_CPP) | |
143 | list(REMOVE_DUPLICATES STRICT_OPTIONS_CPP) | |
144 | endif() | |
145 | if(STRICT_OPTIONS_C) | |
146 | list(REMOVE_DUPLICATES STRICT_OPTIONS_C) | |
147 | endif() | |
148 | ||
149 | ||
150 | if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) | |
151 | set(EXPORT_TARGETS_NAME "LinphoneBuilder") | |
152 | else() | |
153 | set(EXPORT_TARGETS_NAME "ORTP") | |
154 | endif() | |
155 | ||
156 | ||
157 | add_subdirectory(include) | |
158 | add_subdirectory(src) | |
159 | ||
160 | ||
161 | if(ENABLE_DOC) | |
162 | find_package(Doxygen) | |
163 | if(DOXYGEN_FOUND) | |
164 | set(srcdir ${CMAKE_CURRENT_SOURCE_DIR}) | |
165 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ortp.doxygen.in ${CMAKE_CURRENT_BINARY_DIR}/ortp.doxygen) | |
166 | file(GLOB DOC_INPUT_FILES | |
167 | include/ortp/[^.]*.h | |
168 | src/[^.]*.h | |
169 | src/[^.]*.c | |
170 | ) | |
171 | add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/doc/html/index.html" | |
172 | COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/ortp.doxygen | |
173 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ortp.doxygen ${DOC_INPUT_FILES} | |
174 | ) | |
175 | add_custom_target(ortp-html-doc ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/doc/html/index.html") | |
176 | install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doc/html" | |
177 | DESTINATION "${CMAKE_INSTALL_DATADIR}/doc/ortp-${ORTP_VERSION}") | |
178 | endif() | |
179 | endif() | |
180 | ||
181 | ||
182 | ||
183 | ||
184 | set(prefix ${CMAKE_INSTALL_PREFIX}) | |
185 | set(exec_prefix ${prefix}/bin) | |
186 | set(libdir ${prefix}/lib) | |
187 | set(includedir ${prefix}/include) | |
188 | set(ORTP_PKGCONFIG_VERSION "${ORTP_VERSION}") | |
189 | set(ORTPDEPS_LIBS ) | |
190 | ||
191 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ortp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/ortp.pc) | |
192 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ortp.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") | |
193 | ||
194 | include(CMakePackageConfigHelpers) | |
195 | write_basic_package_version_file( | |
196 | "${CMAKE_CURRENT_BINARY_DIR}/ORTPConfigVersion.cmake" | |
197 | VERSION ${ORTP_VERSION} | |
198 | COMPATIBILITY AnyNewerVersion | |
199 | ) | |
200 | export(EXPORT ${EXPORT_TARGETS_NAME}Targets | |
201 | FILE "${CMAKE_CURRENT_BINARY_DIR}/ORTPTargets.cmake" | |
202 | ) | |
203 | configure_file(ORTPConfig.cmake.in | |
204 | "${CMAKE_CURRENT_BINARY_DIR}/ORTPConfig.cmake" | |
205 | @ONLY | |
206 | ) | |
207 | ||
208 | set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake") | |
209 | install(EXPORT ${EXPORT_TARGETS_NAME}Targets | |
210 | FILE ORTPTargets.cmake | |
211 | DESTINATION ${CONFIG_PACKAGE_LOCATION} | |
212 | ) | |
213 | install(FILES | |
214 | "${CMAKE_CURRENT_BINARY_DIR}/ORTPConfig.cmake" | |
215 | "${CMAKE_CURRENT_BINARY_DIR}/ORTPConfigVersion.cmake" | |
216 | DESTINATION ${CONFIG_PACKAGE_LOCATION} | |
217 | ) | |
218 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/README.md" | |
219 | "${CMAKE_CURRENT_SOURCE_DIR}/ChangeLog" | |
220 | "${CMAKE_CURRENT_SOURCE_DIR}/COPYING" | |
221 | "${CMAKE_CURRENT_SOURCE_DIR}/AUTHORS" | |
222 | DESTINATION "${CMAKE_INSTALL_DATADIR}/doc/ortp-${ORTP_VERSION}") | |
223 | ||
224 | ||
0 | ############################################################################ | |
1 | # CMakeLists.txt | |
2 | # Copyright (C) 2010-2019 Belledonne Communications, Grenoble France | |
3 | # | |
4 | ############################################################################ | |
5 | # | |
6 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; either version 2 | |
9 | # of the License, or (at your option) any later version. | |
10 | # | |
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | # | |
20 | ############################################################################ | |
21 | ||
22 | cmake_minimum_required(VERSION 3.11) # we need CMake 3.11 for defining 'package_source' target as custom target | |
23 | project(oRTP VERSION 4.3.0) | |
24 | ||
25 | ||
26 | set(ORTP_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}) | |
27 | set(ORTP_MINOR_VERSION ${PROJECT_VERSION_MINOR}) | |
28 | set(ORTP_MICRO_VERSION ${PROJECT_VERSION_PATCH}) | |
29 | set(ORTP_VERSION ${PROJECT_VERSION}) | |
30 | set(ORTP_SO_VERSION "14") # incremented on September 17, 2019 | |
31 | ||
32 | ||
33 | option(ENABLE_SHARED "Build shared library." YES) | |
34 | option(ENABLE_STATIC "Build static library." YES) | |
35 | option(ENABLE_DOC "Enable documentation generation with Doxygen." YES) | |
36 | option(ENABLE_NTP_TIMESTAMP "Turn on NTP timestamping on packet reception." NO) | |
37 | option(ENABLE_PERF "Disable costly features to reduce cpu consumtion and increase performance." NO) | |
38 | option(ENABLE_STRICT "Build with strict compile options." YES) | |
39 | option(ENABLE_TESTS "Enable compilation of test programs." NO) | |
40 | option(ENABLE_DEBUG_LOGS "Turn on or off debug level logs." NO) | |
41 | set(WITH_THREAD_STACK_SIZE "0" CACHE STRING "Set thread stack size (0 is the OS default).") | |
42 | ||
43 | ||
44 | include(CheckIncludeFile) | |
45 | include(CheckFunctionExists) | |
46 | include(GNUInstallDirs) | |
47 | include(CheckCSourceCompiles) | |
48 | include(CheckSymbolExists) | |
49 | ||
50 | if(NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX) | |
51 | set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) | |
52 | message(STATUS "Setting install rpath to ${CMAKE_INSTALL_RPATH}") | |
53 | endif() | |
54 | ||
55 | set(MSVC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/MSVC") | |
56 | if(MSVC) | |
57 | list(APPEND CMAKE_REQUIRED_INCLUDES "${MSVC_INCLUDE_DIR}") | |
58 | endif() | |
59 | ||
60 | find_package(Threads) | |
61 | find_library(LIBM NAMES m) | |
62 | ||
63 | find_package(bctoolbox 0.2.0 REQUIRED) | |
64 | ||
65 | check_include_file(sys/uio.h HAVE_SYS_UIO_H) | |
66 | check_include_file(sys/audio.h HAVE_SYS_AUDIO_H) | |
67 | if(NOT ANDROID) | |
68 | check_include_file(sys/shm.h HAVE_SYS_SHM_H) | |
69 | endif() | |
70 | check_c_source_compiles("#include <stdatomic.h> | |
71 | int main(int argc, char *argv[]) { | |
72 | atomic_int currrent_ref; | |
73 | atomic_init(&currrent_ref, 1); | |
74 | atomic_int previous_ref = atomic_fetch_sub_explicit(&currrent_ref, 1, memory_order_release); | |
75 | return 0; | |
76 | }" | |
77 | HAVE_STDATOMIC_H) | |
78 | ||
79 | check_function_exists(arc4random HAVE_ARC4RANDOM) | |
80 | check_symbol_exists(recvmsg "sys/socket.h" HAVE_RECVMSG) | |
81 | check_symbol_exists(sendmsg "sys/socket.h" HAVE_SENDMSG) | |
82 | ||
83 | include(TestBigEndian) | |
84 | test_big_endian(WORDS_BIGENDIAN) | |
85 | if(WORDS_BIGENDIAN) | |
86 | set(ORTP_BIGENDIAN 1) | |
87 | endif() | |
88 | ||
89 | ||
90 | include_directories( | |
91 | include/ | |
92 | src/ | |
93 | ${CMAKE_CURRENT_BINARY_DIR} | |
94 | ) | |
95 | if(MSVC) | |
96 | include_directories(${MSVC_INCLUDE_DIR}) | |
97 | endif() | |
98 | ||
99 | ||
100 | set(ORTP_CPPFLAGS ${BCTOOLBOX_CPPFLAGS}) | |
101 | if(ENABLE_STATIC) | |
102 | list(APPEND ORTP_CPPFLAGS "-DORTP_STATIC") | |
103 | endif() | |
104 | if(ENABLE_PERF) | |
105 | set(PERF 1) | |
106 | endif() | |
107 | if(ENABLE_NTP_TIMESTAMP) | |
108 | set(ORTP_TIMESTAMP 1) | |
109 | list(APPEND ORTP_CPPFLAGS "-DORTP_TIMESTAMP") | |
110 | endif() | |
111 | if(ENABLE_DEBUG_LOGS) | |
112 | set(ORTP_DEBUG_MODE 1) | |
113 | endif() | |
114 | if(CMAKE_USE_PTHREADS_INIT) | |
115 | set(ORTP_DEFAULT_THREAD_STACK_SIZE ${WITH_THREAD_STACK_SIZE}) | |
116 | endif() | |
117 | if(APPLE) | |
118 | set(__APPLE_USE_RFC_3542 1) | |
119 | endif() | |
120 | if(ORTP_CPPFLAGS) | |
121 | add_definitions(${ORTP_CPPFLAGS}) | |
122 | endif() | |
123 | set(POSIXTIMER_INTERVAL 10000) | |
124 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ortp-config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/ortp-config.h) | |
125 | set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/ortp-config.h PROPERTIES GENERATED ON) | |
126 | add_definitions(-DHAVE_CONFIG_H) | |
127 | ||
128 | set(STRICT_OPTIONS_CPP ) | |
129 | set(STRICT_OPTIONS_C ) | |
130 | if(MSVC) | |
131 | if(ENABLE_STRICT) | |
132 | list(APPEND STRICT_OPTIONS_CPP "/WX") | |
133 | endif() | |
134 | add_definitions(-D_CRT_SECURE_NO_WARNINGS) | |
135 | else() | |
136 | list(APPEND STRICT_OPTIONS_CPP "-Wall" "-Wuninitialized") | |
137 | list(APPEND STRICT_OPTIONS_C "-Wdeclaration-after-statement" "-Wstrict-prototypes" "-Wno-error=strict-prototypes") | |
138 | if(CMAKE_C_COMPILER_ID MATCHES "Clang") | |
139 | list(APPEND STRICT_OPTIONS_CPP "-Qunused-arguments" "-Wno-array-bounds") | |
140 | endif() | |
141 | if(APPLE) | |
142 | list(APPEND STRICT_OPTIONS_CPP "-Wno-error=unknown-warning-option" "-Qunused-arguments" "-Wno-tautological-compare" "-Wno-unused-function" "-Wno-array-bounds") | |
143 | endif() | |
144 | if(ENABLE_STRICT) | |
145 | list(APPEND STRICT_OPTIONS_CPP "-Werror" "-Wextra" "-Wno-unused-parameter" "-Wno-missing-field-initializers" "-fno-strict-aliasing") | |
146 | endif() | |
147 | endif() | |
148 | if(STRICT_OPTIONS_CPP) | |
149 | list(REMOVE_DUPLICATES STRICT_OPTIONS_CPP) | |
150 | endif() | |
151 | if(STRICT_OPTIONS_C) | |
152 | list(REMOVE_DUPLICATES STRICT_OPTIONS_C) | |
153 | endif() | |
154 | ||
155 | set(EXPORT_TARGET_NAME ortp) | |
156 | ||
157 | add_subdirectory(include) | |
158 | add_subdirectory(src) | |
159 | ||
160 | ||
161 | if(ENABLE_DOC) | |
162 | find_package(Doxygen) | |
163 | if(DOXYGEN_FOUND) | |
164 | set(srcdir ${CMAKE_CURRENT_SOURCE_DIR}) | |
165 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ortp.doxygen.in ${CMAKE_CURRENT_BINARY_DIR}/ortp.doxygen) | |
166 | file(GLOB DOC_INPUT_FILES | |
167 | include/ortp/[^.]*.h | |
168 | src/[^.]*.h | |
169 | src/[^.]*.c | |
170 | ) | |
171 | add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/doc/html/index.html" | |
172 | COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/ortp.doxygen | |
173 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ortp.doxygen ${DOC_INPUT_FILES} | |
174 | ) | |
175 | add_custom_target(ortp-html-doc ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/doc/html/index.html") | |
176 | install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doc/html" | |
177 | DESTINATION "${CMAKE_INSTALL_DATADIR}/doc/ortp-${ORTP_VERSION}") | |
178 | endif() | |
179 | endif() | |
180 | ||
181 | ||
182 | ||
183 | ||
184 | set(prefix ${CMAKE_INSTALL_PREFIX}) | |
185 | set(exec_prefix ${prefix}/bin) | |
186 | set(libdir ${prefix}/lib) | |
187 | set(includedir ${prefix}/include) | |
188 | set(ORTP_PKGCONFIG_VERSION "${ORTP_VERSION}") | |
189 | set(ORTPDEPS_LIBS ) | |
190 | ||
191 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ortp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/ortp.pc) | |
192 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ortp.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") | |
193 | ||
194 | add_subdirectory(build) | |
195 | ||
196 | include(CMakePackageConfigHelpers) | |
197 | ||
198 | set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_TARGET_NAME}") | |
199 | ||
200 | write_basic_package_version_file( | |
201 | "${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_TARGET_NAME}ConfigVersion.cmake" | |
202 | VERSION ${ORTP_VERSION} | |
203 | COMPATIBILITY AnyNewerVersion | |
204 | ) | |
205 | export(EXPORT "${EXPORT_TARGET_NAME}Targets" | |
206 | FILE "${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_TARGET_NAME}Targets.cmake" | |
207 | ) | |
208 | ||
209 | configure_package_config_file(ORTPConfig.cmake.in | |
210 | "${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_TARGET_NAME}Config.cmake" | |
211 | INSTALL_DESTINATION ${CONFIG_PACKAGE_LOCATION} | |
212 | NO_SET_AND_CHECK_MACRO | |
213 | ) | |
214 | ||
215 | install(EXPORT ${EXPORT_TARGET_NAME}Targets | |
216 | FILE "${EXPORT_TARGET_NAME}Targets.cmake" | |
217 | DESTINATION ${CONFIG_PACKAGE_LOCATION} | |
218 | ) | |
219 | ||
220 | install(FILES | |
221 | "${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_TARGET_NAME}Config.cmake" | |
222 | "${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_TARGET_NAME}ConfigVersion.cmake" | |
223 | DESTINATION ${CONFIG_PACKAGE_LOCATION} | |
224 | ) | |
225 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/README.md" | |
226 | "${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG.md" | |
227 | "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt" | |
228 | "${CMAKE_CURRENT_SOURCE_DIR}/AUTHORS.md" | |
229 | DESTINATION "${CMAKE_INSTALL_DATADIR}/doc/ortp-${ORTP_VERSION}" | |
230 | ) |
0 | GNU GENERAL PUBLIC LICENSE | |
1 | Version 2, June 1991 | |
2 | ||
3 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. | |
4 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
5 | Everyone is permitted to copy and distribute verbatim copies | |
6 | of this license document, but changing it is not allowed. | |
7 | ||
8 | Preamble | |
9 | ||
10 | The licenses for most software are designed to take away your | |
11 | freedom to share and change it. By contrast, the GNU General Public | |
12 | License is intended to guarantee your freedom to share and change free | |
13 | software--to make sure the software is free for all its users. This | |
14 | General Public License applies to most of the Free Software | |
15 | Foundation's software and to any other program whose authors commit to | |
16 | using it. (Some other Free Software Foundation software is covered by | |
17 | the GNU Library General Public License instead.) You can apply it to | |
18 | your programs, too. | |
19 | ||
20 | When we speak of free software, we are referring to freedom, not | |
21 | price. Our General Public Licenses are designed to make sure that you | |
22 | have the freedom to distribute copies of free software (and charge for | |
23 | this service if you wish), that you receive source code or can get it | |
24 | if you want it, that you can change the software or use pieces of it | |
25 | in new free programs; and that you know you can do these things. | |
26 | ||
27 | To protect your rights, we need to make restrictions that forbid | |
28 | anyone to deny you these rights or to ask you to surrender the rights. | |
29 | These restrictions translate to certain responsibilities for you if you | |
30 | distribute copies of the software, or if you modify it. | |
31 | ||
32 | For example, if you distribute copies of such a program, whether | |
33 | gratis or for a fee, you must give the recipients all the rights that | |
34 | you have. You must make sure that they, too, receive or can get the | |
35 | source code. And you must show them these terms so they know their | |
36 | rights. | |
37 | ||
38 | We protect your rights with two steps: (1) copyright the software, and | |
39 | (2) offer you this license which gives you legal permission to copy, | |
40 | distribute and/or modify the software. | |
41 | ||
42 | Also, for each author's protection and ours, we want to make certain | |
43 | that everyone understands that there is no warranty for this free | |
44 | software. If the software is modified by someone else and passed on, we | |
45 | want its recipients to know that what they have is not the original, so | |
46 | that any problems introduced by others will not reflect on the original | |
47 | authors' reputations. | |
48 | ||
49 | Finally, any free program is threatened constantly by software | |
50 | patents. We wish to avoid the danger that redistributors of a free | |
51 | program will individually obtain patent licenses, in effect making the | |
52 | program proprietary. To prevent this, we have made it clear that any | |
53 | patent must be licensed for everyone's free use or not licensed at all. | |
54 | ||
55 | The precise terms and conditions for copying, distribution and | |
56 | modification follow. | |
57 | ||
58 | GNU GENERAL PUBLIC LICENSE | |
59 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
60 | ||
61 | 0. This License applies to any program or other work which contains | |
62 | a notice placed by the copyright holder saying it may be distributed | |
63 | under the terms of this General Public License. The "Program", below, | |
64 | refers to any such program or work, and a "work based on the Program" | |
65 | means either the Program or any derivative work under copyright law: | |
66 | that is to say, a work containing the Program or a portion of it, | |
67 | either verbatim or with modifications and/or translated into another | |
68 | language. (Hereinafter, translation is included without limitation in | |
69 | the term "modification".) Each licensee is addressed as "you". | |
70 | ||
71 | Activities other than copying, distribution and modification are not | |
72 | covered by this License; they are outside its scope. The act of | |
73 | running the Program is not restricted, and the output from the Program | |
74 | is covered only if its contents constitute a work based on the | |
75 | Program (independent of having been made by running the Program). | |
76 | Whether that is true depends on what the Program does. | |
77 | ||
78 | 1. You may copy and distribute verbatim copies of the Program's | |
79 | source code as you receive it, in any medium, provided that you | |
80 | conspicuously and appropriately publish on each copy an appropriate | |
81 | copyright notice and disclaimer of warranty; keep intact all the | |
82 | notices that refer to this License and to the absence of any warranty; | |
83 | and give any other recipients of the Program a copy of this License | |
84 | along with the Program. | |
85 | ||
86 | You may charge a fee for the physical act of transferring a copy, and | |
87 | you may at your option offer warranty protection in exchange for a fee. | |
88 | ||
89 | 2. You may modify your copy or copies of the Program or any portion | |
90 | of it, thus forming a work based on the Program, and copy and | |
91 | distribute such modifications or work under the terms of Section 1 | |
92 | above, provided that you also meet all of these conditions: | |
93 | ||
94 | a) You must cause the modified files to carry prominent notices | |
95 | stating that you changed the files and the date of any change. | |
96 | ||
97 | b) You must cause any work that you distribute or publish, that in | |
98 | whole or in part contains or is derived from the Program or any | |
99 | part thereof, to be licensed as a whole at no charge to all third | |
100 | parties under the terms of this License. | |
101 | ||
102 | c) If the modified program normally reads commands interactively | |
103 | when run, you must cause it, when started running for such | |
104 | interactive use in the most ordinary way, to print or display an | |
105 | announcement including an appropriate copyright notice and a | |
106 | notice that there is no warranty (or else, saying that you provide | |
107 | a warranty) and that users may redistribute the program under | |
108 | these conditions, and telling the user how to view a copy of this | |
109 | License. (Exception: if the Program itself is interactive but | |
110 | does not normally print such an announcement, your work based on | |
111 | the Program is not required to print an announcement.) | |
112 | ||
113 | These requirements apply to the modified work as a whole. If | |
114 | identifiable sections of that work are not derived from the Program, | |
115 | and can be reasonably considered independent and separate works in | |
116 | themselves, then this License, and its terms, do not apply to those | |
117 | sections when you distribute them as separate works. But when you | |
118 | distribute the same sections as part of a whole which is a work based | |
119 | on the Program, the distribution of the whole must be on the terms of | |
120 | this License, whose permissions for other licensees extend to the | |
121 | entire whole, and thus to each and every part regardless of who wrote it. | |
122 | ||
123 | Thus, it is not the intent of this section to claim rights or contest | |
124 | your rights to work written entirely by you; rather, the intent is to | |
125 | exercise the right to control the distribution of derivative or | |
126 | collective works based on the Program. | |
127 | ||
128 | In addition, mere aggregation of another work not based on the Program | |
129 | with the Program (or with a work based on the Program) on a volume of | |
130 | a storage or distribution medium does not bring the other work under | |
131 | the scope of this License. | |
132 | ||
133 | 3. You may copy and distribute the Program (or a work based on it, | |
134 | under Section 2) in object code or executable form under the terms of | |
135 | Sections 1 and 2 above provided that you also do one of the following: | |
136 | ||
137 | a) Accompany it with the complete corresponding machine-readable | |
138 | source code, which must be distributed under the terms of Sections | |
139 | 1 and 2 above on a medium customarily used for software interchange; or, | |
140 | ||
141 | b) Accompany it with a written offer, valid for at least three | |
142 | years, to give any third party, for a charge no more than your | |
143 | cost of physically performing source distribution, a complete | |
144 | machine-readable copy of the corresponding source code, to be | |
145 | distributed under the terms of Sections 1 and 2 above on a medium | |
146 | customarily used for software interchange; or, | |
147 | ||
148 | c) Accompany it with the information you received as to the offer | |
149 | to distribute corresponding source code. (This alternative is | |
150 | allowed only for noncommercial distribution and only if you | |
151 | received the program in object code or executable form with such | |
152 | an offer, in accord with Subsection b above.) | |
153 | ||
154 | The source code for a work means the preferred form of the work for | |
155 | making modifications to it. For an executable work, complete source | |
156 | code means all the source code for all modules it contains, plus any | |
157 | associated interface definition files, plus the scripts used to | |
158 | control compilation and installation of the executable. However, as a | |
159 | special exception, the source code distributed need not include | |
160 | anything that is normally distributed (in either source or binary | |
161 | form) with the major components (compiler, kernel, and so on) of the | |
162 | operating system on which the executable runs, unless that component | |
163 | itself accompanies the executable. | |
164 | ||
165 | If distribution of executable or object code is made by offering | |
166 | access to copy from a designated place, then offering equivalent | |
167 | access to copy the source code from the same place counts as | |
168 | distribution of the source code, even though third parties are not | |
169 | compelled to copy the source along with the object code. | |
170 | ||
171 | 4. You may not copy, modify, sublicense, or distribute the Program | |
172 | except as expressly provided under this License. Any attempt | |
173 | otherwise to copy, modify, sublicense or distribute the Program is | |
174 | void, and will automatically terminate your rights under this License. | |
175 | However, parties who have received copies, or rights, from you under | |
176 | this License will not have their licenses terminated so long as such | |
177 | parties remain in full compliance. | |
178 | ||
179 | 5. You are not required to accept this License, since you have not | |
180 | signed it. However, nothing else grants you permission to modify or | |
181 | distribute the Program or its derivative works. These actions are | |
182 | prohibited by law if you do not accept this License. Therefore, by | |
183 | modifying or distributing the Program (or any work based on the | |
184 | Program), you indicate your acceptance of this License to do so, and | |
185 | all its terms and conditions for copying, distributing or modifying | |
186 | the Program or works based on it. | |
187 | ||
188 | 6. Each time you redistribute the Program (or any work based on the | |
189 | Program), the recipient automatically receives a license from the | |
190 | original licensor to copy, distribute or modify the Program subject to | |
191 | these terms and conditions. You may not impose any further | |
192 | restrictions on the recipients' exercise of the rights granted herein. | |
193 | You are not responsible for enforcing compliance by third parties to | |
194 | this License. | |
195 | ||
196 | 7. If, as a consequence of a court judgment or allegation of patent | |
197 | infringement or for any other reason (not limited to patent issues), | |
198 | conditions are imposed on you (whether by court order, agreement or | |
199 | otherwise) that contradict the conditions of this License, they do not | |
200 | excuse you from the conditions of this License. If you cannot | |
201 | distribute so as to satisfy simultaneously your obligations under this | |
202 | License and any other pertinent obligations, then as a consequence you | |
203 | may not distribute the Program at all. For example, if a patent | |
204 | license would not permit royalty-free redistribution of the Program by | |
205 | all those who receive copies directly or indirectly through you, then | |
206 | the only way you could satisfy both it and this License would be to | |
207 | refrain entirely from distribution of the Program. | |
208 | ||
209 | If any portion of this section is held invalid or unenforceable under | |
210 | any particular circumstance, the balance of the section is intended to | |
211 | apply and the section as a whole is intended to apply in other | |
212 | circumstances. | |
213 | ||
214 | It is not the purpose of this section to induce you to infringe any | |
215 | patents or other property right claims or to contest validity of any | |
216 | such claims; this section has the sole purpose of protecting the | |
217 | integrity of the free software distribution system, which is | |
218 | implemented by public license practices. Many people have made | |
219 | generous contributions to the wide range of software distributed | |
220 | through that system in reliance on consistent application of that | |
221 | system; it is up to the author/donor to decide if he or she is willing | |
222 | to distribute software through any other system and a licensee cannot | |
223 | impose that choice. | |
224 | ||
225 | This section is intended to make thoroughly clear what is believed to | |
226 | be a consequence of the rest of this License. | |
227 | ||
228 | 8. If the distribution and/or use of the Program is restricted in | |
229 | certain countries either by patents or by copyrighted interfaces, the | |
230 | original copyright holder who places the Program under this License | |
231 | may add an explicit geographical distribution limitation excluding | |
232 | those countries, so that distribution is permitted only in or among | |
233 | countries not thus excluded. In such case, this License incorporates | |
234 | the limitation as if written in the body of this License. | |
235 | ||
236 | 9. The Free Software Foundation may publish revised and/or new versions | |
237 | of the General Public License from time to time. Such new versions will | |
238 | be similar in spirit to the present version, but may differ in detail to | |
239 | address new problems or concerns. | |
240 | ||
241 | Each version is given a distinguishing version number. If the Program | |
242 | specifies a version number of this License which applies to it and "any | |
243 | later version", you have the option of following the terms and conditions | |
244 | either of that version or of any later version published by the Free | |
245 | Software Foundation. If the Program does not specify a version number of | |
246 | this License, you may choose any version ever published by the Free Software | |
247 | Foundation. | |
248 | ||
249 | 10. If you wish to incorporate parts of the Program into other free | |
250 | programs whose distribution conditions are different, write to the author | |
251 | to ask for permission. For software which is copyrighted by the Free | |
252 | Software Foundation, write to the Free Software Foundation; we sometimes | |
253 | make exceptions for this. Our decision will be guided by the two goals | |
254 | of preserving the free status of all derivatives of our free software and | |
255 | of promoting the sharing and reuse of software generally. | |
256 | ||
257 | NO WARRANTY | |
258 | ||
259 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY | |
260 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN | |
261 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES | |
262 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED | |
263 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
264 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS | |
265 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE | |
266 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, | |
267 | REPAIR OR CORRECTION. | |
268 | ||
269 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | |
270 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR | |
271 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, | |
272 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING | |
273 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED | |
274 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY | |
275 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER | |
276 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE | |
277 | POSSIBILITY OF SUCH DAMAGES. | |
278 | ||
279 | END OF TERMS AND CONDITIONS | |
280 | ||
281 | How to Apply These Terms to Your New Programs | |
282 | ||
283 | If you develop a new program, and you want it to be of the greatest | |
284 | possible use to the public, the best way to achieve this is to make it | |
285 | free software which everyone can redistribute and change under these terms. | |
286 | ||
287 | To do so, attach the following notices to the program. It is safest | |
288 | to attach them to the start of each source file to most effectively | |
289 | convey the exclusion of warranty; and each file should have at least | |
290 | the "copyright" line and a pointer to where the full notice is found. | |
291 | ||
292 | <one line to give the program's name and a brief idea of what it does.> | |
293 | Copyright (C) <year> <name of author> | |
294 | ||
295 | This program is free software; you can redistribute it and/or modify | |
296 | it under the terms of the GNU General Public License as published by | |
297 | the Free Software Foundation; either version 2 of the License, or | |
298 | (at your option) any later version. | |
299 | ||
300 | This program is distributed in the hope that it will be useful, | |
301 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
302 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
303 | GNU General Public License for more details. | |
304 | ||
305 | You should have received a copy of the GNU General Public License | |
306 | along with this program; if not, write to the Free Software | |
307 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
308 | ||
309 | ||
310 | Also add information on how to contact you by electronic and paper mail. | |
311 | ||
312 | If the program is interactive, make it output a short notice like this | |
313 | when it starts in an interactive mode: | |
314 | ||
315 | Gnomovision version 69, Copyright (C) year name of author | |
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | |
317 | This is free software, and you are welcome to redistribute it | |
318 | under certain conditions; type `show c' for details. | |
319 | ||
320 | The hypothetical commands `show w' and `show c' should show the appropriate | |
321 | parts of the General Public License. Of course, the commands you use may | |
322 | be called something other than `show w' and `show c'; they could even be | |
323 | mouse-clicks or menu items--whatever suits your program. | |
324 | ||
325 | You should also get your employer (if you work as a programmer) or your | |
326 | school, if any, to sign a "copyright disclaimer" for the program, if | |
327 | necessary. Here is a sample; alter the names: | |
328 | ||
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program | |
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. | |
331 | ||
332 | <signature of Ty Coon>, 1 April 1989 | |
333 | Ty Coon, President of Vice | |
334 | ||
335 | This General Public License does not permit incorporating your program into | |
336 | proprietary programs. If your program is a subroutine library, you may | |
337 | consider it more useful to permit linking proprietary applications with the | |
338 | library. If this is what you want to do, use the GNU Library General | |
339 | Public License instead of this License. |
0 | 2007-07-26 Francois-Xavier Kowalski <fix@hp.com> | |
1 | ||
2 | * pkg.list: 1.3 | |
3 | Do not run makewhatis when installing EPM-generated package. | |
4 | ||
5 | 2007-04-19 Francois-Xavier Kowalski <fix@hp.com> | |
6 | ||
7 | * ortp.spec.in (Requires): 1.4 | |
8 | Adapt to new documentation generation change from gtk-doc to | |
9 | Doxygen. | |
10 | ||
11 | * Makefile.am (docdir): 1.27 | |
12 | automake's docdir is not always defined & is generally not | |
13 | package specific, so we manually define docdir & pkgdocdir. | |
14 | ||
15 | 2007-03-01 Francois-Xavier Kowalski <fix@hp.com> | |
16 | ||
17 | * include/ortp/payloadtype.h: 1.28 | |
18 | Encompass every declaration (whether lvalue or not) under extern | |
19 | "C". | |
20 | ||
21 | 2007-01-18 Francois-Xavier Kowalski <fix@hp.com> | |
22 | ||
23 | * oRTP/Makefile.am: 1.24 | |
24 | Fix RPM package generattion to cope with | |
25 | <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=206841> | |
26 | ||
27 | 2006-10-24 Francois-Xavier 'FiX' KOWALSKI <fix@hp.com> | |
28 | ||
29 | * include/ortp/port.h: 1.21 | |
30 | * src/scheduler.h (ortp_get_scheduler): 1.13 | |
31 | Disable some Intel C/C++ warnings to build with icc. | |
32 | ||
33 | * include/ortp/stun_udp.h (__STUN_UDP_H__): 1.6 | |
34 | * include/ortp/stun.h: 1.6 | |
35 | Use <ortp/port.h> | |
36 | ||
37 | 2006-07-10 Francois-Xavier 'FiX' KOWALSKI <fix@hp.com> | |
38 | ||
39 | * configure.ac: 1.89 | |
40 | * gtk-doc.make (dist-check-gtkdoc): 1.1 | |
41 | Non-fatal but incomplete "make dist" when gtk-doc is not | |
42 | installed. | |
43 | ||
44 | 2006-07-07 Francois-Xavier 'FiX' KOWALSKI <fix@hp.com> | |
45 | ||
46 | * src/avprofile.c (NORMAL_BITRATE): 1.27 | |
47 | Use ISO C/99 tagged struct syntax rather than GCC's legacy one. | |
48 | ||
49 | 2006-07-07 Francois-Xavier Kowalski <fix@hp.com> | |
50 | ||
51 | * src/rtpsession.c (RTP_SEQ_IS_GREATER): 1.132 | |
52 | Fix comment content (using <>) that breaks gtkdoc SGML | |
53 | generation. | |
54 | ||
55 | * include/ortp/event.h: 1.3 | |
56 | OrtpEventData cannot be a type a s struct at the same time. | |
57 | ||
58 | * ortp.spec.in (Requires): 1.2 | |
59 | Drop glib option | |
60 | ||
61 | * gtk-doc.make: | |
62 | * docs/Makefile.am (#DOC_MAIN_SGML_FILE): 1.7 | |
63 | * Makefile.am | |
64 | Use slightly modified gtkdocize. | |
65 | ||
66 | * ortp.spec.in (Requires): 1.2 | |
67 | Force build of gtk-doc, as the default choice that comes with | |
68 | GTK_DOC_CHECK m4 macro is "no". | |
69 | ||
70 | 2006-07-06 Francois-Xavier Kowalski <fix@hp.com> | |
71 | ||
72 | * src/payloadtype.c (rtp_profile_destroy): 1.20 | |
73 | avoid double-free | |
74 | ||
75 | * configure.ac: 1.88 | |
76 | ortp-0.10.1.1 | |
77 | ||
78 | Friday March 10 2006 : ortp-0.9.1 | |
79 | - fix package name (was 0.9.0.) | |
80 | ||
81 | Wednesday March 8 2006 : ortp-0.9.0 | |
82 | - a lot of cleanups, glib dropped, win32 port reactivated | |
83 | ||
84 | Tuesday December 20 2005 : ortp-0.8.1 | |
85 | - change session's clockrate dependant parameters upon payload type changed events at socket level | |
86 | - rtp_session_set_recv_buf_size() added. | |
87 | - bugfix in rtp_session_set_remote_addr() | |
88 | - memory leak fixed in rtp_profile_destroy() | |
89 | ||
90 | Wednesday December 07 2005: ortp-0.8.0 | |
91 | - make package modifications | |
92 | - make rpm added | |
93 | - add support for different payload types for incoming and outgoing stream (which breaks api compatibility) | |
94 | - prefix all PayloadType with payload_type_* to avoid naming conflicts | |
95 | ||
96 | Wednesday August 24 2005: ortp-0.7.1 | |
97 | - added patch for pkgconfig support from Jean-Philippe Barrette-LaPierre | |
98 | ||
99 | Monday August 8 2005: ortp-0.7.1pre5 | |
100 | - adaptive jitter buffer improvements | |
101 | - timestamp compensated packets returned by rtp_session_recvm_with_ts | |
102 | - new payload definitions. | |
103 | ||
104 | Tuesday August 2 2005: ortp-0.7.1pre4 | |
105 | - adaptive jitter buffer cleanups. | |
106 | - hton24 utility function added for RTCP | |
107 | ||
108 | Tuesday July 4 2005: ortp-0.7.1pre3 | |
109 | - improve automatic jitter buffer: no more closed-loop; just estimation. | |
110 | - merge patch for multicast from Samuel Thibault | |
111 | - merge patch for parsing of rtcp packets from Nicola Baldo | |
112 | - add static payload definitions for g723.1 and g729. | |
113 | ||
114 | Wednesday November 17 2004: ortp-0.7.0 series starts | |
115 | - add automatic jitter buffer: | |
116 | * compensate clock slides | |
117 | * estimate the jitter and sets the minimum jitter compensation delay accordingly | |
118 | - posix timer simplified | |
119 | - less system calls: use non blocking recv() and don't use select() or poll() | |
120 | - add new functions for optimized packet sending | |
121 | - recv() and send() are always made within the rtp_session_recv..() and rtp_session_send..() | |
122 | functions. That means that scheduled non blocking mode does no more work as it worked before, ie | |
123 | that packet will be sent immediately rather than being sent on time by the scheduler as it was before. | |
124 | - HPUX kernel target removed. | |
125 | - scheduler always built. | |
126 | ||
127 | Tuesday August 12 2003 : ortp-0.6.3 | |
128 | - some improvements by Aymeric Moizard for Win32 build | |
129 | - some bug fixes concerning ipv6 support. | |
130 | ||
131 | Thursday August 7 2003 : ortp-0.6.2 | |
132 | - just some minor improvements for using oRTP in a C++ environment. | |
133 | ||
134 | Wednesday January 8 2003: ortp-0.6.0 | |
135 | - many bug fixes by Telisma: the most important bug concerned the windows port. | |
136 | - some new functionnalities concerning the RTP profiles and payload management. | |
137 | - ported to glib-2.0 . | |
138 | ||
139 | Monday September 23 2002: ortp-0.5.0 | |
140 | - ortp has been ported to the Microsoft Windows OS (version 2000 and later) by Eloquant | |
141 | (http://www.eloquant.com) | |
142 | - some bug fixes and improvements of the windows port have been made by Telisma | |
143 | (http://www.telisma.com) | |
144 | ||
145 | Wednesday June 5 2002: ortp-0.4.4 | |
146 | - Some crashing bugs fixed. | |
147 | ||
148 | Wednesday May 15 2002: ortp-0.4.3 | |
149 | - Install include files properly. | |
150 | ||
151 | Tuesday May 7 2002: ortp-0.4.2 | |
152 | - First official and public release of oRTP. |
0 | GNU GENERAL PUBLIC LICENSE | |
1 | Version 3, 29 June 2007 | |
2 | ||
3 | Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> | |
4 | Everyone is permitted to copy and distribute verbatim copies | |
5 | of this license document, but changing it is not allowed. | |
6 | ||
7 | Preamble | |
8 | ||
9 | The GNU General Public License is a free, copyleft license for | |
10 | software and other kinds of works. | |
11 | ||
12 | The licenses for most software and other practical works are designed | |
13 | to take away your freedom to share and change the works. By contrast, | |
14 | the GNU General Public License is intended to guarantee your freedom to | |
15 | share and change all versions of a program--to make sure it remains free | |
16 | software for all its users. We, the Free Software Foundation, use the | |
17 | GNU General Public License for most of our software; it applies also to | |
18 | any other work released this way by its authors. You can apply it to | |
19 | your programs, too. | |
20 | ||
21 | When we speak of free software, we are referring to freedom, not | |
22 | price. Our General Public Licenses are designed to make sure that you | |
23 | have the freedom to distribute copies of free software (and charge for | |
24 | them if you wish), that you receive source code or can get it if you | |
25 | want it, that you can change the software or use pieces of it in new | |
26 | free programs, and that you know you can do these things. | |
27 | ||
28 | To protect your rights, we need to prevent others from denying you | |
29 | these rights or asking you to surrender the rights. Therefore, you have | |
30 | certain responsibilities if you distribute copies of the software, or if | |
31 | you modify it: responsibilities to respect the freedom of others. | |
32 | ||
33 | For example, if you distribute copies of such a program, whether | |
34 | gratis or for a fee, you must pass on to the recipients the same | |
35 | freedoms that you received. You must make sure that they, too, receive | |
36 | or can get the source code. And you must show them these terms so they | |
37 | know their rights. | |
38 | ||
39 | Developers that use the GNU GPL protect your rights with two steps: | |
40 | (1) assert copyright on the software, and (2) offer you this License | |
41 | giving you legal permission to copy, distribute and/or modify it. | |
42 | ||
43 | For the developers' and authors' protection, the GPL clearly explains | |
44 | that there is no warranty for this free software. For both users' and | |
45 | authors' sake, the GPL requires that modified versions be marked as | |
46 | changed, so that their problems will not be attributed erroneously to | |
47 | authors of previous versions. | |
48 | ||
49 | Some devices are designed to deny users access to install or run | |
50 | modified versions of the software inside them, although the manufacturer | |
51 | can do so. This is fundamentally incompatible with the aim of | |
52 | protecting users' freedom to change the software. The systematic | |
53 | pattern of such abuse occurs in the area of products for individuals to | |
54 | use, which is precisely where it is most unacceptable. Therefore, we | |
55 | have designed this version of the GPL to prohibit the practice for those | |
56 | products. If such problems arise substantially in other domains, we | |
57 | stand ready to extend this provision to those domains in future versions | |
58 | of the GPL, as needed to protect the freedom of users. | |
59 | ||
60 | Finally, every program is threatened constantly by software patents. | |
61 | States should not allow patents to restrict development and use of | |
62 | software on general-purpose computers, but in those that do, we wish to | |
63 | avoid the special danger that patents applied to a free program could | |
64 | make it effectively proprietary. To prevent this, the GPL assures that | |
65 | patents cannot be used to render the program non-free. | |
66 | ||
67 | The precise terms and conditions for copying, distribution and | |
68 | modification follow. | |
69 | ||
70 | TERMS AND CONDITIONS | |
71 | ||
72 | 0. Definitions. | |
73 | ||
74 | "This License" refers to version 3 of the GNU General Public License. | |
75 | ||
76 | "Copyright" also means copyright-like laws that apply to other kinds of | |
77 | works, such as semiconductor masks. | |
78 | ||
79 | "The Program" refers to any copyrightable work licensed under this | |
80 | License. Each licensee is addressed as "you". "Licensees" and | |
81 | "recipients" may be individuals or organizations. | |
82 | ||
83 | To "modify" a work means to copy from or adapt all or part of the work | |
84 | in a fashion requiring copyright permission, other than the making of an | |
85 | exact copy. The resulting work is called a "modified version" of the | |
86 | earlier work or a work "based on" the earlier work. | |
87 | ||
88 | A "covered work" means either the unmodified Program or a work based | |
89 | on the Program. | |
90 | ||
91 | To "propagate" a work means to do anything with it that, without | |
92 | permission, would make you directly or secondarily liable for | |
93 | infringement under applicable copyright law, except executing it on a | |
94 | computer or modifying a private copy. Propagation includes copying, | |
95 | distribution (with or without modification), making available to the | |
96 | public, and in some countries other activities as well. | |
97 | ||
98 | To "convey" a work means any kind of propagation that enables other | |
99 | parties to make or receive copies. Mere interaction with a user through | |
100 | a computer network, with no transfer of a copy, is not conveying. | |
101 | ||
102 | An interactive user interface displays "Appropriate Legal Notices" | |
103 | to the extent that it includes a convenient and prominently visible | |
104 | feature that (1) displays an appropriate copyright notice, and (2) | |
105 | tells the user that there is no warranty for the work (except to the | |
106 | extent that warranties are provided), that licensees may convey the | |
107 | work under this License, and how to view a copy of this License. If | |
108 | the interface presents a list of user commands or options, such as a | |
109 | menu, a prominent item in the list meets this criterion. | |
110 | ||
111 | 1. Source Code. | |
112 | ||
113 | The "source code" for a work means the preferred form of the work | |
114 | for making modifications to it. "Object code" means any non-source | |
115 | form of a work. | |
116 | ||
117 | A "Standard Interface" means an interface that either is an official | |
118 | standard defined by a recognized standards body, or, in the case of | |
119 | interfaces specified for a particular programming language, one that | |
120 | is widely used among developers working in that language. | |
121 | ||
122 | The "System Libraries" of an executable work include anything, other | |
123 | than the work as a whole, that (a) is included in the normal form of | |
124 | packaging a Major Component, but which is not part of that Major | |
125 | Component, and (b) serves only to enable use of the work with that | |
126 | Major Component, or to implement a Standard Interface for which an | |
127 | implementation is available to the public in source code form. A | |
128 | "Major Component", in this context, means a major essential component | |
129 | (kernel, window system, and so on) of the specific operating system | |
130 | (if any) on which the executable work runs, or a compiler used to | |
131 | produce the work, or an object code interpreter used to run it. | |
132 | ||
133 | The "Corresponding Source" for a work in object code form means all | |
134 | the source code needed to generate, install, and (for an executable | |
135 | work) run the object code and to modify the work, including scripts to | |
136 | control those activities. However, it does not include the work's | |
137 | System Libraries, or general-purpose tools or generally available free | |
138 | programs which are used unmodified in performing those activities but | |
139 | which are not part of the work. For example, Corresponding Source | |
140 | includes interface definition files associated with source files for | |
141 | the work, and the source code for shared libraries and dynamically | |
142 | linked subprograms that the work is specifically designed to require, | |
143 | such as by intimate data communication or control flow between those | |
144 | subprograms and other parts of the work. | |
145 | ||
146 | The Corresponding Source need not include anything that users | |
147 | can regenerate automatically from other parts of the Corresponding | |
148 | Source. | |
149 | ||
150 | The Corresponding Source for a work in source code form is that | |
151 | same work. | |
152 | ||
153 | 2. Basic Permissions. | |
154 | ||
155 | All rights granted under this License are granted for the term of | |
156 | copyright on the Program, and are irrevocable provided the stated | |
157 | conditions are met. This License explicitly affirms your unlimited | |
158 | permission to run the unmodified Program. The output from running a | |
159 | covered work is covered by this License only if the output, given its | |
160 | content, constitutes a covered work. This License acknowledges your | |
161 | rights of fair use or other equivalent, as provided by copyright law. | |
162 | ||
163 | You may make, run and propagate covered works that you do not | |
164 | convey, without conditions so long as your license otherwise remains | |
165 | in force. You may convey covered works to others for the sole purpose | |
166 | of having them make modifications exclusively for you, or provide you | |
167 | with facilities for running those works, provided that you comply with | |
168 | the terms of this License in conveying all material for which you do | |
169 | not control copyright. Those thus making or running the covered works | |
170 | for you must do so exclusively on your behalf, under your direction | |
171 | and control, on terms that prohibit them from making any copies of | |
172 | your copyrighted material outside their relationship with you. | |
173 | ||
174 | Conveying under any other circumstances is permitted solely under | |
175 | the conditions stated below. Sublicensing is not allowed; section 10 | |
176 | makes it unnecessary. | |
177 | ||
178 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. | |
179 | ||
180 | No covered work shall be deemed part of an effective technological | |
181 | measure under any applicable law fulfilling obligations under article | |
182 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or | |
183 | similar laws prohibiting or restricting circumvention of such | |
184 | measures. | |
185 | ||
186 | When you convey a covered work, you waive any legal power to forbid | |
187 | circumvention of technological measures to the extent such circumvention | |
188 | is effected by exercising rights under this License with respect to | |
189 | the covered work, and you disclaim any intention to limit operation or | |
190 | modification of the work as a means of enforcing, against the work's | |
191 | users, your or third parties' legal rights to forbid circumvention of | |
192 | technological measures. | |
193 | ||
194 | 4. Conveying Verbatim Copies. | |
195 | ||
196 | You may convey verbatim copies of the Program's source code as you | |
197 | receive it, in any medium, provided that you conspicuously and | |
198 | appropriately publish on each copy an appropriate copyright notice; | |
199 | keep intact all notices stating that this License and any | |
200 | non-permissive terms added in accord with section 7 apply to the code; | |
201 | keep intact all notices of the absence of any warranty; and give all | |
202 | recipients a copy of this License along with the Program. | |
203 | ||
204 | You may charge any price or no price for each copy that you convey, | |
205 | and you may offer support or warranty protection for a fee. | |
206 | ||
207 | 5. Conveying Modified Source Versions. | |
208 | ||
209 | You may convey a work based on the Program, or the modifications to | |
210 | produce it from the Program, in the form of source code under the | |
211 | terms of section 4, provided that you also meet all of these conditions: | |
212 | ||
213 | a) The work must carry prominent notices stating that you modified | |
214 | it, and giving a relevant date. | |
215 | ||
216 | b) The work must carry prominent notices stating that it is | |
217 | released under this License and any conditions added under section | |
218 | 7. This requirement modifies the requirement in section 4 to | |
219 | "keep intact all notices". | |
220 | ||
221 | c) You must license the entire work, as a whole, under this | |
222 | License to anyone who comes into possession of a copy. This | |
223 | License will therefore apply, along with any applicable section 7 | |
224 | additional terms, to the whole of the work, and all its parts, | |
225 | regardless of how they are packaged. This License gives no | |
226 | permission to license the work in any other way, but it does not | |
227 | invalidate such permission if you have separately received it. | |
228 | ||
229 | d) If the work has interactive user interfaces, each must display | |
230 | Appropriate Legal Notices; however, if the Program has interactive | |
231 | interfaces that do not display Appropriate Legal Notices, your | |
232 | work need not make them do so. | |
233 | ||
234 | A compilation of a covered work with other separate and independent | |
235 | works, which are not by their nature extensions of the covered work, | |
236 | and which are not combined with it such as to form a larger program, | |
237 | in or on a volume of a storage or distribution medium, is called an | |
238 | "aggregate" if the compilation and its resulting copyright are not | |
239 | used to limit the access or legal rights of the compilation's users | |
240 | beyond what the individual works permit. Inclusion of a covered work | |
241 | in an aggregate does not cause this License to apply to the other | |
242 | parts of the aggregate. | |
243 | ||
244 | 6. Conveying Non-Source Forms. | |
245 | ||
246 | You may convey a covered work in object code form under the terms | |
247 | of sections 4 and 5, provided that you also convey the | |
248 | machine-readable Corresponding Source under the terms of this License, | |
249 | in one of these ways: | |
250 | ||
251 | a) Convey the object code in, or embodied in, a physical product | |
252 | (including a physical distribution medium), accompanied by the | |
253 | Corresponding Source fixed on a durable physical medium | |
254 | customarily used for software interchange. | |
255 | ||
256 | b) Convey the object code in, or embodied in, a physical product | |
257 | (including a physical distribution medium), accompanied by a | |
258 | written offer, valid for at least three years and valid for as | |
259 | long as you offer spare parts or customer support for that product | |
260 | model, to give anyone who possesses the object code either (1) a | |
261 | copy of the Corresponding Source for all the software in the | |
262 | product that is covered by this License, on a durable physical | |
263 | medium customarily used for software interchange, for a price no | |
264 | more than your reasonable cost of physically performing this | |
265 | conveying of source, or (2) access to copy the | |
266 | Corresponding Source from a network server at no charge. | |
267 | ||
268 | c) Convey individual copies of the object code with a copy of the | |
269 | written offer to provide the Corresponding Source. This | |
270 | alternative is allowed only occasionally and noncommercially, and | |
271 | only if you received the object code with such an offer, in accord | |
272 | with subsection 6b. | |
273 | ||
274 | d) Convey the object code by offering access from a designated | |
275 | place (gratis or for a charge), and offer equivalent access to the | |
276 | Corresponding Source in the same way through the same place at no | |
277 | further charge. You need not require recipients to copy the | |
278 | Corresponding Source along with the object code. If the place to | |
279 | copy the object code is a network server, the Corresponding Source | |
280 | may be on a different server (operated by you or a third party) | |
281 | that supports equivalent copying facilities, provided you maintain | |
282 | clear directions next to the object code saying where to find the | |
283 | Corresponding Source. Regardless of what server hosts the | |
284 | Corresponding Source, you remain obligated to ensure that it is | |
285 | available for as long as needed to satisfy these requirements. | |
286 | ||
287 | e) Convey the object code using peer-to-peer transmission, provided | |
288 | you inform other peers where the object code and Corresponding | |
289 | Source of the work are being offered to the general public at no | |
290 | charge under subsection 6d. | |
291 | ||
292 | A separable portion of the object code, whose source code is excluded | |
293 | from the Corresponding Source as a System Library, need not be | |
294 | included in conveying the object code work. | |
295 | ||
296 | A "User Product" is either (1) a "consumer product", which means any | |
297 | tangible personal property which is normally used for personal, family, | |
298 | or household purposes, or (2) anything designed or sold for incorporation | |
299 | into a dwelling. In determining whether a product is a consumer product, | |
300 | doubtful cases shall be resolved in favor of coverage. For a particular | |
301 | product received by a particular user, "normally used" refers to a | |
302 | typical or common use of that class of product, regardless of the status | |
303 | of the particular user or of the way in which the particular user | |
304 | actually uses, or expects or is expected to use, the product. A product | |
305 | is a consumer product regardless of whether the product has substantial | |
306 | commercial, industrial or non-consumer uses, unless such uses represent | |
307 | the only significant mode of use of the product. | |
308 | ||
309 | "Installation Information" for a User Product means any methods, | |
310 | procedures, authorization keys, or other information required to install | |
311 | and execute modified versions of a covered work in that User Product from | |
312 | a modified version of its Corresponding Source. The information must | |
313 | suffice to ensure that the continued functioning of the modified object | |
314 | code is in no case prevented or interfered with solely because | |
315 | modification has been made. | |
316 | ||
317 | If you convey an object code work under this section in, or with, or | |
318 | specifically for use in, a User Product, and the conveying occurs as | |
319 | part of a transaction in which the right of possession and use of the | |
320 | User Product is transferred to the recipient in perpetuity or for a | |
321 | fixed term (regardless of how the transaction is characterized), the | |
322 | Corresponding Source conveyed under this section must be accompanied | |
323 | by the Installation Information. But this requirement does not apply | |
324 | if neither you nor any third party retains the ability to install | |
325 | modified object code on the User Product (for example, the work has | |
326 | been installed in ROM). | |
327 | ||
328 | The requirement to provide Installation Information does not include a | |
329 | requirement to continue to provide support service, warranty, or updates | |
330 | for a work that has been modified or installed by the recipient, or for | |
331 | the User Product in which it has been modified or installed. Access to a | |
332 | network may be denied when the modification itself materially and | |
333 | adversely affects the operation of the network or violates the rules and | |
334 | protocols for communication across the network. | |
335 | ||
336 | Corresponding Source conveyed, and Installation Information provided, | |
337 | in accord with this section must be in a format that is publicly | |
338 | documented (and with an implementation available to the public in | |
339 | source code form), and must require no special password or key for | |
340 | unpacking, reading or copying. | |
341 | ||
342 | 7. Additional Terms. | |
343 | ||
344 | "Additional permissions" are terms that supplement the terms of this | |
345 | License by making exceptions from one or more of its conditions. | |
346 | Additional permissions that are applicable to the entire Program shall | |
347 | be treated as though they were included in this License, to the extent | |
348 | that they are valid under applicable law. If additional permissions | |
349 | apply only to part of the Program, that part may be used separately | |
350 | under those permissions, but the entire Program remains governed by | |
351 | this License without regard to the additional permissions. | |
352 | ||
353 | When you convey a copy of a covered work, you may at your option | |
354 | remove any additional permissions from that copy, or from any part of | |
355 | it. (Additional permissions may be written to require their own | |
356 | removal in certain cases when you modify the work.) You may place | |
357 | additional permissions on material, added by you to a covered work, | |
358 | for which you have or can give appropriate copyright permission. | |
359 | ||
360 | Notwithstanding any other provision of this License, for material you | |
361 | add to a covered work, you may (if authorized by the copyright holders of | |
362 | that material) supplement the terms of this License with terms: | |
363 | ||
364 | a) Disclaiming warranty or limiting liability differently from the | |
365 | terms of sections 15 and 16 of this License; or | |
366 | ||
367 | b) Requiring preservation of specified reasonable legal notices or | |
368 | author attributions in that material or in the Appropriate Legal | |
369 | Notices displayed by works containing it; or | |
370 | ||
371 | c) Prohibiting misrepresentation of the origin of that material, or | |
372 | requiring that modified versions of such material be marked in | |
373 | reasonable ways as different from the original version; or | |
374 | ||
375 | d) Limiting the use for publicity purposes of names of licensors or | |
376 | authors of the material; or | |
377 | ||
378 | e) Declining to grant rights under trademark law for use of some | |
379 | trade names, trademarks, or service marks; or | |
380 | ||
381 | f) Requiring indemnification of licensors and authors of that | |
382 | material by anyone who conveys the material (or modified versions of | |
383 | it) with contractual assumptions of liability to the recipient, for | |
384 | any liability that these contractual assumptions directly impose on | |
385 | those licensors and authors. | |
386 | ||
387 | All other non-permissive additional terms are considered "further | |
388 | restrictions" within the meaning of section 10. If the Program as you | |
389 | received it, or any part of it, contains a notice stating that it is | |
390 | governed by this License along with a term that is a further | |
391 | restriction, you may remove that term. If a license document contains | |
392 | a further restriction but permits relicensing or conveying under this | |
393 | License, you may add to a covered work material governed by the terms | |
394 | of that license document, provided that the further restriction does | |
395 | not survive such relicensing or conveying. | |
396 | ||
397 | If you add terms to a covered work in accord with this section, you | |
398 | must place, in the relevant source files, a statement of the | |
399 | additional terms that apply to those files, or a notice indicating | |
400 | where to find the applicable terms. | |
401 | ||
402 | Additional terms, permissive or non-permissive, may be stated in the | |
403 | form of a separately written license, or stated as exceptions; | |
404 | the above requirements apply either way. | |
405 | ||
406 | 8. Termination. | |
407 | ||
408 | You may not propagate or modify a covered work except as expressly | |
409 | provided under this License. Any attempt otherwise to propagate or | |
410 | modify it is void, and will automatically terminate your rights under | |
411 | this License (including any patent licenses granted under the third | |
412 | paragraph of section 11). | |
413 | ||
414 | However, if you cease all violation of this License, then your | |
415 | license from a particular copyright holder is reinstated (a) | |
416 | provisionally, unless and until the copyright holder explicitly and | |
417 | finally terminates your license, and (b) permanently, if the copyright | |
418 | holder fails to notify you of the violation by some reasonable means | |
419 | prior to 60 days after the cessation. | |
420 | ||
421 | Moreover, your license from a particular copyright holder is | |
422 | reinstated permanently if the copyright holder notifies you of the | |
423 | violation by some reasonable means, this is the first time you have | |
424 | received notice of violation of this License (for any work) from that | |
425 | copyright holder, and you cure the violation prior to 30 days after | |
426 | your receipt of the notice. | |
427 | ||
428 | Termination of your rights under this section does not terminate the | |
429 | licenses of parties who have received copies or rights from you under | |
430 | this License. If your rights have been terminated and not permanently | |
431 | reinstated, you do not qualify to receive new licenses for the same | |
432 | material under section 10. | |
433 | ||
434 | 9. Acceptance Not Required for Having Copies. | |
435 | ||
436 | You are not required to accept this License in order to receive or | |
437 | run a copy of the Program. Ancillary propagation of a covered work | |
438 | occurring solely as a consequence of using peer-to-peer transmission | |
439 | to receive a copy likewise does not require acceptance. However, | |
440 | nothing other than this License grants you permission to propagate or | |
441 | modify any covered work. These actions infringe copyright if you do | |
442 | not accept this License. Therefore, by modifying or propagating a | |
443 | covered work, you indicate your acceptance of this License to do so. | |
444 | ||
445 | 10. Automatic Licensing of Downstream Recipients. | |
446 | ||
447 | Each time you convey a covered work, the recipient automatically | |
448 | receives a license from the original licensors, to run, modify and | |
449 | propagate that work, subject to this License. You are not responsible | |
450 | for enforcing compliance by third parties with this License. | |
451 | ||
452 | An "entity transaction" is a transaction transferring control of an | |
453 | organization, or substantially all assets of one, or subdividing an | |
454 | organization, or merging organizations. If propagation of a covered | |
455 | work results from an entity transaction, each party to that | |
456 | transaction who receives a copy of the work also receives whatever | |
457 | licenses to the work the party's predecessor in interest had or could | |
458 | give under the previous paragraph, plus a right to possession of the | |
459 | Corresponding Source of the work from the predecessor in interest, if | |
460 | the predecessor has it or can get it with reasonable efforts. | |
461 | ||
462 | You may not impose any further restrictions on the exercise of the | |
463 | rights granted or affirmed under this License. For example, you may | |
464 | not impose a license fee, royalty, or other charge for exercise of | |
465 | rights granted under this License, and you may not initiate litigation | |
466 | (including a cross-claim or counterclaim in a lawsuit) alleging that | |
467 | any patent claim is infringed by making, using, selling, offering for | |
468 | sale, or importing the Program or any portion of it. | |
469 | ||
470 | 11. Patents. | |
471 | ||
472 | A "contributor" is a copyright holder who authorizes use under this | |
473 | License of the Program or a work on which the Program is based. The | |
474 | work thus licensed is called the contributor's "contributor version". | |
475 | ||
476 | A contributor's "essential patent claims" are all patent claims | |
477 | owned or controlled by the contributor, whether already acquired or | |
478 | hereafter acquired, that would be infringed by some manner, permitted | |
479 | by this License, of making, using, or selling its contributor version, | |
480 | but do not include claims that would be infringed only as a | |
481 | consequence of further modification of the contributor version. For | |
482 | purposes of this definition, "control" includes the right to grant | |
483 | patent sublicenses in a manner consistent with the requirements of | |
484 | this License. | |
485 | ||
486 | Each contributor grants you a non-exclusive, worldwide, royalty-free | |
487 | patent license under the contributor's essential patent claims, to | |
488 | make, use, sell, offer for sale, import and otherwise run, modify and | |
489 | propagate the contents of its contributor version. | |
490 | ||
491 | In the following three paragraphs, a "patent license" is any express | |
492 | agreement or commitment, however denominated, not to enforce a patent | |
493 | (such as an express permission to practice a patent or covenant not to | |
494 | sue for patent infringement). To "grant" such a patent license to a | |
495 | party means to make such an agreement or commitment not to enforce a | |
496 | patent against the party. | |
497 | ||
498 | If you convey a covered work, knowingly relying on a patent license, | |
499 | and the Corresponding Source of the work is not available for anyone | |
500 | to copy, free of charge and under the terms of this License, through a | |
501 | publicly available network server or other readily accessible means, | |
502 | then you must either (1) cause the Corresponding Source to be so | |
503 | available, or (2) arrange to deprive yourself of the benefit of the | |
504 | patent license for this particular work, or (3) arrange, in a manner | |
505 | consistent with the requirements of this License, to extend the patent | |
506 | license to downstream recipients. "Knowingly relying" means you have | |
507 | actual knowledge that, but for the patent license, your conveying the | |
508 | covered work in a country, or your recipient's use of the covered work | |
509 | in a country, would infringe one or more identifiable patents in that | |
510 | country that you have reason to believe are valid. | |
511 | ||
512 | If, pursuant to or in connection with a single transaction or | |
513 | arrangement, you convey, or propagate by procuring conveyance of, a | |
514 | covered work, and grant a patent license to some of the parties | |
515 | receiving the covered work authorizing them to use, propagate, modify | |
516 | or convey a specific copy of the covered work, then the patent license | |
517 | you grant is automatically extended to all recipients of the covered | |
518 | work and works based on it. | |
519 | ||
520 | A patent license is "discriminatory" if it does not include within | |
521 | the scope of its coverage, prohibits the exercise of, or is | |
522 | conditioned on the non-exercise of one or more of the rights that are | |
523 | specifically granted under this License. You may not convey a covered | |
524 | work if you are a party to an arrangement with a third party that is | |
525 | in the business of distributing software, under which you make payment | |
526 | to the third party based on the extent of your activity of conveying | |
527 | the work, and under which the third party grants, to any of the | |
528 | parties who would receive the covered work from you, a discriminatory | |
529 | patent license (a) in connection with copies of the covered work | |
530 | conveyed by you (or copies made from those copies), or (b) primarily | |
531 | for and in connection with specific products or compilations that | |
532 | contain the covered work, unless you entered into that arrangement, | |
533 | or that patent license was granted, prior to 28 March 2007. | |
534 | ||
535 | Nothing in this License shall be construed as excluding or limiting | |
536 | any implied license or other defenses to infringement that may | |
537 | otherwise be available to you under applicable patent law. | |
538 | ||
539 | 12. No Surrender of Others' Freedom. | |
540 | ||
541 | If conditions are imposed on you (whether by court order, agreement or | |
542 | otherwise) that contradict the conditions of this License, they do not | |
543 | excuse you from the conditions of this License. If you cannot convey a | |
544 | covered work so as to satisfy simultaneously your obligations under this | |
545 | License and any other pertinent obligations, then as a consequence you may | |
546 | not convey it at all. For example, if you agree to terms that obligate you | |
547 | to collect a royalty for further conveying from those to whom you convey | |
548 | the Program, the only way you could satisfy both those terms and this | |
549 | License would be to refrain entirely from conveying the Program. | |
550 | ||
551 | 13. Use with the GNU Affero General Public License. | |
552 | ||
553 | Notwithstanding any other provision of this License, you have | |
554 | permission to link or combine any covered work with a work licensed | |
555 | under version 3 of the GNU Affero General Public License into a single | |
556 | combined work, and to convey the resulting work. The terms of this | |
557 | License will continue to apply to the part which is the covered work, | |
558 | but the special requirements of the GNU Affero General Public License, | |
559 | section 13, concerning interaction through a network will apply to the | |
560 | combination as such. | |
561 | ||
562 | 14. Revised Versions of this License. | |
563 | ||
564 | The Free Software Foundation may publish revised and/or new versions of | |
565 | the GNU General Public License from time to time. Such new versions will | |
566 | be similar in spirit to the present version, but may differ in detail to | |
567 | address new problems or concerns. | |
568 | ||
569 | Each version is given a distinguishing version number. If the | |
570 | Program specifies that a certain numbered version of the GNU General | |
571 | Public License "or any later version" applies to it, you have the | |
572 | option of following the terms and conditions either of that numbered | |
573 | version or of any later version published by the Free Software | |
574 | Foundation. If the Program does not specify a version number of the | |
575 | GNU General Public License, you may choose any version ever published | |
576 | by the Free Software Foundation. | |
577 | ||
578 | If the Program specifies that a proxy can decide which future | |
579 | versions of the GNU General Public License can be used, that proxy's | |
580 | public statement of acceptance of a version permanently authorizes you | |
581 | to choose that version for the Program. | |
582 | ||
583 | Later license versions may give you additional or different | |
584 | permissions. However, no additional obligations are imposed on any | |
585 | author or copyright holder as a result of your choosing to follow a | |
586 | later version. | |
587 | ||
588 | 15. Disclaimer of Warranty. | |
589 | ||
590 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY | |
591 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT | |
592 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY | |
593 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, | |
594 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
595 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM | |
596 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF | |
597 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | |
598 | ||
599 | 16. Limitation of Liability. | |
600 | ||
601 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | |
602 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS | |
603 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY | |
604 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE | |
605 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF | |
606 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD | |
607 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), | |
608 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | |
609 | SUCH DAMAGES. | |
610 | ||
611 | 17. Interpretation of Sections 15 and 16. | |
612 | ||
613 | If the disclaimer of warranty and limitation of liability provided | |
614 | above cannot be given local legal effect according to their terms, | |
615 | reviewing courts shall apply local law that most closely approximates | |
616 | an absolute waiver of all civil liability in connection with the | |
617 | Program, unless a warranty or assumption of liability accompanies a | |
618 | copy of the Program in return for a fee. | |
619 | ||
620 | END OF TERMS AND CONDITIONS |
0 | July 20, 2017: ortp-1.0.2 | |
1 | - Bug fixes | |
2 | ||
3 | February 23, 2017: ortp-1.0.1 | |
4 | - minor enhancements and bugfixes | |
5 | ||
6 | January 10, 2017: ortp-1.0.0 | |
7 | - oRTP license is changed to be GPLv2 | |
8 | - new adaptive jitter buffer algorithm added | |
9 | ||
10 | June 1st 2016: ortp-0.27.0 | |
11 | ||
12 | May XX, 2016:Â | |
13 | - Fix DSCP on Windows. | |
14 | - bctoolbox added as dependency | |
15 | - fixes around IPv6 support for windows and android | |
16 | ||
17 | January 22, 2016: ortp-0.26.0 | |
18 | ||
19 | November 2, 2015: ortp-0.25.0 | |
20 | - Support AVPF generic NACK | |
21 | - Add payload types for RTT (Real-Time Text) and Codec2 | |
22 | - Bug fixes | |
23 | ||
24 | May 6, 2015: ortp-0.24.2 | |
25 | - Bug fixes | |
26 | ||
27 | Mar 31, 2015: ortp-0.24.1 | |
28 | - Add support of TMMBR and TMMBN (RFC 5104) | |
29 | ||
30 | Mar 11, 2015: ortp-0.24.0 | |
31 | - RTCP send algorithm as describe in RFC3550 | |
32 | - RTCP XR (RFC3611) | |
33 | - RTCP send algorithm as describe in RFC4585: AVPF streams | |
34 | ||
35 | Feb 19, 2014: ortp-0.23.0 | |
36 | - network simulator improvements | |
37 | - updated to use ZRTPCPP>=4.0 | |
38 | - security bugfixes | |
39 | ||
40 | May 27, 2012: ortp-0.22.0 | |
41 | - network simulator improvements for simulating random lost packets | |
42 | - srtp initialization bugfix | |
43 | ||
44 | February 22th, 2012: ortp-0.20.0 | |
45 | - fix an issue on video call with ZRTP | |
46 | ||
47 | February 17th, 2012: ortp-0.19.0 | |
48 | - ZRTP media encryption | |
49 | ||
50 | December 22th, 2011: ortp-0.18.0 | |
51 | - SRTP media encryption | |
52 | ||
53 | May XXth, 2011: ortp-0.17.0 | |
54 | - RTCP support fixes | |
55 | - add rtp_session_get_round_trip_propagation() | |
56 | ||
57 | March 28th, 2011: ortp-0.16.5 | |
58 | - optimisations in session-set intersection computation | |
59 | ||
60 | February 7, 2011: ortp-0.16.4 | |
61 | - workaround fix for some versions of uclibc | |
62 | ||
63 | June 3, 2010 : ortp-0.16.3 | |
64 | - cosmetics improvements for compilation. | |
65 | ||
66 | May 10, 2010 : ortp-0.16.2 | |
67 | - add support for setting dscp on windows | |
68 | - add accessors to struct PayloadType | |
69 | ||
70 | September 17, 2009: ortp-0.16.1 | |
71 | - minor compilation fixes | |
72 | ||
73 | May 4, 2009 : ortp-0.16.0 | |
74 | - update stun api to support new RFC | |
75 | - fix gcc warnings | |
76 | - added new PayloadType | |
77 | ||
78 | October 13, 2008: ortp-0.15.0 | |
79 | - telephone event detection bugfix | |
80 | - reduce number of memory allocation: !! attention here ABI/API change !! | |
81 | If you are using mp=rtp_session_recvm_with_ts(), the payload data is no more pointed by mp->b_cont->b_rptr. | |
82 | Instead you can use the following to skip the header: | |
83 | rtp_get_payload(mp,mp->b_rptr); | |
84 | ||
85 | March 14, 2007: ortp-0.14.3 | |
86 | - new ortp_set_memory_functions() method | |
87 | - jitter buffer bugfixes, simplification and improvements | |
88 | ||
89 | July 27, 2007: ortp-0.14.0 | |
90 | - a few optimisations | |
91 | - support for number of channels in PayloadType (interface changed !) | |
92 | - srtp optional support (using libsrtp from http://srtp.sf.net) | |
93 | ||
94 | April, 11 2007: ortp-0.13.1: | |
95 | - do not recv rtcp packets from rtp_session_sendm_with_ts() when session is not send-only. | |
96 | - removed gtk-doc, using doxygen instead. | |
97 | - minor patches | |
98 | ||
99 | January, 23 2007: ortp-0.13.0 | |
100 | - add support for a pluggable transport layer | |
101 | - enables use of different RtpProfile for send and recv directions | |
102 | - fix RTCP memleak | |
103 | - new telephone-event types added. | |
104 | ||
105 | November, 9 2006: ortp-0.12.0 | |
106 | - fix statistics | |
107 | - jitter buffer accuracy improved | |
108 | - enable 0 ms jitter buffer (implies permissive dequeuing of packets) | |
109 | - enable optional connected mode: the udp socket is connect()ed so only | |
110 | packets coming from the connected destination are received. | |
111 | ||
112 | August, 22 2006: ortp-0.11.0 | |
113 | - added rtp_session_set_dscp, rtp_session_send_rtcp_APP | |
114 | - fixed statistics little bugs. | |
115 | ||
116 | May, 30 2006: ortp-0.10.0 | |
117 | - new RTCP parser | |
118 | - new event api | |
119 | - stun helper routines | |
120 | - permissive algorithm for video packet enqueueing |
27 | 27 | # ORTP_LIBRARIES - The libraries needed to use oRTP |
28 | 28 | # ORTP_CPPFLAGS - The cflags needed to use oRTP |
29 | 29 | |
30 | if(NOT LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) | |
31 | include("${CMAKE_CURRENT_LIST_DIR}/ORTPTargets.cmake") | |
32 | endif() | |
30 | @PACKAGE_INIT@ | |
31 | ||
32 | set(ORTP_TARGETNAME ortp) | |
33 | ||
34 | include("${CMAKE_CURRENT_LIST_DIR}/${ORTP_TARGETNAME}Targets.cmake") | |
33 | 35 | |
34 | 36 | if(@ENABLE_SHARED@) |
35 | set(ORTP_TARGETNAME ortp) | |
36 | 37 | set(ORTP_LIBRARIES ${ORTP_TARGETNAME}) |
37 | 38 | else() |
38 | 39 | set(ORTP_TARGETNAME ortp-static) |
39 | 40 | if(TARGET ${ORTP_TARGETNAME}) |
40 | if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) | |
41 | if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) | |
41 | 42 | set(ORTP_LIBRARIES ${ORTP_TARGETNAME}) |
42 | 43 | else() |
43 | 44 | get_target_property(ORTP_LIBRARIES ${ORTP_TARGETNAME} LOCATION) |
44 | 45 | endif() |
45 | 46 | get_target_property(ORTP_LINK_LIBRARIES ${ORTP_TARGETNAME} INTERFACE_LINK_LIBRARIES) |
46 | 47 | if(ORTP_LINK_LIBRARIES) |
47 | list(APPEND ORTP_LIBRARIES ${ORTP_LINK_LIBRARIES}) | |
48 | list(APPEND ORTP_LIBRARIES ${ORTP_LINK_LIBRARIES}) | |
48 | 49 | endif() |
49 | 50 | endif() |
50 | 51 | endif() |
52 | ||
51 | 53 | get_target_property(ORTP_INCLUDE_DIRS ${ORTP_TARGETNAME} INTERFACE_INCLUDE_DIRECTORIES) |
52 | if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) | |
53 | list(INSERT ORTP_INCLUDE_DIRS 0 "${EP_ortp_INCLUDE_DIR}") | |
54 | else() | |
55 | list(INSERT ORTP_INCLUDE_DIRS 0 "@CMAKE_INSTALL_FULL_INCLUDEDIR@") | |
56 | endif() | |
57 | list(REMOVE_DUPLICATES ORTP_INCLUDE_DIRS) | |
58 | 54 | |
59 | 55 | set(ORTP_CPPFLAGS @ORTP_CPPFLAGS@) |
60 | 56 | set(ORTP_FOUND 1) |
0 | [![pipeline status](https://gitlab.linphone.org/BC/public/ortp/badges/master/pipeline.svg)](https://gitlab.linphone.org/BC/public/ortp/commits/master) | |
1 | ||
0 | 2 | oRTP |
1 | 3 | ==== |
2 | 4 | |
3 | What is it ? | |
4 | ------------ | |
5 | 5 | |
6 | oRTP is a GPLv2 licensed C library implementing the RTP protocol (rfc3550). It is available | |
6 | oRTP is a C library implementing the RTP protocol (rfc3550). It is available | |
7 | 7 | for most unix clones (primilarly Linux and HP-UX), and Microsoft Windows. |
8 | 8 | |
9 | Prior to version 1.0.0, oRTP was licensed under LGPLv2. Due to inclusion of new code licensed under GPLv2, oRTP has become GPLv2. | |
10 | For the sake of clarity, all source files headers were updated to mention the GPLv2 only. | |
9 | For additional information, please [visit oRTP's homepage on **linphone.org**](http://www.linphone.org/technical-corner/ortp). | |
10 | ||
11 | ||
12 | License | |
13 | ------- | |
14 | ||
15 | Copyright © Belledonne Communications | |
16 | ||
17 | oRTP is dual licensed, and is available either : | |
18 | ||
19 | - under a [GNU/GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.en.html), for free (open source). Please make sure that you understand and agree with the terms of this license before using it (see LICENSE.txt file for details). | |
20 | ||
21 | - under a proprietary license, for a fee, to be used in closed source applications. Contact [Belledonne Communications](https://www.linphone.org/contact) for any question about costs and services. | |
22 | ||
23 | Prior to version 1.0.0, oRTP was licensed under LGPLv2. Due to inclusion of new code licensed under GPLv2, oRTP has become GPLv2, | |
24 | and later in version 1.1.0, GPLv3. | |
25 | For the sake of clarity, all source files headers were updated to mention the GPLv3 only. | |
11 | 26 | oRTP versions prior to 1.0.0 of course remain LGPLv2. |
12 | 27 | |
13 | 28 | |
14 | What are the build prequisites ? | |
15 | -------------------------------- | |
29 | Dependencies | |
30 | ------------ | |
16 | 31 | |
17 | 32 | *bctoolbox[1]*: portability layer |
18 | 33 | |
19 | 34 | |
20 | What build instructions | |
21 | ----------------------- | |
35 | Compilation | |
36 | ----------- | |
22 | 37 | |
23 | 38 | Autotools procedure is deprecated. Use CMake to configure the source code. |
24 | 39 | |
73 | 88 | starting point. |
74 | 89 | |
75 | 90 | |
76 | What are the current features ? | |
77 | ------------------------------- | |
78 | ||
79 | - works with ipv6 | |
80 | - packet scheduler | |
81 | - adaptive jitter compensation | |
82 | - automatic sending of RTCP SR or RR coumpounded with a SDES | |
83 | - RTCP parser API | |
84 | ||
85 | ||
86 | What are the planned features ? | |
87 | ------------------------------- | |
88 | ||
89 | - multi-endpoint rtp sessions. | |
90 | ||
91 | ||
92 | In which application oRTP is being used ? | |
93 | ----------------------------------------- | |
94 | ||
95 | - linphone (http://www.linphone.org) was the first. | |
96 | - the OCMP platform (a Hewlett Packard product). | |
97 | ||
98 | ||
99 | How to compile my program using ortp ? | |
100 | -------------------------------------- | |
101 | gcc -o myprogram `pkg-config --cflags ortp` myprogram.c \ | |
102 | `pkg-config --libs ortp` | |
103 | ||
104 | ||
105 | What about Windows port ? | |
106 | ------------------------- | |
107 | There are instructions and Microsoft Visual C++ project files in build/win32native/oRTP. | |
108 | ||
109 | 91 | |
110 | 92 | ---------------------------------------- |
111 | 93 |
0 | 0 | #!/bin/sh |
1 | ## | |
2 | ## Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | ## | |
4 | ## This file is part of oRTP. | |
5 | ## | |
6 | ## This program is free software: you can redistribute it and/or modify | |
7 | ## it under the terms of the GNU General Public License as published by | |
8 | ## the Free Software Foundation, either version 3 of the License, or | |
9 | ## (at your option) any later version. | |
10 | ## | |
11 | ## This program is distributed in the hope that it will be useful, | |
12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | ## GNU General Public License for more details. | |
15 | ## | |
16 | ## You should have received a copy of the GNU General Public License | |
17 | ## along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | ## | |
1 | 19 | |
2 | 20 | srcdir=`dirname $0` |
3 | 21 | test -z "$srcdir" && srcdir=. |
0 | 0 | ############################################################################ |
1 | 1 | # CMakeLists.txt |
2 | # Copyright (C) 2017 Belledonne Communications, Grenoble France | |
2 | # Copyright (C) 2010-2019 Belledonne Communications, Grenoble France | |
3 | 3 | # |
4 | 4 | ############################################################################ |
5 | 5 | # |
21 | 21 | |
22 | 22 | if (NOT CPACK_PACKAGE_NAME) |
23 | 23 | set(CPACK_PACKAGE_NAME "ortp") |
24 | ENDIF() | |
24 | endif() | |
25 | 25 | |
26 | set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../COPYING") | |
26 | set(CPACK_SOURCE_IGNORE_FILES "./.*") | |
27 | 27 | |
28 | set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) | |
29 | set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) | |
30 | set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) | |
31 | ||
32 | set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${PROJECT_VERSION}) | |
33 | ||
34 | set(CPACK_SOURCE_GENERATOR "TGZ") | |
35 | set(CPACK_SOURCE_IGNORE_FILES | |
36 | "${CMAKE_BINARY_DIR}" | |
37 | "^${PROJECT_SOURCE_DIR}/.git*" | |
38 | ) | |
39 | bc_project_build_version(${PROJECT_VERSION} PROJECT_VERSION_BUILD) | |
40 | ||
41 | set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${PROJECT_VERSION_BUILD}") | |
42 | ||
43 | message("Package file name is ${CPACK_PACKAGE_FILE_NAME}" ) | |
44 | ||
45 | set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) | |
46 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rpm/ortp.spec.cmake ${CMAKE_CURRENT_SOURCE_DIR}/../ortp.spec) | |
47 | ||
48 | include(CPack) | |
49 | ||
28 | bc_make_package_source_target() |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
0 | 18 | /* ortp-config.h. Generated from ortp-config.h.in by configure. */ |
1 | 19 | /* ortp-config.h.in. Generated from configure.ac by autoheader. */ |
2 | 20 |
4 | 4 | # Default is optimized for Pentium IV but will execute on Pentium II & |
5 | 5 | # later (i686). |
6 | 6 | |
7 | # These 2 lines are here because we can build the RPM for flexisip, in which | |
8 | # case we prefix the entire installation so that we don't break compatibility | |
9 | # with the user's libs. | |
10 | # To compile with bc prefix, use rpmbuild -ba --with bc [SPEC] | |
11 | %define pkg_name %{?_with_bc:bc-ortp}%{!?_with_bc:ortp} | |
12 | %{?_with_bc: %define _prefix /opt/belledonne-communications} | |
13 | %define srtp %{?_without_srtp:0}%{?!_without_srtp:1} | |
7 | %define _prefix @CMAKE_INSTALL_PREFIX@ | |
8 | %define pkg_prefix @BC_PACKAGE_NAME_PREFIX@ | |
9 | %define package_name @CPACK_PACKAGE_NAME@-${FULL_VERSION} | |
14 | 10 | |
15 | 11 | # re-define some directories for older RPMBuild versions which don't. This messes up the doc/ dir |
16 | 12 | # taken from https://fedoraproject.org/wiki/Packaging:RPMMacros?rd=Packaging/RPMMacros |
21 | 17 | %ifarch %ix86 |
22 | 18 | %define ortp_cpu pentium4 |
23 | 19 | %endif |
24 | %define build_number @PROJECT_VERSION_BUILD@ | |
25 | 20 | Summary: Real-time Transport Protocol Stack |
26 | Name: %pkg_name | |
27 | Version: @PROJECT_VERSION@ | |
28 | Release: %build_number%{?dist} | |
21 | Name: @CPACK_PACKAGE_NAME@ | |
22 | Version: ${RPM_VERSION} | |
23 | Release: ${RPM_RELEASE}%{?dist} | |
29 | 24 | #to be alined with redhat which changed epoc to 1 for an unknown reason |
30 | 25 | Epoch: 1 |
31 | 26 | License: GPL |
32 | 27 | Group: Applications/Communications |
33 | 28 | URL: http://linphone.org/ortp/ |
34 | Source0: %{name}-%{version}-%build_number.tar.gz | |
29 | Source0: %{package_name}.tar.gz | |
35 | 30 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot |
36 | 31 | %ifarch %ix86 |
37 | 32 | BuildArch: i686 |
38 | 33 | %endif |
34 | ||
35 | Requires: %{pkg_prefix}bctoolbox | |
39 | 36 | |
40 | 37 | %if 0%{?rhel} && 0%{?rhel} <= 7 |
41 | 38 | %global cmake_name cmake3 |
74 | 71 | %endif |
75 | 72 | %define ortp_cflags %ortp_arch_cflags -Wall -g -pipe -pthread -O3 -fomit-frame-pointer -fno-schedule-insns -fschedule-insns2 -fno-strict-aliasing |
76 | 73 | |
74 | # This is for debian builds where debug_package has to be manually specified, whereas in centos it does not | |
75 | %define custom_debug_package %{!?_enable_debug_packages:%debug_package}%{?_enable_debug_package:%{nil}} | |
76 | %custom_debug_package | |
77 | ||
77 | 78 | %prep |
78 | %setup -n %{name}-%{version}-%build_number | |
79 | %setup -n %{package_name} | |
79 | 80 | |
80 | 81 | %build |
81 | %{expand:%%%cmake_name} . -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} -DCMAKE_PREFIX_PATH:PATH=%{_prefix} | |
82 | %{expand:%%%cmake_name} . -DCMAKE_BUILD_TYPE=@CMAKE_BUILD_TYPE@ -DCMAKE_PREFIX_PATH:PATH=%{_prefix} @RPM_ALL_CMAKE_OPTIONS@ | |
82 | 83 | make %{?_smp_mflags} |
83 | 84 | |
84 | 85 | %install |
85 | 86 | make install DESTDIR=%{buildroot} |
87 | ||
88 | # Dirty workaround to give exec rights for all shared libraries. Debian packaging needs this | |
89 | # TODO : set CMAKE_INSTALL_SO_NO_EXE for a cleaner workaround | |
90 | chmod +x `find %{buildroot} *.so.*` | |
91 | ||
86 | 92 | |
87 | 93 | %check |
88 | 94 | %{ctest_name} -V %{?_smp_mflags} |
93 | 99 | %files |
94 | 100 | %defattr(-,root,root,-) |
95 | 101 | %doc %{_docdir}/ortp-%{version}/README.md |
96 | %doc %{_docdir}/ortp-%{version}/ChangeLog | |
97 | %doc %{_docdir}/ortp-%{version}/COPYING | |
98 | %doc %{_docdir}/ortp-%{version}/AUTHORS | |
102 | %doc %{_docdir}/ortp-%{version}/CHANGELOG.md | |
103 | %doc %{_docdir}/ortp-%{version}/LICENSE.txt | |
104 | %doc %{_docdir}/ortp-%{version}/AUTHORS.md | |
99 | 105 | %{_libdir}/*.so.* |
100 | 106 | |
101 | 107 | %files devel |
102 | 108 | %defattr(-,root,root,-) |
109 | %if @ENABLE_DOC@ | |
103 | 110 | %doc %{_docdir}/ortp-%{version}/html/* |
111 | %endif | |
112 | %if @ENABLE_STATIC@ | |
104 | 113 | %{_libdir}/*.a |
114 | %endif | |
115 | %if @ENABLE_SHARED@ | |
105 | 116 | %{_libdir}/*.so |
117 | %endif | |
106 | 118 | %{_libdir}/pkgconfig/*.pc |
107 | 119 | %{_includedir}/* |
108 | %{_datadir}/oRTP/cmake/ORTPConfig.cmake | |
109 | %{_datadir}/oRTP/cmake/ORTPConfigVersion.cmake | |
110 | %{_datadir}/oRTP/cmake/ORTPTargets-noconfig.cmake | |
111 | %{_datadir}/oRTP/cmake/ORTPTargets.cmake | |
120 | %{_libdir}/cmake/ortp/* | |
121 | ||
112 | 122 | |
113 | 123 | %changelog |
124 | ||
125 | * Tue Nov 27 2018 ronan.abhamon <ronan.abhamon@belledonne-communications.com> | |
126 | - Do not set CMAKE_INSTALL_LIBDIR. | |
127 | ||
114 | 128 | * Tue Oct 25 2005 Francois-Xavier Kowalski <fix@hp.com> |
115 | 129 | - Add to oRTP distribution with "make rpm" target |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
0 | 18 | // ISO C9x compliant inttypes.h for Microsoft Visual Studio |
1 | 19 | // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 |
2 | 20 | // |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
0 | 18 | // ISO C9x compliant stdint.h for Microsoft Visual Studio |
1 | 19 | // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 |
2 | 20 | // |
0 | 0 | ortp_includedir=$(includedir)/ortp |
1 | 1 | |
2 | ortp_include_HEADERS=str_utils.h rtpsession.h rtp.h port.h logging.h \ | |
2 | ortp_include_HEADERS=str_utils.h rtpsession.h rtp.h port.h logging.h nack.h \ | |
3 | 3 | ortp.h telephonyevents.h sessionset.h payloadtype.h rtpprofile.h rtpsignaltable.h \ |
4 | 4 | rtcp.h event.h utils.h \ |
5 | 5 | b64.h |
108 | 108 | */ |
109 | 109 | |
110 | 110 | #include <stddef.h> |
111 | #include "ortp/port.h" | |
111 | 112 | |
112 | 113 | /* ///////////////////////////////////////////////////////////////////////////// |
113 | 114 | * Namespace |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #ifndef ortp_events_h |
53 | 53 | uint32_t received_rtt_character; |
54 | 54 | bool_t congestion_detected; |
55 | 55 | float video_bandwidth_available; |
56 | int jitter_min_size_for_nack; | |
56 | 57 | } info; |
57 | 58 | }; |
58 | 59 | |
84 | 85 | #define ORTP_EVENT_ZRTP_CACHE_MISMATCH 17 |
85 | 86 | #define ORTP_EVENT_ZRTP_PEER_VERSION_OBSOLETE 18 |
86 | 87 | #define ORTP_EVENT_NEW_VIDEO_BANDWIDTH_ESTIMATION_AVAILABLE 19 |
88 | #define ORTP_EVENT_ICE_DEACTIVATION_NEEDED 20 | |
89 | #define ORTP_EVENT_JITTER_UPDATE_FOR_NACK 21 | |
87 | 90 | |
88 | 91 | ORTP_PUBLIC OrtpEventData * ortp_event_get_data(OrtpEvent *ev); |
89 | 92 | ORTP_PUBLIC void ortp_event_destroy(OrtpEvent *ev); |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | /** |
27 | 27 | |
28 | 28 | #include <ortp/port.h> |
29 | 29 | |
30 | #ifndef ORTP_LOG_DOMAIN | |
31 | #define ORTP_LOG_DOMAIN NULL | |
32 | #endif | |
30 | #define ORTP_LOG_DOMAIN BCTBX_LOG_DOMAIN | |
31 | ||
32 | #include "bctoolbox/logging.h" | |
33 | 33 | |
34 | 34 | #ifdef __cplusplus |
35 | 35 | extern "C" |
36 | 36 | { |
37 | 37 | #endif |
38 | 38 | |
39 | typedef enum { | |
40 | ORTP_DEBUG=1, | |
41 | ORTP_TRACE=1<<1, | |
42 | ORTP_MESSAGE=1<<2, | |
43 | ORTP_WARNING=1<<3, | |
44 | ORTP_ERROR=1<<4, | |
45 | ORTP_FATAL=1<<5, | |
46 | ORTP_LOGLEV_END=1<<6 | |
47 | } OrtpLogLevel; | |
39 | /***************/ | |
40 | /* logging api */ | |
41 | /***************/ | |
42 | ||
43 | #define ORTP_FATAL BCTBX_LOG_FATAL | |
44 | #define ORTP_ERROR BCTBX_LOG_ERROR | |
45 | #define ORTP_WARNING BCTBX_LOG_WARNING | |
46 | #define ORTP_MESSAGE BCTBX_LOG_MESSAGE | |
47 | #define ORTP_TRACE BCTBX_LOG_TRACE | |
48 | #define ORTP_DEBUG BCTBX_LOG_DEBUG | |
49 | #define ORTP_END BCTBX_LOG_END | |
50 | #define ORTP_LOGLEV_END BCTBX_LOG_LOGLEV_END | |
51 | #define OrtpLogLevel BctbxLogLevel | |
52 | ||
53 | #define OrtpLogFunc BctbxLogFunc | |
54 | ||
55 | ||
56 | ||
57 | /*#define ortp_set_log_file bctbx_set_log_file*/ | |
58 | ORTP_PUBLIC void ortp_set_log_file(FILE *file); | |
59 | ||
60 | /*#define ortp_set_log_handler bctbx_set_log_handler*/ | |
61 | ORTP_PUBLIC void ortp_set_log_handler(OrtpLogFunc func); | |
48 | 62 | |
49 | 63 | |
50 | typedef void (*OrtpLogFunc)(const char *domain, OrtpLogLevel lev, const char *fmt, va_list args); | |
64 | /* This function does not have any means by now, as even bctbx_set_log_handler is deprecated. use bctbx_log_handler_t instead*/ | |
65 | ORTP_PUBLIC OrtpLogFunc ortp_get_log_handler(void); | |
51 | 66 | |
52 | ORTP_PUBLIC void ortp_set_log_file(FILE *file); | |
53 | ORTP_PUBLIC void ortp_set_log_handler(OrtpLogFunc func); | |
54 | ORTP_PUBLIC OrtpLogFunc ortp_get_log_handler(void); | |
55 | 67 | |
56 | ORTP_PUBLIC void ortp_logv_out(const char *domain, OrtpLogLevel level, const char *fmt, va_list args); | |
68 | #define ortp_logv_out bctbx_logv_out | |
69 | /*ORTP_PUBLIC void ortp_logv_out(const char *domain, OrtpLogLevel level, const char *fmt, va_list args);*/ | |
57 | 70 | |
58 | #define ortp_log_level_enabled(domain, level) (ortp_get_log_level_mask(domain) & (level)) | |
59 | ||
60 | ORTP_PUBLIC void ortp_logv(const char *domain, OrtpLogLevel level, const char *fmt, va_list args); | |
71 | #define ortp_log_level_enabled(domain, level) (bctbx_get_log_level_mask(domain) & (level)) | |
72 | #define ortp_logv bctbx_logv | |
73 | /*ORTP_PUBLIC void ortp_logv(const char *domain, OrtpLogLevel level, const char *fmt, va_list args);*/ | |
61 | 74 | |
62 | 75 | /** |
63 | 76 | * Flushes the log output queue. |
64 | 77 | * WARNING: Must be called from the thread that has been defined with ortp_set_log_thread_id(). |
65 | 78 | */ |
66 | ORTP_PUBLIC void ortp_logv_flush(void); | |
79 | #define ortp_logv_flush bctbx_logv_flush | |
80 | /*ORTP_PUBLIC void ortp_logv_flush(void);*/ | |
67 | 81 | |
68 | 82 | /** |
69 | 83 | * Activate all log level greater or equal than specified level argument. |
70 | 84 | **/ |
71 | ORTP_PUBLIC void ortp_set_log_level(const char *domain, OrtpLogLevel level); | |
85 | #define ortp_set_log_level bctbx_set_log_level | |
86 | /*ORTP_PUBLIC void ortp_set_log_level(const char *domain, OrtpLogLevel level);*/ | |
72 | 87 | |
73 | ORTP_PUBLIC void ortp_set_log_level_mask(const char *domain, int levelmask); | |
74 | ORTP_PUBLIC unsigned int ortp_get_log_level_mask(const char *domain); | |
88 | #define ortp_set_log_level_mask bctbx_set_log_level_mask | |
89 | /*ORTP_PUBLIC void ortp_set_log_level_mask(const char *domain, int levelmask);*/ | |
90 | #define ortp_get_log_level_mask bctbx_get_log_level_mask | |
91 | /*ORTP_PUBLIC unsigned int ortp_get_log_level_mask(const char *domain);*/ | |
75 | 92 | |
76 | 93 | /** |
77 | 94 | * Tell oRTP the id of the thread used to output the logs. |
78 | 95 | * This is meant to output all the logs from the same thread to prevent deadlock problems at the application level. |
79 | 96 | * @param[in] thread_id The id of the thread that will output the logs (can be obtained using ortp_thread_self()). |
80 | 97 | */ |
81 | ORTP_PUBLIC void ortp_set_log_thread_id(unsigned long thread_id); | |
98 | #define ortp_set_log_thread_id bctbx_set_log_thread_id | |
99 | /*ORTP_PUBLIC void ortp_set_log_thread_id(unsigned long thread_id);*/ | |
82 | 100 | |
83 | #ifdef __GNUC__ | |
84 | #define CHECK_FORMAT_ARGS(m,n) __attribute__((format(printf,m,n))) | |
85 | #else | |
86 | #define CHECK_FORMAT_ARGS(m,n) | |
87 | #endif | |
88 | #ifdef __clang__ | |
89 | /*in case of compile with -g static inline can produce this type of warning*/ | |
90 | #pragma GCC diagnostic ignored "-Wunused-function" | |
91 | #endif | |
92 | 101 | #ifdef ORTP_DEBUG_MODE |
93 | static ORTP_INLINE void CHECK_FORMAT_ARGS(1,2) ortp_debug(const char *fmt,...) | |
94 | { | |
95 | va_list args; | |
96 | va_start (args, fmt); | |
97 | ortp_logv(ORTP_LOG_DOMAIN, ORTP_DEBUG, fmt, args); | |
98 | va_end (args); | |
99 | } | |
102 | #define ortp_debug bctbx_debug | |
100 | 103 | #else |
101 | 104 | |
102 | 105 | #define ortp_debug(...) |
114 | 117 | static ORTP_INLINE void CHECK_FORMAT_ARGS(2,3) ortp_log(OrtpLogLevel lev, const char *fmt,...) { |
115 | 118 | va_list args; |
116 | 119 | va_start (args, fmt); |
117 | ortp_logv(ORTP_LOG_DOMAIN, lev, fmt, args); | |
120 | bctbx_logv(ORTP_LOG_DOMAIN, lev, fmt, args); | |
118 | 121 | va_end (args); |
119 | 122 | } |
120 | ||
121 | static ORTP_INLINE void CHECK_FORMAT_ARGS(1,2) ortp_message(const char *fmt,...) | |
122 | { | |
123 | va_list args; | |
124 | va_start (args, fmt); | |
125 | ortp_logv(ORTP_LOG_DOMAIN, ORTP_MESSAGE, fmt, args); | |
126 | va_end (args); | |
127 | } | |
128 | ||
129 | static ORTP_INLINE void CHECK_FORMAT_ARGS(1,2) ortp_warning(const char *fmt,...) | |
130 | { | |
131 | va_list args; | |
132 | va_start (args, fmt); | |
133 | ortp_logv(ORTP_LOG_DOMAIN, ORTP_WARNING, fmt, args); | |
134 | va_end (args); | |
135 | } | |
136 | ||
137 | #endif | |
138 | ||
139 | static ORTP_INLINE void CHECK_FORMAT_ARGS(1,2) ortp_error(const char *fmt,...) | |
140 | { | |
141 | va_list args; | |
142 | va_start (args, fmt); | |
143 | ortp_logv(ORTP_LOG_DOMAIN, ORTP_ERROR, fmt, args); | |
144 | va_end (args); | |
145 | } | |
146 | ||
147 | static ORTP_INLINE void CHECK_FORMAT_ARGS(1,2) ortp_fatal(const char *fmt,...) | |
148 | { | |
149 | va_list args; | |
150 | va_start (args, fmt); | |
151 | ortp_logv(ORTP_LOG_DOMAIN, ORTP_FATAL, fmt, args); | |
152 | va_end (args); | |
153 | } | |
154 | ||
155 | ||
123 | ||
124 | #define ortp_message bctbx_message | |
125 | #define ortp_warning bctbx_warning | |
126 | #define ortp_error bctbx_error | |
127 | #define ortp_fatal bctbx_fatal | |
128 | #endif /*ORTP_NOMESSAGE_MODE*/ | |
129 | ||
156 | 130 | #ifdef __QNX__ |
157 | void ortp_qnx_log_handler(const char *domain, OrtpLogLevel lev, const char *fmt, va_list args); | |
131 | #define ortp_qnx_log_handler bctbx_qnx_log_handler | |
132 | /*void ortp_qnx_log_handler(const char *domain, OrtpLogLevel lev, const char *fmt, va_list args);*/ | |
158 | 133 | #endif |
159 | 134 | |
160 | 135 |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
19 | #ifndef NACK_H | |
20 | #define NACK_H | |
21 | ||
22 | #include <bctoolbox/list.h> | |
23 | #include <bctoolbox/port.h> | |
24 | #include <ortp/port.h> | |
25 | #include <ortp/rtpsession.h> | |
26 | ||
27 | #ifdef __cplusplus | |
28 | extern "C"{ | |
29 | #endif | |
30 | ||
31 | struct _OrtpNackContext { | |
32 | RtpSession *session; | |
33 | OrtpEvDispatcher *ev_dispatcher; | |
34 | RtpTransportModifier *rtp_modifier; | |
35 | queue_t sent_packets; | |
36 | bctbx_mutex_t sent_packets_mutex; | |
37 | int max_packets; | |
38 | int min_jitter_before_nack; | |
39 | bool_t decrease_jitter_timer_running; | |
40 | uint64_t decrease_jitter_timer_start; | |
41 | }; | |
42 | ||
43 | typedef struct _OrtpNackContext OrtpNackContext; | |
44 | ||
45 | ORTP_PUBLIC OrtpNackContext *ortp_nack_context_new(OrtpEvDispatcher *evt); | |
46 | ORTP_PUBLIC void ortp_nack_context_destroy(OrtpNackContext *ctx); | |
47 | ||
48 | ORTP_PUBLIC void ortp_nack_context_set_max_packet(OrtpNackContext *ctx, int max); | |
49 | ||
50 | ORTP_PUBLIC void ortp_nack_context_process_timer(OrtpNackContext *ctx); | |
51 | ||
52 | #ifdef __cplusplus | |
53 | } | |
54 | #endif | |
55 | ||
56 | #endif |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | /** \mainpage oRTP API documentation |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | /** |
177 | 177 | ORTP_VAR_PUBLIC PayloadType payload_type_mp4v; |
178 | 178 | ORTP_VAR_PUBLIC PayloadType payload_type_theora; |
179 | 179 | ORTP_VAR_PUBLIC PayloadType payload_type_h264; |
180 | ORTP_VAR_PUBLIC PayloadType payload_type_h265; | |
180 | 181 | ORTP_VAR_PUBLIC PayloadType payload_type_x_snow; |
181 | 182 | ORTP_VAR_PUBLIC PayloadType payload_type_jpeg; |
182 | 183 | ORTP_VAR_PUBLIC PayloadType payload_type_vp8; |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | /* this file is responsible of the portability of the stack */ |
19 | 19 | |
248 | 248 | |
249 | 249 | #endif |
250 | 250 | |
251 | ORTP_PUBLIC const char *getWinSocketError(int error); | |
251 | #ifdef __cplusplus | |
252 | extern "C" { | |
253 | #endif | |
254 | ||
255 | ORTP_PUBLIC const char *getWinSocketError(int error); | |
252 | 256 | #ifndef getSocketErrorCode |
253 | 257 | #define getSocketErrorCode() WSAGetLastError() |
254 | 258 | #endif |
261 | 265 | #endif |
262 | 266 | |
263 | 267 | |
264 | #ifdef __cplusplus | |
265 | extern "C"{ | |
266 | #endif | |
267 | 268 | ORTP_PUBLIC int ortp_gettimeofday (struct timeval *tv, void* tz); |
268 | 269 | #ifdef _WORKAROUND_MINGW32_BUGS |
269 | 270 | char * WSAAPI gai_strerror(int errnum); |
270 | 271 | #endif |
272 | ||
271 | 273 | #ifdef __cplusplus |
272 | 274 | } |
273 | 275 | #endif |
315 | 317 | ORTP_PUBLIC int set_non_blocking_socket(ortp_socket_t sock); |
316 | 318 | |
317 | 319 | ORTP_PUBLIC char *ortp_strndup(const char *str,int n); |
318 | ORTP_PUBLIC char *ortp_strdup_printf(const char *fmt,...); | |
319 | ORTP_PUBLIC char *ortp_strdup_vprintf(const char *fmt, va_list ap); | |
320 | ORTP_PUBLIC char *ortp_strcat_printf(char *dst, const char *fmt,...); | |
320 | #define ortp_strdup_printf bctbx_strdup_printf | |
321 | /*ORTP_PUBLIC char *ortp_strdup_printf(const char *fmt,...);*/ | |
322 | #define ortp_strdup_vprintf bctbx_strdup_vprintf | |
323 | /*ORTP_PUBLIC char *ortp_strdup_vprintf(const char *fmt, va_list ap);*/ | |
324 | #define ortp_strcat_printf bctbx_strcat_printf | |
325 | /*ORTP_PUBLIC char *ortp_strcat_printf(char *dst, const char *fmt,...);*/ | |
326 | ||
321 | 327 | ORTP_PUBLIC char *ortp_strcat_vprintf(char *dst, const char *fmt, va_list ap); |
322 | 328 | |
323 | 329 | ORTP_PUBLIC int ortp_file_exist(const char *pathname); |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | |
128 | 128 | return (ntohl(rb->fl_cnpl)>>24); |
129 | 129 | } |
130 | 130 | static ORTP_INLINE int32_t report_block_get_cum_packet_lost(const report_block_t * rb){ |
131 | int cum_loss = ntohl(rb->fl_cnpl); | |
131 | uint32_t cum_loss = (uint32_t)ntohl(rb->fl_cnpl); | |
132 | 132 | if (((cum_loss>>23)&1)==0) |
133 | return 0x00FFFFFF & cum_loss; | |
133 | return (int32_t) (0x00FFFFFF & cum_loss); | |
134 | 134 | else |
135 | return 0xFF000000 | (cum_loss-0xFFFFFF-1); | |
135 | return (int32_t)(0xFF000000 | (cum_loss-0xFFFFFF-1)); | |
136 | 136 | } |
137 | 137 | |
138 | 138 | static ORTP_INLINE void report_block_set_fraction_lost(report_block_t * rb, int fl){ |
139 | rb->fl_cnpl = htonl( (ntohl(rb->fl_cnpl) & 0xFFFFFF) | (fl&0xFF)<<24); | |
139 | rb->fl_cnpl = (uint32_t)htonl( ((uint32_t)ntohl(rb->fl_cnpl) & 0xFFFFFF) | ((uint32_t)fl&0xFF)<<24); | |
140 | 140 | } |
141 | 141 | |
142 | 142 | static ORTP_INLINE void report_block_set_cum_packet_lost(report_block_t * rb, int64_t cpl) { |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | |
86 | 86 | float jitter_buffer_size_ms;/* mean jitter buffer size in milliseconds.*/ |
87 | 87 | } jitter_stats_t; |
88 | 88 | |
89 | #define RTP_TIMESTAMP_IS_NEWER_THAN(ts1,ts2) \ | |
90 | ((uint32_t)((uint32_t)(ts1) - (uint32_t)(ts2))< (uint32_t)(1<<31)) | |
89 | #define RTP_TIMESTAMP_IS_NEWER_THAN(ts1, ts2) \ | |
90 | ((uint32_t)((uint32_t)(ts1) - (uint32_t)(ts2)) < ((uint32_t)1 << 31)) | |
91 | 91 | |
92 | #define RTP_TIMESTAMP_IS_STRICTLY_NEWER_THAN(ts1,ts2) \ | |
93 | ( ((uint32_t)((uint32_t)(ts1) - (uint32_t)(ts2))< (uint32_t)(1<<31)) && (ts1)!=(ts2) ) | |
92 | #define RTP_TIMESTAMP_IS_STRICTLY_NEWER_THAN(ts1, ts2) \ | |
93 | (((uint32_t)((uint32_t)(ts1) - (uint32_t)(ts2)) < ((uint32_t)1 << 31)) && (ts1) != (ts2)) | |
94 | 94 | |
95 | #define RTP_SEQ_IS_STRICTLY_GREATER_THAN(seq1,seq2)\ | |
96 | (((uint16_t)((uint16_t)(seq1) - (uint16_t)(seq2))< (uint16_t)(1<<15)) && (seq1!=seq2)) | |
95 | #define RTP_SEQ_IS_STRICTLY_GREATER_THAN(seq1, seq2) \ | |
96 | (((uint16_t)((uint16_t)(seq1) - (uint16_t)(seq2)) < ((uint16_t)1 << 15)) && (seq1) != (seq2)) | |
97 | 97 | |
98 | 98 | #define TIME_IS_NEWER_THAN(t1,t2) RTP_TIMESTAMP_IS_NEWER_THAN(t1,t2) |
99 | 99 |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | /** |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | /** |
46 | 46 | #define ORTP_AVPF_FEATURE_NONE 0 |
47 | 47 | #define ORTP_AVPF_FEATURE_TMMBR (1 << 0) |
48 | 48 | #define ORTP_AVPF_FEATURE_GENERIC_NACK (1 << 1) |
49 | #define ORTP_AVPF_FEATURE_IMMEDIATE_NACK (1 << 2) | |
49 | 50 | |
50 | 51 | |
51 | 52 | typedef enum { |
101 | 102 | uint32_t last_log_ts; |
102 | 103 | uint32_t local_ts_start; |
103 | 104 | uint32_t remote_ts_start; |
105 | uint32_t diverged_start_ts; | |
106 | bool_t is_diverging; | |
107 | bool_t jb_size_updated; | |
108 | bool_t pad[2]; | |
104 | 109 | } JitterControl; |
105 | 110 | |
106 | 111 | typedef struct _WaitPoint |
240 | 245 | } OrtpRtcpXrRcvrRttMode; |
241 | 246 | |
242 | 247 | typedef enum { |
248 | OrtpRtcpXrStatSummaryNone = 0, | |
243 | 249 | OrtpRtcpXrStatSummaryLoss = (1 << 7), |
244 | 250 | OrtpRtcpXrStatSummaryDup = (1 << 6), |
245 | 251 | OrtpRtcpXrStatSummaryJitt = (1 << 5), |
327 | 333 | uint32_t snd_time_offset;/*the scheduler time when the application send its first timestamp*/ |
328 | 334 | uint32_t snd_ts_offset; /* the first application timestamp sent by the application */ |
329 | 335 | uint32_t snd_rand_offset; /* a random number added to the user offset to make the stream timestamp*/ |
330 | uint32_t snd_last_ts; /* the last stream timestamp sended */ | |
336 | uint32_t snd_last_ts; /* the last stream timestamp sent */ | |
337 | uint16_t snd_last_nack; /* the last nack sent when in immediate mode */ | |
331 | 338 | uint32_t rcv_time_offset; /*the scheduler time when the application ask for its first timestamp*/ |
332 | 339 | uint32_t rcv_ts_offset; /* the first stream timestamp */ |
333 | 340 | uint32_t rcv_query_ts_offset; /* the first user timestamp asked by the application */ |
352 | 359 | jitter_stats_t jitter_stats; |
353 | 360 | struct _OrtpCongestionDetector *congdetect; |
354 | 361 | struct _OrtpVideoBandwidthEstimator *video_bw_estimator; |
362 | ortp_thread_t win_t; | |
363 | volatile bool_t is_win_thread_running; | |
364 | ortp_mutex_t winthread_lock; | |
365 | queue_t winrq; | |
366 | ortp_mutex_t winrq_lock; | |
355 | 367 | }RtpStream; |
356 | 368 | |
357 | 369 | typedef struct _RtcpStream |
610 | 622 | ORTP_PUBLIC int rtp_session_recv_with_ts(RtpSession *session, uint8_t *buffer, int len, uint32_t ts, int *have_more); |
611 | 623 | ORTP_PUBLIC int rtp_session_send_with_ts(RtpSession *session, const uint8_t *buffer, int len, uint32_t userts); |
612 | 624 | |
625 | /* Specific function called to reset the winrq queue and if called on windows to stop the async reception thread */ | |
626 | ORTP_PUBLIC void rtp_session_reset_recvfrom(RtpSession *session); | |
627 | ||
613 | 628 | /* event API*/ |
614 | 629 | ORTP_PUBLIC void rtp_session_register_event_queue(RtpSession *session, OrtpEvQueue *q); |
615 | 630 | ORTP_PUBLIC void rtp_session_unregister_event_queue(RtpSession *session, OrtpEvQueue *q); |
755 | 770 | |
756 | 771 | ORTP_PUBLIC void meta_rtp_transport_destroy(RtpTransport *tp); |
757 | 772 | ORTP_PUBLIC void meta_rtp_transport_append_modifier(RtpTransport *tp,RtpTransportModifier *tpm); |
773 | ORTP_PUBLIC void meta_rtp_transport_prepend_modifier(RtpTransport *tp,RtpTransportModifier *tpm); | |
758 | 774 | |
759 | 775 | ORTP_PUBLIC int rtp_session_splice(RtpSession *session, RtpSession *to_session); |
760 | 776 | ORTP_PUBLIC int rtp_session_unsplice(RtpSession *session, RtpSession *to_session); |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #ifndef rtpsignaltable_h |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | /** |
19 | 19 | * \file sessionset.h |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #ifndef STR_UTILS_H |
146 | 146 | |
147 | 147 | ORTP_PUBLIC mblk_t *concatb(mblk_t *mp, mblk_t *newm); |
148 | 148 | |
149 | /*Make sure the message has a unique owner, if not duplicate the underlying data buffer so that it can be changed without impacting others. | |
150 | Note that in case of copy, the message will be un-fragmented, exactly the way msgpullup() does. Always returns mp.*/ | |
151 | ORTP_PUBLIC mblk_t * msgown(mblk_t *mp); | |
152 | ||
149 | 153 | #define qempty(q) (&(q)->_q_stopper==(q)->_q_stopper.b_next) |
150 | 154 | #define qfirst(q) ((q)->_q_stopper.b_next!=&(q)->_q_stopper ? (q)->_q_stopper.b_next : NULL) |
151 | 155 | #define qbegin(q) ((q)->_q_stopper.b_next) |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | /** |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #ifndef ORTP_UTILS_H |
29 | 29 | #cmakedefine HAVE_SYS_SHM_H 1 |
30 | 30 | #cmakedefine HAVE_STDATOMIC_H 1 |
31 | 31 | #cmakedefine HAVE_ARC4RANDOM 1 |
32 | #cmakedefine HAVE_RECVMSG 1 | |
33 | #cmakedefine HAVE_SENDMSG 1 | |
32 | 34 | |
33 | 35 | #cmakedefine ORTP_BIGENDIAN |
34 | 36 |
19 | 19 | # |
20 | 20 | ############################################################################ |
21 | 21 | |
22 | set(LIBS ${BCTOOLBOX_CORE_LIBRARIES}) | |
22 | set(LIBS ) | |
23 | 23 | if(NOT ANDROID) |
24 | 24 | list(APPEND LIBS ${CMAKE_THREAD_LIBS_INIT}) |
25 | 25 | endif() |
39 | 39 | jitterctl.c |
40 | 40 | kalmanrls.c |
41 | 41 | logging.c |
42 | nack.c | |
42 | 43 | netsim.c |
43 | 44 | ortp.c |
44 | 45 | payloadtype.c |
62 | 63 | utils.c |
63 | 64 | ) |
64 | 65 | set(ORTP_SOURCE_FILES_CXX ) |
66 | ||
67 | add_definitions( | |
68 | -DBCTBX_LOG_DOMAIN="ortp" | |
69 | ) | |
65 | 70 | |
66 | 71 | if(WIN32) |
67 | 72 | list(APPEND ORTP_SOURCE_FILES_C dll_entry.c) |
88 | 93 | add_library(ortp-static STATIC ${ORTP_HEADER_FILES} ${ORTP_SOURCE_FILES_C} ${ORTP_SOURCE_FILES_CXX}) |
89 | 94 | set_target_properties(ortp-static PROPERTIES OUTPUT_NAME ortp) |
90 | 95 | target_compile_definitions(ortp-static PRIVATE "ORTP_EXPORTS") |
91 | target_include_directories(ortp-static PUBLIC ${BCTOOLBOX_CORE_INCLUDE_DIRS}) | |
92 | 96 | target_link_libraries(ortp-static INTERFACE ${LIBS}) |
93 | install(TARGETS ortp-static EXPORT ${EXPORT_TARGETS_NAME}Targets | |
97 | install(TARGETS ortp-static EXPORT ${EXPORT_TARGET_NAME}Targets | |
94 | 98 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |
95 | 99 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE |
96 | 100 | ) |
97 | 101 | endif() |
98 | 102 | if(ENABLE_SHARED) |
99 | 103 | add_library(ortp SHARED ${ORTP_HEADER_FILES} ${ORTP_SOURCE_FILES_C} ${ORTP_SOURCE_FILES_CXX}) |
100 | if(IOS) | |
104 | set_target_properties(ortp PROPERTIES LINKER_LANGUAGE CXX) | |
105 | if(APPLE) | |
101 | 106 | if(IOS) |
102 | 107 | set(MIN_OS ${LINPHONE_IOS_DEPLOYMENT_TARGET}) |
103 | 108 | else() |
119 | 124 | target_compile_options(ortp PRIVATE "/DELAYLOAD:Qwave.dll") |
120 | 125 | endif() |
121 | 126 | target_compile_definitions(ortp PRIVATE "ORTP_EXPORTS") |
122 | target_include_directories(ortp PUBLIC ${BCTOOLBOX_CORE_INCLUDE_DIRS}) | |
123 | target_link_libraries(ortp PRIVATE ${LIBS}) | |
127 | target_include_directories(ortp | |
128 | INTERFACE $<INSTALL_INTERFACE:include> | |
129 | ) | |
130 | target_link_libraries(ortp PUBLIC bctoolbox PRIVATE ${LIBS}) | |
124 | 131 | if(MSVC) |
125 | 132 | if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") |
126 | 133 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/ortp.pdb |
129 | 136 | ) |
130 | 137 | endif() |
131 | 138 | endif() |
132 | install(TARGETS ortp EXPORT ${EXPORT_TARGETS_NAME}Targets | |
139 | install(TARGETS ortp EXPORT ${EXPORT_TARGET_NAME}Targets | |
133 | 140 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
134 | 141 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
135 | 142 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |
26 | 26 | kalmanrls.c \ |
27 | 27 | jitterctl.c jitterctl.h \ |
28 | 28 | logging.c \ |
29 | nack.c \ | |
29 | 30 | netsim.c \ |
30 | 31 | ortp.c \ |
31 | 32 | payloadtype.c \ |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | |
712 | 712 | FLAGS(PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED) |
713 | 713 | }; |
714 | 714 | |
715 | PayloadType payload_type_h265={ | |
716 | TYPE(PAYLOAD_VIDEO), | |
717 | CLOCK_RATE(90000), | |
718 | BITS_PER_SAMPLE(0), | |
719 | ZERO_PATTERN(NULL), | |
720 | PATTERN_LENGTH(0), | |
721 | NORMAL_BITRATE(256000), | |
722 | MIME_TYPE("H265"), | |
723 | CHANNELS(0), | |
724 | RECV_FMTP(NULL), | |
725 | SEND_FMTP(NULL), | |
726 | AVPF(PAYLOAD_TYPE_AVPF_FIR | PAYLOAD_TYPE_AVPF_PLI, RTCP_DEFAULT_REPORT_INTERVAL), | |
727 | FLAGS(PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED) | |
728 | }; | |
729 | ||
715 | 730 | PayloadType payload_type_x_snow={ |
716 | 731 | TYPE(PAYLOAD_VIDEO), |
717 | 732 | CLOCK_RATE(90000), |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #include "congestiondetector.h" |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
0 | 18 | |
1 | 19 | #ifdef HAVE_CONFIG_H |
2 | 20 | #include "ortp-config.h" |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #include "ortp/event.h" |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #include "ortp/utils.h" |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | /*************************************************************************** |
19 | 19 | * jitterctl.c |
153 | 153 | void rtp_session_set_jitter_buffer_params(RtpSession *session, const JBParameters *par){ |
154 | 154 | if (par == &session->rtp.jittctl.params) return; |
155 | 155 | memcpy(&session->rtp.jittctl.params, par, sizeof (JBParameters)); |
156 | rtp_session_init_jitter_buffer(session); | |
156 | //rtp_session_init_jitter_buffer(session); | |
157 | session->rtp.jittctl.jb_size_updated = TRUE; | |
157 | 158 | } |
158 | 159 | |
159 | 160 | void rtp_session_get_jitter_buffer_params(RtpSession *session, JBParameters *par){ |
237 | 238 | void jitter_control_new_packet_rls(JitterControl *ctl, uint32_t packet_ts, uint32_t cur_str_ts){ |
238 | 239 | int32_t diff = packet_ts - cur_str_ts; |
239 | 240 | int deviation; |
240 | bool_t jb_size_updated = FALSE; | |
241 | ||
242 | if (ctl->is_diverging){ | |
243 | int32_t elapsed = (int32_t)(cur_str_ts - ctl->diverged_start_ts); | |
244 | if (elapsed >= ctl->clock_rate){ | |
245 | ortp_error("Jitter buffer stays unconverged for one second, reset it."); | |
246 | ctl->count = 0; | |
247 | ctl->is_diverging = FALSE; | |
248 | } | |
249 | } | |
241 | 250 | |
242 | 251 | if (ctl->count==0){ |
243 | 252 | ctl->clock_offset_ts = ctl->prev_clock_offset_ts = (int32_t)packet_ts; |
271 | 280 | if (.5f<ctl->kalman_rls.m && ctl->kalman_rls.m<2.f){ |
272 | 281 | /*realistic clock ratio, the filter is well converged*/ |
273 | 282 | ctl->clock_offset_ts = (int32_t)((int32_t)ctl->kalman_rls.b + ctl->remote_ts_start); |
283 | if (ctl->is_diverging){ | |
284 | ctl->is_diverging = FALSE; | |
285 | } | |
274 | 286 | }else{ |
275 | 287 | ctl->clock_offset_ts = diff; |
288 | if (!ctl->is_diverging){ | |
289 | ctl->is_diverging = TRUE; | |
290 | ctl->diverged_start_ts = cur_str_ts; | |
291 | } | |
276 | 292 | } |
277 | 293 | |
278 | 294 | /*ortp_message("deviation=%g ms", 1000.0*deviation/(double)ctl->clock_rate);*/ |
280 | 296 | jitter_control_update_interarrival_jitter(ctl, diff); |
281 | 297 | cur_str_ts -= ctl->local_ts_start; |
282 | 298 | |
283 | if (ctl->params.adaptive){ | |
299 | if (ctl->params.adaptive || ctl->jb_size_updated){ | |
284 | 300 | bool_t max_updated = ortp_extremum_record_max(&ctl->max_ts_deviation, cur_str_ts, (float)deviation); |
285 | 301 | float max_deviation = MAX(ortp_extremum_get_previous(&ctl->max_ts_deviation), ortp_extremum_get_current(&ctl->max_ts_deviation)); |
286 | 302 | if (max_updated && max_deviation > ctl->adapt_jitt_comp_ts){ |
287 | 303 | ctl->adapt_jitt_comp_ts=(int)max_deviation; |
288 | jb_size_updated = TRUE; | |
304 | ctl->jb_size_updated = TRUE; | |
289 | 305 | }else if (max_deviation < ctl->params.ramp_threshold/100.f*ctl->adapt_jitt_comp_ts){ |
290 | 306 | /*Jitter is decreasing. Make a smooth descent to avoid dropping lot of packets*/ |
291 | 307 | if ( (int32_t)(cur_str_ts - ctl->adapt_refresh_prev_ts) > ((ctl->params.ramp_refresh_ms*ctl->clock_rate)/1000)) { |
292 | 308 | ctl->adapt_jitt_comp_ts -= (ctl->params.ramp_step_ms * ctl->clock_rate) / 1000; |
293 | jb_size_updated = TRUE; | |
309 | ctl->jb_size_updated = TRUE; | |
294 | 310 | } |
295 | 311 | } |
296 | if (jb_size_updated){ | |
312 | if (ctl->jb_size_updated){ | |
297 | 313 | int min_size_ts = (ctl->params.min_size * ctl->clock_rate) / 1000; |
298 | 314 | int max_size_ts = (ctl->params.max_size * ctl->clock_rate) / 1000; |
299 | 315 | if (ctl->adapt_jitt_comp_ts < min_size_ts){ |
302 | 318 | ctl->adapt_jitt_comp_ts = max_size_ts; |
303 | 319 | } |
304 | 320 | ctl->adapt_refresh_prev_ts = cur_str_ts; |
305 | jb_size_updated = TRUE; | |
321 | ctl->jb_size_updated = FALSE; | |
306 | 322 | } |
307 | 323 | } |
308 | 324 | if (time_for_log(ctl, cur_str_ts)){ |
309 | ortp_message("jitter buffer %s: target-size: %f ms, effective-size: %f (min: %i nom: %i, max: %i)",jb_size_updated ? "updated" : "stable", | |
325 | ortp_message("jitter buffer %s: target-size: %f ms, effective-size: %f (min: %i nom: %i, max: %i)",ctl->jb_size_updated ? "updated" : "stable", | |
310 | 326 | ((float)ctl->adapt_jitt_comp_ts/(float)ctl->clock_rate)*1000.0, |
311 | 327 | ctl->jitter_buffer_mean_size, |
312 | 328 | ctl->params.min_size, ctl->params.nom_size, ctl->params.max_size); |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | /*************************************************************************** |
19 | 19 | * jitterctl.h |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #include "ortp/utils.h" |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | #ifdef HAVE_CONFIG_H | |
20 | #include "ortp-config.h" | |
21 | #endif | |
22 | ||
19 | #include "ortp/utils.h" | |
23 | 20 | #include "ortp/logging.h" |
24 | #include "utils.h" | |
25 | #include <time.h> | |
26 | 21 | |
27 | 22 | |
28 | typedef struct{ | |
29 | char *domain; | |
30 | unsigned int logmask; | |
31 | }OrtpLogDomain; | |
32 | 23 | |
33 | static void ortp_log_domain_destroy(OrtpLogDomain *obj){ | |
34 | if (obj->domain) ortp_free(obj->domain); | |
35 | ortp_free(obj); | |
36 | } | |
37 | ||
38 | typedef struct _OrtpLogger{ | |
39 | OrtpLogFunc logv_out; | |
40 | unsigned int log_mask; /*the default log mask, if no per-domain settings are found*/ | |
41 | FILE *log_file; | |
42 | unsigned long log_thread_id; | |
43 | OList *log_stored_messages_list; | |
44 | OList *log_domains; | |
45 | ortp_mutex_t log_stored_messages_mutex; | |
46 | ortp_mutex_t domains_mutex; | |
47 | }OrtpLogger; | |
48 | ||
49 | ||
50 | static OrtpLogger __ortp_logger = { &ortp_logv_out, ORTP_WARNING|ORTP_ERROR|ORTP_FATAL, 0}; | |
51 | ||
52 | void ortp_init_logger(void){ | |
53 | ortp_mutex_init(&__ortp_logger.domains_mutex, NULL); | |
54 | } | |
55 | ||
56 | void ortp_uninit_logger(void){ | |
57 | ortp_mutex_destroy(&__ortp_logger.domains_mutex); | |
58 | __ortp_logger.log_domains = o_list_free_with_data(__ortp_logger.log_domains, (void (*)(void*))ortp_log_domain_destroy); | |
59 | } | |
60 | ||
61 | /** | |
62 | *@param file a FILE pointer where to output the ortp logs. | |
63 | * | |
64 | **/ | |
65 | void ortp_set_log_file(FILE *file) | |
66 | { | |
67 | __ortp_logger.log_file=file; | |
68 | } | |
69 | ||
70 | /** | |
71 | *@param func: your logging function, compatible with the OrtpLogFunc prototype. | |
72 | * | |
73 | **/ | |
74 | 24 | void ortp_set_log_handler(OrtpLogFunc func){ |
75 | __ortp_logger.logv_out=func; | |
25 | bctbx_set_log_handler(func); | |
76 | 26 | } |
77 | 27 | |
78 | 28 | OrtpLogFunc ortp_get_log_handler(void){ |
79 | return __ortp_logger.logv_out; | |
80 | } | |
81 | ||
82 | static OrtpLogDomain * get_log_domain(const char *domain){ | |
83 | OList *it; | |
84 | ||
85 | if (domain == NULL) return NULL; | |
86 | for (it = __ortp_logger.log_domains; it != NULL; it = it->next){ | |
87 | OrtpLogDomain *ld = (OrtpLogDomain*)it->data; | |
88 | if (ld->domain && strcmp(ld->domain, domain) == 0 ){ | |
89 | return ld; | |
90 | } | |
91 | } | |
92 | 29 | return NULL; |
93 | 30 | } |
94 | ||
95 | static OrtpLogDomain *get_log_domain_rw(const char *domain){ | |
96 | OrtpLogDomain *ret; | |
97 | ||
98 | if (domain == NULL) return NULL; | |
99 | ret = get_log_domain(domain); | |
100 | if (ret) return ret; | |
101 | /*it does not exist, hence create it by taking the mutex*/ | |
102 | ortp_mutex_lock(&__ortp_logger.domains_mutex); | |
103 | ret = get_log_domain(domain); | |
104 | if (!ret){ | |
105 | ret = ortp_new0(OrtpLogDomain,1); | |
106 | ret->domain = ortp_strdup(domain); | |
107 | ret->logmask = __ortp_logger.log_mask; | |
108 | __ortp_logger.log_domains = o_list_prepend(__ortp_logger.log_domains, ret); | |
109 | } | |
110 | ortp_mutex_unlock(&__ortp_logger.domains_mutex); | |
111 | return ret; | |
112 | } | |
113 | ||
114 | 31 | /** |
115 | * @ param levelmask a mask of ORTP_DEBUG, ORTP_MESSAGE, ORTP_WARNING, ORTP_ERROR | |
116 | * ORTP_FATAL . | |
117 | **/ | |
118 | void ortp_set_log_level_mask(const char *domain, int levelmask){ | |
119 | if (domain == NULL) __ortp_logger.log_mask=levelmask; | |
120 | else get_log_domain_rw(domain)->logmask = levelmask; | |
32 | *@param file a FILE pointer where to output the ortp logs. | |
33 | * | |
34 | **/ | |
35 | void ortp_set_log_file(FILE *file){ | |
36 | bctbx_set_log_file(file); | |
121 | 37 | } |
122 | 38 | |
123 | 39 | |
124 | void ortp_set_log_level(const char *domain, OrtpLogLevel level){ | |
125 | int levelmask = ORTP_FATAL; | |
126 | if (level<=ORTP_ERROR){ | |
127 | levelmask |= ORTP_ERROR; | |
128 | } | |
129 | if (level<=ORTP_WARNING){ | |
130 | levelmask |= ORTP_WARNING; | |
131 | } | |
132 | if (level<=ORTP_MESSAGE){ | |
133 | levelmask |= ORTP_MESSAGE; | |
134 | } | |
135 | if (level<=ORTP_TRACE){ | |
136 | levelmask |= ORTP_TRACE; | |
137 | } | |
138 | if (level<=ORTP_DEBUG){ | |
139 | levelmask |= ORTP_DEBUG; | |
140 | } | |
141 | ortp_set_log_level_mask(domain, levelmask); | |
142 | } | |
143 | ||
144 | unsigned int ortp_get_log_level_mask(const char *domain) { | |
145 | OrtpLogDomain *ld; | |
146 | if (domain == NULL || (ld = get_log_domain(domain)) == NULL) return __ortp_logger.log_mask; | |
147 | else return ld->logmask; | |
148 | } | |
149 | ||
150 | void ortp_set_log_thread_id(unsigned long thread_id) { | |
151 | if (thread_id == 0) { | |
152 | ortp_logv_flush(); | |
153 | ortp_mutex_destroy(&__ortp_logger.log_stored_messages_mutex); | |
154 | } else { | |
155 | ortp_mutex_init(&__ortp_logger.log_stored_messages_mutex, NULL); | |
156 | } | |
157 | __ortp_logger.log_thread_id = thread_id; | |
158 | } | |
159 | ||
160 | char * ortp_strdup_vprintf(const char *fmt, va_list ap) | |
161 | { | |
162 | /* Guess we need no more than 100 bytes. */ | |
163 | int n, size = 200; | |
164 | char *p,*np; | |
165 | #ifndef _WIN32 | |
166 | va_list cap;/*copy of our argument list: a va_list cannot be re-used (SIGSEGV on linux 64 bits)*/ | |
167 | #endif | |
168 | if ((p = (char *) ortp_malloc (size)) == NULL) | |
169 | return NULL; | |
170 | while (1){ | |
171 | /* Try to print in the allocated space. */ | |
172 | #ifndef _WIN32 | |
173 | va_copy(cap,ap); | |
174 | n = vsnprintf (p, size, fmt, cap); | |
175 | va_end(cap); | |
176 | #else | |
177 | /*this works on 32 bits, luckily*/ | |
178 | n = vsnprintf (p, size, fmt, ap); | |
179 | #endif | |
180 | /* If that worked, return the string. */ | |
181 | if (n > -1 && n < size) | |
182 | return p; | |
183 | //printf("Reallocing space.\n"); | |
184 | /* Else try again with more space. */ | |
185 | if (n > -1) /* glibc 2.1 */ | |
186 | size = n + 1; /* precisely what is needed */ | |
187 | else /* glibc 2.0 */ | |
188 | size *= 2; /* twice the old size */ | |
189 | if ((np = (char *) ortp_realloc (p, size)) == NULL) | |
190 | { | |
191 | free(p); | |
192 | return NULL; | |
193 | } else { | |
194 | p = np; | |
195 | } | |
196 | } | |
197 | } | |
198 | ||
199 | char *ortp_strdup_printf(const char *fmt,...){ | |
200 | char *ret; | |
201 | va_list args; | |
202 | va_start (args, fmt); | |
203 | ret=ortp_strdup_vprintf(fmt, args); | |
204 | va_end (args); | |
205 | return ret; | |
206 | } | |
207 | ||
208 | char * ortp_strcat_vprintf(char* dst, const char *fmt, va_list ap){ | |
209 | char *ret; | |
210 | size_t dstlen, retlen; | |
211 | ||
212 | ret=ortp_strdup_vprintf(fmt, ap); | |
213 | if (!dst) return ret; | |
214 | ||
215 | dstlen = strlen(dst); | |
216 | retlen = strlen(ret); | |
217 | ||
218 | if ((dst = ortp_realloc(dst, dstlen+retlen+1)) != NULL){ | |
219 | strncat(dst,ret,retlen); | |
220 | dst[dstlen+retlen] = '\0'; | |
221 | ortp_free(ret); | |
222 | return dst; | |
223 | } else { | |
224 | ortp_free(ret); | |
225 | return NULL; | |
226 | } | |
227 | } | |
228 | ||
229 | char *ortp_strcat_printf(char* dst, const char *fmt,...){ | |
230 | char *ret; | |
231 | va_list args; | |
232 | va_start (args, fmt); | |
233 | ret=ortp_strcat_vprintf(dst, fmt, args); | |
234 | va_end (args); | |
235 | return ret; | |
236 | } | |
237 | ||
238 | #if defined(_WIN32) || defined(_WIN32_WCE) | |
239 | #define ENDLINE "\r\n" | |
240 | #else | |
241 | #define ENDLINE "\n" | |
242 | #endif | |
243 | ||
244 | typedef struct { | |
245 | int level; | |
246 | char *msg; | |
247 | char *domain; | |
248 | } ortp_stored_log_t; | |
249 | ||
250 | void _ortp_logv_flush(int dummy, ...) { | |
251 | OList *elem; | |
252 | OList *msglist; | |
253 | va_list empty_va_list; | |
254 | va_start(empty_va_list, dummy); | |
255 | ortp_mutex_lock(&__ortp_logger.log_stored_messages_mutex); | |
256 | msglist = __ortp_logger.log_stored_messages_list; | |
257 | __ortp_logger.log_stored_messages_list = NULL; | |
258 | ortp_mutex_unlock(&__ortp_logger.log_stored_messages_mutex); | |
259 | for (elem = msglist; elem != NULL; elem = o_list_next(elem)) { | |
260 | ortp_stored_log_t *l = (ortp_stored_log_t *)elem->data; | |
261 | #ifdef _WIN32 | |
262 | __ortp_logger.logv_out(l->domain, l->level, l->msg, empty_va_list); | |
263 | #else | |
264 | va_list cap; | |
265 | va_copy(cap, empty_va_list); | |
266 | __ortp_logger.logv_out(l->domain, l->level, l->msg, cap); | |
267 | va_end(cap); | |
268 | #endif | |
269 | if (l->domain) ortp_free(l->domain); | |
270 | ortp_free(l->msg); | |
271 | ortp_free(l); | |
272 | } | |
273 | o_list_free(msglist); | |
274 | va_end(empty_va_list); | |
275 | } | |
276 | ||
277 | void ortp_logv_flush(void) { | |
278 | _ortp_logv_flush(0); | |
279 | } | |
280 | ||
281 | void ortp_logv(const char *domain, OrtpLogLevel level, const char *fmt, va_list args) { | |
282 | if ((__ortp_logger.logv_out != NULL) && ortp_log_level_enabled(domain, level)) { | |
283 | if (__ortp_logger.log_thread_id == 0) { | |
284 | __ortp_logger.logv_out(domain, level, fmt, args); | |
285 | } else if (__ortp_logger.log_thread_id == ortp_thread_self()) { | |
286 | ortp_logv_flush(); | |
287 | __ortp_logger.logv_out(domain, level, fmt, args); | |
288 | } else { | |
289 | ortp_stored_log_t *l = ortp_new(ortp_stored_log_t, 1); | |
290 | l->domain = domain ? ortp_strdup(domain) : NULL; | |
291 | l->level = level; | |
292 | l->msg = ortp_strdup_vprintf(fmt, args); | |
293 | ortp_mutex_lock(&__ortp_logger.log_stored_messages_mutex); | |
294 | __ortp_logger.log_stored_messages_list = o_list_append(__ortp_logger.log_stored_messages_list, l); | |
295 | ortp_mutex_unlock(&__ortp_logger.log_stored_messages_mutex); | |
296 | } | |
297 | } | |
298 | #if !defined(_WIN32_WCE) | |
299 | if (level == ORTP_FATAL) { | |
300 | ortp_logv_flush(); | |
301 | abort(); | |
302 | } | |
303 | #endif | |
304 | } | |
305 | ||
306 | /*This function does the default formatting and output to file*/ | |
307 | void ortp_logv_out(const char *domain, OrtpLogLevel lev, const char *fmt, va_list args){ | |
308 | const char *lname="undef"; | |
309 | char *msg; | |
310 | struct timeval tp; | |
311 | struct tm *lt; | |
312 | #ifndef _WIN32 | |
313 | struct tm tmbuf; | |
314 | #endif | |
315 | time_t tt; | |
316 | ortp_gettimeofday(&tp,NULL); | |
317 | tt = (time_t)tp.tv_sec; | |
318 | ||
319 | #ifdef _WIN32 | |
320 | lt = localtime(&tt); | |
321 | #else | |
322 | lt = localtime_r(&tt,&tmbuf); | |
323 | #endif | |
324 | ||
325 | if (__ortp_logger.log_file==NULL) __ortp_logger.log_file=stderr; | |
326 | switch(lev){ | |
327 | case ORTP_DEBUG: | |
328 | lname = "debug"; | |
329 | break; | |
330 | case ORTP_MESSAGE: | |
331 | lname = "message"; | |
332 | break; | |
333 | case ORTP_WARNING: | |
334 | lname = "warning"; | |
335 | break; | |
336 | case ORTP_ERROR: | |
337 | lname = "error"; | |
338 | break; | |
339 | case ORTP_FATAL: | |
340 | lname = "fatal"; | |
341 | break; | |
342 | default: | |
343 | lname = "badlevel"; | |
344 | } | |
345 | ||
346 | msg=ortp_strdup_vprintf(fmt,args); | |
347 | #if defined(_MSC_VER) && !defined(_WIN32_WCE) | |
348 | #ifndef _UNICODE | |
349 | OutputDebugStringA(msg); | |
350 | OutputDebugStringA("\r\n"); | |
351 | #else | |
352 | { | |
353 | size_t len=strlen(msg); | |
354 | wchar_t *tmp=(wchar_t*)ortp_malloc0((len+1)*sizeof(wchar_t)); | |
355 | mbstowcs(tmp,msg,len); | |
356 | OutputDebugStringW(tmp); | |
357 | OutputDebugStringW(L"\r\n"); | |
358 | ortp_free(tmp); | |
359 | } | |
360 | #endif | |
361 | #endif | |
362 | fprintf(__ortp_logger.log_file,"%i-%.2i-%.2i %.2i:%.2i:%.2i:%.3i ortp-%s-%s" ENDLINE | |
363 | ,1900+lt->tm_year,1+lt->tm_mon,lt->tm_mday,lt->tm_hour,lt->tm_min,lt->tm_sec | |
364 | ,(int)(tp.tv_usec/1000), lname, msg); | |
365 | fflush(__ortp_logger.log_file); | |
366 | ||
367 | // fatal messages should go to stderr too, even if we are using a file since application will abort right after | |
368 | if (__ortp_logger.log_file != stderr && lev == ORTP_FATAL) { | |
369 | fprintf(stderr,"%i-%.2i-%.2i %.2i:%.2i:%.2i:%.3i ortp-%s-%s" ENDLINE | |
370 | ,1900+lt->tm_year,1+lt->tm_mon,lt->tm_mday,lt->tm_hour,lt->tm_min,lt->tm_sec | |
371 | ,(int)(tp.tv_usec/1000), lname, msg); | |
372 | fflush(stderr); | |
373 | } | |
374 | ||
375 | ortp_free(msg); | |
376 | } | |
377 | ||
378 | ||
379 | #ifdef __QNX__ | |
380 | #include <slog2.h> | |
381 | ||
382 | static bool_t slog2_registered = FALSE; | |
383 | static slog2_buffer_set_config_t slog2_buffer_config; | |
384 | static slog2_buffer_t slog2_buffer_handle[2]; | |
385 | ||
386 | void ortp_qnx_log_handler(const char *domain, OrtpLogLevel lev, const char *fmt, va_list args) { | |
387 | uint8_t severity = SLOG2_DEBUG1; | |
388 | uint8_t buffer_idx = 1; | |
389 | char* msg; | |
390 | ||
391 | if (slog2_registered != TRUE) { | |
392 | slog2_buffer_config.buffer_set_name = domain; | |
393 | slog2_buffer_config.num_buffers = 2; | |
394 | slog2_buffer_config.verbosity_level = SLOG2_DEBUG2; | |
395 | slog2_buffer_config.buffer_config[0].buffer_name = "hi_rate"; | |
396 | slog2_buffer_config.buffer_config[0].num_pages = 6; | |
397 | slog2_buffer_config.buffer_config[1].buffer_name = "lo_rate"; | |
398 | slog2_buffer_config.buffer_config[1].num_pages = 2; | |
399 | if (slog2_register(&slog2_buffer_config, slog2_buffer_handle, 0) == 0) { | |
400 | slog2_registered = TRUE; | |
401 | } else { | |
402 | fprintf(stderr, "Error registering slogger2 buffer!\n"); | |
403 | return; | |
404 | } | |
405 | } | |
406 | ||
407 | switch(lev){ | |
408 | case ORTP_DEBUG: | |
409 | severity = SLOG2_DEBUG1; | |
410 | break; | |
411 | case ORTP_MESSAGE: | |
412 | severity = SLOG2_INFO; | |
413 | break; | |
414 | case ORTP_WARNING: | |
415 | severity = SLOG2_WARNING; | |
416 | break; | |
417 | case ORTP_ERROR: | |
418 | severity = SLOG2_ERROR; | |
419 | break; | |
420 | case ORTP_FATAL: | |
421 | severity = SLOG2_CRITICAL; | |
422 | break; | |
423 | default: | |
424 | severity = SLOG2_CRITICAL; | |
425 | } | |
426 | ||
427 | msg = ortp_strdup_vprintf(fmt,args); | |
428 | slog2c(slog2_buffer_handle[buffer_idx], 0, severity, msg); | |
429 | } | |
430 | #endif /* __QNX__ */ |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
19 | #include "ortp/logging.h" | |
20 | #include "ortp/nack.h" | |
21 | ||
22 | #define DECREASE_JITTER_DELAY 5000 | |
23 | ||
24 | static mblk_t *find_packet_with_sequence_number(const queue_t *q, const uint16_t seq_number) { | |
25 | mblk_t *tmp; | |
26 | ||
27 | for (tmp = qbegin(q); !qend(q, tmp); tmp = qnext(q, tmp)) { | |
28 | if (ntohs(rtp_get_seqnumber(tmp)) == seq_number) { | |
29 | return tmp; | |
30 | } | |
31 | } | |
32 | ||
33 | return NULL; | |
34 | } | |
35 | ||
36 | static void generic_nack_received(const OrtpEventData *evd, OrtpNackContext *ctx) { | |
37 | if (rtcp_is_RTPFB(evd->packet) && rtcp_RTPFB_get_type(evd->packet) == RTCP_RTPFB_NACK) { | |
38 | RtpTransport *rtpt = NULL; | |
39 | rtcp_fb_generic_nack_fci_t *fci; | |
40 | uint16_t pid, blp, seq; | |
41 | mblk_t *lost_msg; | |
42 | ||
43 | /* get RTP transport from session */ | |
44 | rtp_session_get_transports(ctx->session, &rtpt, NULL); | |
45 | ||
46 | fci = rtcp_RTPFB_generic_nack_get_fci(evd->packet); | |
47 | pid = rtcp_fb_generic_nack_fci_get_pid(fci); | |
48 | blp = rtcp_fb_generic_nack_fci_get_blp(fci); | |
49 | ||
50 | bctbx_mutex_lock(&ctx->sent_packets_mutex); | |
51 | ||
52 | lost_msg = find_packet_with_sequence_number(&ctx->sent_packets, pid); | |
53 | if (lost_msg != NULL) { | |
54 | meta_rtp_transport_modifier_inject_packet_to_send(rtpt, ctx->rtp_modifier, lost_msg, 0); | |
55 | ortp_message("OrtpNackContext [%p]: Resending missing packet with seq=%hu", ctx, pid); | |
56 | } else { | |
57 | ortp_warning("OrtpNackContext [%p]: Cannot find missing packet with seq=%hu", ctx, pid); | |
58 | } | |
59 | ++pid; | |
60 | ||
61 | for (seq = blp; seq != 0; seq >>= 1, ++pid) { | |
62 | if (seq & 1) { | |
63 | lost_msg = find_packet_with_sequence_number(&ctx->sent_packets, pid); | |
64 | if (lost_msg != NULL) { | |
65 | meta_rtp_transport_modifier_inject_packet_to_send(rtpt, ctx->rtp_modifier, lost_msg, 0); | |
66 | ortp_message("OrtpNackContext [%p]: Resending missing packet with seq=%hu", ctx, pid); | |
67 | } else { | |
68 | ortp_warning("OrtpNackContext [%p]: Cannot find missing packet with seq=%hu", ctx, pid); | |
69 | } | |
70 | } | |
71 | } | |
72 | ||
73 | bctbx_mutex_unlock(&ctx->sent_packets_mutex); | |
74 | } | |
75 | } | |
76 | ||
77 | static int ortp_nack_rtp_process_on_send(RtpTransportModifier *t, mblk_t *msg) { | |
78 | OrtpNackContext *userData = (OrtpNackContext *) t->data; | |
79 | ||
80 | if (rtp_get_version(msg) == 2) { | |
81 | bctbx_mutex_lock(&userData->sent_packets_mutex); | |
82 | ||
83 | // Remove the oldest packet if the cache is full | |
84 | if (userData->sent_packets.q_mcount >= userData->max_packets) { | |
85 | mblk_t *erase = qbegin(&userData->sent_packets); | |
86 | remq(&userData->sent_packets, erase); | |
87 | ||
88 | if (erase != NULL) freemsg(erase); | |
89 | } | |
90 | ||
91 | // Stock the packet before sending it | |
92 | putq(&userData->sent_packets, dupmsg(msg)); | |
93 | ||
94 | //ortp_message("OrtpNackContext [%p]: Stocking packet with pid=%hu (seq=%hu)", userData, ntohs(rtp_get_seqnumber(msg)), userData->session->rtp.snd_seq); | |
95 | ||
96 | bctbx_mutex_unlock(&userData->sent_packets_mutex); | |
97 | } | |
98 | ||
99 | return (int) msgdsize(msg); | |
100 | } | |
101 | ||
102 | static int ortp_nack_rtp_process_on_receive(RtpTransportModifier *t, mblk_t *msg) { | |
103 | return (int) msgdsize(msg); | |
104 | } | |
105 | ||
106 | static int ortp_nack_rtcp_process_on_send(RtpTransportModifier *t, mblk_t *msg) { | |
107 | mblk_t *pullmsg = dupmsg(msg); | |
108 | msgpullup(pullmsg, (size_t)-1); | |
109 | ||
110 | do { | |
111 | if (rtcp_is_RTPFB(pullmsg) && rtcp_RTPFB_get_type(pullmsg) == RTCP_RTPFB_NACK) { | |
112 | OrtpNackContext *userData = (OrtpNackContext *) t->data; | |
113 | OrtpEvent *ev; | |
114 | OrtpEventData *evd; | |
115 | JBParameters jitter_params; | |
116 | int rtt = (int) userData->session->rtt; | |
117 | ||
118 | if (rtt == 0) rtt = 200; | |
119 | ||
120 | rtp_session_get_jitter_buffer_params(userData->session, &jitter_params); | |
121 | ||
122 | if (userData->min_jitter_before_nack == 0) { | |
123 | /* We keep the min_size at the first sent NACK to know at which value it has to come back */ | |
124 | userData->min_jitter_before_nack = jitter_params.min_size; | |
125 | } | |
126 | ||
127 | if (userData->min_jitter_before_nack + rtt != jitter_params.min_size) { | |
128 | if (userData->min_jitter_before_nack + rtt >= jitter_params.max_size) { | |
129 | jitter_params.min_size = jitter_params.max_size - 20; | |
130 | } else { | |
131 | jitter_params.min_size = userData->min_jitter_before_nack + rtt; | |
132 | } | |
133 | ||
134 | rtp_session_set_jitter_buffer_params(userData->session, &jitter_params); | |
135 | ||
136 | ortp_message("OrtpNackContext [%p]: Sending NACK... increasing jitter min size to %dms", userData, jitter_params.min_size); | |
137 | ||
138 | // Send an event that the video jitter has been updated so that we can update the audio too | |
139 | ev = ortp_event_new(ORTP_EVENT_JITTER_UPDATE_FOR_NACK); | |
140 | evd = ortp_event_get_data(ev); | |
141 | evd->info.jitter_min_size_for_nack = jitter_params.min_size; | |
142 | rtp_session_dispatch_event(userData->session, ev); | |
143 | } | |
144 | ||
145 | // Start the timer that will decrase the min jitter if no NACK is sent | |
146 | userData->decrease_jitter_timer_running = TRUE; | |
147 | userData->decrease_jitter_timer_start = ortp_get_cur_time_ms(); | |
148 | ||
149 | break; | |
150 | } | |
151 | } while (rtcp_next_packet(pullmsg)); | |
152 | ||
153 | freemsg(pullmsg); | |
154 | return (int) msgdsize(msg); | |
155 | } | |
156 | ||
157 | static int ortp_nack_rtcp_process_on_receive(RtpTransportModifier *t, mblk_t *msg) { | |
158 | return (int) msgdsize(msg); | |
159 | } | |
160 | ||
161 | static void ortp_nack_transport_modifier_destroy(RtpTransportModifier *tp) { | |
162 | ortp_free(tp); | |
163 | } | |
164 | ||
165 | static void ortp_nack_transport_modifier_new(OrtpNackContext* ctx, RtpTransportModifier **rtpt, RtpTransportModifier **rtcpt ) { | |
166 | if (rtpt) { | |
167 | *rtpt = ortp_new0(RtpTransportModifier, 1); | |
168 | (*rtpt)->data = ctx; /* back link to get access to the other fields of the OrtpNackContext from the RtpTransportModifier structure */ | |
169 | (*rtpt)->t_process_on_send = ortp_nack_rtp_process_on_send; | |
170 | (*rtpt)->t_process_on_receive = ortp_nack_rtp_process_on_receive; | |
171 | (*rtpt)->t_destroy = ortp_nack_transport_modifier_destroy; | |
172 | } | |
173 | ||
174 | if (rtcpt) { | |
175 | *rtcpt = ortp_new0(RtpTransportModifier, 1); | |
176 | (*rtcpt)->data = ctx; /* back link to get access to the other fields of the OrtpNackContext from the RtpTransportModifier structure */ | |
177 | (*rtcpt)->t_process_on_send = ortp_nack_rtcp_process_on_send; | |
178 | (*rtcpt)->t_process_on_receive = ortp_nack_rtcp_process_on_receive; | |
179 | (*rtcpt)->t_destroy = ortp_nack_transport_modifier_destroy; | |
180 | } | |
181 | } | |
182 | ||
183 | static OrtpNackContext *ortp_nack_configure_context(OrtpNackContext *userData) { | |
184 | RtpTransport *rtpt = NULL, *rtcpt = NULL; | |
185 | RtpTransportModifier *rtp_modifier, *rtcp_modifier; | |
186 | ||
187 | rtp_session_get_transports(userData->session, &rtpt, &rtcpt); | |
188 | ||
189 | ortp_nack_transport_modifier_new(userData, &rtp_modifier, &rtcp_modifier); | |
190 | meta_rtp_transport_append_modifier(rtpt, rtp_modifier); | |
191 | meta_rtp_transport_prepend_modifier(rtcpt, rtcp_modifier); | |
192 | ||
193 | userData->rtp_modifier = rtp_modifier; | |
194 | ||
195 | return userData; | |
196 | } | |
197 | ||
198 | OrtpNackContext *ortp_nack_context_new(OrtpEvDispatcher *evt) { | |
199 | OrtpNackContext *userData; | |
200 | ||
201 | userData = ortp_new0(OrtpNackContext, 1); | |
202 | userData->session = evt->session; | |
203 | userData->ev_dispatcher = evt; | |
204 | userData->max_packets = 100; | |
205 | ||
206 | qinit(&userData->sent_packets); | |
207 | bctbx_mutex_init(&userData->sent_packets_mutex, NULL); | |
208 | ||
209 | rtp_session_enable_avpf_feature(userData->session, ORTP_AVPF_FEATURE_IMMEDIATE_NACK, TRUE); | |
210 | ||
211 | ortp_ev_dispatcher_connect(userData->ev_dispatcher | |
212 | , ORTP_EVENT_RTCP_PACKET_RECEIVED | |
213 | , RTCP_RTPFB | |
214 | , (OrtpEvDispatcherCb)generic_nack_received | |
215 | , userData); | |
216 | ||
217 | return ortp_nack_configure_context(userData); | |
218 | } | |
219 | ||
220 | void ortp_nack_context_destroy(OrtpNackContext *ctx) { | |
221 | ortp_ev_dispatcher_disconnect(ctx->ev_dispatcher | |
222 | , ORTP_EVENT_RTCP_PACKET_RECEIVED | |
223 | , RTCP_RTPFB | |
224 | , (OrtpEvDispatcherCb)generic_nack_received); | |
225 | ||
226 | rtp_session_enable_avpf_feature(ctx->session, ORTP_AVPF_FEATURE_IMMEDIATE_NACK, FALSE); | |
227 | ||
228 | bctbx_mutex_lock(&ctx->sent_packets_mutex); | |
229 | flushq(&ctx->sent_packets, FLUSHALL); | |
230 | bctbx_mutex_unlock(&ctx->sent_packets_mutex); | |
231 | ||
232 | bctbx_mutex_destroy(&ctx->sent_packets_mutex); | |
233 | ortp_free(ctx); | |
234 | } | |
235 | ||
236 | void ortp_nack_context_set_max_packet(OrtpNackContext *ctx, int max) { | |
237 | ctx->max_packets = max; | |
238 | } | |
239 | ||
240 | void ortp_nack_context_process_timer(OrtpNackContext *ctx) { | |
241 | if (ctx->decrease_jitter_timer_running) { | |
242 | uint64_t current_time = ortp_get_cur_time_ms(); | |
243 | if (current_time - ctx->decrease_jitter_timer_start >= DECREASE_JITTER_DELAY) { | |
244 | OrtpEvent *ev; | |
245 | OrtpEventData *evd; | |
246 | JBParameters jitter_params; | |
247 | ||
248 | ortp_message("OrtpNackContext [%p]: No NACK sent in the last %d seconds, decreasing jitter min size to %dms...", ctx, DECREASE_JITTER_DELAY / 1000, ctx->min_jitter_before_nack); | |
249 | ||
250 | rtp_session_get_jitter_buffer_params(ctx->session, &jitter_params); | |
251 | jitter_params.min_size = ctx->min_jitter_before_nack; | |
252 | rtp_session_set_jitter_buffer_params(ctx->session, &jitter_params); | |
253 | ||
254 | // Send an event that the video jitter has been updated so that we can update the audio too | |
255 | ev = ortp_event_new(ORTP_EVENT_JITTER_UPDATE_FOR_NACK); | |
256 | evd = ortp_event_get_data(ev); | |
257 | evd->info.jitter_min_size_for_nack = jitter_params.min_size; | |
258 | rtp_session_dispatch_event(ctx->session, ev); | |
259 | ||
260 | ctx->decrease_jitter_timer_running = FALSE; | |
261 | } | |
262 | } | |
263 | } |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #include "ortp/ortp.h" |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | |
76 | 76 | #ifdef _WIN32 |
77 | 77 | win32_init_sockets(); |
78 | 78 | #endif |
79 | ortp_init_logger(); | |
80 | 79 | av_profile_init(&av_profile); |
81 | 80 | ortp_global_stats_reset(); |
82 | 81 | init_random_number_generator(); |
127 | 126 | rtp_scheduler_destroy(__ortp_scheduler); |
128 | 127 | __ortp_scheduler=NULL; |
129 | 128 | } |
130 | ortp_uninit_logger(); | |
131 | 129 | } |
132 | 130 | } |
133 | 131 |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #ifdef HAVE_CONFIG_H |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | |
146 | 146 | #else |
147 | 147 | int inet_aton (const char * cp, struct in_addr * addr) |
148 | 148 | { |
149 | unsigned long retval; | |
150 | ||
151 | retval = inet_addr (cp); | |
152 | ||
153 | if (retval == INADDR_NONE) | |
154 | { | |
155 | return -1; | |
156 | } | |
157 | else | |
158 | { | |
159 | addr->S_un.S_addr = retval; | |
160 | return 1; | |
161 | } | |
149 | int retval; | |
150 | ||
151 | retval = inet_pton (AF_INET, cp, addr); | |
152 | ||
153 | return retval == 1 ? 1 : 0; | |
162 | 154 | } |
163 | 155 | #endif |
164 | 156 |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #ifdef HAVE_CONFIG_H |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | /*************************************************************************** |
247 | 247 | packet_loss = (int)(expected_packets - stream->hwrcv_since_last_SR); |
248 | 248 | session->stats.cum_packet_loss += packet_loss; |
249 | 249 | } |
250 | if (expected_packets>0){/*prevent division by zero and negative loss fraction*/ | |
250 | if (expected_packets>0 && packet_loss > 0){/*prevent division by zero and negative loss fraction*/ | |
251 | 251 | loss_fraction=(int)( 256 * packet_loss) / expected_packets; |
252 | 252 | /*make sure this fits into 8 bit unsigned*/ |
253 | 253 | if (loss_fraction>255) loss_fraction=255; |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | |
45 | 45 | const rtcp_common_header_t * rtcp_get_common_header(const mblk_t *m){ |
46 | 46 | size_t size=msgdsize(m); |
47 | 47 | rtcp_common_header_t *ch; |
48 | if (size<sizeof(rtcp_common_header_t)){ | |
49 | ortp_warning("Bad RTCP packet, too short [%i byte] on block [%p]",(int)size,m); | |
50 | return NULL; | |
51 | } | |
48 | 52 | if (m->b_cont!=NULL){ |
49 | 53 | ortp_fatal("RTCP parser does not work on fragmented mblk_t. Use msgpullup() before to re-assemble the packet."); |
50 | return NULL; | |
51 | } | |
52 | if (size<sizeof(rtcp_common_header_t)){ | |
53 | ortp_warning("Bad RTCP packet, too short [%i b]. on block [%p]",(int)size,m); | |
54 | 54 | return NULL; |
55 | 55 | } |
56 | 56 | ch=(rtcp_common_header_t*)m->b_rptr; |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | |
53 | 53 | { |
54 | 54 | /* remove the oldest mblk_t */ |
55 | 55 | tmp=getq(q); |
56 | if (mp!=NULL) | |
57 | { | |
58 | ortp_warning("rtp_putq: Queue is full. Discarding message with ts=%u",((rtp_header_t*)mp->b_rptr)->timestamp); | |
59 | freemsg(tmp); | |
60 | (*discarded)++; | |
61 | } | |
56 | ||
57 | ortp_warning("rtp_putq: Queue is full. Discarding message with ts=%u",((rtp_header_t*)tmp->b_rptr)->timestamp); | |
58 | freemsg(tmp); | |
59 | (*discarded)++; | |
62 | 60 | } |
63 | 61 | return TRUE; |
64 | 62 | } |
121 | 119 | } |
122 | 120 | } |
123 | 121 | session->rtcp_xr_stats.last_jitter_diff_since_last_stat_summary = diff; |
122 | } | |
123 | ||
124 | static void check_for_seq_number_gap(RtpSession *session, rtp_header_t *rtp) { | |
125 | uint16_t pid; | |
126 | uint16_t i; | |
127 | ||
128 | /*don't check anything before first packet delivered*/ | |
129 | if (session->flags & RTP_SESSION_FIRST_PACKET_DELIVERED | |
130 | && RTP_SEQ_IS_STRICTLY_GREATER_THAN(rtp->seq_number, session->rtp.rcv_last_seq + 1) | |
131 | && RTP_SEQ_IS_STRICTLY_GREATER_THAN(rtp->seq_number, session->rtp.snd_last_nack + 1) | |
132 | ) { | |
133 | uint16_t first_missed_seq = session->rtp.rcv_last_seq + 1; | |
134 | uint16_t diff; | |
135 | ||
136 | if (first_missed_seq <= session->rtp.snd_last_nack) { | |
137 | first_missed_seq = session->rtp.snd_last_nack + 1; | |
138 | } | |
139 | ||
140 | diff = rtp->seq_number - first_missed_seq; | |
141 | pid = first_missed_seq; | |
142 | ||
143 | for (i = 0; i <= (diff / 16); i++) { | |
144 | uint16_t seq; | |
145 | uint16_t blp = 0; | |
146 | for (seq = pid + 1; (seq < rtp->seq_number) && ((seq - pid) < 16); seq++) { | |
147 | blp |= (1 << (seq - pid - 1)); | |
148 | } | |
149 | rtp_session_send_rtcp_fb_generic_nack(session, pid, blp); | |
150 | pid = seq; | |
151 | } | |
152 | } | |
153 | ||
154 | if (session->rtp.snd_last_nack < rtp->seq_number) { | |
155 | /* We update the last_nack since we received this packet we don't need a nack for it */ | |
156 | session->rtp.snd_last_nack = rtp->seq_number; | |
157 | } | |
124 | 158 | } |
125 | 159 | |
126 | 160 | void rtp_session_rtp_parse(RtpSession *session, mblk_t *mp, uint32_t local_str_ts, struct sockaddr *addr, socklen_t addrlen) |
328 | 362 | } |
329 | 363 | } |
330 | 364 | |
365 | if ((rtp_session_avpf_enabled(session) == TRUE) | |
366 | && (rtp_session_avpf_feature_enabled(session, ORTP_AVPF_FEATURE_GENERIC_NACK) == TRUE) | |
367 | && (rtp_session_avpf_feature_enabled(session, ORTP_AVPF_FEATURE_IMMEDIATE_NACK) == TRUE)) { | |
368 | /* | |
369 | * If immediate nack is enabled then we check for missing packets here instead of | |
370 | * rtp_session_recvm_with_ts | |
371 | */ | |
372 | check_for_seq_number_gap(session, rtp); | |
373 | } | |
374 | ||
331 | 375 | if (queue_packet(&session->rtp.rq,session->rtp.jittctl.params.max_packets,mp,rtp,&discarded,&duplicate)) |
332 | 376 | jitter_control_update_size(&session->rtp.jittctl,&session->rtp.rq); |
333 | 377 | stats->discarded+=discarded; |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #include "ortp/ortp.h" |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | |
262 | 262 | session->multicast_loopback=RTP_DEFAULT_MULTICAST_LOOPBACK; |
263 | 263 | qinit(&session->rtp.rq); |
264 | 264 | qinit(&session->rtp.tev_rq); |
265 | qinit(&session->rtp.winrq); | |
265 | 266 | qinit(&session->contributing_sources); |
266 | 267 | session->eventqs=NULL; |
267 | 268 | |
309 | 310 | |
310 | 311 | ortp_bw_estimator_init(&session->rtp.gs.recv_bw_estimator, 0.95f, 0.01f); |
311 | 312 | ortp_bw_estimator_init(&session->rtcp.gs.recv_bw_estimator, 0.95f, 0.01f); |
313 | ||
314 | #if defined(_WIN32) || defined(_WIN32_WCE) | |
315 | session->rtp.is_win_thread_running = FALSE; | |
316 | ortp_mutex_init(&session->rtp.winthread_lock, NULL); | |
317 | ortp_mutex_init(&session->rtp.winrq_lock, NULL); | |
318 | #endif | |
312 | 319 | } |
313 | 320 | |
314 | 321 | void rtp_session_enable_congestion_detection(RtpSession *session, bool_t enabled){ |
1277 | 1284 | { |
1278 | 1285 | payload_type_changed_notify(session, rtp->paytype); |
1279 | 1286 | } |
1280 | check_for_seq_number_gap(session, rtp); | |
1287 | ||
1288 | if ((rtp_session_avpf_enabled(session) == TRUE) | |
1289 | && (rtp_session_avpf_feature_enabled(session, ORTP_AVPF_FEATURE_GENERIC_NACK) == TRUE) | |
1290 | && (rtp_session_avpf_feature_enabled(session, ORTP_AVPF_FEATURE_IMMEDIATE_NACK) == FALSE)) { | |
1291 | /* | |
1292 | * If immediate nack is disabled then we check for missing packets here instead of | |
1293 | * rtp_session_rtp_parse | |
1294 | */ | |
1295 | check_for_seq_number_gap(session, rtp); | |
1296 | } | |
1297 | ||
1281 | 1298 | /* update the packet's timestamp so that it corrected by the |
1282 | 1299 | adaptive jitter buffer mechanism */ |
1283 | 1300 | if (session->rtp.jittctl.params.adaptive){ |
1557 | 1574 | } |
1558 | 1575 | |
1559 | 1576 | void rtp_session_uninit (RtpSession * session) |
1560 | { | |
1577 | { | |
1561 | 1578 | RtpTransport *rtp_meta_transport = NULL; |
1562 | 1579 | RtpTransport *rtcp_meta_transport = NULL; |
1580 | ||
1581 | /* If rtp async thread is running stop it and wait fot it to finish */ | |
1582 | #if defined(_WIN32) || defined(_WIN32_WCE) | |
1583 | if (session->rtp.is_win_thread_running) { | |
1584 | session->rtp.is_win_thread_running = FALSE; | |
1585 | ortp_thread_join(session->rtp.win_t, NULL); | |
1586 | } | |
1587 | ortp_mutex_destroy(&session->rtp.winthread_lock); | |
1588 | ortp_mutex_destroy(&session->rtp.winrq_lock); | |
1589 | #endif | |
1590 | ||
1563 | 1591 | /* first of all remove the session from the scheduler */ |
1564 | 1592 | if (session->flags & RTP_SESSION_SCHEDULED) |
1565 | 1593 | { |
1566 | 1594 | rtp_scheduler_remove_session (session->sched,session); |
1567 | 1595 | } |
1596 | ||
1568 | 1597 | /*flush all queues */ |
1569 | 1598 | flushq(&session->rtp.rq, FLUSHALL); |
1570 | 1599 | flushq(&session->rtp.tev_rq, FLUSHALL); |
1600 | flushq(&session->rtp.winrq, FLUSHALL); | |
1571 | 1601 | |
1572 | 1602 | if (session->eventqs!=NULL) o_list_free(session->eventqs); |
1573 | 1603 | /* close sockets */ |
1623 | 1653 | session->rtp.QoSHandle=NULL; |
1624 | 1654 | } |
1625 | 1655 | #endif |
1656 | ||
1657 | if (session->rtcp.tmmbr_info.received) | |
1658 | freemsg(session->rtcp.tmmbr_info.received); | |
1659 | if (session->rtcp.send_algo.fb_packets) | |
1660 | freemsg(session->rtcp.send_algo.fb_packets); | |
1626 | 1661 | } |
1627 | 1662 | |
1628 | 1663 | /** |
2449 | 2484 | tpm->session = tp->session; |
2450 | 2485 | } |
2451 | 2486 | } |
2487 | ||
2488 | void meta_rtp_transport_prepend_modifier(RtpTransport *tp,RtpTransportModifier *tpm) { | |
2489 | MetaRtpTransportImpl *m = (MetaRtpTransportImpl*)tp->data; | |
2490 | tpm->transport = tp; | |
2491 | m->modifiers=o_list_prepend(m->modifiers, tpm); | |
2492 | if(m->has_set_session) { | |
2493 | tpm->session = tp->session; | |
2494 | } | |
2495 | } | |
2496 | ||
2452 | 2497 | bool_t rtp_session_get_symmetric_rtp(const RtpSession *session) { |
2453 | 2498 | return session->symmetric_rtp; |
2454 | 2499 | } |
2493 | 2538 | } |
2494 | 2539 | return FALSE; |
2495 | 2540 | } |
2541 | ||
2542 | void rtp_session_reset_recvfrom(RtpSession *session) { | |
2543 | #if defined(_WIN32) || defined(_WIN32_WCE) | |
2544 | ortp_mutex_lock(&session->rtp.winthread_lock); | |
2545 | if (session->rtp.is_win_thread_running) { | |
2546 | session->rtp.is_win_thread_running = FALSE; | |
2547 | ortp_thread_join(session->rtp.win_t, NULL); | |
2548 | } | |
2549 | ortp_mutex_unlock(&session->rtp.winthread_lock); | |
2550 | #endif | |
2551 | flushq(&session->rtp.winrq, FLUSHALL); | |
2552 | } |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | |
49 | 49 | |
50 | 50 | #ifdef HAVE_SYS_UIO_H |
51 | 51 | #include <sys/uio.h> |
52 | #ifdef HAVE_RECVMSG | |
53 | #define USE_RECVMSG 1 | |
54 | #endif | |
55 | #ifdef HAVE_SENDMSG | |
52 | 56 | #define USE_SENDMSG 1 |
57 | #endif | |
53 | 58 | #endif |
54 | 59 | |
55 | 60 | #define can_connect(s) ( (s)->use_connect && !(s)->symmetric_rtp) |
175 | 180 | if (*port==0) reuse_addr=FALSE; |
176 | 181 | |
177 | 182 | res0 = bctbx_name_to_addrinfo(AF_UNSPEC, SOCK_DGRAM, addr, *port); |
178 | if (res0 == NULL) return -1; | |
183 | if (res0 == NULL){ | |
184 | ortp_error("Cannot create addrinfo from address [%s], port [%i].", addr, *port); | |
185 | return -1; | |
186 | } | |
179 | 187 | |
180 | 188 | for (res = res0; res; res = res->ai_next) { |
181 | 189 | sock = socket(res->ai_family, res->ai_socktype, 0); |
182 | if (sock==-1) | |
190 | if (sock==-1){ | |
191 | ortp_error("Cannot create a socket with family=[%i] and socktype=[%i]: %s", res->ai_family, res->ai_socktype, getSocketError()); | |
183 | 192 | continue; |
184 | ||
193 | } | |
185 | 194 | if (reuse_addr){ |
186 | 195 | err = setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, |
187 | 196 | (SOCKET_OPTION_VALUE)&optval, sizeof (optval)); |
239 | 248 | *sock_family=res->ai_family; |
240 | 249 | err = bind(sock, res->ai_addr, (int)res->ai_addrlen); |
241 | 250 | if (err != 0){ |
242 | ortp_error ("Fail to bind rtp socket to (addr=%s port=%i) : %s.", addr, *port, getSocketError()); | |
251 | ortp_error ("Fail to bind rtp/rtcp socket to (addr=%s port=%i) : %s.", addr, *port, getSocketError()); | |
243 | 252 | close_socket(sock); |
244 | 253 | sock=-1; |
245 | 254 | continue; |
248 | 257 | set_multicast_group(sock, addr); |
249 | 258 | break; |
250 | 259 | } |
251 | memcpy(bound_addr,res0->ai_addr,res0->ai_addrlen); | |
252 | *bound_addr_len=(socklen_t)res0->ai_addrlen; | |
253 | 260 | |
254 | 261 | bctbx_freeaddrinfo(res0); |
255 | 262 | |
264 | 271 | } |
265 | 272 | #endif |
266 | 273 | if (sock!=-1){ |
274 | struct sockaddr_storage saddr; | |
275 | socklen_t slen=sizeof(saddr); | |
276 | ||
267 | 277 | set_non_blocking_socket (sock); |
278 | err=getsockname(sock,(struct sockaddr*)&saddr,&slen); | |
279 | if (err==-1){ | |
280 | ortp_error("getsockname(): %s",getSocketError()); | |
281 | close_socket(sock); | |
282 | return (ortp_socket_t)-1; | |
283 | } | |
284 | /*update the bind address, especially useful if requested port was 0 (random)*/ | |
285 | memcpy(bound_addr,&saddr,slen); | |
286 | *bound_addr_len=slen; | |
268 | 287 | if (*port==0){ |
269 | struct sockaddr_storage saddr; | |
270 | socklen_t slen=sizeof(saddr); | |
271 | err=getsockname(sock,(struct sockaddr*)&saddr,&slen); | |
272 | if (err==-1){ | |
273 | ortp_error("getsockname(): %s",getSocketError()); | |
274 | close_socket(sock); | |
275 | return (ortp_socket_t)-1; | |
276 | } | |
277 | 288 | err = bctbx_sockaddr_to_ip_address((struct sockaddr *)&saddr, slen, NULL, 0, port); |
278 | 289 | if (err!=0){ |
279 | 290 | close_socket(sock); |
347 | 358 | { |
348 | 359 | ortp_socket_t sock; |
349 | 360 | int sockfamily; |
361 | ||
362 | // Stop async rtp recv thread before recreating the socket | |
363 | rtp_session_reset_recvfrom(session); | |
364 | ||
350 | 365 | if (session->rtp.gs.socket!=(ortp_socket_t)-1){ |
351 | 366 | /* don't rebind, but close before*/ |
352 | 367 | _rtp_session_release_sockets(session, FALSE); |
1021 | 1036 | return is_rtp ? session->rtp.gs.socket : session->rtcp.gs.socket; |
1022 | 1037 | } |
1023 | 1038 | |
1024 | int _ortp_sendto(ortp_socket_t sockfd, mblk_t *m, int flags, const struct sockaddr *destaddr, socklen_t destlen){ | |
1039 | int _ortp_sendto(ortp_socket_t sockfd, mblk_t *m, int flags, const struct sockaddr *destaddr, socklen_t destlen) { | |
1025 | 1040 | int error; |
1026 | 1041 | #ifdef USE_SENDMSG |
1027 | error=rtp_sendmsg(sockfd,m,destaddr,destlen); | |
1042 | error = rtp_sendmsg(sockfd, m, destaddr, destlen); | |
1028 | 1043 | #else |
1029 | if (m->b_cont!=NULL) | |
1030 | msgpullup(m,-1); | |
1031 | error = sendto (sockfd, (char*)m->b_rptr, (int) (m->b_wptr - m->b_rptr), | |
1032 | 0,destaddr,destlen); | |
1044 | if (m->b_cont != NULL) | |
1045 | msgpullup(m, -1); | |
1046 | error = sendto(sockfd, (char*)m->b_rptr, (int)(m->b_wptr - m->b_rptr), 0, destaddr, destlen); | |
1033 | 1047 | #endif |
1034 | 1048 | return error; |
1035 | 1049 | } |
1051 | 1065 | ortp_mutex_unlock(&session->net_sim_ctx->mutex); |
1052 | 1066 | }else{ |
1053 | 1067 | ortp_socket_t sockfd = rtp_session_get_socket(session, is_rtp); |
1054 | ret=_ortp_sendto(sockfd, m, flags, destaddr, destlen); | |
1068 | if (sockfd != (ortp_socket_t)-1){ | |
1069 | ret=_ortp_sendto(sockfd, m, flags, destaddr, destlen); | |
1070 | }else{ | |
1071 | ret = -1; | |
1072 | } | |
1055 | 1073 | } |
1056 | 1074 | return ret; |
1057 | 1075 | } |
1280 | 1298 | return error; |
1281 | 1299 | } |
1282 | 1300 | |
1301 | #ifdef USE_RECVMSG | |
1302 | static int rtp_recvmsg(ortp_socket_t socket, mblk_t *msg, int flags, struct sockaddr *from, socklen_t *fromlen, struct msghdr *msghdr, int bufsz) { | |
1303 | struct iovec iov; | |
1304 | int error; | |
1305 | ||
1306 | memset(&iov, 0, sizeof(iov)); | |
1307 | iov.iov_base = msg->b_wptr; | |
1308 | iov.iov_len = bufsz; | |
1309 | if ((from != NULL) && (fromlen != NULL)) { | |
1310 | msghdr->msg_name = from; | |
1311 | msghdr->msg_namelen = *fromlen; | |
1312 | } | |
1313 | msghdr->msg_iov = &iov; | |
1314 | msghdr->msg_iovlen = 1; | |
1315 | error = recvmsg(socket, msghdr, flags); | |
1316 | if (fromlen != NULL) | |
1317 | *fromlen = msghdr->msg_namelen; | |
1318 | return error; | |
1319 | } | |
1320 | #endif | |
1321 | ||
1283 | 1322 | int rtp_session_rtp_recv_abstract(ortp_socket_t socket, mblk_t *msg, int flags, struct sockaddr *from, socklen_t *fromlen) { |
1284 | 1323 | int ret; |
1285 | 1324 | int bufsz = (int) (msg->b_datap->db_lim - msg->b_datap->db_base); |
1286 | #ifndef _WIN32 | |
1287 | struct iovec iov; | |
1288 | struct msghdr msghdr; | |
1289 | struct cmsghdr *cmsghdr; | |
1290 | char control[512]; | |
1291 | memset(&msghdr, 0, sizeof(msghdr)); | |
1292 | memset(&iov, 0, sizeof(iov)); | |
1293 | iov.iov_base = msg->b_wptr; | |
1294 | iov.iov_len = bufsz; | |
1295 | if(from != NULL && fromlen != NULL) { | |
1296 | msghdr.msg_name = from; | |
1297 | msghdr.msg_namelen = *fromlen; | |
1298 | } | |
1299 | msghdr.msg_iov = &iov; | |
1300 | msghdr.msg_iovlen = 1; | |
1301 | msghdr.msg_control = &control; | |
1302 | msghdr.msg_controllen = sizeof(control); | |
1303 | ret = recvmsg(socket, &msghdr, flags); | |
1304 | if(fromlen != NULL) | |
1305 | *fromlen = msghdr.msg_namelen; | |
1306 | if(ret >= 0) { | |
1307 | #else | |
1308 | char control[512]; | |
1309 | WSAMSG msghdr; | |
1325 | char control[512] = {0}; | |
1326 | #ifdef _WIN32 | |
1327 | WSAMSG msghdr = {0}; | |
1310 | 1328 | WSACMSGHDR *cmsghdr; |
1311 | 1329 | WSABUF data_buf; |
1312 | 1330 | DWORD bytes_received; |
1315 | 1333 | return recvfrom(socket, (char *)msg->b_wptr, bufsz, flags, from, fromlen); |
1316 | 1334 | } |
1317 | 1335 | |
1318 | memset(&msghdr, 0, sizeof(msghdr)); | |
1319 | memset(control, 0, sizeof(control)); | |
1320 | 1336 | if(from != NULL && fromlen != NULL) { |
1321 | 1337 | msghdr.name = from; |
1322 | 1338 | msghdr.namelen = *fromlen; |
1333 | 1349 | *fromlen = msghdr.namelen; |
1334 | 1350 | if(ret >= 0) { |
1335 | 1351 | ret = bytes_received; |
1352 | #else | |
1353 | struct msghdr msghdr = {0}; | |
1354 | msghdr.msg_control = control; | |
1355 | msghdr.msg_controllen = sizeof(control); | |
1356 | #ifdef USE_RECVMSG | |
1357 | ret = rtp_recvmsg(socket, msg, flags, from, fromlen, &msghdr, bufsz); | |
1358 | #else | |
1359 | ret = recvfrom(socket, msg->b_wptr, bufsz, flags, from, fromlen); | |
1360 | #endif | |
1361 | if(ret >= 0) { | |
1362 | struct cmsghdr *cmsghdr; | |
1336 | 1363 | #endif |
1337 | 1364 | for (cmsghdr = CMSG_FIRSTHDR(&msghdr); cmsghdr != NULL ; cmsghdr = CMSG_NXTHDR(&msghdr, cmsghdr)) { |
1338 | 1365 | #ifdef SO_TIMESTAMP |
1382 | 1409 | #endif |
1383 | 1410 | } |
1384 | 1411 | |
1385 | if (msg->timestamp.tv_sec == 0){ | |
1386 | static int warn_once = 1; /*VERY BAD to use a static but there is no context in this function to hold this variable*/ | |
1387 | if (warn_once){ | |
1388 | ortp_warning("This platform doesn't implement SO_TIMESTAMP, will use gettimeofday() instead."); | |
1389 | warn_once = 0; | |
1390 | } | |
1391 | ortp_gettimeofday(&msg->timestamp, NULL); | |
1392 | } | |
1393 | 1412 | /*store recv addr for use by modifiers*/ |
1394 | 1413 | if (from && fromlen) { |
1395 | 1414 | memcpy(&msg->net_addr,from,*fromlen); |
1644 | 1663 | } |
1645 | 1664 | } |
1646 | 1665 | |
1647 | int rtp_session_rtp_recv (RtpSession * session, uint32_t user_ts) { | |
1666 | void* rtp_session_recvfrom_async(void* obj) { | |
1667 | RtpSession *session = (RtpSession*) obj; | |
1648 | 1668 | int error; |
1649 | 1669 | struct sockaddr_storage remaddr; |
1650 | 1670 | socklen_t addrlen = sizeof (remaddr); |
1651 | 1671 | mblk_t *mp; |
1672 | #if defined(_WIN32) || defined(_WIN32_WCE) | |
1673 | WSAPOLLFD fdarray = {0}; | |
1674 | fdarray.fd = session->rtp.gs.socket; | |
1675 | fdarray.events = POLLRDNORM; | |
1676 | ||
1677 | if(!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST)){ | |
1678 | ortp_warning("Error rtp recv async thread for windows: SetThreadPriority() failed [%d]\n", (int)GetLastError()); | |
1679 | } | |
1680 | ||
1681 | while(session->rtp.is_win_thread_running) | |
1682 | { | |
1683 | int ret = WSAPoll(&fdarray, 1, 10); | |
1684 | ||
1685 | if (ret == SOCKET_ERROR) { | |
1686 | ortp_warning("Error rtp recv async thread for windows: error while polling [%i]", WSAGetLastError()); | |
1687 | } else if (ret > 0) { | |
1688 | #endif | |
1689 | bool_t sock_connected=!!(session->flags & RTP_SOCKET_CONNECTED); | |
1690 | ||
1691 | mp = msgb_allocator_alloc(&session->rtp.gs.allocator, session->recv_buf_size); | |
1692 | ||
1693 | if (sock_connected){ | |
1694 | error = rtp_session_recvfrom(session, TRUE, mp, 0, NULL, NULL); | |
1695 | }else if (rtp_session_using_transport(session, rtp)) { | |
1696 | error = (session->rtp.gs.tr->t_recvfrom)(session->rtp.gs.tr, mp, 0, (struct sockaddr *) &remaddr, &addrlen); | |
1697 | } else { | |
1698 | error = rtp_session_recvfrom(session, TRUE, mp, 0, (struct sockaddr *) &remaddr, &addrlen); | |
1699 | } | |
1700 | ||
1701 | if (error > 0) { | |
1702 | if (mp->timestamp.tv_sec == 0){ | |
1703 | static int warn_once = 1; /*VERY BAD to use a static but there is no context in this function to hold this variable*/ | |
1704 | if (warn_once){ | |
1705 | ortp_warning("The transport layer doesn't implement SO_TIMESTAMP, will use gettimeofday() instead."); | |
1706 | warn_once = 0; | |
1707 | } | |
1708 | ortp_gettimeofday(&mp->timestamp, NULL); | |
1709 | } | |
1710 | ||
1711 | mp->b_wptr+=error; | |
1712 | ||
1713 | #if defined(_WIN32) || defined(_WIN32_WCE) | |
1714 | ortp_mutex_lock(&session->rtp.winrq_lock); | |
1715 | #endif | |
1716 | putq(&session->rtp.winrq, mp); | |
1717 | #if defined(_WIN32) || defined(_WIN32_WCE) | |
1718 | ortp_mutex_unlock(&session->rtp.winrq_lock); | |
1719 | #endif | |
1720 | } else { | |
1721 | int errnum; | |
1722 | if (error==-1 && !is_would_block_error((errnum=getSocketErrorCode())) ) | |
1723 | { | |
1724 | if (session->on_network_error.count>0){ | |
1725 | rtp_signal_table_emit3(&session->on_network_error,"Error receiving RTP packet",ORTP_INT_TO_POINTER(getSocketErrorCode())); | |
1726 | }else ortp_warning("Error receiving RTP packet: %s, err num [%i],error [%i]",getSocketError(),errnum,error); | |
1727 | #if TARGET_OS_IPHONE | |
1728 | /*hack for iOS and non-working socket because of background mode*/ | |
1729 | if (errnum==ENOTCONN){ | |
1730 | /*re-create new sockets */ | |
1731 | rtp_session_set_local_addr(session,session->rtp.gs.sockfamily==AF_INET ? "0.0.0.0" : "::0",session->rtp.gs.loc_port,session->rtcp.gs.loc_port); | |
1732 | } | |
1733 | #endif | |
1734 | } | |
1735 | freemsg(mp); | |
1736 | } | |
1737 | #if defined(_WIN32) || defined(_WIN32_WCE) | |
1738 | } | |
1739 | } | |
1740 | #endif | |
1741 | ||
1742 | return NULL; | |
1743 | } | |
1744 | ||
1745 | int rtp_session_rtp_recv (RtpSession * session, uint32_t user_ts) { | |
1746 | mblk_t *mp; | |
1652 | 1747 | |
1653 | 1748 | if ((session->rtp.gs.socket==(ortp_socket_t)-1) && !rtp_session_using_transport(session, rtp)) return -1; /*session has no sockets for the moment*/ |
1654 | 1749 | |
1655 | 1750 | while (1) |
1656 | 1751 | { |
1657 | bool_t sock_connected=!!(session->flags & RTP_SOCKET_CONNECTED); | |
1658 | ||
1659 | mp = msgb_allocator_alloc(&session->rtp.gs.allocator, session->recv_buf_size); | |
1660 | mp->reserved1 = user_ts; | |
1661 | ||
1662 | if (sock_connected){ | |
1663 | error=rtp_session_recvfrom(session, TRUE, mp, 0, NULL, NULL); | |
1664 | }else if (rtp_session_using_transport(session, rtp)) { | |
1665 | error = (session->rtp.gs.tr->t_recvfrom)(session->rtp.gs.tr, mp, 0, (struct sockaddr *) &remaddr, &addrlen); | |
1752 | #if defined(_WIN32) || defined(_WIN32_WCE) | |
1753 | ortp_mutex_lock(&session->rtp.winthread_lock); | |
1754 | if (!session->rtp.is_win_thread_running) { | |
1755 | int errnum; | |
1756 | ||
1757 | session->rtp.is_win_thread_running = TRUE; | |
1758 | if ((errnum = ortp_thread_create(&session->rtp.win_t, NULL, rtp_session_recvfrom_async, (void*)session)) != 0) { | |
1759 | ortp_warning("Error creating rtp recv async thread for windows: error [%i]", errnum); | |
1760 | session->rtp.is_win_thread_running = FALSE; | |
1761 | return -1; | |
1762 | } | |
1763 | } | |
1764 | ortp_mutex_unlock(&session->rtp.winthread_lock); | |
1765 | #else | |
1766 | rtp_session_recvfrom_async((void*)session); | |
1767 | #endif | |
1768 | ||
1769 | #if defined(_WIN32) || defined(_WIN32_WCE) | |
1770 | ortp_mutex_lock(&session->rtp.winrq_lock); | |
1771 | #endif | |
1772 | mp = getq(&session->rtp.winrq); | |
1773 | #if defined(_WIN32) || defined(_WIN32_WCE) | |
1774 | ortp_mutex_unlock(&session->rtp.winrq_lock); | |
1775 | #endif | |
1776 | ||
1777 | if (mp != NULL) { | |
1778 | mp->reserved1 = user_ts; | |
1779 | rtp_session_process_incoming(session, mp, TRUE, user_ts, FALSE); | |
1666 | 1780 | } else { |
1667 | error = rtp_session_recvfrom(session, TRUE, mp, 0, (struct sockaddr *) &remaddr, &addrlen); | |
1668 | } | |
1669 | if (error > 0){ | |
1670 | mp->b_wptr+=error; | |
1671 | rtp_session_process_incoming(session, mp, TRUE, user_ts, FALSE); | |
1672 | } | |
1673 | else | |
1674 | { | |
1675 | int errnum; | |
1676 | if (error==-1 && !is_would_block_error((errnum=getSocketErrorCode())) ) | |
1677 | { | |
1678 | if (session->on_network_error.count>0){ | |
1679 | rtp_signal_table_emit3(&session->on_network_error,"Error receiving RTP packet",ORTP_INT_TO_POINTER(getSocketErrorCode())); | |
1680 | }else ortp_warning("Error receiving RTP packet: %s, err num [%i],error [%i]",getSocketError(),errnum,error); | |
1681 | #if TARGET_OS_IPHONE | |
1682 | /*hack for iOS and non-working socket because of background mode*/ | |
1683 | if (errnum==ENOTCONN){ | |
1684 | /*re-create new sockets */ | |
1685 | rtp_session_set_local_addr(session,session->rtp.gs.sockfamily==AF_INET ? "0.0.0.0" : "::0",session->rtp.gs.loc_port,session->rtcp.gs.loc_port); | |
1686 | } | |
1687 | #endif | |
1688 | }else{ | |
1689 | /*EWOULDBLOCK errors or transports returning 0 are ignored.*/ | |
1690 | rtp_session_process_incoming(session, NULL, TRUE, user_ts, FALSE); | |
1691 | } | |
1692 | freemsg(mp); | |
1781 | rtp_session_process_incoming(session, NULL, TRUE, user_ts, FALSE); | |
1693 | 1782 | return -1; |
1694 | 1783 | } |
1695 | 1784 | } |
1696 | return error; | |
1785 | return -1; | |
1697 | 1786 | } |
1698 | 1787 | |
1699 | 1788 | int rtp_session_rtcp_recv (RtpSession * session) { |
1710 | 1799 | { |
1711 | 1800 | bool_t sock_connected=!!(session->flags & RTCP_SOCKET_CONNECTED); |
1712 | 1801 | |
1713 | mp = msgb_allocator_alloc(&session->rtp.gs.allocator, RTCP_MAX_RECV_BUFSIZE); | |
1802 | mp = msgb_allocator_alloc(&session->rtcp.gs.allocator, session->recv_buf_size); | |
1714 | 1803 | mp->reserved1 = session->rtp.rcv_last_app_ts; |
1715 | 1804 | |
1716 | 1805 | if (sock_connected){ |
1731 | 1820 | if (error > 0) |
1732 | 1821 | { |
1733 | 1822 | mp->b_wptr += error; |
1823 | if (mp->timestamp.tv_sec == 0) ortp_gettimeofday(&mp->timestamp, NULL); | |
1734 | 1824 | rtp_session_process_incoming(session, mp, FALSE, session->rtp.rcv_last_app_ts, FALSE); |
1735 | 1825 | } |
1736 | 1826 | else |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #ifndef rtpsession_priv_h |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #include "ortp/ortp.h" |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #ifndef RTPTIMER_H |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #include <ortp/ortp.h> |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #ifndef SCHEDULER_H |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #include <ortp/ortp.h> |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #ifdef HAVE_CONFIG_H |
20 | 20 | #include "ortp-config.h" |
21 | 21 | #endif |
22 | 22 | |
23 | #include "ortp/ortp.h" | |
23 | 24 | #include "ortp/str_utils.h" |
24 | 25 | #include "utils.h" |
25 | 26 | |
53 | 54 | db=(dblk_t *) ortp_malloc(total_size); |
54 | 55 | db->db_base=(uint8_t*)db+sizeof(dblk_t); |
55 | 56 | db->db_lim=db->db_base+size; |
57 | #if HAVE_STDATOMIC_H | |
58 | atomic_store(&db->db_ref, 1); | |
59 | #else | |
56 | 60 | db->db_ref=1; |
61 | #endif | |
57 | 62 | db->db_freefn=NULL; /* the buffer pointed by db_base must never be freed !*/ |
58 | 63 | return db; |
59 | 64 | } |
341 | 346 | qinit(&a->q); |
342 | 347 | } |
343 | 348 | |
349 | static void msgb_allocator_free_db(void *unused){ | |
350 | } | |
351 | ||
344 | 352 | mblk_t *msgb_allocator_alloc(msgb_allocator_t *a, size_t size){ |
345 | 353 | queue_t *q=&a->q; |
346 | 354 | mblk_t *m,*found=NULL; |
354 | 362 | } |
355 | 363 | if (found==NULL){ |
356 | 364 | found=allocb(size,0); |
365 | /*Hack: we put a special freefn impletation to be able to recognize mblk_t allocated by the msgb_allocator_t */ | |
366 | found->b_datap->db_freefn = msgb_allocator_free_db; | |
357 | 367 | putq(q,found); |
358 | 368 | } |
359 | 369 | return dupb(found); |
362 | 372 | void msgb_allocator_uninit(msgb_allocator_t *a){ |
363 | 373 | flushq(&a->q,-1); |
364 | 374 | } |
375 | ||
376 | /*Same as ownb(), but invoke it for each mblk_t of the chain*/ | |
377 | mblk_t * msgown(mblk_t *mp){ | |
378 | int single_owner_ref = (mp->b_datap->db_freefn == msgb_allocator_free_db) ? 2 : 1; | |
379 | ||
380 | if (mp->b_datap->db_ref > single_owner_ref){ | |
381 | //ortp_message("msgown(): datab copied db_ref=%i single_owner_ref=%i", mp->b_datap->db_ref, single_owner_ref); | |
382 | msgpullup(mp, msgdsize(mp)); | |
383 | } | |
384 | return mp; | |
385 | } | |
386 | ||
365 | 387 | |
366 | 388 | void ortp_recvaddr_to_sockaddr(ortp_recv_addr_t *recvaddr, struct sockaddr *addr, socklen_t *socklen) { |
367 | 389 | if (recvaddr->family == AF_INET) { |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #include <ortp/telephonyevents.h> |
24 | 24 | foreach(executable ${EXECUTABLES}) |
25 | 25 | bc_apply_compile_flags(${executable}.c STRICT_OPTIONS_CPP STRICT_OPTIONS_C) |
26 | 26 | add_executable(${executable} ${executable}.c) |
27 | target_link_libraries(${executable} ortp) | |
27 | target_link_libraries(${executable} ortp ${BCTOOLBOX_CORE_LIBRARIES}) | |
28 | 28 | endforeach() |
29 | 29 | |
30 | 30 | install(TARGETS ${EXECUTABLES} |
0 | 0 | /* |
1 | The oRTP LinPhone RTP library intends to provide basics for a RTP stack. | |
2 | Copyright (C) 2015 Belledonne Communications | |
3 | ||
4 | This library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | This library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
15 | License along with this library; if not, write to the Free Software | |
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 | */ | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | 18 | |
19 | 19 | |
20 | 20 | #include <ortp/ortp.h> |
0 | 0 | /* |
1 | The oRTP LinPhone RTP library intends to provide basics for a RTP stack. | |
2 | Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org | |
3 | ||
4 | This library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | This library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
15 | License along with this library; if not, write to the Free Software | |
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 | */ | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | 18 | |
19 | 19 | /* this program shows how to receive streams in paralel using the SessionSet api |
20 | 20 | and two threads only. */ |
0 | /* | |
1 | The oRTP LinPhone RTP library intends to provide basics for a RTP stack. | |
2 | Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org | |
3 | ||
4 | This library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | This library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
15 | License along with this library; if not, write to the Free Software | |
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 | */ | |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | 18 | |
19 | 19 | /* this program shows how to send streams in paralel using the SessionSet api |
20 | 20 | and two threads only. */ |
0 | /* | |
1 | The oRTP LinPhone RTP library intends to provide basics for a RTP stack. | |
2 | Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org | |
3 | ||
4 | This library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | This library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
15 | License along with this library; if not, write to the Free Software | |
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 | */ | |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | 18 | |
19 | 19 | /* this program shows how to receive streams in paralel using the SessionSet api |
20 | 20 | and two threads only. */ |
0 | /* | |
1 | The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.. | |
2 | Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org | |
3 | ||
4 | This library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | This library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
15 | License along with this library; if not, write to the Free Software | |
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 | */ | |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | 18 | |
19 | 19 | |
20 | 20 | #include <ortp/ortp.h> |
0 | /* | |
1 | The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack. | |
2 | Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org | |
3 | ||
4 | This library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | This library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
15 | License along with this library; if not, write to the Free Software | |
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 | */ | |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | 18 | |
19 | 19 | #include <ortp/ortp.h> |
20 | 20 | #include <signal.h> |
0 | /* | |
1 | The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack. | |
2 | Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org | |
3 | ||
4 | This library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | This library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
15 | License along with this library; if not, write to the Free Software | |
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 | */ | |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | 18 | |
19 | 19 | #include <ortp/ortp.h> |
20 | 20 | #include <signal.h> |
0 | /* | |
1 | The oRTP LinPhone RTP library intends to provide basics for a RTP stack. | |
2 | Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org | |
3 | ||
4 | This library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | This library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
15 | License along with this library; if not, write to the Free Software | |
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 | */ | |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | 18 | |
19 | 19 | |
20 | 20 | #include "../rtptimer.h" |
0 | /* | |
1 | The oRTP LinPhone RTP library intends to provide basics for a RTP stack. | |
2 | Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org | |
3 | ||
4 | This library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | This library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
15 | License along with this library; if not, write to the Free Software | |
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 | */ | |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | 18 | |
19 | 19 | /* this program shows how to receive streams in paralel using the SessionSet api |
20 | 20 | and two threads only. */ |
0 | 0 | /* |
1 | The oRTP LinPhone RTP library intends to provide basics for a RTP stack. | |
2 | Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org | |
3 | ||
4 | This library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | This library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
15 | License along with this library; if not, write to the Free Software | |
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 | */ | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | 18 | |
19 | 19 | #include <ortp/ortp.h> |
20 | 20 | #include <ortp/telephonyevents.h> |
0 | 0 | /* |
1 | The oRTP LinPhone RTP library intends to provide basics for a RTP stack. | |
2 | Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org | |
3 | ||
4 | This library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | This library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
15 | License along with this library; if not, write to the Free Software | |
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 | */ | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | 18 | |
19 | 19 | #include <ortp/ortp.h> |
20 | 20 | #include <ortp/telephonyevents.h> |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
0 | 18 | #include <ortp/ortp.h> |
1 | 19 | #include <signal.h> |
2 | 20 | #include <stdio.h> |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
0 | 18 | #include <ortp/ortp.h> |
1 | 19 | #include <string.h> |
2 | 20 |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #include "ortp/port.h" |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #ifndef UTILS_H |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #include "videobandwidthestimator.h" |
20 | 20 | #include <ortp/logging.h> |
21 | 21 | #include <math.h> |
22 | 22 | #include <ortp/rtpsession.h> |
23 | ||
24 | #define MIN_DIFFTIME 0.00001f | |
23 | 25 | |
24 | 26 | OrtpVideoBandwidthEstimator * ortp_video_bandwidth_estimator_new(RtpSession *session) { |
25 | 27 | OrtpVideoBandwidthEstimator *vbe = (OrtpVideoBandwidthEstimator*)ortp_malloc0(sizeof(OrtpVideoBandwidthEstimator)); |
92 | 94 | static void compute_bitrate_add_to_list_and_remove_oldest_value(OrtpVideoBandwidthEstimator *vbe, OrtpVideoBandwidthEstimatorPacket *packet) { |
93 | 95 | float difftime = (float)(packet->recv_last_timestamp.tv_sec - packet->recv_first_timestamp.tv_sec) |
94 | 96 | + 1e-6f*(packet->recv_last_timestamp.tv_usec - packet->recv_first_timestamp.tv_usec); |
95 | packet->bitrate = (packet->bytes * 8 / difftime); | |
96 | ortp_debug("[VBE] Bitrate is %f kbits/s computed using %f timedif and %u size", packet->bitrate / 1000, difftime, packet->bytes); | |
97 | ||
98 | if (difftime > MIN_DIFFTIME) { | |
99 | packet->bitrate = (packet->bytes * 8 / difftime); | |
100 | ortp_debug("[VBE] Bitrate is %f kbits/s computed using %f timedif and %u size", packet->bitrate / 1000, difftime, packet->bytes); | |
97 | 101 | |
98 | vbe->nb_packets_computed += 1; | |
99 | vbe->packets = bctbx_list_prepend(vbe->packets, packet); | |
102 | vbe->nb_packets_computed += 1; | |
103 | vbe->packets = bctbx_list_prepend(vbe->packets, packet); | |
100 | 104 | |
101 | if (bctbx_list_size(vbe->packets) > vbe->packets_size_max) { | |
102 | void *old_data = bctbx_list_nth_data(vbe->packets, vbe->packets_size_max); | |
103 | vbe->packets = bctbx_list_remove(vbe->packets, old_data); | |
105 | if (bctbx_list_size(vbe->packets) > vbe->packets_size_max) { | |
106 | void *old_data = bctbx_list_nth_data(vbe->packets, vbe->packets_size_max); | |
107 | vbe->packets = bctbx_list_remove(vbe->packets, old_data); | |
108 | ortp_free(old_data); | |
109 | } | |
110 | ||
111 | if (vbe->nb_packets_computed % vbe->packets_size_max == 0) { | |
112 | OrtpEvent *ev = ortp_event_new(ORTP_EVENT_NEW_VIDEO_BANDWIDTH_ESTIMATION_AVAILABLE); | |
113 | OrtpEventData *ed = ortp_event_get_data(ev); | |
114 | ed->info.video_bandwidth_available = ortp_video_bandwidth_estimator_get_estimated_available_bandwidth(vbe); | |
115 | ortp_debug("[VBE] Dispatching event ORTP_EVENT_NEW_VIDEO_BANDWIDTH_ESTIMATION_AVAILABLE with value %f kbits/s", ed->info.video_bandwidth_available / 1000); | |
116 | rtp_session_dispatch_event(vbe->session, ev); | |
117 | } | |
118 | } else { | |
119 | ortp_free(packet); | |
104 | 120 | } |
105 | ||
106 | if (vbe->nb_packets_computed % vbe->packets_size_max == 0) { | |
107 | OrtpEvent *ev = ortp_event_new(ORTP_EVENT_NEW_VIDEO_BANDWIDTH_ESTIMATION_AVAILABLE); | |
108 | OrtpEventData *ed = ortp_event_get_data(ev); | |
109 | ed->info.video_bandwidth_available = ortp_video_bandwidth_estimator_get_estimated_available_bandwidth(vbe); | |
110 | ortp_debug("[VBE] Dispatching event ORTP_EVENT_NEW_VIDEO_BANDWIDTH_ESTIMATION_AVAILABLE with value %f kbits/s", ed->info.video_bandwidth_available / 1000); | |
111 | rtp_session_dispatch_event(vbe->session, ev); | |
112 | } | |
113 | 121 | } |
114 | 122 | |
115 | 123 | void ortp_video_bandwidth_estimator_process_packet(OrtpVideoBandwidthEstimator *vbe, uint32_t sent_timestamp, const struct timeval *recv_timestamp, int msgsize, bool_t is_last) { |
0 | 0 | /* |
1 | * The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) implementation with additional features. | |
2 | * Copyright (C) 2017 Belledonne Communications SARL | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
3 | 2 | * |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
3 | * This file is part of oRTP. | |
8 | 4 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
13 | 9 | * |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | 17 | */ |
18 | 18 | |
19 | 19 |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
0 | 18 | #include <windows.h> |
1 | 19 | |
2 | 20 | #include "winrttimer.h" |
0 | /* | |
1 | * Copyright (c) 2010-2019 Belledonne Communications SARL. | |
2 | * | |
3 | * This file is part of oRTP. | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
0 | 18 | #pragma once |
1 | 19 | |
2 | 20 | #ifdef __cplusplus |