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

Side by Side Diff: media/audio/mac/audio_low_latency_input_mac_unittest.cc

Issue 623263003: replace OVERRIDE and FINAL with override and final in media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « media/audio/mac/audio_low_latency_input_mac.h ('k') | media/audio/mac/audio_manager_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/environment.h" 6 #include "base/environment.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/test_timeouts.h" 9 #include "base/test/test_timeouts.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 buffer_.Seek(chunk_size); 71 buffer_.Seek(chunk_size);
72 bytes_written += chunk_size; 72 bytes_written += chunk_size;
73 } 73 }
74 fclose(file_); 74 fclose(file_);
75 } 75 }
76 76
77 // AudioInputStream::AudioInputCallback implementation. 77 // AudioInputStream::AudioInputCallback implementation.
78 virtual void OnData(AudioInputStream* stream, 78 virtual void OnData(AudioInputStream* stream,
79 const AudioBus* src, 79 const AudioBus* src,
80 uint32 hardware_delay_bytes, 80 uint32 hardware_delay_bytes,
81 double volume) OVERRIDE { 81 double volume) override {
82 const int num_samples = src->frames() * src->channels(); 82 const int num_samples = src->frames() * src->channels();
83 scoped_ptr<int16> interleaved(new int16[num_samples]); 83 scoped_ptr<int16> interleaved(new int16[num_samples]);
84 const int bytes_per_sample = sizeof(*interleaved); 84 const int bytes_per_sample = sizeof(*interleaved);
85 src->ToInterleaved(src->frames(), bytes_per_sample, interleaved.get()); 85 src->ToInterleaved(src->frames(), bytes_per_sample, interleaved.get());
86 86
87 // Store data data in a temporary buffer to avoid making blocking 87 // Store data data in a temporary buffer to avoid making blocking
88 // fwrite() calls in the audio callback. The complete buffer will be 88 // fwrite() calls in the audio callback. The complete buffer will be
89 // written to file in the destructor. 89 // written to file in the destructor.
90 const int size = bytes_per_sample * num_samples; 90 const int size = bytes_per_sample * num_samples;
91 if (buffer_.Append((const uint8*)interleaved.get(), size)) { 91 if (buffer_.Append((const uint8*)interleaved.get(), size)) {
92 bytes_to_write_ += size; 92 bytes_to_write_ += size;
93 } 93 }
94 } 94 }
95 95
96 virtual void OnError(AudioInputStream* stream) OVERRIDE {} 96 virtual void OnError(AudioInputStream* stream) override {}
97 97
98 private: 98 private:
99 media::SeekableBuffer buffer_; 99 media::SeekableBuffer buffer_;
100 FILE* file_; 100 FILE* file_;
101 int bytes_to_write_; 101 int bytes_to_write_;
102 }; 102 };
103 103
104 class MacAudioInputTest : public testing::Test { 104 class MacAudioInputTest : public testing::Test {
105 protected: 105 protected:
106 MacAudioInputTest() 106 MacAudioInputTest()
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 WriteToFileAudioSink file_sink(file_name); 303 WriteToFileAudioSink file_sink(file_name);
304 fprintf(stderr, " >> Speak into the mic while recording...\n"); 304 fprintf(stderr, " >> Speak into the mic while recording...\n");
305 ais->Start(&file_sink); 305 ais->Start(&file_sink);
306 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); 306 base::PlatformThread::Sleep(TestTimeouts::action_timeout());
307 ais->Stop(); 307 ais->Stop();
308 fprintf(stderr, " >> Recording has stopped.\n"); 308 fprintf(stderr, " >> Recording has stopped.\n");
309 ais->Close(); 309 ais->Close();
310 } 310 }
311 311
312 } // namespace media 312 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/mac/audio_low_latency_input_mac.h ('k') | media/audio/mac/audio_manager_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698