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

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

Issue 2476283002: PacketBuffer no longer copy the bitstream data of incoming packets. (Closed)
Patch Set: Created 4 years, 1 month 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/video_packet_buffer_unittest.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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 last_seq_num_ = seq_num; 93 last_seq_num_ = seq_num;
94 94
95 sequence_buffer_[index].frame_begin = packet.isFirstPacket; 95 sequence_buffer_[index].frame_begin = packet.isFirstPacket;
96 sequence_buffer_[index].frame_end = packet.markerBit; 96 sequence_buffer_[index].frame_end = packet.markerBit;
97 sequence_buffer_[index].seq_num = packet.seqNum; 97 sequence_buffer_[index].seq_num = packet.seqNum;
98 sequence_buffer_[index].continuous = false; 98 sequence_buffer_[index].continuous = false;
99 sequence_buffer_[index].frame_created = false; 99 sequence_buffer_[index].frame_created = false;
100 sequence_buffer_[index].used = true; 100 sequence_buffer_[index].used = true;
101 data_buffer_[index] = packet; 101 data_buffer_[index] = packet;
102 102
103 // Since the data pointed to by |packet.dataPtr| is non-persistent the
104 // data has to be copied to its own buffer.
105 // TODO(philipel): Take ownership instead of copying payload when
106 // bitstream-fixing has been implemented.
107 if (packet.sizeBytes) {
108 uint8_t* payload = new uint8_t[packet.sizeBytes];
109 memcpy(payload, packet.dataPtr, packet.sizeBytes);
110 data_buffer_[index].dataPtr = payload;
111 }
112
113 FindFrames(seq_num); 103 FindFrames(seq_num);
114 return true; 104 return true;
115 } 105 }
116 106
117 void PacketBuffer::ClearTo(uint16_t seq_num) { 107 void PacketBuffer::ClearTo(uint16_t seq_num) {
118 rtc::CritScope lock(&crit_); 108 rtc::CritScope lock(&crit_);
119 109
120 // If the packet buffer was cleared between a frame was created and returned. 110 // If the packet buffer was cleared between a frame was created and returned.
121 if (!first_packet_received_) 111 if (!first_packet_received_)
122 return; 112 return;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 int PacketBuffer::Release() const { 283 int PacketBuffer::Release() const {
294 int count = rtc::AtomicOps::Decrement(&ref_count_); 284 int count = rtc::AtomicOps::Decrement(&ref_count_);
295 if (!count) { 285 if (!count) {
296 delete this; 286 delete this;
297 } 287 }
298 return count; 288 return count;
299 } 289 }
300 290
301 } // namespace video_coding 291 } // namespace video_coding
302 } // namespace webrtc 292 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/video_packet_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698