Merge lp:~phablet-team/qtubuntu-media/fix-1506953 into lp:qtubuntu-media
- fix-1506953
- Merge into trunk
Proposed by
Jim Hodapp
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Konrad Zapałowicz | ||||
Approved revision: | 114 | ||||
Merged at revision: | 111 | ||||
Proposed branch: | lp:~phablet-team/qtubuntu-media/fix-1506953 | ||||
Merge into: | lp:qtubuntu-media | ||||
Diff against target: |
438 lines (+164/-34) 8 files modified
debian/control (+1/-1) src/aal/aalmediaplayerservice.cpp (+79/-8) src/aal/aalmediaplayerservice.h (+4/-1) src/aal/aalmediaplaylistcontrol.cpp (+55/-19) src/aal/aalmediaplaylistprovider.cpp (+2/-4) src/aal/aalvideorenderercontrol.cpp (+8/-1) tests/unit/service.cpp (+12/-0) tests/unit/service.h (+3/-0) |
||||
To merge this branch: | bzr merge lp:~phablet-team/qtubuntu-media/fix-1506953 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Konrad Zapałowicz (community) | code | Approve | |
Review via email: mp+300533@code.launchpad.net |
Commit message
Register for media-hub service unregister/register signals and raise an error to the client application when media-hub-server unregisters and then re-registers on dbus. This will allow the client to handle this event as it deems appropriate.
Description of the change
Register for media-hub service unregister/register signals and raise an error to the client application when media-hub-server unregisters and then re-registers on dbus. This will allow the client to handle this event as it deems appropriate.
To post a comment you must log in.
- 112. By Jim Hodapp
-
Merge with upstream
- 113. By Jim Hodapp
-
Clean up unnecessary debug statements
- 114. By Jim Hodapp
-
Another unnessary debug statement
- 115. By Jim Hodapp
-
Some additional protection from unhandled exceptions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/control' | |||
2 | --- debian/control 2016-07-11 01:04:02 +0000 | |||
3 | +++ debian/control 2016-07-20 21:27:06 +0000 | |||
4 | @@ -9,7 +9,7 @@ | |||
5 | 9 | libgl1-mesa-dev | libgl-dev, | 9 | libgl1-mesa-dev | libgl-dev, |
6 | 10 | libgles2-mesa-dev, | 10 | libgles2-mesa-dev, |
7 | 11 | libhybris-dev (>= 0.1.0+git20131207+e452e83-0ubuntu13), | 11 | libhybris-dev (>= 0.1.0+git20131207+e452e83-0ubuntu13), |
9 | 12 | libmedia-hub-dev (>= 4.4.0), | 12 | libmedia-hub-dev (>= 4.5.0), |
10 | 13 | libpulse-dev, | 13 | libpulse-dev, |
11 | 14 | libqt5opengl5-dev, | 14 | libqt5opengl5-dev, |
12 | 15 | libqtubuntu-media-signals-dev (>= 0.3+15.04.20150618.1-0ubuntu1), | 15 | libqtubuntu-media-signals-dev (>= 0.3+15.04.20150618.1-0ubuntu1), |
13 | 16 | 16 | ||
14 | === modified file 'src/aal/aalmediaplayerservice.cpp' | |||
15 | --- src/aal/aalmediaplayerservice.cpp 2016-06-09 18:34:21 +0000 | |||
16 | +++ src/aal/aalmediaplayerservice.cpp 2016-07-20 21:27:06 +0000 | |||
17 | @@ -63,13 +63,42 @@ | |||
18 | 63 | core::Signal<void> the_void; | 63 | core::Signal<void> the_void; |
19 | 64 | } | 64 | } |
20 | 65 | 65 | ||
21 | 66 | class EmptySink : public core::ubuntu::media::video::Sink | ||
22 | 67 | { | ||
23 | 68 | public: | ||
24 | 69 | EmptySink(std::uint32_t gl_texture) | ||
25 | 70 | { | ||
26 | 71 | Q_UNUSED(gl_texture); | ||
27 | 72 | } | ||
28 | 73 | |||
29 | 74 | const core::Signal<void>& frame_available() const override | ||
30 | 75 | { | ||
31 | 76 | static const core::Signal<void> frame_available; | ||
32 | 77 | return frame_available; | ||
33 | 78 | } | ||
34 | 79 | |||
35 | 80 | bool transformation_matrix(float* matrix) const override | ||
36 | 81 | { | ||
37 | 82 | Q_UNUSED(matrix); | ||
38 | 83 | return false; | ||
39 | 84 | } | ||
40 | 85 | |||
41 | 86 | bool swap_buffers() const override | ||
42 | 87 | { | ||
43 | 88 | return false; | ||
44 | 89 | } | ||
45 | 90 | }; | ||
46 | 91 | |||
47 | 92 | |||
48 | 66 | AalMediaPlayerService::AalMediaPlayerService(QObject *parent) | 93 | AalMediaPlayerService::AalMediaPlayerService(QObject *parent) |
49 | 67 | : | 94 | : |
50 | 68 | QMediaService(parent), | 95 | QMediaService(parent), |
52 | 69 | m_hubPlayerSession(NULL), | 96 | m_hubPlayerSession(nullptr), |
53 | 70 | m_playbackStatusChangedConnection(the_void.connect([](){})), | 97 | m_playbackStatusChangedConnection(the_void.connect([](){})), |
54 | 71 | m_errorConnection(the_void.connect([](){})), | 98 | m_errorConnection(the_void.connect([](){})), |
55 | 72 | m_endOfStreamConnection(the_void.connect([](){})), | 99 | m_endOfStreamConnection(the_void.connect([](){})), |
56 | 100 | m_serviceDisconnectedConnection(the_void.connect([](){})), | ||
57 | 101 | m_serviceReconnectedConnection(the_void.connect([](){})), | ||
58 | 73 | m_bufferingStatusChangedConnection(the_void.connect([](){})), | 102 | m_bufferingStatusChangedConnection(the_void.connect([](){})), |
59 | 74 | m_mediaPlayerControl(nullptr), | 103 | m_mediaPlayerControl(nullptr), |
60 | 75 | m_videoOutput(nullptr), | 104 | m_videoOutput(nullptr), |
61 | @@ -79,7 +108,7 @@ | |||
62 | 79 | m_videoOutputReady(false), | 108 | m_videoOutputReady(false), |
63 | 80 | m_firstPlayback(true), | 109 | m_firstPlayback(true), |
64 | 81 | m_cachedDuration(0), | 110 | m_cachedDuration(0), |
66 | 82 | m_mediaPlaylist(NULL), | 111 | m_mediaPlaylist(nullptr), |
67 | 83 | m_bufferPercent(0), | 112 | m_bufferPercent(0), |
68 | 84 | m_doReattachSession(false) | 113 | m_doReattachSession(false) |
69 | 85 | #ifdef MEASURE_PERFORMANCE | 114 | #ifdef MEASURE_PERFORMANCE |
70 | @@ -100,10 +129,12 @@ | |||
71 | 100 | : | 129 | : |
72 | 101 | QMediaService(parent), | 130 | QMediaService(parent), |
73 | 102 | m_hubService(service), | 131 | m_hubService(service), |
75 | 103 | m_hubPlayerSession(NULL), | 132 | m_hubPlayerSession(nullptr), |
76 | 104 | m_playbackStatusChangedConnection(the_void.connect([](){})), | 133 | m_playbackStatusChangedConnection(the_void.connect([](){})), |
77 | 105 | m_errorConnection(the_void.connect([](){})), | 134 | m_errorConnection(the_void.connect([](){})), |
78 | 106 | m_endOfStreamConnection(the_void.connect([](){})), | 135 | m_endOfStreamConnection(the_void.connect([](){})), |
79 | 136 | m_serviceDisconnectedConnection(the_void.connect([](){})), | ||
80 | 137 | m_serviceReconnectedConnection(the_void.connect([](){})), | ||
81 | 107 | m_bufferingStatusChangedConnection(the_void.connect([](){})), | 138 | m_bufferingStatusChangedConnection(the_void.connect([](){})), |
82 | 108 | m_mediaPlayerControl(nullptr), | 139 | m_mediaPlayerControl(nullptr), |
83 | 109 | m_videoOutput(nullptr), | 140 | m_videoOutput(nullptr), |
84 | @@ -113,7 +144,7 @@ | |||
85 | 113 | m_videoOutputReady(false), | 144 | m_videoOutputReady(false), |
86 | 114 | m_firstPlayback(true), | 145 | m_firstPlayback(true), |
87 | 115 | m_cachedDuration(0), | 146 | m_cachedDuration(0), |
89 | 116 | m_mediaPlaylist(NULL), | 147 | m_mediaPlaylist(nullptr), |
90 | 117 | m_bufferPercent(0), | 148 | m_bufferPercent(0), |
91 | 118 | m_doReattachSession(false) | 149 | m_doReattachSession(false) |
92 | 119 | #ifdef MEASURE_PERFORMANCE | 150 | #ifdef MEASURE_PERFORMANCE |
93 | @@ -133,6 +164,8 @@ | |||
94 | 133 | { | 164 | { |
95 | 134 | m_errorConnection.disconnect(); | 165 | m_errorConnection.disconnect(); |
96 | 135 | m_playbackStatusChangedConnection.disconnect(); | 166 | m_playbackStatusChangedConnection.disconnect(); |
97 | 167 | m_serviceDisconnectedConnection.disconnect(); | ||
98 | 168 | m_serviceReconnectedConnection.disconnect(); | ||
99 | 136 | 169 | ||
100 | 137 | if (m_audioRoleControl) | 170 | if (m_audioRoleControl) |
101 | 138 | deleteAudioRoleControl(); | 171 | deleteAudioRoleControl(); |
102 | @@ -160,11 +193,13 @@ | |||
103 | 160 | // it again. If we don't do this connectSignals() will never be able to attach | 193 | // it again. If we don't do this connectSignals() will never be able to attach |
104 | 161 | // to the relevant signals. | 194 | // to the relevant signals. |
105 | 162 | m_endOfStreamConnection.disconnect(); | 195 | m_endOfStreamConnection.disconnect(); |
106 | 196 | m_serviceDisconnectedConnection.disconnect(); | ||
107 | 197 | m_serviceReconnectedConnection.disconnect(); | ||
108 | 163 | 198 | ||
109 | 164 | if (!newMediaPlayer()) | 199 | if (!newMediaPlayer()) |
110 | 165 | qWarning() << "Failed to create a new media player backend. Video playback will not function." << endl; | 200 | qWarning() << "Failed to create a new media player backend. Video playback will not function." << endl; |
111 | 166 | 201 | ||
113 | 167 | if (m_hubPlayerSession == NULL) | 202 | if (m_hubPlayerSession == nullptr) |
114 | 168 | { | 203 | { |
115 | 169 | qWarning() << "Could not finish contructing new AalMediaPlayerService instance since m_hubPlayerSession is NULL"; | 204 | qWarning() << "Could not finish contructing new AalMediaPlayerService instance since m_hubPlayerSession is NULL"; |
116 | 170 | return; | 205 | return; |
117 | @@ -262,7 +297,7 @@ | |||
118 | 262 | // changes | 297 | // changes |
119 | 263 | m_sessionUuid = m_hubPlayerSession->uuid(); | 298 | m_sessionUuid = m_hubPlayerSession->uuid(); |
120 | 264 | } catch (const std::runtime_error &e) { | 299 | } catch (const std::runtime_error &e) { |
122 | 265 | qWarning() << "Failed to retrieve the current player's uuid: " << e.what() << endl; | 300 | qWarning() << "Failed to retrieve the current player's uuid: " << e.what(); |
123 | 266 | return false; | 301 | return false; |
124 | 267 | } | 302 | } |
125 | 268 | 303 | ||
126 | @@ -271,13 +306,19 @@ | |||
127 | 271 | 306 | ||
128 | 272 | std::shared_ptr<core::ubuntu::media::video::Sink> AalMediaPlayerService::createVideoSink(uint32_t texture_id) | 307 | std::shared_ptr<core::ubuntu::media::video::Sink> AalMediaPlayerService::createVideoSink(uint32_t texture_id) |
129 | 273 | { | 308 | { |
131 | 274 | if (m_hubPlayerSession == NULL) | 309 | if (m_hubPlayerSession == nullptr) |
132 | 275 | throw std::runtime_error | 310 | throw std::runtime_error |
133 | 276 | { | 311 | { |
134 | 277 | "Cannot create a video sink without a valid media-hub player session" | 312 | "Cannot create a video sink without a valid media-hub player session" |
135 | 278 | }; | 313 | }; |
136 | 279 | 314 | ||
138 | 280 | auto sink = m_hubPlayerSession->create_gl_texture_video_sink(texture_id); | 315 | std::shared_ptr<core::ubuntu::media::video::Sink> sink; |
139 | 316 | try { | ||
140 | 317 | sink = m_hubPlayerSession->create_gl_texture_video_sink(texture_id); | ||
141 | 318 | } catch (const std::runtime_error &e) { | ||
142 | 319 | qWarning() << "Failed to create a new video sink:" << e.what(); | ||
143 | 320 | return core::ubuntu::media::video::Sink::Ptr{new EmptySink(0)}; | ||
144 | 321 | } | ||
145 | 281 | m_videoOutputReady = true; | 322 | m_videoOutputReady = true; |
146 | 282 | 323 | ||
147 | 283 | return sink; | 324 | return sink; |
148 | @@ -782,6 +823,20 @@ | |||
149 | 782 | } | 823 | } |
150 | 783 | } | 824 | } |
151 | 784 | 825 | ||
152 | 826 | void AalMediaPlayerService::onServiceDisconnected() | ||
153 | 827 | { | ||
154 | 828 | qDebug() << Q_FUNC_INFO; | ||
155 | 829 | m_mediaPlayerControl->setState(QMediaPlayer::StoppedState); | ||
156 | 830 | m_mediaPlayerControl->setMediaStatus(QMediaPlayer::NoMedia); | ||
157 | 831 | } | ||
158 | 832 | |||
159 | 833 | void AalMediaPlayerService::onServiceReconnected() | ||
160 | 834 | { | ||
161 | 835 | qDebug() << Q_FUNC_INFO; | ||
162 | 836 | const QString errStr = "Player session is no longer valid since the service restarted."; | ||
163 | 837 | m_mediaPlayerControl->error(QMediaPlayer::ServiceMissingError, errStr); | ||
164 | 838 | } | ||
165 | 839 | |||
166 | 785 | void AalMediaPlayerService::onBufferingChanged() | 840 | void AalMediaPlayerService::onBufferingChanged() |
167 | 786 | { | 841 | { |
168 | 787 | Q_EMIT m_mediaPlayerControl->bufferStatusChanged(m_bufferPercent); | 842 | Q_EMIT m_mediaPlayerControl->bufferStatusChanged(m_bufferPercent); |
169 | @@ -822,6 +877,22 @@ | |||
170 | 822 | Q_EMIT playbackComplete(); | 877 | Q_EMIT playbackComplete(); |
171 | 823 | }); | 878 | }); |
172 | 824 | } | 879 | } |
173 | 880 | |||
174 | 881 | if (!m_serviceDisconnectedConnection.is_connected()) | ||
175 | 882 | { | ||
176 | 883 | m_serviceDisconnectedConnection = m_hubService->service_disconnected().connect([this]() | ||
177 | 884 | { | ||
178 | 885 | QMetaObject::invokeMethod(this, "onServiceDisconnected", Qt::QueuedConnection); | ||
179 | 886 | }); | ||
180 | 887 | } | ||
181 | 888 | |||
182 | 889 | if (!m_serviceReconnectedConnection.is_connected()) | ||
183 | 890 | { | ||
184 | 891 | m_serviceReconnectedConnection = m_hubService->service_reconnected().connect([this]() | ||
185 | 892 | { | ||
186 | 893 | QMetaObject::invokeMethod(this, "onServiceReconnected", Qt::QueuedConnection); | ||
187 | 894 | }); | ||
188 | 895 | } | ||
189 | 825 | } | 896 | } |
190 | 826 | 897 | ||
191 | 827 | void AalMediaPlayerService::disconnectSignals() | 898 | void AalMediaPlayerService::disconnectSignals() |
192 | 828 | 899 | ||
193 | === modified file 'src/aal/aalmediaplayerservice.h' | |||
194 | --- src/aal/aalmediaplayerservice.h 2016-06-08 09:17:31 +0000 | |||
195 | +++ src/aal/aalmediaplayerservice.h 2016-07-20 21:27:06 +0000 | |||
196 | @@ -113,6 +113,8 @@ | |||
197 | 113 | public Q_SLOTS: | 113 | public Q_SLOTS: |
198 | 114 | void onPlaybackStatusChanged(); | 114 | void onPlaybackStatusChanged(); |
199 | 115 | void onApplicationStateChanged(Qt::ApplicationState state); | 115 | void onApplicationStateChanged(Qt::ApplicationState state); |
200 | 116 | void onServiceDisconnected(); | ||
201 | 117 | void onServiceReconnected(); | ||
202 | 116 | void onBufferingChanged(); | 118 | void onBufferingChanged(); |
203 | 117 | 119 | ||
204 | 118 | protected: | 120 | protected: |
205 | @@ -138,7 +140,6 @@ | |||
206 | 138 | 140 | ||
207 | 139 | // Signals the proper QMediaPlayer::Error from a core::ubuntu::media::Error | 141 | // Signals the proper QMediaPlayer::Error from a core::ubuntu::media::Error |
208 | 140 | void signalQMediaPlayerError(const core::ubuntu::media::Player::Error &error); | 142 | void signalQMediaPlayerError(const core::ubuntu::media::Player::Error &error); |
209 | 141 | |||
210 | 142 | void onError(const core::ubuntu::media::Player::Error &error); | 143 | void onError(const core::ubuntu::media::Player::Error &error); |
211 | 143 | 144 | ||
212 | 144 | inline QString playbackStatusStr(const core::ubuntu::media::Player::PlaybackStatus &status); | 145 | inline QString playbackStatusStr(const core::ubuntu::media::Player::PlaybackStatus &status); |
213 | @@ -148,6 +149,8 @@ | |||
214 | 148 | core::Connection m_playbackStatusChangedConnection; | 149 | core::Connection m_playbackStatusChangedConnection; |
215 | 149 | core::Connection m_errorConnection; | 150 | core::Connection m_errorConnection; |
216 | 150 | core::Connection m_endOfStreamConnection; | 151 | core::Connection m_endOfStreamConnection; |
217 | 152 | core::Connection m_serviceDisconnectedConnection; | ||
218 | 153 | core::Connection m_serviceReconnectedConnection; | ||
219 | 151 | core::Connection m_bufferingStatusChangedConnection; | 154 | core::Connection m_bufferingStatusChangedConnection; |
220 | 152 | 155 | ||
221 | 153 | AalMediaPlayerControl *m_mediaPlayerControl; | 156 | AalMediaPlayerControl *m_mediaPlayerControl; |
222 | 154 | 157 | ||
223 | === modified file 'src/aal/aalmediaplaylistcontrol.cpp' | |||
224 | --- src/aal/aalmediaplaylistcontrol.cpp 2016-01-13 16:45:28 +0000 | |||
225 | +++ src/aal/aalmediaplaylistcontrol.cpp 2016-07-20 21:27:06 +0000 | |||
226 | @@ -49,7 +49,6 @@ | |||
227 | 49 | 49 | ||
228 | 50 | AalMediaPlaylistControl::~AalMediaPlaylistControl() | 50 | AalMediaPlaylistControl::~AalMediaPlaylistControl() |
229 | 51 | { | 51 | { |
230 | 52 | qDebug() << Q_FUNC_INFO; | ||
231 | 53 | disconnect_signals(); | 52 | disconnect_signals(); |
232 | 54 | } | 53 | } |
233 | 55 | 54 | ||
234 | @@ -180,7 +179,12 @@ | |||
235 | 180 | QMediaPlaylist::PlaybackMode AalMediaPlaylistControl::playbackMode() const | 179 | QMediaPlaylist::PlaybackMode AalMediaPlaylistControl::playbackMode() const |
236 | 181 | { | 180 | { |
237 | 182 | QMediaPlaylist::PlaybackMode currentMode = QMediaPlaylist::Sequential; | 181 | QMediaPlaylist::PlaybackMode currentMode = QMediaPlaylist::Sequential; |
239 | 183 | const auto loopStatus = m_hubPlayerSession->loop_status(); | 182 | media::Player::LoopStatus loopStatus = media::Player::LoopStatus::none; |
240 | 183 | try { | ||
241 | 184 | loopStatus = m_hubPlayerSession->loop_status(); | ||
242 | 185 | } catch (const std::runtime_error &e) { | ||
243 | 186 | qWarning() << "Failed to go to get loop_status: " << e.what(); | ||
244 | 187 | } | ||
245 | 184 | switch (loopStatus) | 188 | switch (loopStatus) |
246 | 185 | { | 189 | { |
247 | 186 | case media::Player::LoopStatus::none: | 190 | case media::Player::LoopStatus::none: |
248 | @@ -196,10 +200,14 @@ | |||
249 | 196 | qWarning() << "Unknown loop status: " << loopStatus; | 200 | qWarning() << "Unknown loop status: " << loopStatus; |
250 | 197 | } | 201 | } |
251 | 198 | 202 | ||
256 | 199 | // Shuffle overrides loopStatus since in the media-hub API random is not part of loop_status | 203 | try { |
257 | 200 | // like it's all one for QMediaPlaylist::PlaybackMode | 204 | // Shuffle overrides loopStatus since in the media-hub API random is not part of loop_status |
258 | 201 | if (m_hubPlayerSession->shuffle()) | 205 | // like it's all one for QMediaPlaylist::PlaybackMode |
259 | 202 | currentMode = QMediaPlaylist::Random; | 206 | if (m_hubPlayerSession->shuffle()) |
260 | 207 | currentMode = QMediaPlaylist::Random; | ||
261 | 208 | } catch (const std::runtime_error &e) { | ||
262 | 209 | qWarning() << "Failed to get current shuffle mode: " << e.what(); | ||
263 | 210 | } | ||
264 | 203 | 211 | ||
265 | 204 | return currentMode; | 212 | return currentMode; |
266 | 205 | } | 213 | } |
267 | @@ -211,34 +219,58 @@ | |||
268 | 211 | { | 219 | { |
269 | 212 | case QMediaPlaylist::CurrentItemOnce: | 220 | case QMediaPlaylist::CurrentItemOnce: |
270 | 213 | qDebug() << "PlaybackMode: CurrentItemOnce"; | 221 | qDebug() << "PlaybackMode: CurrentItemOnce"; |
272 | 214 | m_hubPlayerSession->shuffle() = false; | 222 | try { |
273 | 223 | m_hubPlayerSession->shuffle() = false; | ||
274 | 224 | } catch (const std::runtime_error &e) { | ||
275 | 225 | qWarning() << "Failed to set shuffle mode: " << e.what(); | ||
276 | 226 | } | ||
277 | 215 | qWarning() << "No media-hub equivalent for QMediaPlaylist::CurrentItemOnce"; | 227 | qWarning() << "No media-hub equivalent for QMediaPlaylist::CurrentItemOnce"; |
278 | 216 | break; | 228 | break; |
279 | 217 | case QMediaPlaylist::CurrentItemInLoop: | 229 | case QMediaPlaylist::CurrentItemInLoop: |
280 | 218 | qDebug() << "PlaybackMode: CurrentItemInLoop"; | 230 | qDebug() << "PlaybackMode: CurrentItemInLoop"; |
283 | 219 | m_hubPlayerSession->shuffle() = false; | 231 | try { |
284 | 220 | m_hubPlayerSession->loop_status() = media::Player::LoopStatus::track; | 232 | m_hubPlayerSession->shuffle() = false; |
285 | 233 | m_hubPlayerSession->loop_status() = media::Player::LoopStatus::track; | ||
286 | 234 | } catch (const std::runtime_error &e) { | ||
287 | 235 | qWarning() << "Failed to set shuffle mode/loop_status: " << e.what(); | ||
288 | 236 | } | ||
289 | 221 | break; | 237 | break; |
290 | 222 | case QMediaPlaylist::Sequential: | 238 | case QMediaPlaylist::Sequential: |
291 | 223 | qDebug() << "PlaybackMode: Sequential"; | 239 | qDebug() << "PlaybackMode: Sequential"; |
294 | 224 | m_hubPlayerSession->shuffle() = false; | 240 | try { |
295 | 225 | m_hubPlayerSession->loop_status() = media::Player::LoopStatus::none; | 241 | m_hubPlayerSession->shuffle() = false; |
296 | 242 | m_hubPlayerSession->loop_status() = media::Player::LoopStatus::none; | ||
297 | 243 | } catch (const std::runtime_error &e) { | ||
298 | 244 | qWarning() << "Failed to set shuffle mode/loop_status: " << e.what(); | ||
299 | 245 | } | ||
300 | 226 | break; | 246 | break; |
301 | 227 | case QMediaPlaylist::Loop: | 247 | case QMediaPlaylist::Loop: |
302 | 228 | qDebug() << "PlaybackMode: Loop"; | 248 | qDebug() << "PlaybackMode: Loop"; |
305 | 229 | m_hubPlayerSession->shuffle() = false; | 249 | try { |
306 | 230 | m_hubPlayerSession->loop_status() = media::Player::LoopStatus::playlist; | 250 | m_hubPlayerSession->shuffle() = false; |
307 | 251 | m_hubPlayerSession->loop_status() = media::Player::LoopStatus::playlist; | ||
308 | 252 | } catch (const std::runtime_error &e) { | ||
309 | 253 | qWarning() << "Failed to set shuffle mode/loop_status: " << e.what(); | ||
310 | 254 | } | ||
311 | 231 | break; | 255 | break; |
312 | 232 | case QMediaPlaylist::Random: | 256 | case QMediaPlaylist::Random: |
313 | 233 | qDebug() << "PlaybackMode: Random"; | 257 | qDebug() << "PlaybackMode: Random"; |
318 | 234 | m_hubPlayerSession->shuffle() = true; | 258 | try { |
319 | 235 | // FIXME: Until pad.lv/1518157 (RandomAndLoop playbackMode) is | 259 | m_hubPlayerSession->shuffle() = true; |
320 | 236 | // fixed set Random to be always looping due to pad.lv/1531296 | 260 | // FIXME: Until pad.lv/1518157 (RandomAndLoop playbackMode) is |
321 | 237 | m_hubPlayerSession->loop_status() = media::Player::LoopStatus::playlist; | 261 | // fixed set Random to be always looping due to pad.lv/1531296 |
322 | 262 | m_hubPlayerSession->loop_status() = media::Player::LoopStatus::playlist; | ||
323 | 263 | } catch (const std::runtime_error &e) { | ||
324 | 264 | qWarning() << "Failed to set shuffle mode/loop_status: " << e.what(); | ||
325 | 265 | } | ||
326 | 238 | break; | 266 | break; |
327 | 239 | default: | 267 | default: |
328 | 240 | qWarning() << "Unknown playback mode: " << mode; | 268 | qWarning() << "Unknown playback mode: " << mode; |
330 | 241 | m_hubPlayerSession->shuffle() = false; | 269 | try { |
331 | 270 | m_hubPlayerSession->shuffle() = false; | ||
332 | 271 | } catch (const std::runtime_error &e) { | ||
333 | 272 | qWarning() << "Failed to get current shuffle mode: " << e.what(); | ||
334 | 273 | } | ||
335 | 242 | } | 274 | } |
336 | 243 | 275 | ||
337 | 244 | Q_EMIT playbackModeChanged(mode); | 276 | Q_EMIT playbackModeChanged(mode); |
338 | @@ -313,7 +345,11 @@ | |||
339 | 313 | if (playbackMode() == QMediaPlaylist::Sequential) | 345 | if (playbackMode() == QMediaPlaylist::Sequential) |
340 | 314 | { | 346 | { |
341 | 315 | qDebug() << "Repeat is off, so stopping playback"; | 347 | qDebug() << "Repeat is off, so stopping playback"; |
343 | 316 | m_hubPlayerSession->stop(); | 348 | try { |
344 | 349 | m_hubPlayerSession->stop(); | ||
345 | 350 | } catch (std::runtime_error &e) { | ||
346 | 351 | qWarning() << "FATAL: Failed to stop playback:" << e.what(); | ||
347 | 352 | } | ||
348 | 317 | } | 353 | } |
349 | 318 | } | 354 | } |
350 | 319 | } | 355 | } |
351 | 320 | 356 | ||
352 | === modified file 'src/aal/aalmediaplaylistprovider.cpp' | |||
353 | --- src/aal/aalmediaplaylistprovider.cpp 2016-02-22 16:10:09 +0000 | |||
354 | +++ src/aal/aalmediaplaylistprovider.cpp 2016-07-20 21:27:06 +0000 | |||
355 | @@ -48,7 +48,6 @@ | |||
356 | 48 | 48 | ||
357 | 49 | AalMediaPlaylistProvider::~AalMediaPlaylistProvider() | 49 | AalMediaPlaylistProvider::~AalMediaPlaylistProvider() |
358 | 50 | { | 50 | { |
359 | 51 | qDebug() << Q_FUNC_INFO; | ||
360 | 52 | disconnect_signals(); | 51 | disconnect_signals(); |
361 | 53 | } | 52 | } |
362 | 54 | 53 | ||
363 | @@ -414,9 +413,8 @@ | |||
364 | 414 | 413 | ||
365 | 415 | try { | 414 | try { |
366 | 416 | m_hubTrackList = m_hubPlayerSession->track_list(); | 415 | m_hubTrackList = m_hubPlayerSession->track_list(); |
370 | 417 | } | 416 | } catch (std::runtime_error &e) { |
371 | 418 | catch (std::runtime_error &e) { | 417 | qWarning() << "FATAL: Failed to retrieve the current player session TrackList:" << e.what(); |
369 | 419 | qWarning() << "FATAL: Failed to retrieve the current player session TrackList: " << e.what(); | ||
372 | 420 | } | 418 | } |
373 | 421 | 419 | ||
374 | 422 | /* Disconnect first to avoid duplicated calls */ | 420 | /* Disconnect first to avoid duplicated calls */ |
375 | 423 | 421 | ||
376 | === modified file 'src/aal/aalvideorenderercontrol.cpp' | |||
377 | --- src/aal/aalvideorenderercontrol.cpp 2015-06-18 16:17:21 +0000 | |||
378 | +++ src/aal/aalvideorenderercontrol.cpp 2016-07-20 21:27:06 +0000 | |||
379 | @@ -103,7 +103,8 @@ | |||
380 | 103 | #endif | 103 | #endif |
381 | 104 | { | 104 | { |
382 | 105 | // Get notified when qtvideo-node creates a GL texture | 105 | // Get notified when qtvideo-node creates a GL texture |
384 | 106 | connect(SharedSignal::instance(), SIGNAL(textureCreated(unsigned int)), this, SLOT(onTextureCreated(unsigned int))); | 106 | connect(SharedSignal::instance(), SIGNAL(textureCreated(unsigned int)), |
385 | 107 | this, SLOT(onTextureCreated(unsigned int))); | ||
386 | 107 | connect(SharedSignal::instance(), SIGNAL(glConsumerSet()), this, SLOT(onGLConsumerSet())); | 108 | connect(SharedSignal::instance(), SIGNAL(glConsumerSet()), this, SLOT(onGLConsumerSet())); |
387 | 108 | connect(m_service, SIGNAL(playbackComplete()), this, SLOT(playbackComplete())); | 109 | connect(m_service, SIGNAL(playbackComplete()), this, SLOT(playbackComplete())); |
388 | 109 | } | 110 | } |
389 | @@ -274,6 +275,12 @@ | |||
390 | 274 | if (m_textureId == 0) { | 275 | if (m_textureId == 0) { |
391 | 275 | m_textureId = static_cast<GLuint>(textureID); | 276 | m_textureId = static_cast<GLuint>(textureID); |
392 | 276 | m_videoSink = m_service->createVideoSink(textureID); | 277 | m_videoSink = m_service->createVideoSink(textureID); |
393 | 278 | if (not m_videoSink) | ||
394 | 279 | { | ||
395 | 280 | qWarning() << "Failed to create a new video sink with texture ID (" | ||
396 | 281 | << textureID << "), m_videoSink is a nullptr"; | ||
397 | 282 | return; | ||
398 | 283 | } | ||
399 | 277 | 284 | ||
400 | 278 | // Connect callback so that frames are rendered after decoding | 285 | // Connect callback so that frames are rendered after decoding |
401 | 279 | m_frameAvailableConnection.reset(new core::Connection(m_videoSink->frame_available().connect( | 286 | m_frameAvailableConnection.reset(new core::Connection(m_videoSink->frame_available().connect( |
402 | 280 | 287 | ||
403 | === modified file 'tests/unit/service.cpp' | |||
404 | --- tests/unit/service.cpp 2016-05-03 14:41:12 +0000 | |||
405 | +++ tests/unit/service.cpp 2016-07-20 21:27:06 +0000 | |||
406 | @@ -58,6 +58,18 @@ | |||
407 | 58 | { | 58 | { |
408 | 59 | } | 59 | } |
409 | 60 | 60 | ||
410 | 61 | const core::Signal<void>& TestService::service_disconnected() const | ||
411 | 62 | { | ||
412 | 63 | static const core::Signal<void> s; | ||
413 | 64 | return s; | ||
414 | 65 | } | ||
415 | 66 | |||
416 | 67 | const core::Signal<void>& TestService::service_reconnected() const | ||
417 | 68 | { | ||
418 | 69 | static const core::Signal<void> s; | ||
419 | 70 | return s; | ||
420 | 71 | } | ||
421 | 72 | |||
422 | 61 | } | 73 | } |
423 | 62 | } | 74 | } |
424 | 63 | } | 75 | } |
425 | 64 | 76 | ||
426 | === modified file 'tests/unit/service.h' | |||
427 | --- tests/unit/service.h 2016-05-03 14:41:12 +0000 | |||
428 | +++ tests/unit/service.h 2016-07-20 21:27:06 +0000 | |||
429 | @@ -51,6 +51,9 @@ | |||
430 | 51 | virtual std::shared_ptr<Player> create_fixed_session(const std::string& name, const Player::Configuration&); | 51 | virtual std::shared_ptr<Player> create_fixed_session(const std::string& name, const Player::Configuration&); |
431 | 52 | virtual std::shared_ptr<Player> resume_session(Player::PlayerKey); | 52 | virtual std::shared_ptr<Player> resume_session(Player::PlayerKey); |
432 | 53 | virtual void pause_other_sessions(Player::PlayerKey); | 53 | virtual void pause_other_sessions(Player::PlayerKey); |
433 | 54 | |||
434 | 55 | virtual const core::Signal<void>& service_disconnected() const; | ||
435 | 56 | virtual const core::Signal<void>& service_reconnected() const; | ||
436 | 54 | }; | 57 | }; |
437 | 55 | } | 58 | } |
438 | 56 | } | 59 | } |
LGTM