OLD | NEW |
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 "media/audio/win/audio_low_latency_output_win.h" |
| 6 |
5 #include <windows.h> | 7 #include <windows.h> |
6 #include <mmsystem.h> | 8 #include <mmsystem.h> |
7 #include <stddef.h> | 9 #include <stddef.h> |
8 #include <stdint.h> | 10 #include <stdint.h> |
9 | 11 |
| 12 #include <memory> |
| 13 |
10 #include "base/environment.h" | 14 #include "base/environment.h" |
11 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
14 #include "base/path_service.h" | 17 #include "base/path_service.h" |
15 #include "base/test/test_timeouts.h" | 18 #include "base/test/test_timeouts.h" |
16 #include "base/time/time.h" | 19 #include "base/time/time.h" |
17 #include "base/win/scoped_com_initializer.h" | 20 #include "base/win/scoped_com_initializer.h" |
18 #include "media/audio/audio_io.h" | 21 #include "media/audio/audio_io.h" |
19 #include "media/audio/audio_manager_base.h" | 22 #include "media/audio/audio_manager_base.h" |
20 #include "media/audio/audio_unittest_util.h" | 23 #include "media/audio/audio_unittest_util.h" |
21 #include "media/audio/mock_audio_source_callback.h" | 24 #include "media/audio/mock_audio_source_callback.h" |
22 #include "media/audio/win/audio_low_latency_output_win.h" | |
23 #include "media/audio/win/core_audio_util_win.h" | 25 #include "media/audio/win/core_audio_util_win.h" |
24 #include "media/base/decoder_buffer.h" | 26 #include "media/base/decoder_buffer.h" |
25 #include "media/base/seekable_buffer.h" | 27 #include "media/base/seekable_buffer.h" |
26 #include "media/base/test_data_util.h" | 28 #include "media/base/test_data_util.h" |
27 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
28 #include "testing/gmock_mutant.h" | 30 #include "testing/gmock_mutant.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
30 | 32 |
31 using ::testing::_; | 33 using ::testing::_; |
32 using ::testing::AnyNumber; | 34 using ::testing::AnyNumber; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 133 } |
132 return frames; | 134 return frames; |
133 } | 135 } |
134 | 136 |
135 void OnError(AudioOutputStream* stream) override {} | 137 void OnError(AudioOutputStream* stream) override {} |
136 | 138 |
137 int file_size() { return file_->data_size(); } | 139 int file_size() { return file_->data_size(); } |
138 | 140 |
139 private: | 141 private: |
140 scoped_refptr<DecoderBuffer> file_; | 142 scoped_refptr<DecoderBuffer> file_; |
141 scoped_ptr<int[]> delta_times_; | 143 std::unique_ptr<int[]> delta_times_; |
142 int pos_; | 144 int pos_; |
143 base::TimeTicks previous_call_time_; | 145 base::TimeTicks previous_call_time_; |
144 FILE* text_file_; | 146 FILE* text_file_; |
145 size_t elements_to_write_; | 147 size_t elements_to_write_; |
146 }; | 148 }; |
147 | 149 |
148 static bool ExclusiveModeIsEnabled() { | 150 static bool ExclusiveModeIsEnabled() { |
149 return (WASAPIAudioOutputStream::GetShareMode() == | 151 return (WASAPIAudioOutputStream::GetShareMode() == |
150 AUDCLNT_SHAREMODE_EXCLUSIVE); | 152 AUDCLNT_SHAREMODE_EXCLUSIVE); |
151 } | 153 } |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 aos->Start(&source); | 624 aos->Start(&source); |
623 message_loop_.PostDelayedTask(FROM_HERE, | 625 message_loop_.PostDelayedTask(FROM_HERE, |
624 base::MessageLoop::QuitWhenIdleClosure(), | 626 base::MessageLoop::QuitWhenIdleClosure(), |
625 TestTimeouts::action_timeout()); | 627 TestTimeouts::action_timeout()); |
626 message_loop_.Run(); | 628 message_loop_.Run(); |
627 aos->Stop(); | 629 aos->Stop(); |
628 aos->Close(); | 630 aos->Close(); |
629 } | 631 } |
630 | 632 |
631 } // namespace media | 633 } // namespace media |
OLD | NEW |