mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-01-14 09:36:25 +01:00
GstEnginePipeline: Add mutex locker for Spotify access token
This commit is contained in:
parent
07c898581c
commit
3d2315f754
@ -295,6 +295,7 @@ void GstEnginePipeline::set_fading_enabled(const bool enabled) {
|
|||||||
|
|
||||||
#ifdef HAVE_SPOTIFY
|
#ifdef HAVE_SPOTIFY
|
||||||
void GstEnginePipeline::set_spotify_access_token(const QString &spotify_access_token) {
|
void GstEnginePipeline::set_spotify_access_token(const QString &spotify_access_token) {
|
||||||
|
QMutexLocker l(&mutex_spotify_access_token_);
|
||||||
spotify_access_token_ = spotify_access_token;
|
spotify_access_token_ = spotify_access_token;
|
||||||
}
|
}
|
||||||
#endif // HAVE_SPOTIFY
|
#endif // HAVE_SPOTIFY
|
||||||
@ -1065,11 +1066,12 @@ void GstEnginePipeline::SourceSetupCallback(GstElement *playbin, GstElement *sou
|
|||||||
|
|
||||||
#ifdef HAVE_SPOTIFY
|
#ifdef HAVE_SPOTIFY
|
||||||
{
|
{
|
||||||
QMutexLocker l(&instance->mutex_url_);
|
QMutexLocker mutex_locker_url(&instance->mutex_url_);
|
||||||
if (instance->media_url_.scheme() == u"spotify"_s) {
|
if (instance->media_url_.scheme() == u"spotify"_s) {
|
||||||
if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "bitrate")) {
|
if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "bitrate")) {
|
||||||
g_object_set(source, "bitrate", 2, nullptr);
|
g_object_set(source, "bitrate", 2, nullptr);
|
||||||
}
|
}
|
||||||
|
QMutexLocker mutex_locker_spotify_access_token(&instance->mutex_spotify_access_token_);
|
||||||
if (!instance->spotify_access_token_.isEmpty() && g_object_class_find_property(G_OBJECT_GET_CLASS(source), "access-token")) {
|
if (!instance->spotify_access_token_.isEmpty() && g_object_class_find_property(G_OBJECT_GET_CLASS(source), "access-token")) {
|
||||||
const QByteArray access_token = instance->spotify_access_token_.toUtf8();
|
const QByteArray access_token = instance->spotify_access_token_.toUtf8();
|
||||||
g_object_set(source, "access-token", access_token.constData(), nullptr);
|
g_object_set(source, "access-token", access_token.constData(), nullptr);
|
||||||
|
@ -263,6 +263,7 @@ class GstEnginePipeline : public QObject {
|
|||||||
// Spotify
|
// Spotify
|
||||||
#ifdef HAVE_SPOTIFY
|
#ifdef HAVE_SPOTIFY
|
||||||
QString spotify_access_token_;
|
QString spotify_access_token_;
|
||||||
|
mutable QMutex mutex_spotify_access_token_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The URL that is currently playing, and the URL that is to be preloaded when the current track is close to finishing.
|
// The URL that is currently playing, and the URL that is to be preloaded when the current track is close to finishing.
|
||||||
|
Loading…
Reference in New Issue
Block a user