Merge remote-tracking branch 'origin/5.5' into 5.6

Change-Id: I6d88b17f44479a522d181374023648dd007112bd
This commit is contained in:
Liang Qi
2016-01-21 08:00:31 +01:00
11 changed files with 51 additions and 36 deletions

View File

@@ -651,7 +651,7 @@ void QAlsaAudioOutput::resume()
}
resuming = true;
deviceState = QAudio::ActiveState;
deviceState = pullMode ? QAudio::ActiveState : QAudio::IdleState;
errorState = QAudio::NoError;
timer->start(period_time/1000);

View File

@@ -187,6 +187,7 @@ private:
QTimer *m_intervalTimer;
CoreAudioDeviceInfo *m_audioDeviceInfo;
qreal m_cachedVolume;
bool m_pullMode;
QAudio::Error m_errorCode;
QAudio::State m_stateCode;

View File

@@ -222,6 +222,7 @@ CoreAudioOutput::CoreAudioOutput(const QByteArray &device)
, m_startTime(0)
, m_audioBuffer(0)
, m_cachedVolume(1.0)
, m_pullMode(false)
, m_errorCode(QAudio::NoError)
, m_stateCode(QAudio::StoppedState)
{
@@ -271,6 +272,7 @@ void CoreAudioOutput::start(QIODevice *device)
m_stateCode = QAudio::ActiveState;
// Start
m_pullMode = true;
m_errorCode = QAudio::NoError;
m_totalFrames = 0;
m_startTime = CoreAudioUtils::currentTime();
@@ -296,6 +298,7 @@ QIODevice *CoreAudioOutput::start()
m_stateCode = QAudio::IdleState;
// Start
m_pullMode = false;
m_errorCode = QAudio::NoError;
m_totalFrames = 0;
m_startTime = CoreAudioUtils::currentTime();
@@ -347,7 +350,7 @@ void CoreAudioOutput::resume()
if (m_stateCode == QAudio::SuspendedState) {
audioThreadStart();
m_stateCode = QAudio::ActiveState;
m_stateCode = m_pullMode ? QAudio::ActiveState : QAudio::IdleState;
m_errorCode = QAudio::NoError;
emit stateChanged(m_stateCode);
}

View File

@@ -142,9 +142,6 @@ void QGstreamerAudioDecoderSession::configureAppSrcElement(GObject* object, GObj
if (!self->appsrc())
return;
if (self->appsrc()->isReady())
return;
GstElement *appsrc;
g_object_get(orig, "source", &appsrc, NULL);
@@ -350,9 +347,8 @@ void QGstreamerAudioDecoderSession::start()
return;
}
if (m_appSrc)
m_appSrc->deleteLater();
m_appSrc = new QGstAppSrc(this);
if (!m_appSrc)
m_appSrc = new QGstAppSrc(this);
m_appSrc->setStream(mDevice);
g_object_set(G_OBJECT(m_playbin), "uri", "appsrc://", NULL);

View File

@@ -241,6 +241,10 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
g_signal_connect(G_OBJECT(m_playbin), "video-changed", G_CALLBACK(handleStreamsChange), this);
g_signal_connect(G_OBJECT(m_playbin), "audio-changed", G_CALLBACK(handleStreamsChange), this);
g_signal_connect(G_OBJECT(m_playbin), "text-changed", G_CALLBACK(handleStreamsChange), this);
#if defined(HAVE_GST_APPSRC)
g_signal_connect(G_OBJECT(m_playbin), "deep-notify::source", G_CALLBACK(configureAppSrcElement), this);
#endif
}
}
@@ -274,7 +278,7 @@ void QGstreamerPlayerSession::configureAppSrcElement(GObject* object, GObject *o
Q_UNUSED(object);
Q_UNUSED(pspec);
if (self->appsrc()->isReady())
if (!self->appsrc())
return;
GstElement *appsrc;
@@ -298,16 +302,14 @@ void QGstreamerPlayerSession::loadFromStream(const QNetworkRequest &request, QIO
m_lastPosition = 0;
m_isPlaylist = false;
if (m_appSrc)
m_appSrc->deleteLater();
m_appSrc = new QGstAppSrc(this);
if (!m_appSrc)
m_appSrc = new QGstAppSrc(this);
m_appSrc->setStream(appSrcStream);
if (m_playbin) {
m_tags.clear();
emit tagsChanged();
g_signal_connect(G_OBJECT(m_playbin), "deep-notify::source", (GCallback) &QGstreamerPlayerSession::configureAppSrcElement, (gpointer)this);
g_object_set(G_OBJECT(m_playbin), "uri", "appsrc://", NULL);
if (!m_streamTypes.isEmpty()) {
@@ -330,6 +332,13 @@ void QGstreamerPlayerSession::loadFromUri(const QNetworkRequest &request)
m_lastPosition = 0;
m_isPlaylist = false;
#if defined(HAVE_GST_APPSRC)
if (m_appSrc) {
m_appSrc->deleteLater();
m_appSrc = 0;
}
#endif
if (m_playbin) {
m_tags.clear();
emit tagsChanged();

View File

@@ -248,7 +248,7 @@ void QOpenSLESAudioOutput::resume()
return;
}
setState(QAudio::ActiveState);
setState(m_pullMode ? QAudio::ActiveState : QAudio::IdleState);
setError(QAudio::NoError);
}

View File

@@ -555,7 +555,7 @@ void QPulseAudioOutput::resume()
m_tickTimer->start(m_periodTime);
setState(QAudio::ActiveState);
setState(m_pullMode ? QAudio::ActiveState : QAudio::IdleState);
setError(QAudio::NoError);
}
}

View File

@@ -434,7 +434,7 @@ qint64 QWindowsAudioOutput::write( const char *data, qint64 len )
void QWindowsAudioOutput::resume()
{
if(deviceState == QAudio::SuspendedState) {
deviceState = QAudio::ActiveState;
deviceState = pullMode ? QAudio::ActiveState : QAudio::IdleState;
errorState = QAudio::NoError;
waveOutRestart(hWaveOut);
QTimer::singleShot(10, this, SLOT(feedback()));