blob: f9bf686a6ea52283bc29a79ea5668f03cb113a4e [file] [log] [blame]
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
// This file contains the class RtpFormatVp8TestHelper. The class is
// responsible for setting up a fake VP8 bitstream according to the
// RTPVideoHeaderVP8 header, and partition information. After initialization,
// an RTPFragmentationHeader is provided so that the tester can create a
// packetizer. The packetizer can then be provided to this helper class, which
// will then extract all packets and compare to the expected outcome.
#include "modules/interface/module_common_types.h"
#include "modules/rtp_rtcp/source/rtp_format_vp8.h"
#include "system_wrappers/interface/constructor_magic.h"
#include "typedefs.h"
namespace webrtc {
namespace test {
class RtpFormatVp8TestHelper {
explicit RtpFormatVp8TestHelper(const RTPVideoHeaderVP8* hdr);
bool Init(const int* partition_sizes, int num_partitions);
void GetAllPacketsAndCheck(RtpFormatVp8* packetizer,
const int* expected_sizes,
const int* expected_part,
const bool* expected_frag_start,
int expected_num_packets);
uint8_t* payload_data() const { return payload_data_; }
int payload_size() const { return payload_size_; }
RTPFragmentationHeader* fragmentation() const { return fragmentation_; }
int buffer_size() const { return buffer_size_; }
void set_sloppy_partitioning(bool value) { sloppy_partitioning_ = value; }
void CheckHeader(bool frag_start);
void CheckPictureID();
void CheckTl0PicIdx();
void CheckTIDAndKeyIdx();
void CheckPayload(int payload_end);
void CheckLast(bool last) const;
void CheckPacket(int send_bytes, int expect_bytes, bool last,
bool frag_start);
uint8_t* payload_data_;
uint8_t* buffer_;
uint8_t* data_ptr_;
RTPFragmentationHeader* fragmentation_;
const RTPVideoHeaderVP8* hdr_info_;
int payload_start_;
int payload_size_;
int buffer_size_;
bool sloppy_partitioning_;
bool inited_;
} // namespace test
} // namespace webrtc