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

Side by Side Diff: media/audio/win/audio_low_latency_input_win_unittest.cc

Issue 12611030: Remove unused parameter to OnError() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits + rebase Created 7 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 // 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 <windows.h> 5 #include <windows.h>
6 #include <mmsystem.h> 6 #include <mmsystem.h>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 24 matching lines...) Expand all
35 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 35 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure());
36 } 36 }
37 } 37 }
38 38
39 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { 39 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback {
40 public: 40 public:
41 MOCK_METHOD5(OnData, void(AudioInputStream* stream, 41 MOCK_METHOD5(OnData, void(AudioInputStream* stream,
42 const uint8* src, uint32 size, 42 const uint8* src, uint32 size,
43 uint32 hardware_delay_bytes, double volume)); 43 uint32 hardware_delay_bytes, double volume));
44 MOCK_METHOD1(OnClose, void(AudioInputStream* stream)); 44 MOCK_METHOD1(OnClose, void(AudioInputStream* stream));
45 MOCK_METHOD2(OnError, void(AudioInputStream* stream, int code)); 45 MOCK_METHOD1(OnError, void(AudioInputStream* stream));
46 }; 46 };
47 47
48 // This audio sink implementation should be used for manual tests only since 48 // This audio sink implementation should be used for manual tests only since
49 // the recorded data is stored on a raw binary data file. 49 // the recorded data is stored on a raw binary data file.
50 class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback { 50 class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback {
51 public: 51 public:
52 // Allocate space for ~10 seconds of data @ 48kHz in stereo: 52 // Allocate space for ~10 seconds of data @ 48kHz in stereo:
53 // 2 bytes per sample, 2 channels, 10ms @ 48kHz, 10 seconds <=> 1920000 bytes. 53 // 2 bytes per sample, 2 channels, 10ms @ 48kHz, 10 seconds <=> 1920000 bytes.
54 static const size_t kMaxBufferSize = 2 * 2 * 480 * 100 * 10; 54 static const size_t kMaxBufferSize = 2 * 2 * 480 * 100 * 10;
55 55
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 double volume) { 91 double volume) {
92 // Store data data in a temporary buffer to avoid making blocking 92 // Store data data in a temporary buffer to avoid making blocking
93 // fwrite() calls in the audio callback. The complete buffer will be 93 // fwrite() calls in the audio callback. The complete buffer will be
94 // written to file in the destructor. 94 // written to file in the destructor.
95 if (buffer_.Append(src, size)) { 95 if (buffer_.Append(src, size)) {
96 bytes_to_write_ += size; 96 bytes_to_write_ += size;
97 } 97 }
98 } 98 }
99 99
100 virtual void OnClose(AudioInputStream* stream) {} 100 virtual void OnClose(AudioInputStream* stream) {}
101 virtual void OnError(AudioInputStream* stream, int code) {} 101 virtual void OnError(AudioInputStream* stream) {}
102 102
103 private: 103 private:
104 media::SeekableBuffer buffer_; 104 media::SeekableBuffer buffer_;
105 FILE* binary_file_; 105 FILE* binary_file_;
106 size_t bytes_to_write_; 106 size_t bytes_to_write_;
107 }; 107 };
108 108
109 // Convenience method which ensures that we are not running on the build 109 // Convenience method which ensures that we are not running on the build
110 // bots and that at least one valid input device can be found. We also 110 // bots and that at least one valid input device can be found. We also
111 // verify that we are not running on XP since the low-latency (WASAPI- 111 // verify that we are not running on XP since the low-latency (WASAPI-
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 WriteToFileAudioSink file_sink(file_name); 396 WriteToFileAudioSink file_sink(file_name);
397 LOG(INFO) << ">> Speak into the default microphone while recording."; 397 LOG(INFO) << ">> Speak into the default microphone while recording.";
398 ais->Start(&file_sink); 398 ais->Start(&file_sink);
399 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); 399 base::PlatformThread::Sleep(TestTimeouts::action_timeout());
400 ais->Stop(); 400 ais->Stop();
401 LOG(INFO) << ">> Recording has stopped."; 401 LOG(INFO) << ">> Recording has stopped.";
402 ais->Close(); 402 ais->Close();
403 } 403 }
404 404
405 } // namespace media 405 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/win/audio_low_latency_input_win.cc ('k') | media/audio/win/audio_low_latency_output_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698