Fix sending End Of Stream on gst plugin
When streaming to gst a typefind operation is performed which jumps around to find which codec the file provides, this fix the call to send an EOS before we try to read and not after which causes confusion to gst. Task-number: QTBUG-32963 Change-Id: I2658b6a4e960430c8ab422a3bee5e11956663116 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
This commit is contained in:
committed by
The Qt Project
parent
d26fcf043d
commit
7451906b71
@@ -149,28 +149,29 @@ void QGstAppSrc::pushDataToAppSrc()
|
||||
size = qMin(m_stream->bytesAvailable(), queueSize());
|
||||
else
|
||||
size = qMin(m_stream->bytesAvailable(), (qint64)m_dataRequestSize);
|
||||
void *data = g_malloc(size);
|
||||
GstBuffer* buffer = gst_app_buffer_new(data, size, g_free, data);
|
||||
buffer->offset = m_stream->pos();
|
||||
qint64 bytesRead = m_stream->read((char*)GST_BUFFER_DATA(buffer), size);
|
||||
buffer->offset_end = buffer->offset + bytesRead - 1;
|
||||
|
||||
if (bytesRead > 0) {
|
||||
m_dataRequested = false;
|
||||
m_enoughData = false;
|
||||
GstFlowReturn ret = gst_app_src_push_buffer (GST_APP_SRC (element()), buffer);
|
||||
if (ret == GST_FLOW_ERROR) {
|
||||
qWarning()<<"appsrc: push buffer error";
|
||||
} else if (ret == GST_FLOW_WRONG_STATE) {
|
||||
qWarning()<<"appsrc: push buffer wrong state";
|
||||
} else if (ret == GST_FLOW_RESEND) {
|
||||
qWarning()<<"appsrc: push buffer resend";
|
||||
if (size) {
|
||||
void *data = g_malloc(size);
|
||||
GstBuffer* buffer = gst_app_buffer_new(data, size, g_free, data);
|
||||
buffer->offset = m_stream->pos();
|
||||
qint64 bytesRead = m_stream->read((char*)GST_BUFFER_DATA(buffer), size);
|
||||
buffer->offset_end = buffer->offset + bytesRead - 1;
|
||||
|
||||
if (bytesRead > 0) {
|
||||
m_dataRequested = false;
|
||||
m_enoughData = false;
|
||||
GstFlowReturn ret = gst_app_src_push_buffer (GST_APP_SRC (element()), buffer);
|
||||
if (ret == GST_FLOW_ERROR) {
|
||||
qWarning()<<"appsrc: push buffer error";
|
||||
} else if (ret == GST_FLOW_WRONG_STATE) {
|
||||
qWarning()<<"appsrc: push buffer wrong state";
|
||||
} else if (ret == GST_FLOW_RESEND) {
|
||||
qWarning()<<"appsrc: push buffer resend";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// After reading we might be all done
|
||||
if (m_stream->atEnd())
|
||||
} else {
|
||||
sendEOS();
|
||||
}
|
||||
} else if (m_stream->atEnd()) {
|
||||
sendEOS();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user