mirror of
https://github.com/clangen/musikcube.git
synced 2025-04-10 03:44:31 +00:00
Added configurable track query timeout for use by PlaybackService.
This commit is contained in:
parent
a12134c610
commit
a498ef93ad
@ -60,12 +60,6 @@ using musik::core::ILibraryPtr;
|
|||||||
using musik::core::audio::ITransport;
|
using musik::core::audio::ITransport;
|
||||||
using Editor = PlaybackService::Editor;
|
using Editor = PlaybackService::Editor;
|
||||||
|
|
||||||
/* internally PlaybackService leverages a message queue for synchronization;
|
|
||||||
tracks are a special in that they are heavy-weight so aggressively exjected
|
|
||||||
from caches... sometimes we may have to query for them. if they take more than
|
|
||||||
the specified timeout we consider it a failure and stop playback. */
|
|
||||||
static const size_t kTrackTimeoutMs = 3000;
|
|
||||||
|
|
||||||
#define NO_POSITION (size_t) -1
|
#define NO_POSITION (size_t) -1
|
||||||
#define START_OVER (size_t) -2
|
#define START_OVER (size_t) -2
|
||||||
|
|
||||||
@ -140,6 +134,12 @@ static inline void savePreferences(
|
|||||||
prefs->SetInt(keys::TimeChangeMode, playback.GetTimeChangeMode());
|
prefs->SetInt(keys::TimeChangeMode, playback.GetTimeChangeMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* internally PlaybackService leverages a message queue for synchronization;
|
||||||
|
tracks are a special in that they are heavy-weight so aggressively exjected
|
||||||
|
from caches... sometimes we may have to query for them. if they take more than
|
||||||
|
the specified timeout we consider it a failure and stop playback. */
|
||||||
|
#define TRACK_TIMEOUT_MS() (size_t) this->appPrefs->GetInt(keys::PlaybackTrackQueryTimeoutMs, 5000)
|
||||||
|
|
||||||
PlaybackService::PlaybackService(
|
PlaybackService::PlaybackService(
|
||||||
IMessageQueue& messageQueue,
|
IMessageQueue& messageQueue,
|
||||||
ILibraryPtr library,
|
ILibraryPtr library,
|
||||||
@ -853,7 +853,7 @@ ITrack* PlaybackService::GetTrack(size_t index) {
|
|||||||
const size_t count = this->playlist.Count();
|
const size_t count = this->playlist.Count();
|
||||||
|
|
||||||
if (count && index < this->playlist.Count()) {
|
if (count && index < this->playlist.Count()) {
|
||||||
auto track = this->playlist.GetWithTimeout(index, kTrackTimeoutMs * 10);
|
auto track = this->playlist.GetWithTimeout(index, TRACK_TIMEOUT_MS() * 10);
|
||||||
if (track) {
|
if (track) {
|
||||||
return track->GetSdkValue();
|
return track->GetSdkValue();
|
||||||
}
|
}
|
||||||
@ -888,7 +888,7 @@ TrackPtr PlaybackService::TrackAtIndexWithTimeout(size_t index) {
|
|||||||
return TrackPtr();
|
return TrackPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this->playlist.GetWithTimeout(index, kTrackTimeoutMs);
|
return this->playlist.GetWithTimeout(index, TRACK_TIMEOUT_MS());
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor PlaybackService::Edit() {
|
Editor PlaybackService::Edit() {
|
||||||
|
@ -66,6 +66,7 @@ namespace musik { namespace core { namespace prefs {
|
|||||||
const std::string keys::DisableAlbumArtistFallback = "DisableAlbumArtistFallback";
|
const std::string keys::DisableAlbumArtistFallback = "DisableAlbumArtistFallback";
|
||||||
const std::string keys::AuddioApiToken = "AuddioApiToken";
|
const std::string keys::AuddioApiToken = "AuddioApiToken";
|
||||||
const std::string keys::LibraryType = "LibraryType";
|
const std::string keys::LibraryType = "LibraryType";
|
||||||
|
const std::string keys::PlaybackTrackQueryTimeoutMs = "PlaybackTrackQueryTimeoutMs";
|
||||||
const std::string keys::RemoteLibraryHostname = "RemoteLibraryHostname";
|
const std::string keys::RemoteLibraryHostname = "RemoteLibraryHostname";
|
||||||
const std::string keys::RemoteLibraryWssPort = "RemoteLibraryWssPort";
|
const std::string keys::RemoteLibraryWssPort = "RemoteLibraryWssPort";
|
||||||
const std::string keys::RemoteLibraryHttpPort = "RemoteLibraryHttpPort";
|
const std::string keys::RemoteLibraryHttpPort = "RemoteLibraryHttpPort";
|
||||||
|
@ -70,6 +70,7 @@ namespace musik { namespace core { namespace prefs {
|
|||||||
extern const std::string DisableAlbumArtistFallback;
|
extern const std::string DisableAlbumArtistFallback;
|
||||||
extern const std::string AuddioApiToken;
|
extern const std::string AuddioApiToken;
|
||||||
extern const std::string LibraryType;
|
extern const std::string LibraryType;
|
||||||
|
extern const std::string PlaybackTrackQueryTimeoutMs;
|
||||||
extern const std::string RemoteLibraryHostname;
|
extern const std::string RemoteLibraryHostname;
|
||||||
extern const std::string RemoteLibraryWssPort;
|
extern const std::string RemoteLibraryWssPort;
|
||||||
extern const std::string RemoteLibraryHttpPort;
|
extern const std::string RemoteLibraryHttpPort;
|
||||||
|
@ -119,6 +119,7 @@ static inline std::shared_ptr<ISchema> AdvancedSettingsSchema() {
|
|||||||
#endif
|
#endif
|
||||||
schema->AddBool(cube::prefs::keys::AutoHideCommandBar, false);
|
schema->AddBool(cube::prefs::keys::AutoHideCommandBar, false);
|
||||||
schema->AddInt(core::prefs::keys::RemoteLibraryLatencyTimeoutMs, 5000);
|
schema->AddInt(core::prefs::keys::RemoteLibraryLatencyTimeoutMs, 5000);
|
||||||
|
schema->AddInt(core::prefs::keys::PlaybackTrackQueryTimeoutMs, 5000);
|
||||||
schema->AddBool(core::prefs::keys::AsyncTrackListQueries, true);
|
schema->AddBool(core::prefs::keys::AsyncTrackListQueries, true);
|
||||||
schema->AddBool(cube::prefs::keys::DisableRatingColumn, false);
|
schema->AddBool(cube::prefs::keys::DisableRatingColumn, false);
|
||||||
schema->AddBool(cube::prefs::keys::DisableWindowTitleUpdates, false);
|
schema->AddBool(cube::prefs::keys::DisableWindowTitleUpdates, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user