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

Side by Side Diff: content/browser/speech/audio_encoder.cc

Issue 791923003: replace COMPILE_ASSERT with static_assert in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixups Created 5 years, 11 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 // 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 "content/browser/speech/audio_encoder.h" 5 #include "content/browser/speech/audio_encoder.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 //-------------------------------- SpeexEncoder -------------------------------- 103 //-------------------------------- SpeexEncoder --------------------------------
104 104
105 const char* const kContentTypeSpeex = "audio/x-speex-with-header-byte; rate="; 105 const char* const kContentTypeSpeex = "audio/x-speex-with-header-byte; rate=";
106 const int kSpeexEncodingQuality = 8; 106 const int kSpeexEncodingQuality = 8;
107 const int kMaxSpeexFrameLength = 110; // (44kbps rate sampled at 32kHz). 107 const int kMaxSpeexFrameLength = 110; // (44kbps rate sampled at 32kHz).
108 108
109 // Since the frame length gets written out as a byte in the encoded packet, 109 // Since the frame length gets written out as a byte in the encoded packet,
110 // make sure it is within the byte range. 110 // make sure it is within the byte range.
111 COMPILE_ASSERT(kMaxSpeexFrameLength <= 0xFF, invalidLength); 111 static_assert(kMaxSpeexFrameLength <= 0xFF, "invalid length");
112 112
113 class SpeexEncoder : public AudioEncoder { 113 class SpeexEncoder : public AudioEncoder {
114 public: 114 public:
115 explicit SpeexEncoder(int sampling_rate, int bits_per_sample); 115 explicit SpeexEncoder(int sampling_rate, int bits_per_sample);
116 ~SpeexEncoder() override; 116 ~SpeexEncoder() override;
117 void Encode(const AudioChunk& raw_audio) override; 117 void Encode(const AudioChunk& raw_audio) override;
118 void Flush() override {} 118 void Flush() override {}
119 119
120 private: 120 private:
121 void* encoder_state_; 121 void* encoder_state_;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 185 }
186 186
187 AudioEncoder::~AudioEncoder() { 187 AudioEncoder::~AudioEncoder() {
188 } 188 }
189 189
190 scoped_refptr<AudioChunk> AudioEncoder::GetEncodedDataAndClear() { 190 scoped_refptr<AudioChunk> AudioEncoder::GetEncodedDataAndClear() {
191 return encoded_audio_buffer_.DequeueAll(); 191 return encoded_audio_buffer_.DequeueAll();
192 } 192 }
193 193
194 } // namespace content 194 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/websocket_host.cc ('k') | content/browser/speech/chunked_byte_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698