| 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/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 size_t elements_written = 0; | 96 size_t elements_written = 0; |
| 97 while (elements_written < elements_to_write_) { | 97 while (elements_written < elements_to_write_) { |
| 98 fprintf(text_file_, "%d\n", delta_times_[elements_written]); | 98 fprintf(text_file_, "%d\n", delta_times_[elements_written]); |
| 99 ++elements_written; | 99 ++elements_written; |
| 100 } | 100 } |
| 101 | 101 |
| 102 base::CloseFile(text_file_); | 102 base::CloseFile(text_file_); |
| 103 } | 103 } |
| 104 | 104 |
| 105 // AudioOutputStream::AudioSourceCallback implementation. | 105 // AudioOutputStream::AudioSourceCallback implementation. |
| 106 int OnMoreData(AudioBus* audio_bus, uint32 total_bytes_delay) override { | 106 int OnMoreData(AudioBus* audio_bus, |
| 107 uint32_t total_bytes_delay, |
| 108 uint32_t frames_skipped) override { |
| 107 // Store time difference between two successive callbacks in an array. | 109 // Store time difference between two successive callbacks in an array. |
| 108 // These values will be written to a file in the destructor. | 110 // These values will be written to a file in the destructor. |
| 109 const base::TimeTicks now_time = base::TimeTicks::Now(); | 111 const base::TimeTicks now_time = base::TimeTicks::Now(); |
| 110 const int diff = (now_time - previous_call_time_).InMilliseconds(); | 112 const int diff = (now_time - previous_call_time_).InMilliseconds(); |
| 111 previous_call_time_ = now_time; | 113 previous_call_time_ = now_time; |
| 112 if (elements_to_write_ < kMaxDeltaSamples) { | 114 if (elements_to_write_ < kMaxDeltaSamples) { |
| 113 delta_times_[elements_to_write_] = diff; | 115 delta_times_[elements_to_write_] = diff; |
| 114 ++elements_to_write_; | 116 ++elements_to_write_; |
| 115 } | 117 } |
| 116 | 118 |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 | 619 |
| 618 aos->Start(&source); | 620 aos->Start(&source); |
| 619 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 621 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
| 620 TestTimeouts::action_timeout()); | 622 TestTimeouts::action_timeout()); |
| 621 loop.Run(); | 623 loop.Run(); |
| 622 aos->Stop(); | 624 aos->Stop(); |
| 623 aos->Close(); | 625 aos->Close(); |
| 624 } | 626 } |
| 625 | 627 |
| 626 } // namespace media | 628 } // namespace media |
| OLD | NEW |