OLD | NEW |
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 30 matching lines...) Expand all Loading... |
41 class PacketBuffer { | 41 class PacketBuffer { |
42 public: | 42 public: |
43 static rtc::scoped_refptr<PacketBuffer> Create( | 43 static rtc::scoped_refptr<PacketBuffer> Create( |
44 Clock* clock, | 44 Clock* clock, |
45 size_t start_buffer_size, | 45 size_t start_buffer_size, |
46 size_t max_buffer_size, | 46 size_t max_buffer_size, |
47 OnReceivedFrameCallback* frame_callback); | 47 OnReceivedFrameCallback* frame_callback); |
48 | 48 |
49 virtual ~PacketBuffer(); | 49 virtual ~PacketBuffer(); |
50 | 50 |
51 // Returns true if |packet| is inserted into the packet buffer, | 51 // Returns true if |packet| is inserted into the packet buffer, false |
52 // false otherwise. Made virtual for testing. | 52 // otherwise. The PacketBuffer will always take ownership of the |
53 virtual bool InsertPacket(const VCMPacket& packet); | 53 // |packet.dataPtr| when this function is called. Made virtual for testing. |
| 54 virtual bool InsertPacket(VCMPacket* packet); |
54 void ClearTo(uint16_t seq_num); | 55 void ClearTo(uint16_t seq_num); |
55 void Clear(); | 56 void Clear(); |
56 | 57 |
57 int AddRef() const; | 58 int AddRef() const; |
58 int Release() const; | 59 int Release() const; |
59 | 60 |
60 protected: | 61 protected: |
61 // Both |start_buffer_size| and |max_buffer_size| must be a power of 2. | 62 // Both |start_buffer_size| and |max_buffer_size| must be a power of 2. |
62 PacketBuffer(Clock* clock, | 63 PacketBuffer(Clock* clock, |
63 size_t start_buffer_size, | 64 size_t start_buffer_size, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // Called when a received frame is found. | 145 // Called when a received frame is found. |
145 OnReceivedFrameCallback* const received_frame_callback_; | 146 OnReceivedFrameCallback* const received_frame_callback_; |
146 | 147 |
147 mutable volatile int ref_count_ = 0; | 148 mutable volatile int ref_count_ = 0; |
148 }; | 149 }; |
149 | 150 |
150 } // namespace video_coding | 151 } // namespace video_coding |
151 } // namespace webrtc | 152 } // namespace webrtc |
152 | 153 |
153 #endif // WEBRTC_MODULES_VIDEO_CODING_PACKET_BUFFER_H_ | 154 #endif // WEBRTC_MODULES_VIDEO_CODING_PACKET_BUFFER_H_ |
OLD | NEW |