Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.h

Issue 2522553002: RtpPacketizer::NextPacket fills RtpPacket instead of payload. (Closed)
Patch Set: Named kTheMagicSix Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 // This file contains the class RtpFormatVp8TestHelper. The class is 11 // This file contains the class RtpFormatVp8TestHelper. The class is
12 // responsible for setting up a fake VP8 bitstream according to the 12 // responsible for setting up a fake VP8 bitstream according to the
13 // RTPVideoHeaderVP8 header, and partition information. After initialization, 13 // RTPVideoHeaderVP8 header, and partition information. After initialization,
14 // an RTPFragmentationHeader is provided so that the tester can create a 14 // an RTPFragmentationHeader is provided so that the tester can create a
15 // packetizer. The packetizer can then be provided to this helper class, which 15 // packetizer. The packetizer can then be provided to this helper class, which
16 // will then extract all packets and compare to the expected outcome. 16 // will then extract all packets and compare to the expected outcome.
17 17
18 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_VP8_TEST_HELPER_H_ 18 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_VP8_TEST_HELPER_H_
19 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_VP8_TEST_HELPER_H_ 19 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_VP8_TEST_HELPER_H_
20 20
21 #include "webrtc/base/constructormagic.h" 21 #include "webrtc/base/constructormagic.h"
22 #include "webrtc/modules/include/module_common_types.h" 22 #include "webrtc/modules/include/module_common_types.h"
23 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h" 23 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h"
24 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h"
24 #include "webrtc/typedefs.h" 25 #include "webrtc/typedefs.h"
25 26
26 namespace webrtc { 27 namespace webrtc {
27 28
28 namespace test { 29 namespace test {
29 30
30 class RtpFormatVp8TestHelper { 31 class RtpFormatVp8TestHelper {
31 public: 32 public:
32 explicit RtpFormatVp8TestHelper(const RTPVideoHeaderVP8* hdr); 33 explicit RtpFormatVp8TestHelper(const RTPVideoHeaderVP8* hdr);
33 ~RtpFormatVp8TestHelper(); 34 ~RtpFormatVp8TestHelper();
34 bool Init(const size_t* partition_sizes, size_t num_partitions); 35 bool Init(const size_t* partition_sizes, size_t num_partitions);
35 void GetAllPacketsAndCheck(RtpPacketizerVp8* packetizer, 36 void GetAllPacketsAndCheck(RtpPacketizerVp8* packetizer,
36 const size_t* expected_sizes, 37 const size_t* expected_sizes,
37 const int* expected_part, 38 const int* expected_part,
38 const bool* expected_frag_start, 39 const bool* expected_frag_start,
39 size_t expected_num_packets); 40 size_t expected_num_packets);
40 41
41 uint8_t* payload_data() const { return payload_data_; } 42 uint8_t* payload_data() const { return payload_data_; }
42 size_t payload_size() const { return payload_size_; } 43 size_t payload_size() const { return payload_size_; }
43 RTPFragmentationHeader* fragmentation() const { return fragmentation_; } 44 RTPFragmentationHeader* fragmentation() const { return fragmentation_; }
44 size_t buffer_size() const { return buffer_size_; } 45 size_t buffer_size() const {
46 static constexpr size_t kVp8PayloadDescriptorMaxSize = 6;
47 return payload_size_ + kVp8PayloadDescriptorMaxSize;
48 }
45 void set_sloppy_partitioning(bool value) { sloppy_partitioning_ = value; } 49 void set_sloppy_partitioning(bool value) { sloppy_partitioning_ = value; }
46 50
47 private: 51 private:
48 void CheckHeader(bool frag_start); 52 void CheckHeader(bool frag_start);
49 void CheckPictureID(); 53 void CheckPictureID();
50 void CheckTl0PicIdx(); 54 void CheckTl0PicIdx();
51 void CheckTIDAndKeyIdx(); 55 void CheckTIDAndKeyIdx();
52 void CheckPayload(size_t payload_end); 56 void CheckPayload();
53 void CheckLast(bool last) const; 57 void CheckLast(bool last) const;
54 void CheckPacket(size_t send_bytes, size_t expect_bytes, bool last, 58 void CheckPacket(size_t expect_bytes, bool last, bool frag_start);
55 bool frag_start);
56 59
60 RtpPacketToSend packet_;
57 uint8_t* payload_data_; 61 uint8_t* payload_data_;
58 uint8_t* buffer_;
59 uint8_t* data_ptr_; 62 uint8_t* data_ptr_;
60 RTPFragmentationHeader* fragmentation_; 63 RTPFragmentationHeader* fragmentation_;
61 const RTPVideoHeaderVP8* hdr_info_; 64 const RTPVideoHeaderVP8* hdr_info_;
62 int payload_start_; 65 int payload_start_;
63 size_t payload_size_; 66 size_t payload_size_;
64 size_t buffer_size_;
65 bool sloppy_partitioning_; 67 bool sloppy_partitioning_;
66 bool inited_; 68 bool inited_;
67 69
68 RTC_DISALLOW_COPY_AND_ASSIGN(RtpFormatVp8TestHelper); 70 RTC_DISALLOW_COPY_AND_ASSIGN(RtpFormatVp8TestHelper);
69 }; 71 };
70 72
71 } // namespace test 73 } // namespace test
72 74
73 } // namespace webrtc 75 } // namespace webrtc
74 76
75 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_VP8_TEST_HELPER_H_ 77 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_VP8_TEST_HELPER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_format_vp8.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698