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

Side by Side Diff: webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc

Issue 1327053002: copy-red: Fill an rtc::Buffer with bytes the easy way (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | no next file » | 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // intentional. 81 // intentional.
82 info.redundant.push_back(info); 82 info.redundant.push_back(info);
83 DCHECK_EQ(info.redundant.size(), 1u); 83 DCHECK_EQ(info.redundant.size(), 1u);
84 if (secondary_info_.encoded_bytes > 0) { 84 if (secondary_info_.encoded_bytes > 0) {
85 memcpy(&encoded[info.encoded_bytes], secondary_encoded_.data(), 85 memcpy(&encoded[info.encoded_bytes], secondary_encoded_.data(),
86 secondary_info_.encoded_bytes); 86 secondary_info_.encoded_bytes);
87 info.redundant.push_back(secondary_info_); 87 info.redundant.push_back(secondary_info_);
88 DCHECK_EQ(info.redundant.size(), 2u); 88 DCHECK_EQ(info.redundant.size(), 2u);
89 } 89 }
90 // Save primary to secondary. 90 // Save primary to secondary.
91 secondary_encoded_.SetSize(info.encoded_bytes); 91 secondary_encoded_.SetData(encoded, info.encoded_bytes);
92 memcpy(secondary_encoded_.data(), encoded, info.encoded_bytes);
93 secondary_info_ = info; 92 secondary_info_ = info;
94 DCHECK_EQ(info.speech, info.redundant[0].speech); 93 DCHECK_EQ(info.speech, info.redundant[0].speech);
95 } 94 }
96 // Update main EncodedInfo. 95 // Update main EncodedInfo.
97 info.payload_type = red_payload_type_; 96 info.payload_type = red_payload_type_;
98 info.encoded_bytes = 0; 97 info.encoded_bytes = 0;
99 for (std::vector<EncodedInfoLeaf>::const_iterator it = info.redundant.begin(); 98 for (std::vector<EncodedInfoLeaf>::const_iterator it = info.redundant.begin();
100 it != info.redundant.end(); ++it) { 99 it != info.redundant.end(); ++it) {
101 info.encoded_bytes += it->encoded_bytes; 100 info.encoded_bytes += it->encoded_bytes;
102 } 101 }
103 return info; 102 return info;
104 } 103 }
105 104
106 } // namespace webrtc 105 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698