1 From 7624830d2ec11d2f3645a27384ae9ced7ac7a258 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali.rohar@gmail.com>
3 Date: Sun, 15 Mar 2015 14:00:40 +0100
4 Subject: [PATCH] Fix libjingle compilation with mediastreamer >= 2.11
9 cmake/modules/FindMediastreamer.cmake | 11 +++--
10 protocols/jabber/libjingle/CMakeLists.txt | 10 +++--
11 .../libjingle/patches/08_mediastreamer_2_11.patch | 47 ++++++++++++++++++++
12 .../talk/session/phone/linphonemediaengine.cc | 22 ++++-----
13 4 files changed, 74 insertions(+), 16 deletions(-)
14 create mode 100644 protocols/jabber/libjingle/patches/08_mediastreamer_2_11.patch
16 diff --git a/cmake/modules/FindMediastreamer.cmake b/cmake/modules/FindMediastreamer.cmake
17 index 929b1ee..47fe5c3 100644
18 --- a/cmake/modules/FindMediastreamer.cmake
19 +++ b/cmake/modules/FindMediastreamer.cmake
20 @@ -22,9 +22,14 @@ IF (MEDIASTREAMER_FOUND)
21 IF (NOT MEDIASTREAMER_FIND_QUIETLY)
22 MESSAGE(STATUS "Found Mediastreamer: ${MEDIASTREAMER_LIBRARIES} (version: ${MEDIASTREAMER_VERSION})")
23 IF (MEDIASTREAMER_VERSION VERSION_LESS 2.9)
24 - SET(MEDIASTREAMER_OLD TRUE)
25 + SET(MEDIASTREAMER_LESS_2_9 TRUE)
26 + SET(MEDIASTREAMER_LESS_2_11 TRUE)
27 + ELSEIF (MEDIASTREAMER_VERSION VERSION_LESS 2.11)
28 + SET(MEDIASTREAMER_LESS_2_9 FALSE)
29 + SET(MEDIASTREAMER_LESS_2_11 TRUE)
30 ELSE (MEDIASTREAMER_VERSION VERSION_LESS 2.9)
31 - SET(MEDIASTREAMER_OLD FALSE)
32 + SET(MEDIASTREAMER_LESS_2_9 FALSE)
33 + SET(MEDIASTREAMER_LESS_2_11 FALSE)
34 ENDIF (MEDIASTREAMER_VERSION VERSION_LESS 2.9)
35 ENDIF (NOT MEDIASTREAMER_FIND_QUIETLY)
36 ELSE (MEDIASTREAMER_FOUND)
37 @@ -33,4 +38,4 @@ ELSE (MEDIASTREAMER_FOUND)
38 ENDIF (MEDIASTREAMER_FIND_REQUIRED)
39 ENDIF (MEDIASTREAMER_FOUND)
41 -MARK_AS_ADVANCED(MEDIASTREAMER_INCLUDE_DIR MEDIASTREAMER_LIBRARIES MEDIASTREAMER_OLD)
42 +MARK_AS_ADVANCED(MEDIASTREAMER_INCLUDE_DIR MEDIASTREAMER_LIBRARIES MEDIASTREAMER_LESS_2_9 MEDIASTREAMER_LESS_2_11)
43 diff --git a/protocols/jabber/libjingle/CMakeLists.txt b/protocols/jabber/libjingle/CMakeLists.txt
44 index 6db3da3..4b4b620 100644
45 --- a/protocols/jabber/libjingle/CMakeLists.txt
46 +++ b/protocols/jabber/libjingle/CMakeLists.txt
47 @@ -28,9 +28,13 @@ if ( NOT WIN32 )
51 -if ( MEDIASTREAMER_OLD )
52 - add_definitions ( -DMEDIASTREAMER_OLD )
53 -endif ( MEDIASTREAMER_OLD )
54 +if ( MEDIASTREAMER_LESS_2_9 )
55 + add_definitions ( -DMEDIASTREAMER_LESS_2_9 )
56 +endif ( MEDIASTREAMER_LESS_2_9 )
58 +if ( MEDIASTREAMER_LESS_2_11 )
59 + add_definitions ( -DMEDIASTREAMER_LESS_2_11 )
60 +endif ( MEDIASTREAMER_LESS_2_11 )
62 if ( CMAKE_BUILD_TYPE STREQUAL "Debug" )
63 add_definitions ( -D_DEBUG )
64 diff --git a/protocols/jabber/libjingle/patches/08_mediastreamer_2_11.patch b/protocols/jabber/libjingle/patches/08_mediastreamer_2_11.patch
66 index 0000000..5eef985
68 +++ b/protocols/jabber/libjingle/patches/08_mediastreamer_2_11.patch
70 +diff --git a/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc b/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc
71 +index 6da35e0..e337dd4 100644
72 +--- a/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc
73 ++++ b/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc
74 +@@ -171,6 +171,16 @@ bool LinphoneVoiceChannel::SetPlayout(bool playout) {
78 ++#ifdef MEDIASTREAMER_LESS_2_11
79 ++static inline RtpSession * audio_stream_get_rtp_session(const AudioStream *stream) {
80 ++#ifdef MEDIASTREAMER_LESS_2_9
81 ++ return stream->session;
83 ++ return stream->ms.session;
88 + bool LinphoneVoiceChannel::SetSendCodecs(const std::vector<AudioCodec>& codecs) {
91 +@@ -200,11 +210,7 @@ bool LinphoneVoiceChannel::SetSendCodecs(const std::vector<AudioCodec>& codecs)
92 + LOG(LS_INFO) << "Using " << i->name << "/" << i->clockrate;
94 + audio_stream_ = audio_stream_start(&av_profile, -1, "localhost", port1, i->id, 250, 0); /* -1 means that function will choose some free port */
95 +-#ifdef MEDIASTREAMER_OLD
96 +- port2 = rtp_session_get_local_port(audio_stream_->session);
98 +- port2 = rtp_session_get_local_port(audio_stream_->ms.session);
100 ++ port2 = rtp_session_get_local_port(audio_stream_get_rtp_session(audio_stream_));
104 +@@ -215,11 +221,7 @@ bool LinphoneVoiceChannel::SetSendCodecs(const std::vector<AudioCodec>& codecs)
105 + // working with a buggy client; let's try PCMU.
106 + LOG(LS_WARNING) << "Received empty list of codces; using PCMU/8000";
107 + audio_stream_ = audio_stream_start(&av_profile, -1, "localhost", port1, 0, 250, 0); /* -1 means that function will choose some free port */
108 +-#ifdef MEDIASTREAMER_OLD
109 +- port2 = rtp_session_get_local_port(audio_stream_->session);
111 +- port2 = rtp_session_get_local_port(audio_stream_->ms.session);
113 ++ port2 = rtp_session_get_local_port(audio_stream_get_rtp_session(audio_stream_));
117 diff --git a/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc b/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc
118 index 6da35e0..e337dd4 100644
119 --- a/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc
120 +++ b/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc
121 @@ -171,6 +171,16 @@ bool LinphoneVoiceChannel::SetPlayout(bool playout) {
125 +#ifdef MEDIASTREAMER_LESS_2_11
126 +static inline RtpSession * audio_stream_get_rtp_session(const AudioStream *stream) {
127 +#ifdef MEDIASTREAMER_LESS_2_9
128 + return stream->session;
130 + return stream->ms.session;
135 bool LinphoneVoiceChannel::SetSendCodecs(const std::vector<AudioCodec>& codecs) {
138 @@ -200,11 +210,7 @@ bool LinphoneVoiceChannel::SetSendCodecs(const std::vector<AudioCodec>& codecs)
139 LOG(LS_INFO) << "Using " << i->name << "/" << i->clockrate;
141 audio_stream_ = audio_stream_start(&av_profile, -1, "localhost", port1, i->id, 250, 0); /* -1 means that function will choose some free port */
142 -#ifdef MEDIASTREAMER_OLD
143 - port2 = rtp_session_get_local_port(audio_stream_->session);
145 - port2 = rtp_session_get_local_port(audio_stream_->ms.session);
147 + port2 = rtp_session_get_local_port(audio_stream_get_rtp_session(audio_stream_));
151 @@ -215,11 +221,7 @@ bool LinphoneVoiceChannel::SetSendCodecs(const std::vector<AudioCodec>& codecs)
152 // working with a buggy client; let's try PCMU.
153 LOG(LS_WARNING) << "Received empty list of codces; using PCMU/8000";
154 audio_stream_ = audio_stream_start(&av_profile, -1, "localhost", port1, 0, 250, 0); /* -1 means that function will choose some free port */
155 -#ifdef MEDIASTREAMER_OLD
156 - port2 = rtp_session_get_local_port(audio_stream_->session);
158 - port2 = rtp_session_get_local_port(audio_stream_->ms.session);
160 + port2 = rtp_session_get_local_port(audio_stream_get_rtp_session(audio_stream_));