added more debug information
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2218 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a3d1f07f83
commit
ced4130fee
@ -187,7 +187,7 @@ void AppManager::CleanupAddonServer()
|
||||
ASSERT(false == fLocker->IsLocked());
|
||||
|
||||
TRACE("AppManager: cleaning up media_addon_server\n");
|
||||
|
||||
gNodeManager->CleanupDormantFlavorInfos();
|
||||
}
|
||||
|
||||
void AppManager::StartAddonServer()
|
||||
@ -216,3 +216,15 @@ void AppManager::TerminateAddonServer()
|
||||
snooze(1000000);
|
||||
}
|
||||
}
|
||||
|
||||
void AppManager::Dump()
|
||||
{
|
||||
BAutolock lock(fLocker);
|
||||
printf("\n");
|
||||
printf("AppManager: list of applications follows:\n");
|
||||
App *app;
|
||||
for (fAppMap->Rewind(); fAppMap->GetNext(&app); ) {
|
||||
printf(" team %ld, messenger %svalid\n", app->team, app->messenger.IsValid() ? "" : "NOT ");
|
||||
}
|
||||
printf("AppManager: list end\n");
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ public:
|
||||
void StartAddonServer();
|
||||
void TerminateAddonServer();
|
||||
|
||||
void Dump();
|
||||
|
||||
private:
|
||||
void CleanupTeam(team_id);
|
||||
void CleanupAddonServer();
|
||||
|
@ -42,7 +42,6 @@ BufferManager::RegisterBuffer(team_id teamid, media_buffer_id bufferid,
|
||||
buffer_info *info;
|
||||
if (!fBufferInfoMap->Get(bufferid, &info)) {
|
||||
FATAL("failed to register buffer! team = %ld, bufferid = %ld\n", teamid, bufferid);
|
||||
PrintToStream();
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@ -52,8 +51,6 @@ BufferManager::RegisterBuffer(team_id teamid, media_buffer_id bufferid,
|
||||
*offset = info->offset;
|
||||
*size = info->size,
|
||||
*flags = info->flags;
|
||||
|
||||
PrintToStream();
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -88,7 +85,6 @@ BufferManager::RegisterBuffer(team_id teamid, size_t size, int32 flags, size_t o
|
||||
|
||||
fNextBufferId += 1;
|
||||
|
||||
PrintToStream();
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -103,20 +99,17 @@ BufferManager::UnregisterBuffer(team_id teamid, media_buffer_id bufferid)
|
||||
|
||||
if (!fBufferInfoMap->Get(bufferid, &info)) {
|
||||
FATAL("UnregisterBuffer: failed to unregister buffer! team = %ld, bufferid = %ld\n", teamid, bufferid);
|
||||
PrintToStream();
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
index = info->teams.Find(teamid);
|
||||
if (index < 0) {
|
||||
FATAL("UnregisterBuffer: failed to find team = %ld belonging to bufferid = %ld\n", teamid, bufferid);
|
||||
PrintToStream();
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
if (!info->teams.Remove(index)) {
|
||||
FATAL("UnregisterBuffer: failed to remove team = %ld from bufferid = %ld\n", teamid, bufferid);
|
||||
PrintToStream();
|
||||
return B_ERROR;
|
||||
}
|
||||
TRACE("UnregisterBuffer: team = %ld removed from bufferid = %ld\n", teamid, bufferid);
|
||||
@ -125,7 +118,6 @@ BufferManager::UnregisterBuffer(team_id teamid, media_buffer_id bufferid)
|
||||
|
||||
if (!fBufferInfoMap->Remove(bufferid)) {
|
||||
FATAL("UnregisterBuffer: failed to remove bufferid = %ld\n", bufferid);
|
||||
PrintToStream();
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@ -143,8 +135,6 @@ BufferManager::CleanupTeam(team_id team)
|
||||
|
||||
TRACE("BufferManager::CleanupTeam: team %ld\n", team);
|
||||
|
||||
PrintToStream();
|
||||
|
||||
for (fBufferInfoMap->Rewind(); fBufferInfoMap->GetNext(&info); ) {
|
||||
team_id *otherteam;
|
||||
for (info->teams.Rewind(); info->teams.GetNext(&otherteam); ) {
|
||||
@ -158,24 +148,24 @@ BufferManager::CleanupTeam(team_id team)
|
||||
fBufferInfoMap->RemoveCurrent();
|
||||
}
|
||||
}
|
||||
|
||||
PrintToStream();
|
||||
}
|
||||
|
||||
void
|
||||
BufferManager::PrintToStream()
|
||||
BufferManager::Dump()
|
||||
{
|
||||
BAutolock lock(fLocker);
|
||||
buffer_info *info;
|
||||
team_id *team;
|
||||
TRACE("BufferManager: list of buffers follows:\n");
|
||||
printf("\n");
|
||||
printf("BufferManager: list of buffers follows:\n");
|
||||
for (fBufferInfoMap->Rewind(); fBufferInfoMap->GetNext(&info); ) {
|
||||
TRACE(" bufferid = %ld, areaid = %ld, offset = %ld, size = %ld, flags = %#08lx\n",
|
||||
printf(" buffer-id %ld, area-id %ld, offset %ld, size %ld, flags %#08lx\n",
|
||||
info->id, info->area, info->offset, info->size, info->flags);
|
||||
printf(" assigned teams: ");
|
||||
team_id *team;
|
||||
for (info->teams.Rewind(); info->teams.GetNext(&team); ) {
|
||||
TRACE(" team = %ld", *team);
|
||||
printf("%ld, ", *team);
|
||||
}
|
||||
TRACE("\n");
|
||||
printf("\n");
|
||||
}
|
||||
TRACE("BufferManager: list end\n");
|
||||
printf("BufferManager: list end\n");
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
|
||||
void CleanupTeam(team_id teamid);
|
||||
|
||||
void PrintToStream();
|
||||
void Dump();
|
||||
|
||||
private:
|
||||
struct buffer_info
|
||||
|
@ -2,6 +2,8 @@ SubDir OBOS_TOP src servers media ;
|
||||
|
||||
UsePrivateHeaders media ;
|
||||
|
||||
AddResources media_server : media_server.rsrc ;
|
||||
|
||||
Server media_server :
|
||||
media_server.cpp
|
||||
AppManager.cpp
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <Message.h>
|
||||
#include <Locker.h>
|
||||
#include <Autolock.h>
|
||||
#include <Path.h>
|
||||
#include <Messenger.h>
|
||||
#include <MediaDefs.h>
|
||||
#include <MediaAddOn.h>
|
||||
@ -53,7 +54,7 @@ NodeManager::RegisterNode(media_node_id *nodeid, media_addon_id addon_id, int32
|
||||
ASSERT(b);
|
||||
*nodeid = nextnodeid;
|
||||
nextnodeid += 1;
|
||||
TRACE("NodeManager::RegisterNode: node %ld, addon_id %ld, flavor_id %ld, name '%s', kinds %#Lx, port %ld, team %ld\n", *nodeid, addon_id, addon_flavor_id, name, kinds, port, team);
|
||||
TRACE("NodeManager::RegisterNode: node %ld, addon_id %ld, flavor_id %ld, name \"%s\", kinds %#Lx, port %ld, team %ld\n", *nodeid, addon_id, addon_flavor_id, name, kinds, port, team);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -161,6 +162,7 @@ NodeManager::GetCloneForId(media_node *node, media_node_id nodeid, team_id team)
|
||||
b = fRegisteredNodeMap->Get(nodeid, &rn);
|
||||
if (!b) {
|
||||
FATAL("!!! NodeManager::GetCloneForId: Error: node %ld not found\n", nodeid);
|
||||
DecrementGlobalRefCount(nodeid, team);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@ -277,7 +279,7 @@ NodeManager::GetLiveNodeInfo(live_node_info *live_info, const media_node &node)
|
||||
live_info->node = node;
|
||||
live_info->hint_point = BPoint(0, 0);
|
||||
strcpy(live_info->name, rn->name);
|
||||
TRACE("NodeManager::GetLiveNodeInfo node %ld, name = '%s'\n", node.node, rn->name);
|
||||
TRACE("NodeManager::GetLiveNodeInfo node %ld, name = \"%s\"\n", node.node, rn->name);
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
@ -381,7 +383,7 @@ NodeManager::GetDormantNodeInfo(dormant_node_info *node_info, const media_node &
|
||||
node_info->addon = rn->addon_id;
|
||||
node_info->flavor_id = rn->addon_flavor_id;
|
||||
strcpy(node_info->name, rn->name);
|
||||
TRACE("NodeManager::GetDormantNodeInfo node %ld, addon_id %ld, addon_flavor_id %ld, name '%s'\n", node.node, rn->addon_id, rn->addon_flavor_id, rn->name);
|
||||
TRACE("NodeManager::GetDormantNodeInfo node %ld, addon_id %ld, addon_flavor_id %ld, name \"%s\"\n", node.node, rn->addon_id, rn->addon_flavor_id, rn->name);
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
@ -412,6 +414,8 @@ NodeManager::RegisterAddon(const entry_ref &ref, media_addon_id *newid)
|
||||
id = nextaddonid;
|
||||
nextaddonid += 1;
|
||||
|
||||
printf("NodeManager::RegisterAddon: ref-name \"%s\", assigning id %ld\n", ref.name, id);
|
||||
|
||||
fAddonPathMap->Insert(id, ref);
|
||||
*newid = id;
|
||||
}
|
||||
@ -420,22 +424,47 @@ void
|
||||
NodeManager::UnregisterAddon(media_addon_id id)
|
||||
{
|
||||
BAutolock lock(fLocker);
|
||||
|
||||
printf("NodeManager::UnregisterAddon: id %ld\n", id);
|
||||
|
||||
RemoveDormantFlavorInfo(id);
|
||||
fAddonPathMap->Remove(id);
|
||||
}
|
||||
|
||||
// this function is only called (indirectly) by the media_addon_server
|
||||
void
|
||||
NodeManager::AddDormantFlavorInfo(const dormant_flavor_info &dfi)
|
||||
{
|
||||
BAutolock lock(fLocker);
|
||||
|
||||
printf("NodeManager::AddDormantFlavorInfo, addon-id %ld, flavor-id %ld, name \"%s\", flavor-name \"%s\", flavor-info \"%s\"\n", dfi.node_info.addon, dfi.node_info.flavor_id, dfi.node_info.name, dfi.name, dfi.info);
|
||||
|
||||
fDormantFlavorList->Insert(dfi);
|
||||
}
|
||||
|
||||
// this function is only called (indirectly) by the media_addon_server
|
||||
void
|
||||
NodeManager::RemoveDormantFlavorInfo(media_addon_id id)
|
||||
{
|
||||
BAutolock lock(fLocker);
|
||||
UNIMPLEMENTED();
|
||||
dormant_flavor_info *flavor;
|
||||
for (fDormantFlavorList->Rewind(); fDormantFlavorList->GetNext(&flavor); ) {
|
||||
if (flavor->node_info.addon == id) {
|
||||
printf("NodeManager::RemoveDormantFlavorInfo, addon-id %ld, flavor-id %ld, name \"%s\", flavor-name \"%s\", flavor-info \"%s\"\n", flavor->node_info.addon, flavor->node_info.flavor_id, flavor->node_info.name, flavor->name, flavor->info);
|
||||
fDormantFlavorList->RemoveCurrent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this function is called when the media_addon_server has crashed
|
||||
void
|
||||
NodeManager::CleanupDormantFlavorInfos()
|
||||
{
|
||||
BAutolock lock(fLocker);
|
||||
printf("NodeManager::CleanupDormantFlavorInfos\n");
|
||||
fDormantFlavorList->MakeEmpty();
|
||||
printf("NodeManager::CleanupDormantFlavorInfos done\n");
|
||||
// XXX FlavorsChanged(media_addon_id addonid, int32 newcount, int32 gonecount)
|
||||
}
|
||||
|
||||
status_t
|
||||
@ -526,7 +555,7 @@ NodeManager::GetDormantFlavorInfoFor(media_addon_id addon,
|
||||
if (flavor->node_info.addon == addon && flavor->node_info.flavor_id == flavor_id) {
|
||||
*outFlavor = *flavor;
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
return B_ERROR;
|
||||
}
|
||||
@ -537,3 +566,57 @@ NodeManager::CleanupTeam(team_id team)
|
||||
BAutolock lock(fLocker);
|
||||
FATAL("NodeManager::CleanupTeam: should cleanup team %ld\n", team);
|
||||
}
|
||||
|
||||
void
|
||||
NodeManager::Dump()
|
||||
{
|
||||
BAutolock lock(fLocker);
|
||||
printf("\n");
|
||||
printf("NodeManager: addon path map follows:\n");
|
||||
entry_ref *ref;
|
||||
media_addon_id *id;
|
||||
for (fAddonPathMap->Rewind(); fAddonPathMap->GetNext(&ref); ) {
|
||||
fAddonPathMap->GetCurrentKey(&id);
|
||||
BPath path(ref);
|
||||
printf(" addon-id %ld, ref-name \"%s\", path \"%s\"\n", *id, ref->name, (path.InitCheck() == B_OK) ? path.Path() : "INVALID");
|
||||
}
|
||||
printf("NodeManager: list end\n");
|
||||
printf("\n");
|
||||
printf("NodeManager: registered nodes map follows:\n");
|
||||
registered_node *rn;
|
||||
for (fRegisteredNodeMap->Rewind(); fRegisteredNodeMap->GetNext(&rn); ) {
|
||||
printf(" node-id %ld, addon-id %ld, addon-flavor-id %ld, port %ld, team %ld, kinds %#08x, name \"%s\"\n",
|
||||
rn->nodeid, rn->addon_id, rn->addon_flavor_id, rn->port, rn->team, rn->kinds, rn->name);
|
||||
printf(" teams (refcount): ");
|
||||
team_id *team;
|
||||
int32 *refcount;
|
||||
for (rn->teamrefcount.Rewind(); rn->teamrefcount.GetNext(&refcount); ) {
|
||||
rn->teamrefcount.GetCurrentKey(&team);
|
||||
printf("%ld (%ld), ", *team, *refcount);
|
||||
}
|
||||
printf("\n");
|
||||
media_input *input;
|
||||
for (rn->inputlist.Rewind(); rn->inputlist.GetNext(&input); ) {
|
||||
printf(" media_input: node-id %ld, node-port %ld, source-port %ld, source-id %ld, dest-port %ld, dest-id %ld, name \"%s\"\n",
|
||||
input->node.node, input->node.port, input->source.port, input->source.id, input->destination.port, input->destination.id, input->name);
|
||||
}
|
||||
media_output *output;
|
||||
for (rn->outputlist.Rewind(); rn->outputlist.GetNext(&output); ) {
|
||||
printf(" media_output: node-id %ld, node-port %ld, source-port %ld, source-id %ld, dest-port %ld, dest-id %ld, name \"%s\"\n",
|
||||
output->node.node, output->node.port, output->source.port, output->source.id, output->destination.port, output->destination.id, output->name);
|
||||
}
|
||||
}
|
||||
printf("NodeManager: list end\n");
|
||||
printf("\n");
|
||||
printf("NodeManager: dormant flavor list follows:\n");
|
||||
dormant_flavor_info *dfi;
|
||||
for (fDormantFlavorList->Rewind(); fDormantFlavorList->GetNext(&dfi); ) {
|
||||
printf(" addon-id %ld, addon-flavor-id %ld, addon-name \"%s\"\n",
|
||||
dfi->node_info.addon, dfi->node_info.flavor_id, dfi->node_info.name);
|
||||
printf(" flavor-kinds %#08x, flavor_flags %#08x, internal_id %ld, possible_count %ld, in_format_count %ld, out_format_count %ld\n",
|
||||
dfi->kinds, dfi->flavor_flags, dfi->internal_id, dfi->possible_count, dfi->in_format_count, dfi->out_format_count);
|
||||
printf(" flavor-name \"%s\"\n", dfi->name);
|
||||
printf(" flavor-info \"%s\"\n", dfi->info);
|
||||
}
|
||||
printf("NodeManager: list end\n");
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ public:
|
||||
status_t BroadcastMessage(long, void *, long, long long);
|
||||
status_t LoadState();
|
||||
status_t SaveState();
|
||||
|
||||
void Dump();
|
||||
|
||||
|
||||
status_t RegisterNode(media_node_id *nodeid, media_addon_id addon_id, int32 addon_flavor_id, const char *name, uint64 kinds, port_id port, team_id team);
|
||||
@ -67,7 +69,8 @@ public:
|
||||
status_t GetLiveNodes(BMessage *msg);
|
||||
|
||||
void AddDormantFlavorInfo(const dormant_flavor_info &dfi);
|
||||
void RemoveDormantFlavorInfo(media_addon_id id);
|
||||
void RemoveDormantFlavorInfo(media_addon_id id);
|
||||
void CleanupDormantFlavorInfos();
|
||||
void RegisterAddon(const entry_ref &ref, media_addon_id *newid);
|
||||
void UnregisterAddon(media_addon_id id);
|
||||
status_t GetAddonRef(entry_ref *ref, media_addon_id id);
|
||||
|
@ -4,6 +4,7 @@
|
||||
*/
|
||||
#include <OS.h>
|
||||
#include <Locker.h>
|
||||
#include <Autolock.h>
|
||||
#include <Message.h>
|
||||
#include <Messenger.h>
|
||||
#include <MediaNode.h>
|
||||
@ -249,3 +250,17 @@ NotificationManager::worker_thread(void *arg)
|
||||
static_cast<NotificationManager *>(arg)->WorkerThread();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
NotificationManager::Dump()
|
||||
{
|
||||
BAutolock lock(fLocker);
|
||||
printf("\n");
|
||||
printf("NotificationManager: list of subscribers follows:\n");
|
||||
Notification *n;
|
||||
for (fNotificationList->Rewind(); fNotificationList->GetNext(&n); ) {
|
||||
printf(" team %ld, what %#08x, node-id %ld, node-port %ld, messenger %svalid\n",
|
||||
n->team, n->what, n->node.node, n->node.port, n->messenger.IsValid() ? "" : "NOT ");
|
||||
}
|
||||
printf("NotificationManager: list end\n");
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
NotificationManager();
|
||||
~NotificationManager();
|
||||
|
||||
void Dump();
|
||||
|
||||
void EnqueueMessage(BMessage *msg);
|
||||
|
||||
void CleanupTeam(team_id team);
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <MediaDefs.h>
|
||||
#include <MediaFormats.h>
|
||||
#include <Autolock.h>
|
||||
#include <string.h>
|
||||
#include "NotificationManager.h"
|
||||
#include "ServerInterface.h"
|
||||
#include "DataExchange.h"
|
||||
@ -46,6 +47,7 @@ public:
|
||||
|
||||
bool QuitRequested();
|
||||
void HandleMessage(int32 code, void *data, size_t size);
|
||||
void ArgvReceived(int32 argc, char **argv);
|
||||
static int32 controlthread(void *arg);
|
||||
|
||||
/* functionality not yet implemented
|
||||
@ -112,6 +114,27 @@ ServerApp::~ServerApp()
|
||||
wait_for_thread(control_thread,&err);
|
||||
}
|
||||
|
||||
void ServerApp::ArgvReceived(int32 argc, char **argv)
|
||||
{
|
||||
for (int arg = 1; arg < argc; arg++) {
|
||||
if (strstr(argv[arg], "dump")) {
|
||||
gAppManager->Dump();
|
||||
gNodeManager->Dump();
|
||||
gBufferManager->Dump();
|
||||
gNotificationManager->Dump();
|
||||
}
|
||||
if (strstr(argv[arg], "buffer")) {
|
||||
gBufferManager->Dump();
|
||||
}
|
||||
if (strstr(argv[arg], "node")) {
|
||||
gNodeManager->Dump();
|
||||
}
|
||||
if (strstr(argv[arg], "quit")) {
|
||||
PostMessage(B_QUIT_REQUESTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ServerApp::QuitRequested()
|
||||
{
|
||||
|
BIN
src/servers/media/media_server.rsrc
Normal file
BIN
src/servers/media/media_server.rsrc
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user