GstEnginePipeline: place probes/handles *after* output queue

We want to get the segments in sync with when they are passed onto
the sound card, and now that is after the output queue.
This commit is contained in:
Roman Lebedev 2023-08-02 03:29:22 +03:00
parent ec6db8ccfa
commit c8e6fa7e74
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
1 changed files with 3 additions and 15 deletions

View File

@ -576,8 +576,6 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
}
eventprobe_ = audioqueueconverter_;
// Create the replaygain elements if it's enabled.
GstElement *rgvolume = nullptr;
GstElement *rglimiter = nullptr;
@ -595,7 +593,6 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
if (!rgconverter) {
return false;
}
eventprobe_ = rgconverter;
// Set replaygain settings
g_object_set(G_OBJECT(rgvolume), "album-mode", rg_mode_, nullptr);
g_object_set(G_OBJECT(rgvolume), "pre-amp", rg_preamp_, nullptr);
@ -612,7 +609,6 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
UpdateEBUR128LoudnessNormalizingGaindB();
eventprobe_ = ebur128_volume_;
}
GstElement *bs2b = nullptr;
@ -637,16 +633,6 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
}
}
// Add a data probe on the src pad of the audioconvert element for our scope.
// We do it here because we want pre-equalized and pre-volume samples so that our visualization are not be affected by them.
{
GstPad *pad = gst_element_get_static_pad(eventprobe_, "src");
if (pad) {
upstream_events_probe_cb_id_ = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, &UpstreamEventsProbeCallback, this, nullptr);
gst_object_unref(pad);
}
}
// Set the buffer duration.
// We set this on our queues instead of the playbin because setting it on the playbin only affects network sources.
// Disable the default buffer and byte limits, so we only buffer based on time.
@ -767,6 +753,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
error = "Failed to link audio sink converter to output audio queue with filter";
return false;
}
eventprobe_ = outputaudioqueue_;
element_link = outputaudioqueue_;
}
@ -777,8 +764,9 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
element_link = audiosink_;
{ // Add probes and handlers.
GstPad *pad = gst_element_get_static_pad(audioqueueconverter_, "src");
GstPad *pad = gst_element_get_static_pad(eventprobe_, "src");
if (pad) {
upstream_events_probe_cb_id_ = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, &UpstreamEventsProbeCallback, this, nullptr);
buffer_probe_cb_id_ = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, BufferProbeCallback, this, nullptr);
gst_object_unref(pad);
}