]>
Commit | Line | Data |
---|---|---|
d029bc51 JR |
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 | |
5 | ||
6 | BUG: 345162 | |
7 | FIXED-IN: 15.04 | |
8 | --- | |
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 | |
15 | ||
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) | |
40 | ||
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 ) | |
48 | endif ( NOT APPLE ) | |
49 | endif ( NOT WIN32 ) | |
50 | ||
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 ) | |
57 | + | |
58 | +if ( MEDIASTREAMER_LESS_2_11 ) | |
59 | + add_definitions ( -DMEDIASTREAMER_LESS_2_11 ) | |
60 | +endif ( MEDIASTREAMER_LESS_2_11 ) | |
61 | ||
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 | |
65 | new file mode 100644 | |
66 | index 0000000..5eef985 | |
67 | --- /dev/null | |
68 | +++ b/protocols/jabber/libjingle/patches/08_mediastreamer_2_11.patch | |
69 | @@ -0,0 +1,47 @@ | |
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) { | |
75 | + return true; | |
76 | + } | |
77 | + | |
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; | |
82 | ++#else | |
83 | ++ return stream->ms.session; | |
84 | ++#endif | |
85 | ++} | |
86 | ++#endif | |
87 | ++ | |
88 | + bool LinphoneVoiceChannel::SetSendCodecs(const std::vector<AudioCodec>& codecs) { | |
89 | + | |
90 | + bool first = true; | |
91 | +@@ -200,11 +210,7 @@ bool LinphoneVoiceChannel::SetSendCodecs(const std::vector<AudioCodec>& codecs) | |
92 | + LOG(LS_INFO) << "Using " << i->name << "/" << i->clockrate; | |
93 | + pt_ = i->id; | |
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); | |
97 | +-#else | |
98 | +- port2 = rtp_session_get_local_port(audio_stream_->ms.session); | |
99 | +-#endif | |
100 | ++ port2 = rtp_session_get_local_port(audio_stream_get_rtp_session(audio_stream_)); | |
101 | + first = false; | |
102 | + } | |
103 | + } | |
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); | |
110 | +-#else | |
111 | +- port2 = rtp_session_get_local_port(audio_stream_->ms.session); | |
112 | +-#endif | |
113 | ++ port2 = rtp_session_get_local_port(audio_stream_get_rtp_session(audio_stream_)); | |
114 | + } | |
115 | + | |
116 | + return true; | |
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) { | |
122 | return true; | |
123 | } | |
124 | ||
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; | |
129 | +#else | |
130 | + return stream->ms.session; | |
131 | +#endif | |
132 | +} | |
133 | +#endif | |
134 | + | |
135 | bool LinphoneVoiceChannel::SetSendCodecs(const std::vector<AudioCodec>& codecs) { | |
136 | ||
137 | bool first = true; | |
138 | @@ -200,11 +210,7 @@ bool LinphoneVoiceChannel::SetSendCodecs(const std::vector<AudioCodec>& codecs) | |
139 | LOG(LS_INFO) << "Using " << i->name << "/" << i->clockrate; | |
140 | pt_ = i->id; | |
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); | |
144 | -#else | |
145 | - port2 = rtp_session_get_local_port(audio_stream_->ms.session); | |
146 | -#endif | |
147 | + port2 = rtp_session_get_local_port(audio_stream_get_rtp_session(audio_stream_)); | |
148 | first = false; | |
149 | } | |
150 | } | |
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); | |
157 | -#else | |
158 | - port2 = rtp_session_get_local_port(audio_stream_->ms.session); | |
159 | -#endif | |
160 | + port2 = rtp_session_get_local_port(audio_stream_get_rtp_session(audio_stream_)); | |
161 | } | |
162 | ||
163 | return true; | |
164 | -- | |
165 | 1.7.9.5 | |
166 |