launch_media_server: Use BLaunchRoster::Start

* Remove SyncToServices and the related code from BMediaRoster.
This commit is contained in:
Dario Casalinuovo
2016-05-07 22:22:55 +02:00
parent f2bb946bd8
commit 6d63bc5e60
3 changed files with 2 additions and 61 deletions
-4
View File
@@ -44,10 +44,6 @@ public:
// Check if the media services are running.
static bool IsRunning();
// Wait until the media_server is running or the specified timeout
// is reached.
status_t SyncToServices(bigtime_t timeout);
// Getting common instances of system nodes:
status_t GetVideoInput(media_node* _node);
status_t GetAudioInput(media_node* _node);
+2 -12
View File
@@ -14,6 +14,7 @@
#include <Bitmap.h>
#include <Catalog.h>
#include <IconUtils.h>
#include <LaunchRoster.h>
#include <Locale.h>
#include <MediaNode.h>
#include <MediaRoster.h>
@@ -1433,18 +1434,7 @@ launch_media_server(bigtime_t timeout,
progress_startup(50, progress, cookie);
err = roster->SyncToServices(2000000);
if (err != B_OK) {
// At this point, it might be that the launch_daemon isn't
// restarting us, then we'll attempt at launching the server
// ourselves.
err = be_roster->Launch(B_MEDIA_SERVER_SIGNATURE);
if (err != B_OK)
return err;
if (roster->SyncToServices(2000000) != B_OK)
err = B_MEDIA_SYSTEM_FAILURE;
}
err = BLaunchRoster().Start(B_MEDIA_SERVER_SIGNATURE);
if (err != B_OK)
progress_startup(90, progress, cookie);
-45
View File
@@ -112,7 +112,6 @@ static bool sServerIsUp = false;
static List<RosterNotification> sNotificationList;
static BLocker sInitLocker("BMediaRoster::Roster locker");
static List<LocalNode> sRegisteredNodes;
static List<SyncedMessage> sSyncedMessages;
class MediaRosterUndertaker {
@@ -3363,26 +3362,6 @@ BMediaRoster::IsRunning()
}
status_t
BMediaRoster::SyncToServices(bigtime_t timeout)
{
BMessenger messenger(this);
BMessage msg(MEDIA_ROSTER_REGISTER_SYNC);
BMessage reply;
if (!messenger.IsValid())
return B_MEDIA_SYSTEM_FAILURE;
status_t ret = messenger.SendMessage(&msg, &reply, timeout, timeout);
if (ret == B_TIMED_OUT || reply.what == B_NO_REPLY)
return B_TIMED_OUT;
else if (ret != B_OK)
return ret;
return B_OK;
}
ssize_t
BMediaRoster::AudioBufferSizeFor(int32 channelCount, uint32 sampleFormat,
float frameRate, bus_type busKind)
@@ -3471,20 +3450,6 @@ BMediaRoster::MessageReceived(BMessage* message)
return;
}
case MEDIA_ROSTER_REGISTER_SYNC:
{
BMessage reply;
if (sServerIsUp)
message->SendReply(&reply);
else {
DetachCurrentMessage();
SyncedMessage msg;
msg.message = message;
sSyncedMessages.Insert(msg);
}
return;
}
case B_SOME_APP_LAUNCHED:
{
BString mimeSig;
@@ -3552,16 +3517,6 @@ BMediaRoster::MessageReceived(BMessage* message)
MediaRosterEx(this)->fLaunchNotification = false;
}
BMessage reply;
for (int32 i = 0; i < sSyncedMessages.CountItems(); i++) {
SyncedMessage* msg;
if (sSyncedMessages.Get(i, &msg) == true) {
msg->message->SendReply(&reply);
delete msg->message;
}
sSyncedMessages.Remove(i);
}
// Send the notification to our subscribers
for (int32 i = 0; i < sNotificationList.CountItems(); i++) {
RosterNotification* current;