Safeguard against a null pipeline in GstEngine::Play.
This commit is contained in:
parent
940783bc23
commit
0c95f7c234
|
@ -78,3 +78,9 @@ void Engine::Base::EmitAboutToEnd() {
|
||||||
int Engine::Base::AddBackgroundStream(const QUrl& url) {
|
int Engine::Base::AddBackgroundStream(const QUrl& url) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Engine::Base::Play(const QUrl& u, TrackChangeType c) {
|
||||||
|
if (!Load(u, c))
|
||||||
|
return false;
|
||||||
|
return Play();
|
||||||
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ class Base : public QObject, boost::noncopyable {
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
virtual bool Load(const QUrl &url, TrackChangeType change);
|
virtual bool Load(const QUrl &url, TrackChangeType change);
|
||||||
bool Play(const QUrl &u, TrackChangeType c) { return Load(u, c) && Play(); }
|
bool Play(const QUrl &u, TrackChangeType c);
|
||||||
void SetVolume( uint value );
|
void SetVolume( uint value );
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -496,6 +496,9 @@ void GstEngine::StartFadeout() {
|
||||||
bool GstEngine::Play( uint offset ) {
|
bool GstEngine::Play( uint offset ) {
|
||||||
EnsureInitialised();
|
EnsureInitialised();
|
||||||
|
|
||||||
|
if (!current_pipeline_)
|
||||||
|
return false;
|
||||||
|
|
||||||
QFuture<GstStateChangeReturn> future = current_pipeline_->SetState(GST_STATE_PLAYING);
|
QFuture<GstStateChangeReturn> future = current_pipeline_->SetState(GST_STATE_PLAYING);
|
||||||
BoundFutureWatcher<GstStateChangeReturn, uint>* watcher =
|
BoundFutureWatcher<GstStateChangeReturn, uint>* watcher =
|
||||||
new BoundFutureWatcher<GstStateChangeReturn, uint>(offset, this);
|
new BoundFutureWatcher<GstStateChangeReturn, uint>(offset, this);
|
||||||
|
|
Loading…
Reference in New Issue