Merge lp:~jhodapp/media-hub/fix-1435088 into lp:media-hub

Proposed by Jim Hodapp
Status: Merged
Approved by: Nick Dedekind
Approved revision: 138
Merged at revision: 139
Proposed branch: lp:~jhodapp/media-hub/fix-1435088
Merge into: lp:media-hub
Prerequisite: lp:~jhodapp/media-hub/player-add-prev-next
Diff against target: 81 lines (+25/-7)
4 files modified
src/core/media/gstreamer/engine.cpp (+22/-4)
src/core/media/gstreamer/playbin.cpp (+1/-1)
src/core/media/gstreamer/playbin.h (+1/-1)
src/core/media/player_stub.cpp (+1/-1)
To merge this branch: bzr merge lp:~jhodapp/media-hub/fix-1435088
Reviewer Review Type Date Requested Status
Nick Dedekind (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+258075@code.launchpad.net

Commit message

Fix issues with not reporting failed decoding error to the client.

Description of the change

Fix issues with not reporting failed decoding error to the client.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

Code and reasoning looks fine.

This doesn't fix the "Fail to connect with playback backend" issues. Think the media-hub is hanging.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/core/media/gstreamer/engine.cpp'
2--- src/core/media/gstreamer/engine.cpp 2015-04-03 22:52:08 +0000
3+++ src/core/media/gstreamer/engine.cpp 2015-05-01 20:02:25 +0000
4@@ -49,10 +49,27 @@
5
6 struct gstreamer::Engine::Private
7 {
8- void on_playbin_state_changed(
9- const gstreamer::Bus::Message::Detail::StateChanged& state_change)
10- {
11- (void) state_change;
12+ media::Player::PlaybackStatus gst_state_to_player_status(const gstreamer::Bus::Message::Detail::StateChanged& state)
13+ {
14+ if (state.new_state == GST_STATE_PLAYING)
15+ return media::Player::PlaybackStatus::playing;
16+ else if (state.new_state == GST_STATE_PAUSED)
17+ return media::Player::PlaybackStatus::paused;
18+ else if (state.new_state == GST_STATE_READY)
19+ return media::Player::PlaybackStatus::ready;
20+ else if (state.new_state == GST_STATE_NULL)
21+ return media::Player::PlaybackStatus::null;
22+ else
23+ return media::Player::PlaybackStatus::stopped;
24+ }
25+
26+ void on_playbin_state_changed(const std::pair<gstreamer::Bus::Message::Detail::StateChanged,std::string>& p)
27+ {
28+ if (p.second == "playbin")
29+ {
30+ std::cout << "State changed on playbin: " << p.first.new_state << std::endl;
31+ playback_status_changed(gst_state_to_player_status(p.first));
32+ }
33 }
34
35 // Converts from a GStreamer GError to a media::Player:Error enum
36@@ -95,6 +112,7 @@
37 switch (ewi.error->code)
38 {
39 case GST_STREAM_ERROR_CODEC_NOT_FOUND:
40+ case GST_STREAM_ERROR_DECODE:
41 return media::Player::Error::format_error;
42 default:
43 std::cerr << "Got an unhandled stream error: '"
44
45=== modified file 'src/core/media/gstreamer/playbin.cpp'
46--- src/core/media/gstreamer/playbin.cpp 2015-05-01 20:02:25 +0000
47+++ src/core/media/gstreamer/playbin.cpp 2015-05-01 20:02:25 +0000
48@@ -194,7 +194,7 @@
49 }
50 break;
51 case GST_MESSAGE_STATE_CHANGED:
52- signals.on_state_changed(message.detail.state_changed);
53+ signals.on_state_changed(std::make_pair(message.detail.state_changed, message.source));
54 break;
55 case GST_MESSAGE_ASYNC_DONE:
56 if (is_seeking)
57
58=== modified file 'src/core/media/gstreamer/playbin.h'
59--- src/core/media/gstreamer/playbin.h 2015-04-15 17:13:58 +0000
60+++ src/core/media/gstreamer/playbin.h 2015-05-01 20:02:25 +0000
61@@ -125,7 +125,7 @@
62 core::Signal<Bus::Message::Detail::ErrorWarningInfo> on_warning;
63 core::Signal<Bus::Message::Detail::ErrorWarningInfo> on_info;
64 core::Signal<Bus::Message::Detail::Tag> on_tag_available;
65- core::Signal<Bus::Message::Detail::StateChanged> on_state_changed;
66+ core::Signal<std::pair<Bus::Message::Detail::StateChanged,std::string>> on_state_changed;
67 core::Signal<uint64_t> on_seeked_to;
68 core::Signal<void> on_end_of_stream;
69 core::Signal<core::ubuntu::media::Player::PlaybackStatus> on_playback_status_changed;
70
71=== modified file 'src/core/media/player_stub.cpp'
72--- src/core/media/player_stub.cpp 2015-04-17 16:45:47 +0000
73+++ src/core/media/player_stub.cpp 2015-05-01 20:02:25 +0000
74@@ -177,7 +177,7 @@
75
76 dbus.playback_status_changed->connect([this](const media::Player::PlaybackStatus& status)
77 {
78- std::cout << "PlaybackStatusChanged signal arrived via the bus." << std::endl;
79+ std::cout << "PlaybackStatusChanged signal arrived via the bus (Status: " << status << ")" << std::endl;
80 playback_status_changed(status);
81 });
82

Subscribers

People subscribed via source and target branches