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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 speech_encoder_->Encode(rtp_timestamp, audio, encoded); | 64 speech_encoder_->Encode(rtp_timestamp, audio, encoded); |
65 | 65 |
66 RTC_CHECK(info.redundant.empty()) << "Cannot use nested redundant encoders."; | 66 RTC_CHECK(info.redundant.empty()) << "Cannot use nested redundant encoders."; |
67 RTC_DCHECK_EQ(encoded->size() - primary_offset, info.encoded_bytes); | 67 RTC_DCHECK_EQ(encoded->size() - primary_offset, info.encoded_bytes); |
68 | 68 |
69 if (info.encoded_bytes > 0) { | 69 if (info.encoded_bytes > 0) { |
70 // |info| will be implicitly cast to an EncodedInfoLeaf struct, effectively | 70 // |info| will be implicitly cast to an EncodedInfoLeaf struct, effectively |
71 // discarding the (empty) vector of redundant information. This is | 71 // discarding the (empty) vector of redundant information. This is |
72 // intentional. | 72 // intentional. |
73 info.redundant.push_back(info); | 73 info.redundant.push_back(info); |
74 RTC_DCHECK_EQ(info.redundant.size(), 1u); | 74 RTC_DCHECK_EQ(info.redundant.size(), 1); |
75 if (secondary_info_.encoded_bytes > 0) { | 75 if (secondary_info_.encoded_bytes > 0) { |
76 encoded->AppendData(secondary_encoded_); | 76 encoded->AppendData(secondary_encoded_); |
77 info.redundant.push_back(secondary_info_); | 77 info.redundant.push_back(secondary_info_); |
78 RTC_DCHECK_EQ(info.redundant.size(), 2u); | 78 RTC_DCHECK_EQ(info.redundant.size(), 2); |
79 } | 79 } |
80 // Save primary to secondary. | 80 // Save primary to secondary. |
81 secondary_encoded_.SetData(encoded->data() + primary_offset, | 81 secondary_encoded_.SetData(encoded->data() + primary_offset, |
82 info.encoded_bytes); | 82 info.encoded_bytes); |
83 secondary_info_ = info; | 83 secondary_info_ = info; |
84 RTC_DCHECK_EQ(info.speech, info.redundant[0].speech); | 84 RTC_DCHECK_EQ(info.speech, info.redundant[0].speech); |
85 } | 85 } |
86 // Update main EncodedInfo. | 86 // Update main EncodedInfo. |
87 info.payload_type = red_payload_type_; | 87 info.payload_type = red_payload_type_; |
88 info.encoded_bytes = 0; | 88 info.encoded_bytes = 0; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 void AudioEncoderCopyRed::SetTargetBitrate(int bits_per_second) { | 122 void AudioEncoderCopyRed::SetTargetBitrate(int bits_per_second) { |
123 speech_encoder_->SetTargetBitrate(bits_per_second); | 123 speech_encoder_->SetTargetBitrate(bits_per_second); |
124 } | 124 } |
125 | 125 |
126 rtc::ArrayView<std::unique_ptr<AudioEncoder>> | 126 rtc::ArrayView<std::unique_ptr<AudioEncoder>> |
127 AudioEncoderCopyRed::ReclaimContainedEncoders() { | 127 AudioEncoderCopyRed::ReclaimContainedEncoders() { |
128 return rtc::ArrayView<std::unique_ptr<AudioEncoder>>(&speech_encoder_, 1); | 128 return rtc::ArrayView<std::unique_ptr<AudioEncoder>>(&speech_encoder_, 1); |
129 } | 129 } |
130 | 130 |
131 } // namespace webrtc | 131 } // namespace webrtc |
OLD | NEW |