| 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 <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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 virtual ~ReadFromFileAudioSource() { | 92 virtual ~ReadFromFileAudioSource() { |
| 93 // Get complete file path to output file in directory containing | 93 // Get complete file path to output file in directory containing |
| 94 // media_unittests.exe. | 94 // media_unittests.exe. |
| 95 base::FilePath file_name; | 95 base::FilePath file_name; |
| 96 EXPECT_TRUE(PathService::Get(base::DIR_EXE, &file_name)); | 96 EXPECT_TRUE(PathService::Get(base::DIR_EXE, &file_name)); |
| 97 file_name = file_name.AppendASCII(kDeltaTimeMsFileName); | 97 file_name = file_name.AppendASCII(kDeltaTimeMsFileName); |
| 98 | 98 |
| 99 EXPECT_TRUE(!text_file_); | 99 EXPECT_TRUE(!text_file_); |
| 100 text_file_ = file_util::OpenFile(file_name, "wt"); | 100 text_file_ = base::OpenFile(file_name, "wt"); |
| 101 DLOG_IF(ERROR, !text_file_) << "Failed to open log file."; | 101 DLOG_IF(ERROR, !text_file_) << "Failed to open log file."; |
| 102 | 102 |
| 103 // Write the array which contains delta times to a text file. | 103 // Write the array which contains delta times to a text file. |
| 104 size_t elements_written = 0; | 104 size_t elements_written = 0; |
| 105 while (elements_written < elements_to_write_) { | 105 while (elements_written < elements_to_write_) { |
| 106 fprintf(text_file_, "%d\n", delta_times_[elements_written]); | 106 fprintf(text_file_, "%d\n", delta_times_[elements_written]); |
| 107 ++elements_written; | 107 ++elements_written; |
| 108 } | 108 } |
| 109 | 109 |
| 110 file_util::CloseFile(text_file_); | 110 base::CloseFile(text_file_); |
| 111 } | 111 } |
| 112 | 112 |
| 113 // AudioOutputStream::AudioSourceCallback implementation. | 113 // AudioOutputStream::AudioSourceCallback implementation. |
| 114 virtual int OnMoreData(AudioBus* audio_bus, | 114 virtual int OnMoreData(AudioBus* audio_bus, |
| 115 AudioBuffersState buffers_state) { | 115 AudioBuffersState buffers_state) { |
| 116 // Store time difference between two successive callbacks in an array. | 116 // Store time difference between two successive callbacks in an array. |
| 117 // These values will be written to a file in the destructor. | 117 // These values will be written to a file in the destructor. |
| 118 const base::TimeTicks now_time = base::TimeTicks::Now(); | 118 const base::TimeTicks now_time = base::TimeTicks::Now(); |
| 119 const int diff = (now_time - previous_call_time_).InMilliseconds(); | 119 const int diff = (now_time - previous_call_time_).InMilliseconds(); |
| 120 previous_call_time_ = now_time; | 120 previous_call_time_ = now_time; |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 | 693 |
| 694 aos->Start(&source); | 694 aos->Start(&source); |
| 695 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), | 695 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), |
| 696 TestTimeouts::action_timeout()); | 696 TestTimeouts::action_timeout()); |
| 697 loop.Run(); | 697 loop.Run(); |
| 698 aos->Stop(); | 698 aos->Stop(); |
| 699 aos->Close(); | 699 aos->Close(); |
| 700 } | 700 } |
| 701 | 701 |
| 702 } // namespace media | 702 } // namespace media |
| OLD | NEW |