[Live-devel] Reception Packet Information
Dixon Siu
dixonsiu at mediaglue.co.jp
Tue Jun 22 18:42:12 PDT 2004
Hi Ross and everyone,
Just received an request from another engineer that packet loss and received
packet are needed. The client side will implicitly send a leave group
message to the multicast group if network is congested. So I implemented a
public method in RTCPInstance.
Ross, please advise if it is the correct way. Hope that you can implement a
better way so that I can use your method for later release.
In RTCP.hh added the following method definition:
void getCurrentReceiverPacketInfo(long* numPacketReceived, long*
numPacketLost);
// hack to allow application that creates RTCPInstance to retrieve
// packet information since last reset.
Then in RTCP.cpp:
// Implemented by MGC to retrieve receiver packet loss information.
void RTCPInstance::getCurrentReceiverPacketInfo(long* numPacketReceived,
long* numPacketLost) {
if (fSource != NULL) {
RTPReceptionStatsDB& allReceptionStats = fSource->receptionStatsDB();
RTPReceptionStatsDB::Iterator iterator(allReceptionStats);
RTPReceptionStats* receptionStats = iterator.next();
if (receptionStats == NULL) {
fprintf(stderr, "Reception Statistics is not available!\n");
*numPacketReceived = -1; // invalid value checked by the caller
*numPacketLost = -1; // invalid value checked by the caller
return;
}
*numPacketReceived =
(long)receptionStats->numPacketsReceivedSinceLastReset();
*numPacketLost = (long)(receptionStats->highestExtSeqNumReceived() -
receptionStats->lastResetExtSeqNumReceived() -
receptionStats->numPacketsReceivedSinceLastReset());
}
}
The way to use is to create an RTCPInstance within your application and then
call the method anytime you want. For example, I created a thread for
testing:
DWORD WINAPI thread_proc(LPVOID lpParameter) {
long x = 0;
long y = 0;
while (1){
sessionState.rtcpInstance->getCurrentReceiverPacketInfo(&x, &y);
Sleep(5000); // For testing.
}
}
More information about the live-devel
mailing list