Closed raoulh closed 9 years ago
Cool! I'll have a better look later today, but one thing I noticed is that you're calling libspotify session functions (sp_session_preferred_bitrate
) without holding the session mutex (g_spotify_api_mutex
). That's not allowed, since it might cause races & crashes and other fun things (more here https://developer.spotify.com/technologies/libspotify/faq/).
There's a bunch of (terribly poorly documented) macros defined towards the top of spfs_spotify.c
to help deal with these intricacies - you might be able to use one of those to generate a wrapper for the function for you.
I was thinking that it was not needed because the bitrate function is called just after the session init
I think it'd be wiser to play it safe, regardless. It's such an easy bug to avoid (regardless if you use one of the macros or lock/unlock the mutex yourself) that even if it only triggers once every millionth execution it's worth it, imo.
New PR with updated code as requested
bitrate_preset=STRING One of the following value: (96kbps/160kbps/320kbps)
This is the correct pull request fir bitrate option. Sorry for the wrong previous one. I also changed the option type to be a string with the real bitrate values as you requested.