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

Side by Side Diff: webrtc/modules/video_coding/packet_buffer.h

Issue 1988653002: PacketBuffer now can save how many times a packet has been nacked. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 21 matching lines...) Expand all
32 virtual void OnCompleteFrame(std::unique_ptr<FrameObject> frame) = 0; 32 virtual void OnCompleteFrame(std::unique_ptr<FrameObject> frame) = 0;
33 }; 33 };
34 34
35 class PacketBuffer { 35 class PacketBuffer {
36 public: 36 public:
37 // Both |start_buffer_size| and |max_buffer_size| must be a power of 2. 37 // Both |start_buffer_size| and |max_buffer_size| must be a power of 2.
38 PacketBuffer(size_t start_buffer_size, 38 PacketBuffer(size_t start_buffer_size,
39 size_t max_buffer_size, 39 size_t max_buffer_size,
40 OnCompleteFrameCallback* frame_callback); 40 OnCompleteFrameCallback* frame_callback);
41 41
42 bool InsertPacket(const VCMPacket& packet); 42 bool InsertPacket(const VCMPacket& packet, int times_nacked = -1);
stefan-webrtc 2016/05/20 13:10:23 Avoid default arguments. Maybe add a nacked member
philipel 2016/05/23 09:19:22 Done.
43 void ClearTo(uint16_t seq_num); 43 void ClearTo(uint16_t seq_num);
44 void Clear(); 44 void Clear();
45 45
46 private: 46 private:
47 friend RtpFrameObject; 47 friend RtpFrameObject;
48 // Since we want the packet buffer to be as packet type agnostic 48 // Since we want the packet buffer to be as packet type agnostic
49 // as possible we extract only the information needed in order 49 // as possible we extract only the information needed in order
50 // to determine whether a sequence of packets is continuous or not. 50 // to determine whether a sequence of packets is continuous or not.
51 struct ContinuityInfo { 51 struct ContinuityInfo {
52 // The sequence number of the packet. 52 // The sequence number of the packet.
53 uint16_t seq_num = 0; 53 uint16_t seq_num = 0;
54 54
55 // If this is the first packet of the frame. 55 // If this is the first packet of the frame.
56 bool frame_begin = false; 56 bool frame_begin = false;
57 57
58 // If this is the last packet of the frame. 58 // If this is the last packet of the frame.
59 bool frame_end = false; 59 bool frame_end = false;
60 60
61 // If this slot is currently used. 61 // If this slot is currently used.
62 bool used = false; 62 bool used = false;
63 63
64 // If all its previous packets have been inserted into the packet buffer. 64 // If all its previous packets have been inserted into the packet buffer.
65 bool continuous = false; 65 bool continuous = false;
66 66
67 // If this packet has been used to create a frame already. 67 // If this packet has been used to create a frame already.
68 bool frame_created = false; 68 bool frame_created = false;
69
70 // How many times this packet has been Nacked.
71 uint8_t times_nacked = 0;
69 }; 72 };
70 73
71 // Tries to expand the buffer. 74 // Tries to expand the buffer.
72 bool ExpandBufferSize() EXCLUSIVE_LOCKS_REQUIRED(crit_); 75 bool ExpandBufferSize() EXCLUSIVE_LOCKS_REQUIRED(crit_);
73 76
74 // Test if all previous packets has arrived for the given sequence number. 77 // Test if all previous packets has arrived for the given sequence number.
75 bool IsContinuous(uint16_t seq_num) const EXCLUSIVE_LOCKS_REQUIRED(crit_); 78 bool IsContinuous(uint16_t seq_num) const EXCLUSIVE_LOCKS_REQUIRED(crit_);
76 79
77 // Test if all packets of a frame has arrived, and if so, creates a frame. 80 // Test if all packets of a frame has arrived, and if so, creates a frame.
78 // May create multiple frames per invocation. 81 // May create multiple frames per invocation.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 114
112 // Frames that have received all their packets are handed off to the 115 // Frames that have received all their packets are handed off to the
113 // |reference_finder_| which finds the dependencies between the frames. 116 // |reference_finder_| which finds the dependencies between the frames.
114 RtpFrameReferenceFinder reference_finder_; 117 RtpFrameReferenceFinder reference_finder_;
115 }; 118 };
116 119
117 } // namespace video_coding 120 } // namespace video_coding
118 } // namespace webrtc 121 } // namespace webrtc
119 122
120 #endif // WEBRTC_MODULES_VIDEO_CODING_PACKET_BUFFER_H_ 123 #endif // WEBRTC_MODULES_VIDEO_CODING_PACKET_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698