[Live-devel] MPEG1or2VideoRTPSource slice begin/end interpretation

Verbeiren, David david.verbeiren at intel.com
Fri Oct 11 09:20:35 PDT 2013


Hi,
 
While testing my application that uses Live555 for MPEG2 Video input ("MPV"), I noticed MPEG1or2VideoRTPSource presents some slice data with the expected size, but others are presented as individual 1384 bytes chunks, just like at the network level.
 
Looking into the code, I see the following fragment which looks suspicious  (MPEG1or2VideoRTPSource::processSpecialHeader() in MPEG1or2VideoRTPSource.cpp, line 50):
 
  u_int32_t sBit = header&0x00002000; // sequence-header-present
  u_int32_t bBit = header&0x00001000; // beginning-of-slice
  u_int32_t eBit = header&0x00000800; // end-of-slice
 
  fCurrentPacketBeginsFrame = (sBit|bBit) != 0;
  fCurrentPacketCompletesFrame = ((sBit&~bBit)|eBit) != 0;
 
sBit and bBit are looking at different bits of the header, and as each can only have the one specific bit set and all other bits are always 0, (sBit&~bBit) is in fact identical to sBit (*).
 
I believe the operation should be performed at the logical level rather than bitwise:
  fCurrentPacketCompletesFrame = ((sBit != 0) && (bBit == 0)) || (eBit != 0);
 
Changing the code as above did allow me to receive slice data correctly (if my understanding is correct) aggregated according to the S, B and E bits of the header.

Is the above correct and if so, could this change be applied for a next release?

Thanks,
-David

(*) in sBit, all bits are 0 except - possibly - the 'S' bit; hence the only bit that could be set in (sBit&~bBit) is the 'S' bit; and in ~bBit, all other bits than the 'B' bit are always 1, hence the 'S' bit in ~bBit is always 1.
Intel Corporation NV/SA
Kings Square, Veldkant 31
2550 Kontich
RPM (Bruxelles) 0415.497.718. 
Citibank, Brussels, account 570/1031255/09

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.




More information about the live-devel mailing list