From d3dd26c596dd393c4f6ce3a5c4324a8defb25b9f Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Thu, 1 Aug 2024 23:22:19 +0200 Subject: [PATCH] GstEnginePipeline: Set Spotify bitrate to 320 --- src/engine/gstenginepipeline.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/engine/gstenginepipeline.cpp b/src/engine/gstenginepipeline.cpp index ef2da4931..f16d79127 100644 --- a/src/engine/gstenginepipeline.cpp +++ b/src/engine/gstenginepipeline.cpp @@ -1006,13 +1006,17 @@ void GstEnginePipeline::SourceSetupCallback(GstElement *playbin, GstElement *sou } #ifdef HAVE_SPOTIFY - if (instance->media_url_.scheme() == QStringLiteral("spotify") && - !instance->spotify_username_.isEmpty() && - !instance->spotify_password_.isEmpty() && - g_object_class_find_property(G_OBJECT_GET_CLASS(source), "username") && - g_object_class_find_property(G_OBJECT_GET_CLASS(source), "password")) { - g_object_set(source, "username", instance->spotify_username_.toUtf8().constData(), nullptr); - g_object_set(source, "password", instance->spotify_password_.toUtf8().constData(), nullptr); + if (instance->media_url_.scheme() == QStringLiteral("spotify")) { + if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "bitrate")) { + g_object_set(source, "bitrate", 2, nullptr); + } + if (!instance->spotify_username_.isEmpty() && + !instance->spotify_password_.isEmpty() && + g_object_class_find_property(G_OBJECT_GET_CLASS(source), "username") && + g_object_class_find_property(G_OBJECT_GET_CLASS(source), "password")) { + g_object_set(source, "username", instance->spotify_username_.toUtf8().constData(), nullptr); + g_object_set(source, "password", instance->spotify_password_.toUtf8().constData(), nullptr); + } } #endif