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

Side by Side Diff: remoting/codec/audio_encoder_opus.cc

Issue 24649002: Clean up a few more unused globals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thestig comment Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/codec/audio_encoder_opus.h" 5 #include "remoting/codec/audio_encoder_opus.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "media/base/audio_bus.h" 10 #include "media/base/audio_bus.h"
11 #include "media/base/multi_channel_resampler.h" 11 #include "media/base/multi_channel_resampler.h"
12 #include "third_party/opus/src/include/opus.h" 12 #include "third_party/opus/src/include/opus.h"
13 13
14 namespace remoting { 14 namespace remoting {
15 15
16 namespace { 16 namespace {
17 17
18 // Output 160 kb/s bitrate. 18 // Output 160 kb/s bitrate.
19 const int kOutputBitrateBps = 160 * 1024; 19 const int kOutputBitrateBps = 160 * 1024;
20 20
21 // Encoded buffer size.
22 const int kFrameDefaultBufferSize = 4096;
23
24 // Maximum buffer size we'll allocate when encoding before giving up.
25 const int kMaxBufferSize = 65536;
26
27 // Opus doesn't support 44100 sampling rate so we always resample to 48kHz. 21 // Opus doesn't support 44100 sampling rate so we always resample to 48kHz.
28 const AudioPacket::SamplingRate kOpusSamplingRate = 22 const AudioPacket::SamplingRate kOpusSamplingRate =
29 AudioPacket::SAMPLING_RATE_48000; 23 AudioPacket::SAMPLING_RATE_48000;
30 24
31 // Opus supports frame sizes of 2.5, 5, 10, 20, 40 and 60 ms. We use 20 ms 25 // Opus supports frame sizes of 2.5, 5, 10, 20, 40 and 60 ms. We use 20 ms
32 // frames to balance latency and efficiency. 26 // frames to balance latency and efficiency.
33 const int kFrameSizeMs = 20; 27 const int kFrameSizeMs = 20;
34 28
35 // Number of samples per frame when using default sampling rate. 29 // Number of samples per frame when using default sampling rate.
36 const int kFrameSamples = 30 const int kFrameSamples =
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 229 }
236 230
237 // Return NULL if there's nothing in the packet. 231 // Return NULL if there's nothing in the packet.
238 if (encoded_packet->data_size() == 0) 232 if (encoded_packet->data_size() == 0)
239 return scoped_ptr<AudioPacket>(); 233 return scoped_ptr<AudioPacket>();
240 234
241 return encoded_packet.Pass(); 235 return encoded_packet.Pass();
242 } 236 }
243 237
244 } // namespace remoting 238 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698