~justinmcp/media-hub/fix-video-detection

« back to all changes in this revision

Viewing changes to src/core/media/power/state_controller.cpp

* debian/control:
  - Removing pre-depends that are not required
  - Bumping standards-version to 3.9.6
[ Ricardo Salveti de Araujo ]
* Migrating tests to use ogg instead of mp3/avi removed:
  tests/h264.avi tests/test.mp3 added: tests/test-audio-1.ogg
  tests/test-video.ogg tests/test.mp3 renamed: tests/test.ogg =>
  tests/test-audio.ogg

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
        if (cookie == the_invalid_cookie)
129
129
            return;
130
130
 
131
 
        std::weak_ptr<DisplayStateLock> wp{shared_from_this()};
 
131
        // We make sure that we keep ourselves alive to make sure
 
132
        // that release requests are always correctly issued.
 
133
        auto sp = shared_from_this();
132
134
 
133
135
        auto current_cookie(cookie);
134
136
 
135
137
        timeout.expires_from_now(timeout_for_release());
136
 
        timeout.async_wait([wp, state, current_cookie](const boost::system::error_code& ec)
 
138
        timeout.async_wait([sp, state, current_cookie](const boost::system::error_code& ec)
137
139
        {
138
140
            // We only return early from the timeout handler if the operation has been
139
141
            // explicitly aborted before.
140
142
            if (ec == boost::asio::error::operation_aborted)
141
143
                return;
142
144
 
143
 
            if (auto sp = wp.lock())
144
 
            {
145
 
                sp->object->invoke_method_asynchronously_with_callback<com::canonical::Unity::Screen::removeDisplayOnRequest, void>(
146
 
                            [wp, state, current_cookie](const core::dbus::Result<void>& result)
 
145
            sp->object->invoke_method_asynchronously_with_callback<com::canonical::Unity::Screen::removeDisplayOnRequest, void>(
 
146
                        [sp, state, current_cookie](const core::dbus::Result<void>& result)
 
147
                        {
 
148
                            if (result.is_error())
147
149
                            {
148
 
                                if (result.is_error())
149
 
                                {
150
 
                                    std::cerr << result.error().print() << std::endl;
151
 
                                    return;
152
 
                                }
153
 
 
154
 
                                if (auto sp = wp.lock())
155
 
                                {
156
 
                                    sp->signals.released(state);
157
 
 
158
 
                                    // We might have issued a different request before and
159
 
                                    // only call the display state done if the original cookie
160
 
                                    // corresponds to the one we just gave up.
161
 
                                    if (sp->cookie == current_cookie)
162
 
                                        sp->cookie = the_invalid_cookie;
163
 
                                }
164
 
 
165
 
                            }, current_cookie);
166
 
            }
 
150
                                std::cerr << result.error().print() << std::endl;
 
151
                                return;
 
152
                            }
 
153
 
 
154
                            sp->signals.released(state);
 
155
 
 
156
                            // We might have issued a different request before and
 
157
                            // only call the display state done if the original cookie
 
158
                            // corresponds to the one we just gave up.
 
159
                            if (sp->cookie == current_cookie)
 
160
                                sp->cookie = the_invalid_cookie;
 
161
 
 
162
                        }, current_cookie);
167
163
        });
168
164
    }
169
165