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

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

Issue 1418423010: Pass audio to AudioEncoder::Encode() in an ArrayView (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 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
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 size_t AudioEncoderCopyRed::Max10MsFramesInAPacket() const { 47 size_t AudioEncoderCopyRed::Max10MsFramesInAPacket() const {
48 return speech_encoder_->Max10MsFramesInAPacket(); 48 return speech_encoder_->Max10MsFramesInAPacket();
49 } 49 }
50 50
51 int AudioEncoderCopyRed::GetTargetBitrate() const { 51 int AudioEncoderCopyRed::GetTargetBitrate() const {
52 return speech_encoder_->GetTargetBitrate(); 52 return speech_encoder_->GetTargetBitrate();
53 } 53 }
54 54
55 AudioEncoder::EncodedInfo AudioEncoderCopyRed::EncodeInternal( 55 AudioEncoder::EncodedInfo AudioEncoderCopyRed::EncodeInternal(
56 uint32_t rtp_timestamp, 56 uint32_t rtp_timestamp,
57 const int16_t* audio, 57 rtc::ArrayView<const int16_t> audio,
58 size_t max_encoded_bytes, 58 size_t max_encoded_bytes,
59 uint8_t* encoded) { 59 uint8_t* encoded) {
60 EncodedInfo info = speech_encoder_->Encode( 60 EncodedInfo info =
61 rtp_timestamp, audio, static_cast<size_t>(SampleRateHz() / 100), 61 speech_encoder_->Encode(rtp_timestamp, audio, max_encoded_bytes, encoded);
62 max_encoded_bytes, encoded);
63 RTC_CHECK_GE(max_encoded_bytes, 62 RTC_CHECK_GE(max_encoded_bytes,
64 info.encoded_bytes + secondary_info_.encoded_bytes); 63 info.encoded_bytes + secondary_info_.encoded_bytes);
65 RTC_CHECK(info.redundant.empty()) << "Cannot use nested redundant encoders."; 64 RTC_CHECK(info.redundant.empty()) << "Cannot use nested redundant encoders.";
66 65
67 if (info.encoded_bytes > 0) { 66 if (info.encoded_bytes > 0) {
68 // |info| will be implicitly cast to an EncodedInfoLeaf struct, effectively 67 // |info| will be implicitly cast to an EncodedInfoLeaf struct, effectively
69 // discarding the (empty) vector of redundant information. This is 68 // discarding the (empty) vector of redundant information. This is
70 // intentional. 69 // intentional.
71 info.redundant.push_back(info); 70 info.redundant.push_back(info);
72 RTC_DCHECK_EQ(info.redundant.size(), 1u); 71 RTC_DCHECK_EQ(info.redundant.size(), 1u);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 114
116 void AudioEncoderCopyRed::SetProjectedPacketLossRate(double fraction) { 115 void AudioEncoderCopyRed::SetProjectedPacketLossRate(double fraction) {
117 speech_encoder_->SetProjectedPacketLossRate(fraction); 116 speech_encoder_->SetProjectedPacketLossRate(fraction);
118 } 117 }
119 118
120 void AudioEncoderCopyRed::SetTargetBitrate(int bits_per_second) { 119 void AudioEncoderCopyRed::SetTargetBitrate(int bits_per_second) {
121 speech_encoder_->SetTargetBitrate(bits_per_second); 120 speech_encoder_->SetTargetBitrate(bits_per_second);
122 } 121 }
123 122
124 } // namespace webrtc 123 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698