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 #include "rtc_base/constructor_magic.h" 25 26 namespace webrtc { 27 28 class RtpFormatVp8TestHelper { 29 public: 30 RtpFormatVp8TestHelper(const RTPVideoHeaderVP8* hdr, size_t payload_len); 31 ~RtpFormatVp8TestHelper(); 32 void GetAllPacketsAndCheck(RtpPacketizerVp8* packetizer, 33 rtc::ArrayView<const size_t> expected_sizes); 34 payload()35 rtc::ArrayView<const uint8_t> payload() const { return payload_; } payload_size()36 size_t payload_size() const { return payload_.size(); } 37 38 private: 39 // Returns header size, i.e. payload offset. 40 int CheckHeader(rtc::ArrayView<const uint8_t> rtp_payload, bool first); 41 void CheckPictureID(rtc::ArrayView<const uint8_t> rtp_payload, int* offset); 42 void CheckTl0PicIdx(rtc::ArrayView<const uint8_t> rtp_payload, int* offset); 43 void CheckTIDAndKeyIdx(rtc::ArrayView<const uint8_t> rtp_payload, 44 int* offset); 45 void CheckPayload(const uint8_t* data_ptr); 46 47 const RTPVideoHeaderVP8* const hdr_info_; 48 rtc::Buffer payload_; 49 50 RTC_DISALLOW_COPY_AND_ASSIGN(RtpFormatVp8TestHelper); 51 }; 52 53 } // namespace webrtc 54 55 #endif // MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_VP8_TEST_HELPER_H_ 56