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

Side by Side Diff: webrtc/modules/audio_coding/codecs/audio_encoder.cc

Issue 1764583003: Renamed new EncodeInternal to EncodeImpl to ensure proper backwards compatibility. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Clarified doc comments in AudioEncoder. Created 4 years, 9 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
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 14 matching lines...) Expand all
25 25
26 AudioEncoder::EncodedInfo AudioEncoder::Encode( 26 AudioEncoder::EncodedInfo AudioEncoder::Encode(
27 uint32_t rtp_timestamp, 27 uint32_t rtp_timestamp,
28 rtc::ArrayView<const int16_t> audio, 28 rtc::ArrayView<const int16_t> audio,
29 rtc::Buffer* encoded) { 29 rtc::Buffer* encoded) {
30 TRACE_EVENT0("webrtc", "AudioEncoder::Encode"); 30 TRACE_EVENT0("webrtc", "AudioEncoder::Encode");
31 RTC_CHECK_EQ(audio.size(), 31 RTC_CHECK_EQ(audio.size(),
32 static_cast<size_t>(NumChannels() * SampleRateHz() / 100)); 32 static_cast<size_t>(NumChannels() * SampleRateHz() / 100));
33 33
34 const size_t old_size = encoded->size(); 34 const size_t old_size = encoded->size();
35 EncodedInfo info = EncodeInternal(rtp_timestamp, audio, encoded); 35 EncodedInfo info = EncodeImpl(rtp_timestamp, audio, encoded);
36 RTC_CHECK_EQ(encoded->size() - old_size, info.encoded_bytes); 36 RTC_CHECK_EQ(encoded->size() - old_size, info.encoded_bytes);
37 return info; 37 return info;
38 } 38 }
39 39
40 AudioEncoder::EncodedInfo AudioEncoder::Encode( 40 AudioEncoder::EncodedInfo AudioEncoder::Encode(
41 uint32_t rtp_timestamp, 41 uint32_t rtp_timestamp,
42 rtc::ArrayView<const int16_t> audio, 42 rtc::ArrayView<const int16_t> audio,
43 size_t max_encoded_bytes, 43 size_t max_encoded_bytes,
44 uint8_t* encoded) { 44 uint8_t* encoded) {
45 return DEPRECATED_Encode(rtp_timestamp, audio, max_encoded_bytes, encoded); 45 return DEPRECATED_Encode(rtp_timestamp, audio, max_encoded_bytes, encoded);
46 } 46 }
47 47
48 AudioEncoder::EncodedInfo AudioEncoder::DEPRECATED_Encode( 48 AudioEncoder::EncodedInfo AudioEncoder::DEPRECATED_Encode(
49 uint32_t rtp_timestamp, 49 uint32_t rtp_timestamp,
50 rtc::ArrayView<const int16_t> audio, 50 rtc::ArrayView<const int16_t> audio,
51 size_t max_encoded_bytes, 51 size_t max_encoded_bytes,
52 uint8_t* encoded) { 52 uint8_t* encoded) {
53 TRACE_EVENT0("webrtc", "AudioEncoder::Encode"); 53 TRACE_EVENT0("webrtc", "AudioEncoder::Encode");
54 RTC_CHECK_EQ(audio.size(), 54 RTC_CHECK_EQ(audio.size(),
55 static_cast<size_t>(NumChannels() * SampleRateHz() / 100)); 55 static_cast<size_t>(NumChannels() * SampleRateHz() / 100));
56 EncodedInfo info = 56 EncodedInfo info =
57 EncodeInternal(rtp_timestamp, audio, max_encoded_bytes, encoded); 57 EncodeInternal(rtp_timestamp, audio, max_encoded_bytes, encoded);
58 RTC_CHECK_LE(info.encoded_bytes, max_encoded_bytes); 58 RTC_CHECK_LE(info.encoded_bytes, max_encoded_bytes);
59 return info; 59 return info;
60 } 60 }
61 61
62 AudioEncoder::EncodedInfo AudioEncoder::EncodeInternal( 62 AudioEncoder::EncodedInfo AudioEncoder::EncodeImpl(
63 uint32_t rtp_timestamp, 63 uint32_t rtp_timestamp,
64 rtc::ArrayView<const int16_t> audio, 64 rtc::ArrayView<const int16_t> audio,
65 rtc::Buffer* encoded) 65 rtc::Buffer* encoded)
66 { 66 {
67 EncodedInfo info; 67 EncodedInfo info;
68 encoded->AppendData(MaxEncodedBytes(), [&] (rtc::ArrayView<uint8_t> encoded) { 68 encoded->AppendData(MaxEncodedBytes(), [&] (rtc::ArrayView<uint8_t> encoded) {
69 info = EncodeInternal(rtp_timestamp, audio, 69 info = EncodeInternal(rtp_timestamp, audio,
70 encoded.size(), encoded.data()); 70 encoded.size(), encoded.data());
71 return info.encoded_bytes; 71 return info.encoded_bytes;
72 }); 72 });
73 return info; 73 return info;
74 } 74 }
75 75
76 AudioEncoder::EncodedInfo AudioEncoder::EncodeInternal( 76 AudioEncoder::EncodedInfo AudioEncoder::EncodeInternal(
77 uint32_t rtp_timestamp, 77 uint32_t rtp_timestamp,
78 rtc::ArrayView<const int16_t> audio, 78 rtc::ArrayView<const int16_t> audio,
79 size_t max_encoded_bytes, 79 size_t max_encoded_bytes,
80 uint8_t* encoded) 80 uint8_t* encoded)
81 { 81 {
82 rtc::Buffer temp_buffer; 82 rtc::Buffer temp_buffer;
83 EncodedInfo info = EncodeInternal(rtp_timestamp, audio, &temp_buffer); 83 EncodedInfo info = EncodeImpl(rtp_timestamp, audio, &temp_buffer);
84 RTC_DCHECK_LE(temp_buffer.size(), max_encoded_bytes); 84 RTC_DCHECK_LE(temp_buffer.size(), max_encoded_bytes);
85 std::memcpy(encoded, temp_buffer.data(), info.encoded_bytes); 85 std::memcpy(encoded, temp_buffer.data(), info.encoded_bytes);
86 return info; 86 return info;
87 } 87 }
88 88
89 bool AudioEncoder::SetFec(bool enable) { 89 bool AudioEncoder::SetFec(bool enable) {
90 return !enable; 90 return !enable;
91 } 91 }
92 92
93 bool AudioEncoder::SetDtx(bool enable) { 93 bool AudioEncoder::SetDtx(bool enable) {
94 return !enable; 94 return !enable;
95 } 95 }
96 96
97 bool AudioEncoder::SetApplication(Application application) { 97 bool AudioEncoder::SetApplication(Application application) {
98 return false; 98 return false;
99 } 99 }
100 100
101 void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {} 101 void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {}
102 102
103 void AudioEncoder::SetProjectedPacketLossRate(double fraction) {} 103 void AudioEncoder::SetProjectedPacketLossRate(double fraction) {}
104 104
105 void AudioEncoder::SetTargetBitrate(int target_bps) {} 105 void AudioEncoder::SetTargetBitrate(int target_bps) {}
106 106
107 } // namespace webrtc 107 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/audio_encoder.h ('k') | webrtc/modules/audio_coding/codecs/audio_encoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698