1 /* 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 // This file contains the class RtpFormatVp8TestHelper. The class is 12 // responsible for setting up a fake VP8 bitstream according to the 13 // RTPVideoHeaderVP8 header. The packetizer can then be provided to this helper 14 // class, which will then extract all packets and compare to the expected 15 // outcome. 16 17 #ifndef MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_VP8_TEST_HELPER_H_ 18 #define MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_VP8_TEST_HELPER_H_ 19 20 #include "api/array_view.h" 21 #include "modules/rtp_rtcp/source/rtp_format_vp8.h" 22 #include "modules/video_coding/codecs/vp8/include/vp8_globals.h" 23 #include "rtc_base/buffer.h" 24 25 namespace webrtc { 26 27 class RtpFormatVp8TestHelper { 28 public: 29 RtpFormatVp8TestHelper(const RTPVideoHeaderVP8* hdr, size_t payload_len); 30 ~RtpFormatVp8TestHelper(); 31 32 RtpFormatVp8TestHelper(const RtpFormatVp8TestHelper&) = delete; 33 RtpFormatVp8TestHelper& operator=(const RtpFormatVp8TestHelper&) = delete; 34 35 void GetAllPacketsAndCheck(RtpPacketizerVp8* packetizer, 36 rtc::ArrayView<const size_t> expected_sizes); 37 payload()38 rtc::ArrayView<const uint8_t> payload() const { return payload_; } payload_size()39 size_t payload_size() const { return payload_.size(); } 40 41 private: 42 // Returns header size, i.e. payload offset. 43 int CheckHeader(rtc::ArrayView<const uint8_t> rtp_payload, bool first); 44 void CheckPictureID(rtc::ArrayView<const uint8_t> rtp_payload, int* offset); 45 void CheckTl0PicIdx(rtc::ArrayView<const uint8_t> rtp_payload, int* offset); 46 void CheckTIDAndKeyIdx(rtc::ArrayView<const uint8_t> rtp_payload, 47 int* offset); 48 void CheckPayload(const uint8_t* data_ptr); 49 50 const RTPVideoHeaderVP8* const hdr_info_; 51 rtc::Buffer payload_; 52 }; 53 54 } // namespace webrtc 55 56 #endif // MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_VP8_TEST_HELPER_H_ 57