1.single nal unit packet
=> nal_unit_type(first byte & 0x1f)=5(IDR)
2.fragmentation unit
=> 先看 fu indicator(first byte & 0x1f) = 28 or 29
=> nal_unit_type(second byte & 0x1f) = 5(IDR)
=> fu header start bit(second byte & 0x80) = 0x80
範例程式:=> nal_unit_type(first byte & 0x1f)=5(IDR)
2.fragmentation unit
=> 先看 fu indicator(first byte & 0x1f) = 28 or 29
=> nal_unit_type(second byte & 0x1f) = 5(IDR)
=> fu header start bit(second byte & 0x80) = 0x80
public static bool isH264iFrame(byte[] paket)
{
int RTPHeaderBytes = 0;
int fragment_type = paket[RTPHeaderBytes + 0] & 0x1F;
int nal_type = paket[RTPHeaderBytes + 1] & 0x1F;
int start_bit = paket[RTPHeaderBytes + 1] & 0x80;
if (((fragment_type == 28 || fragment_type == 29) && nal_type == 5 && start_bit == 128) || fragment_type == 5)
{
return true;
}
return false;
}
沒有留言:
張貼留言