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

Side by Side Diff: webrtc/modules/audio_coding/codecs/opus/interface/audio_encoder_opus.h

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 3 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 int complexity; 43 int complexity;
44 bool dtx_enabled; 44 bool dtx_enabled;
45 }; 45 };
46 46
47 explicit AudioEncoderOpus(const Config& config); 47 explicit AudioEncoderOpus(const Config& config);
48 ~AudioEncoderOpus() override; 48 ~AudioEncoderOpus() override;
49 49
50 int SampleRateHz() const override; 50 int SampleRateHz() const override;
51 int NumChannels() const override; 51 int NumChannels() const override;
52 size_t MaxEncodedBytes() const override; 52 size_t MaxEncodedBytes() const override;
53 int Num10MsFramesInNextPacket() const override; 53 size_t Num10MsFramesInNextPacket() const override;
54 int Max10MsFramesInAPacket() const override; 54 size_t Max10MsFramesInAPacket() const override;
55 int GetTargetBitrate() const override; 55 int GetTargetBitrate() const override;
56 void SetTargetBitrate(int bits_per_second) override; 56 void SetTargetBitrate(int bits_per_second) override;
57 void SetProjectedPacketLossRate(double fraction) override; 57 void SetProjectedPacketLossRate(double fraction) override;
58 58
59 double packet_loss_rate() const { return packet_loss_rate_; } 59 double packet_loss_rate() const { return packet_loss_rate_; }
60 ApplicationMode application() const { return application_; } 60 ApplicationMode application() const { return application_; }
61 bool dtx_enabled() const { return dtx_enabled_; } 61 bool dtx_enabled() const { return dtx_enabled_; }
62 62
63 EncodedInfo EncodeInternal(uint32_t rtp_timestamp, 63 EncodedInfo EncodeInternal(uint32_t rtp_timestamp,
64 const int16_t* audio, 64 const int16_t* audio,
65 size_t max_encoded_bytes, 65 size_t max_encoded_bytes,
66 uint8_t* encoded) override; 66 uint8_t* encoded) override;
67 67
68 private: 68 private:
69 const int num_10ms_frames_per_packet_; 69 const size_t num_10ms_frames_per_packet_;
70 const int num_channels_; 70 const int num_channels_;
71 const int payload_type_; 71 const int payload_type_;
72 const ApplicationMode application_; 72 const ApplicationMode application_;
73 int bitrate_bps_; 73 int bitrate_bps_;
74 const bool dtx_enabled_; 74 const bool dtx_enabled_;
75 const int samples_per_10ms_frame_; 75 const size_t samples_per_10ms_frame_;
76 std::vector<int16_t> input_buffer_; 76 std::vector<int16_t> input_buffer_;
77 OpusEncInst* inst_; 77 OpusEncInst* inst_;
78 uint32_t first_timestamp_in_buffer_; 78 uint32_t first_timestamp_in_buffer_;
79 double packet_loss_rate_; 79 double packet_loss_rate_;
80 }; 80 };
81 81
82 struct CodecInst; 82 struct CodecInst;
83 83
84 class AudioEncoderMutableOpus 84 class AudioEncoderMutableOpus
85 : public AudioEncoderMutableImpl<AudioEncoderOpus> { 85 : public AudioEncoderMutableImpl<AudioEncoderOpus> {
(...skipping 17 matching lines...) Expand all
103 return encoder()->packet_loss_rate(); 103 return encoder()->packet_loss_rate();
104 } 104 }
105 bool dtx_enabled() const { 105 bool dtx_enabled() const {
106 CriticalSectionScoped cs(encoder_lock_.get()); 106 CriticalSectionScoped cs(encoder_lock_.get());
107 return encoder()->dtx_enabled(); 107 return encoder()->dtx_enabled();
108 } 108 }
109 }; 109 };
110 110
111 } // namespace webrtc 111 } // namespace webrtc
112 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_INTERFACE_AUDIO_ENCODER_OPUS_ H_ 112 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_INTERFACE_AUDIO_ENCODER_OPUS_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698