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

Side by Side Diff: webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h

Issue 1725143003: Changed AudioEncoder::Encode to take an rtc::Buffer* instead of uint8_t* and a maximum size. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added more fixes for override hiding in AudioEncoder implementations. 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
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_H_ 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_H_
13 13
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" 16 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
17 #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h" 17 #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h"
18 18
19 namespace webrtc { 19 namespace webrtc {
20 20
21 struct CodecInst; 21 struct CodecInst;
22 22
23 template <typename T> 23 template <typename T>
24 class AudioEncoderIsacT final : public AudioEncoder { 24 class AudioEncoderIsacT final : public AudioEncoder {
25 public: 25 public:
26 using AudioEncoder::EncodeInternal;
27
26 // Allowed combinations of sample rate, frame size, and bit rate are 28 // Allowed combinations of sample rate, frame size, and bit rate are
27 // - 16000 Hz, 30 ms, 10000-32000 bps 29 // - 16000 Hz, 30 ms, 10000-32000 bps
28 // - 16000 Hz, 60 ms, 10000-32000 bps 30 // - 16000 Hz, 60 ms, 10000-32000 bps
29 // - 32000 Hz, 30 ms, 10000-56000 bps (if T has super-wideband support) 31 // - 32000 Hz, 30 ms, 10000-56000 bps (if T has super-wideband support)
30 struct Config { 32 struct Config {
31 bool IsOk() const; 33 bool IsOk() const;
32 34
33 LockedIsacBandwidthInfo* bwinfo = nullptr; 35 LockedIsacBandwidthInfo* bwinfo = nullptr;
34 36
35 int payload_type = 103; 37 int payload_type = 103;
(...skipping 19 matching lines...) Expand all
55 ~AudioEncoderIsacT() override; 57 ~AudioEncoderIsacT() override;
56 58
57 size_t MaxEncodedBytes() const override; 59 size_t MaxEncodedBytes() const override;
58 int SampleRateHz() const override; 60 int SampleRateHz() const override;
59 size_t NumChannels() const override; 61 size_t NumChannels() const override;
60 size_t Num10MsFramesInNextPacket() const override; 62 size_t Num10MsFramesInNextPacket() const override;
61 size_t Max10MsFramesInAPacket() const override; 63 size_t Max10MsFramesInAPacket() const override;
62 int GetTargetBitrate() const override; 64 int GetTargetBitrate() const override;
63 EncodedInfo EncodeInternal(uint32_t rtp_timestamp, 65 EncodedInfo EncodeInternal(uint32_t rtp_timestamp,
64 rtc::ArrayView<const int16_t> audio, 66 rtc::ArrayView<const int16_t> audio,
65 size_t max_encoded_bytes, 67 rtc::Buffer* encoded) override;
66 uint8_t* encoded) override;
67 void Reset() override; 68 void Reset() override;
68 69
69 private: 70 private:
70 // This value is taken from STREAM_SIZE_MAX_60 for iSAC float (60 ms) and 71 // This value is taken from STREAM_SIZE_MAX_60 for iSAC float (60 ms) and
71 // STREAM_MAXW16_60MS for iSAC fix (60 ms). 72 // STREAM_MAXW16_60MS for iSAC fix (60 ms).
72 static const size_t kSufficientEncodeBufferSizeBytes = 400; 73 static const size_t kSufficientEncodeBufferSizeBytes = 400;
73 74
74 static const int kDefaultBitRate = 32000; 75 static const int kDefaultBitRate = 32000;
75 76
76 // Recreate the iSAC encoder instance with the given settings, and save them. 77 // Recreate the iSAC encoder instance with the given settings, and save them.
(...skipping 11 matching lines...) Expand all
88 89
89 // Timestamp of the previously encoded packet. 90 // Timestamp of the previously encoded packet.
90 uint32_t last_encoded_timestamp_; 91 uint32_t last_encoded_timestamp_;
91 92
92 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderIsacT); 93 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderIsacT);
93 }; 94 };
94 95
95 } // namespace webrtc 96 } // namespace webrtc
96 97
97 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_H_ 98 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698