mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-26 12:21:39 +00:00
Improve music attenuation error handling
This commit is contained in:
parent
34896b0205
commit
11181136d8
1 changed files with 3 additions and 8 deletions
|
|
@ -27,7 +27,7 @@ static std::vector<std::string> GetMediaPlayerBusNames(DBusConnection* connectio
|
||||||
{
|
{
|
||||||
assert(connection != nullptr);
|
assert(connection != nullptr);
|
||||||
|
|
||||||
std::vector<std::string> result;
|
auto result = std::vector<std::string>();
|
||||||
|
|
||||||
DBusMessageIter rootIterator;
|
DBusMessageIter rootIterator;
|
||||||
DBusMessageIter arrayIterator;
|
DBusMessageIter arrayIterator;
|
||||||
|
|
@ -41,7 +41,7 @@ static std::vector<std::string> GetMediaPlayerBusNames(DBusConnection* connectio
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_iter_init_append(message, &rootIterator);
|
dbus_message_iter_init_append(message, &rootIterator);
|
||||||
if (!dbus_connection_send_with_reply(connection, message, &pendingReturn, -1))
|
if (!dbus_connection_send_with_reply(connection, message, &pendingReturn, 40))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Failed to create D-Bus Message!");
|
LOG_ERROR("Failed to create D-Bus Message!");
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -121,7 +121,7 @@ static bool IsMediaPlayerPlaying(DBusConnection* connection, const std::string&
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dbus_connection_send_with_reply(connection, message, &pendingReturn, -1))
|
if (!dbus_connection_send_with_reply(connection, message, &pendingReturn, 40))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Failed to create D-Bus Message!");
|
LOG_ERROR("Failed to create D-Bus Message!");
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -152,15 +152,10 @@ static bool IsMediaPlayerPlaying(DBusConnection* connection, const std::string&
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dbus_message_iter_get_arg_type(&rootIterator) == DBUS_TYPE_VARIANT)
|
if (dbus_message_iter_get_arg_type(&rootIterator) == DBUS_TYPE_VARIANT)
|
||||||
{
|
|
||||||
dbus_message_iter_recurse(&rootIterator, &arrayIterator);
|
dbus_message_iter_recurse(&rootIterator, &arrayIterator);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
arrayIterator = rootIterator;
|
arrayIterator = rootIterator;
|
||||||
}
|
|
||||||
|
|
||||||
dbus_message_iter_recurse(&rootIterator, &arrayIterator);
|
|
||||||
if (dbus_message_iter_get_arg_type(&arrayIterator) != DBUS_TYPE_STRING)
|
if (dbus_message_iter_get_arg_type(&arrayIterator) != DBUS_TYPE_STRING)
|
||||||
{
|
{
|
||||||
LOG_ERROR("D-Bus message returned invalid type!");
|
LOG_ERROR("D-Bus message returned invalid type!");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue