OLD | NEW |
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 Loading... |
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 |
OLD | NEW |