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

Side by Side Diff: webrtc/modules/video_coding/video_packet_buffer_unittest.cc

Issue 2199133004: PacketBuffer is now ref counted. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 months 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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
(...skipping 11 matching lines...) Expand all
22 22
23 namespace webrtc { 23 namespace webrtc {
24 namespace video_coding { 24 namespace video_coding {
25 25
26 class TestPacketBuffer : public ::testing::Test, 26 class TestPacketBuffer : public ::testing::Test,
27 public OnCompleteFrameCallback { 27 public OnCompleteFrameCallback {
28 protected: 28 protected:
29 TestPacketBuffer() 29 TestPacketBuffer()
30 : rand_(0x8739211), 30 : rand_(0x8739211),
31 clock_(new SimulatedClock(0)), 31 clock_(new SimulatedClock(0)),
32 packet_buffer_(new PacketBuffer(clock_.get(), 32 packet_buffer_(PacketBuffer::Create(clock_.get(),
33 kStartSize, 33 kStartSize,
34 kMaxSize, 34 kMaxSize,
35 this)), 35 this)),
36 frames_from_callback_(FrameComp()), 36 frames_from_callback_(FrameComp()),
37 dummy_data_(new uint8_t[kDummyDataSize]()) {} 37 dummy_data_(new uint8_t[kDummyDataSize]()) {}
38 38
39 uint16_t Rand() { return rand_.Rand(std::numeric_limits<uint16_t>::max()); } 39 uint16_t Rand() { return rand_.Rand(std::numeric_limits<uint16_t>::max()); }
40 40
41 void OnCompleteFrame(std::unique_ptr<FrameObject> frame) override { 41 void OnCompleteFrame(std::unique_ptr<FrameObject> frame) override {
42 uint16_t pid = frame->picture_id; 42 uint16_t pid = frame->picture_id;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 246 }
247 247
248 void RefsToSet(std::set<uint16_t>* m) const {} 248 void RefsToSet(std::set<uint16_t>* m) const {}
249 249
250 const int kStartSize = 16; 250 const int kStartSize = 16;
251 const int kMaxSize = 64; 251 const int kMaxSize = 64;
252 const int kDummyDataSize = 4; 252 const int kDummyDataSize = 4;
253 253
254 Random rand_; 254 Random rand_;
255 std::unique_ptr<Clock> clock_; 255 std::unique_ptr<Clock> clock_;
256 std::unique_ptr<PacketBuffer> packet_buffer_; 256 rtc::scoped_refptr<PacketBuffer> packet_buffer_;
257 struct FrameComp { 257 struct FrameComp {
258 bool operator()(const std::pair<uint16_t, uint8_t> f1, 258 bool operator()(const std::pair<uint16_t, uint8_t> f1,
259 const std::pair<uint16_t, uint8_t> f2) const { 259 const std::pair<uint16_t, uint8_t> f2) const {
260 if (f1.first == f2.first) 260 if (f1.first == f2.first)
261 return f1.second < f2.second; 261 return f1.second < f2.second;
262 return f1.first < f2.first; 262 return f1.first < f2.first;
263 } 263 }
264 }; 264 };
265 std::map<std::pair<uint16_t, uint8_t>, 265 std::map<std::pair<uint16_t, uint8_t>,
266 std::unique_ptr<FrameObject>, 266 std::unique_ptr<FrameObject>,
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 CheckReferencesVp8(pid); 927 CheckReferencesVp8(pid);
928 CheckReferencesVp8(pid + 1, pid); 928 CheckReferencesVp8(pid + 1, pid);
929 CheckReferencesVp8(pid + 2, pid); 929 CheckReferencesVp8(pid + 2, pid);
930 CheckReferencesVp8(pid + 4, pid + 2); 930 CheckReferencesVp8(pid + 4, pid + 2);
931 CheckReferencesVp8(pid + 5, pid + 4); 931 CheckReferencesVp8(pid + 5, pid + 4);
932 CheckReferencesVp8(pid + 6, pid + 4); 932 CheckReferencesVp8(pid + 6, pid + 4);
933 CheckReferencesVp8(pid + 7, pid + 6, pid + 5); 933 CheckReferencesVp8(pid + 7, pid + 6, pid + 5);
934 } 934 }
935 935
936 TEST_F(TestPacketBuffer, Vp8InsertLargeFrames) { 936 TEST_F(TestPacketBuffer, Vp8InsertLargeFrames) {
937 packet_buffer_.reset(new PacketBuffer(clock_.get(), 1 << 3, 1 << 12, this)); 937 packet_buffer_ = PacketBuffer::Create(clock_.get(), 1 << 3, 1 << 12, this);
938 uint16_t pid = Rand(); 938 uint16_t pid = Rand();
939 uint16_t seq_num = Rand(); 939 uint16_t seq_num = Rand();
940 940
941 const uint16_t packets_per_frame = 1000; 941 const uint16_t packets_per_frame = 1000;
942 uint16_t current = seq_num; 942 uint16_t current = seq_num;
943 uint16_t end = current + packets_per_frame; 943 uint16_t end = current + packets_per_frame;
944 944
945 // seq_num , keyf, frst, lst, sync, pid, tid, tl0 945 // seq_num , keyf, frst, lst, sync, pid, tid, tl0
946 InsertVp8(current++, kT , kT , kF , kF , pid, 0 , 0); 946 InsertVp8(current++, kT , kT , kF , kF , pid, 0 , 0);
947 while (current != end) 947 while (current != end)
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 CheckReferencesVp9(pid + 5, 1, pid + 4); 1601 CheckReferencesVp9(pid + 5, 1, pid + 4);
1602 CheckReferencesVp9(pid + 6, 0, pid + 4); 1602 CheckReferencesVp9(pid + 6, 0, pid + 4);
1603 CheckReferencesVp9(pid + 6, 1, pid + 5); 1603 CheckReferencesVp9(pid + 6, 1, pid + 5);
1604 CheckReferencesVp9(pid + 7, 1, pid + 6); 1604 CheckReferencesVp9(pid + 7, 1, pid + 6);
1605 CheckReferencesVp9(pid + 8, 0, pid + 6); 1605 CheckReferencesVp9(pid + 8, 0, pid + 6);
1606 CheckReferencesVp9(pid + 8, 1, pid + 7); 1606 CheckReferencesVp9(pid + 8, 1, pid + 7);
1607 } 1607 }
1608 1608
1609 } // namespace video_coding 1609 } // namespace video_coding
1610 } // namespace webrtc 1610 } // namespace webrtc
OLDNEW
« webrtc/modules/video_coding/packet_buffer.cc ('K') | « webrtc/modules/video_coding/packet_buffer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698