shutdown_media_server: Finalize rework of synchronization

* When the user isn't requesting a custom notification, it will
be a BMediaRoster job to do it.
* Reintroduce BMediaRoster::SyncToServices, this time based on local
message passing rather than a global semaphore.
* SyncToServices is used in launch_media_server to make the process
more launch_daemon safe and faster in the average case.
* It was an error to add notifications in the media_server.
* Fixes #12717.
This commit is contained in:
Dario Casalinuovo
2016-04-21 19:02:27 +02:00
parent 721adc92d3
commit 76889670db
6 changed files with 121 additions and 25 deletions
+4
View File
@@ -44,6 +44,10 @@ 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);
+6
View File
@@ -95,7 +95,13 @@ public:
void RegisterLocalNode(BMediaNode* node);
void UnregisterLocalNode(BMediaNode* node);
void EnableLaunchNotification(bool enable,
bool autoExit);
private:
bool fLaunchNotification;
bool fAutoExit;
friend class BMediaRoster;
};
+4 -1
View File
@@ -40,7 +40,10 @@ enum {
enum {
// local media services status notification service
MEDIA_ROSTER_REQUEST_NOTIFICATIONS = 2000,
MEDIA_ROSTER_CANCEL_NOTIFICATIONS
MEDIA_ROSTER_CANCEL_NOTIFICATIONS,
// used to sync with media services startup
MEDIA_ROSTER_REGISTER_SYNC
};
// Raw port based communication