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 2535203002: Fix memory leak in video_coding::PacketBuffer::InsertPacket. (Closed)
Patch Set: Fixed ownership 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
« no previous file with comments | « no previous file | webrtc/modules/video_coding/packet_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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,
52 // false otherwise. Made virtual for testing. 52 // false otherwise. Made virtual for testing.
53 virtual bool InsertPacket(const VCMPacket& packet); 53 virtual bool InsertPacket(VCMPacket* packet);
nisse-webrtc 2016/11/29 12:31:40 Please comment on the ownership convention. As far
philipel 2016/11/29 12:40:23 Done.
54 void ClearTo(uint16_t seq_num); 54 void ClearTo(uint16_t seq_num);
55 void Clear(); 55 void Clear();
56 56
57 int AddRef() const; 57 int AddRef() const;
58 int Release() const; 58 int Release() const;
59 59
60 protected: 60 protected:
61 // Both |start_buffer_size| and |max_buffer_size| must be a power of 2. 61 // Both |start_buffer_size| and |max_buffer_size| must be a power of 2.
62 PacketBuffer(Clock* clock, 62 PacketBuffer(Clock* clock,
63 size_t start_buffer_size, 63 size_t start_buffer_size,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // Called when a received frame is found. 144 // Called when a received frame is found.
145 OnReceivedFrameCallback* const received_frame_callback_; 145 OnReceivedFrameCallback* const received_frame_callback_;
146 146
147 mutable volatile int ref_count_ = 0; 147 mutable volatile int ref_count_ = 0;
148 }; 148 };
149 149
150 } // namespace video_coding 150 } // namespace video_coding
151 } // namespace webrtc 151 } // namespace webrtc
152 152
153 #endif // WEBRTC_MODULES_VIDEO_CODING_PACKET_BUFFER_H_ 153 #endif // WEBRTC_MODULES_VIDEO_CODING_PACKET_BUFFER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/packet_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698