Duh, I overlooked something when initializing the PlayerReceiver. The bool overwrite_cmds in the ThreadedDriver was set to true.
So I guess my follow up question: PLAYER_MSGQUEUE_DEFAULT_MAXLEN what does that tell me and how does the MessageQueue behave?
I thought that would tell me the MessageQueue can hold up to 1024 messages so that Messages only get replaced when the Queue is full?

--- Peter Müller <grandmastermt2000@yahoo.de> schrieb am Fr, 25.6.2010:

Von: Peter Müller <grandmastermt2000@yahoo.de>
Betreff: Player - publishing messages
An: playerstage-users@lists.sourceforge.net
Datum: Freitag, 25. Juni, 2010 01:13 Uhr

Hi,

I have a question regarding Player and how it works with message passing between 2 driver instances.

I wrote 2 drivers, one producing (sending opaque data) and one receiving the data. The amount of messages is fixed and on every driver a counter indicates how many messages were send or received. So ideally on both drivers the counter should be identical.
However, depending on the amount of bytes of the opaque data the counter differs.
5MB of opaque data is no problem, the amount of send messages equals the amount of received ones. 1MB works too. With 512Bytes not every message is received (like 50 send - 4x received).

Does anyone know what the problem is? Code is below.

Producer works like this in the Main():
void PlayerProducer::Main() {
    bool finished = false;
    double time;
    for (;;) {
        if(!finished) {
            sleep(1); // sleep 500ms
            printf("Starting %i runs with size %i bytes \n", iterations, mData.data_count);
            for(int i = 0;i < iterations;++i) {
                for(int j = 0;j < 5;++j) {
                    GlobalTime->GetTimeDouble(&time);
                    Publish(device_addr, PLAYER_MSGTYPE_DATA, PLAYER_OPAQUE_DATA_STATE,
                                reinterpret_cast<void*> (&mData), 0, &time, copy_data);
                    ++counter;
                }
                usleep(100000); // sleep 100ms
            }
            printf("counter - producer %i\n", counter);
            finished = true;
        } else {
            printf("Runs finished - Sleeping 60 seconds\n");
            sleep(60);
        }
    }
}


Receiver works like this:
void PlayerReceiver::Main() {
    for (;;) {
        Wait();
        ProcessMessages();
    }
}

int PlayerReceiver::ProcessMessage(QueuePointer &resp_queue,
        player_msghdr* hdr, void* data) {
    if (Message::MatchMessage(hdr, PLAYER_MSGTYPE_DATA,
            PLAYER_OPAQUE_DATA_STATE)) {
        ++counter;
        return 0;
    }
    return -1;
}