Shaping up formatting of rtp_utility_test.cc

Preparations for future work in this file.

Review URL: http://webrtc-codereview.appspot.com/318011

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1168 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrik.lundin@webrtc.org 2011-12-13 09:15:21 +00:00
parent 0edb25dcc9
commit 4aae0e489f

View File

@ -10,14 +10,13 @@
/*
* This file includes unit tests for the ModuleRTPUtility.
* This file conatins unit tests for the ModuleRTPUtility.
*/
#include <gtest/gtest.h>
#include "typedefs.h"
#include "rtp_utility.h"
#include "rtp_format_vp8.h"
#include "gtest/gtest.h"
#include "modules/rtp_rtcp/source/rtp_format_vp8.h"
#include "modules/rtp_rtcp/source/rtp_utility.h"
#include "typedefs.h" // NOLINT(build/include)
namespace webrtc {
@ -57,16 +56,15 @@ using ModuleRTPUtility::RTPPayloadVP8;
// : :
// +-+-+-+-+-+-+-+-+
void VerifyBasicHeader(const RTPPayloadVP8 &header, bool N, bool S, int PartID)
{
void VerifyBasicHeader(const RTPPayloadVP8 &header,
bool N, bool S, int PartID) {
EXPECT_EQ(N, header.nonReferenceFrame);
EXPECT_EQ(S, header.beginningOfPartition);
EXPECT_EQ(PartID, header.partitionID);
}
void VerifyExtensions(const RTPPayloadVP8 &header,
bool I, bool L, bool T, bool K)
{
bool I, bool L, bool T, bool K) {
EXPECT_EQ(I, header.hasPictureID);
EXPECT_EQ(L, header.hasTl0PicIdx);
EXPECT_EQ(T, header.hasTID);
@ -75,8 +73,8 @@ void VerifyExtensions(const RTPPayloadVP8 &header,
TEST(ParseVP8Test, BasicHeader) {
WebRtc_UWord8 payload[4] = {0};
payload[0] = 0x14; // binary 0001 0100; S = 1, PartID = 4
payload[1] = 0x01; // P frame
payload[0] = 0x14; // Binary 0001 0100; S = 1, PartID = 4.
payload[1] = 0x01; // P frame.
RTPPayloadParser rtpPayloadParser(kRtpVp8Video, payload, 4, 0);
@ -116,7 +114,7 @@ TEST(ParseVP8Test, PictureID) {
EXPECT_EQ(10 - 3, parsedPacket.info.VP8.dataLength);
// Re-use payload, but change to long PictureID
// Re-use payload, but change to long PictureID.
payload[2] = 0x80 | 17;
payload[3] = 17;
RTPPayloadParser rtpPayloadParser2(kRtpVp8Video, payload, 10, 0);
@ -181,8 +179,8 @@ TEST(ParseVP8Test, TID) {
TEST(ParseVP8Test, KeyIdx) {
WebRtc_UWord8 payload[10] = {0};
payload[0] = 0x88;
payload[1] = 0x10; // K = 1
payload[2] = 0x11; // KEYIDX = 17 decimal
payload[1] = 0x10; // K = 1.
payload[2] = 0x11; // KEYIDX = 17 decimal.
RTPPayloadParser rtpPayloadParser(kRtpVp8Video, payload, 10, 0);
@ -205,10 +203,10 @@ TEST(ParseVP8Test, MultipleExtensions) {
WebRtc_UWord8 payload[10] = {0};
payload[0] = 0x88;
payload[1] = 0x80 | 0x40 | 0x20 | 0x10;
payload[2] = 0x80 | 17; // PictureID, high 7 bits
payload[3] = 17; // PictureID, low 8 bits
payload[4] = 42; // Tl0PicIdx
payload[5] = 0x40 | 0x11; // TID + KEYIDX
payload[2] = 0x80 | 17; // PictureID, high 7 bits.
payload[3] = 17; // PictureID, low 8 bits.
payload[4] = 42; // Tl0PicIdx.
payload[5] = 0x40 | 0x11; // TID + KEYIDX.
RTPPayloadParser rtpPayloadParser(kRtpVp8Video, payload, 10, 0);
@ -233,9 +231,9 @@ TEST(ParseVP8Test, MultipleExtensions) {
TEST(ParseVP8Test, TooShortHeader) {
WebRtc_UWord8 payload[4] = {0};
payload[0] = 0x88;
payload[1] = 0x80 | 0x40 | 0x20 | 0x10; // All extensions are enabled
payload[2] = 0x80 | 17; //... but only 2 bytes PictureID is provided
payload[3] = 17; // PictureID, low 8 bits
payload[1] = 0x80 | 0x40 | 0x20 | 0x10; // All extensions are enabled...
payload[2] = 0x80 | 17; // ... but only 2 bytes PictureID is provided.
payload[3] = 17; // PictureID, low 8 bits.
RTPPayloadParser rtpPayloadParser(kRtpVp8Video, payload, 4, 0);
@ -250,7 +248,7 @@ TEST(ParseVP8Test, TestWithPacketizer) {
inputHeader.nonReference = true;
inputHeader.pictureId = 300;
inputHeader.temporalIdx = 1;
inputHeader.tl0PicIdx = kNoTl0PicIdx; // disable
inputHeader.tl0PicIdx = kNoTl0PicIdx; // Disable.
inputHeader.keyIdx = 31;
RtpFormatVp8 packetizer = RtpFormatVp8(payload, 10, inputHeader);
bool last;