Ignore buffering messages from the magic queue2 element that's created by the uridecodebin. Also lower the threshold for buffering to start.
This commit is contained in:
parent
b86be65ea1
commit
03b0e51b7d
@ -164,9 +164,6 @@ bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) {
|
|||||||
} else {
|
} else {
|
||||||
new_bin = engine_->CreateElement("uridecodebin");
|
new_bin = engine_->CreateElement("uridecodebin");
|
||||||
g_object_set(G_OBJECT(new_bin), "uri", url.toEncoded().constData(), NULL);
|
g_object_set(G_OBJECT(new_bin), "uri", url.toEncoded().constData(), NULL);
|
||||||
g_object_set(G_OBJECT(new_bin), "buffer-duration", buffer_duration_nanosec_, NULL);
|
|
||||||
g_object_set(G_OBJECT(new_bin), "download", true, NULL);
|
|
||||||
g_object_set(G_OBJECT(new_bin), "use-buffering", true, NULL);
|
|
||||||
g_signal_connect(G_OBJECT(new_bin), "drained", G_CALLBACK(SourceDrainedCallback), this);
|
g_signal_connect(G_OBJECT(new_bin), "drained", G_CALLBACK(SourceDrainedCallback), this);
|
||||||
g_signal_connect(G_OBJECT(new_bin), "pad-added", G_CALLBACK(NewPadCallback), this);
|
g_signal_connect(G_OBJECT(new_bin), "pad-added", G_CALLBACK(NewPadCallback), this);
|
||||||
g_signal_connect(G_OBJECT(new_bin), "notify::source", G_CALLBACK(SourceSetupCallback), this);
|
g_signal_connect(G_OBJECT(new_bin), "notify::source", G_CALLBACK(SourceSetupCallback), this);
|
||||||
@ -309,8 +306,14 @@ bool GstEnginePipeline::Init() {
|
|||||||
// Set the buffer duration. We set this on the queue as well as on the
|
// Set the buffer duration. We set this on the queue as well as on the
|
||||||
// decode bin (in ReplaceDecodeBin()) because setting it on the decode bin
|
// decode bin (in ReplaceDecodeBin()) because setting it on the decode bin
|
||||||
// only affects network sources.
|
// only affects network sources.
|
||||||
|
g_object_set(G_OBJECT(queue_), "max-size-buffers", 0, NULL);
|
||||||
|
g_object_set(G_OBJECT(queue_), "max-size-bytes", 0, NULL);
|
||||||
g_object_set(G_OBJECT(queue_), "max-size-time", buffer_duration_nanosec_, NULL);
|
g_object_set(G_OBJECT(queue_), "max-size-time", buffer_duration_nanosec_, NULL);
|
||||||
g_object_set(G_OBJECT(queue_), "use-buffering", true, NULL);
|
g_object_set(G_OBJECT(queue_), "low-percent", 1, NULL);
|
||||||
|
|
||||||
|
if (buffer_duration_nanosec_ > 0) {
|
||||||
|
g_object_set(G_OBJECT(queue_), "use-buffering", true, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
gst_element_link(queue_, audioconvert_);
|
gst_element_link(queue_, audioconvert_);
|
||||||
|
|
||||||
@ -569,6 +572,12 @@ void GstEnginePipeline::StateChangedMessageReceived(GstMessage* msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GstEnginePipeline::BufferingMessageReceived(GstMessage* msg) {
|
void GstEnginePipeline::BufferingMessageReceived(GstMessage* msg) {
|
||||||
|
// Only handle buffering messages from the queue2 element in audiobin - not
|
||||||
|
// the one that's created automatically by uridecidebin.
|
||||||
|
if (GST_ELEMENT(GST_MESSAGE_SRC(msg)) != queue_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int percent = 0;
|
int percent = 0;
|
||||||
gst_message_parse_buffering(msg, &percent);
|
gst_message_parse_buffering(msg, &percent);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user