Change the way we reference enumerators in H.264 packetization code to be standard C++ compliant.

R=kjellander@webrtc.org, phoglund@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/21109004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6833 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2014-08-06 08:06:53 +00:00
parent 56d8e05238
commit 8b033adb19
2 changed files with 28 additions and 30 deletions

View File

@ -45,16 +45,16 @@ void ParseSingleNalu(WebRtcRTPHeader* rtp_header,
h264_header->single_nalu = true;
h264_header->stap_a = false;
uint8_t nal_type = payload_data[0] & NalDefs::kTypeMask;
if (nal_type == Nalu::kStapA) {
nal_type = payload_data[3] & NalDefs::kTypeMask;
uint8_t nal_type = payload_data[0] & kTypeMask;
if (nal_type == kStapA) {
nal_type = payload_data[3] & kTypeMask;
h264_header->stap_a = true;
}
switch (nal_type) {
case Nalu::kSps:
case Nalu::kPps:
case Nalu::kIdr:
case kSps:
case kPps:
case kIdr:
rtp_header->frameType = kVideoFrameKey;
break;
default:
@ -67,9 +67,9 @@ void ParseFuaNalu(WebRtcRTPHeader* rtp_header,
const uint8_t* payload_data,
size_t payload_data_length,
size_t* offset) {
uint8_t fnri = payload_data[0] & (NalDefs::kFBit | NalDefs::kNriMask);
uint8_t original_nal_type = payload_data[1] & NalDefs::kTypeMask;
bool first_fragment = (payload_data[1] & FuDefs::kSBit) > 0;
uint8_t fnri = payload_data[0] & (kFBit | kNriMask);
uint8_t original_nal_type = payload_data[1] & kTypeMask;
bool first_fragment = (payload_data[1] & kSBit) > 0;
uint8_t original_nal_header = fnri | original_nal_type;
if (first_fragment) {
@ -80,7 +80,7 @@ void ParseFuaNalu(WebRtcRTPHeader* rtp_header,
*offset = kFuAHeaderSize;
}
if (original_nal_type == Nalu::kIdr) {
if (original_nal_type == kIdr) {
rtp_header->frameType = kVideoFrameKey;
} else {
rtp_header->frameType = kVideoFrameDelta;
@ -272,9 +272,9 @@ RtpDepacketizerH264::RtpDepacketizerH264(RtpData* const callback)
bool RtpDepacketizerH264::Parse(WebRtcRTPHeader* rtp_header,
const uint8_t* payload_data,
size_t payload_data_length) {
uint8_t nal_type = payload_data[0] & NalDefs::kTypeMask;
uint8_t nal_type = payload_data[0] & kTypeMask;
size_t offset = 0;
if (nal_type == Nalu::kFuA) {
if (nal_type == kFuA) {
// Fragmented NAL units (FU-A).
ParseFuaNalu(rtp_header, payload_data, payload_data_length, &offset);
} else {

View File

@ -326,11 +326,10 @@ TEST_F(RtpDepacketizerH264Test, TestSingleNalu) {
}
TEST_F(RtpDepacketizerH264Test, TestStapAKey) {
uint8_t packet[16] = {Nalu::kStapA, // F=0, NRI=0, Type=24.
uint8_t packet[16] = {kStapA, // F=0, NRI=0, Type=24.
// Length, nal header, payload.
0, 0x02, Nalu::kIdr, 0xFF, 0,
0x03, Nalu::kIdr, 0xFF, 0x00, 0,
0x04, Nalu::kIdr, 0xFF, 0x00, 0x11};
0, 0x02, kIdr, 0xFF, 0, 0x03, kIdr, 0xFF,
0x00, 0, 0x04, kIdr, 0xFF, 0x00, 0x11};
WebRtcRTPHeader expected_header;
memset(&expected_header, 0, sizeof(expected_header));
@ -343,11 +342,10 @@ TEST_F(RtpDepacketizerH264Test, TestStapAKey) {
}
TEST_F(RtpDepacketizerH264Test, TestStapADelta) {
uint8_t packet[16] = {Nalu::kStapA, // F=0, NRI=0, Type=24.
uint8_t packet[16] = {kStapA, // F=0, NRI=0, Type=24.
// Length, nal header, payload.
0, 0x02, Nalu::kSlice, 0xFF, 0,
0x03, Nalu::kSlice, 0xFF, 0x00, 0,
0x04, Nalu::kSlice, 0xFF, 0x00, 0x11};
0, 0x02, kSlice, 0xFF, 0, 0x03, kSlice, 0xFF,
0x00, 0, 0x04, kSlice, 0xFF, 0x00, 0x11};
WebRtcRTPHeader expected_header;
memset(&expected_header, 0, sizeof(expected_header));
@ -361,23 +359,23 @@ TEST_F(RtpDepacketizerH264Test, TestStapADelta) {
TEST_F(RtpDepacketizerH264Test, TestFuA) {
uint8_t packet1[3] = {
Nalu::kFuA, // F=0, NRI=0, Type=28.
FuDefs::kSBit | Nalu::kIdr, // FU header.
0x01 // Payload.
kFuA, // F=0, NRI=0, Type=28.
kSBit | kIdr, // FU header.
0x01 // Payload.
};
const uint8_t kExpected1[2] = {Nalu::kIdr, 0x01};
const uint8_t kExpected1[2] = {kIdr, 0x01};
uint8_t packet2[3] = {
Nalu::kFuA, // F=0, NRI=0, Type=28.
Nalu::kIdr, // FU header.
0x02 // Payload.
kFuA, // F=0, NRI=0, Type=28.
kIdr, // FU header.
0x02 // Payload.
};
const uint8_t kExpected2[1] = {0x02};
uint8_t packet3[3] = {
Nalu::kFuA, // F=0, NRI=0, Type=28.
FuDefs::kEBit | Nalu::kIdr, // FU header.
0x03 // Payload.
kFuA, // F=0, NRI=0, Type=28.
kEBit | kIdr, // FU header.
0x03 // Payload.
};
const uint8_t kExpected3[1] = {0x03};