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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 | 617 |
616 aos->Start(&source); | 618 aos->Start(&source); |
617 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 619 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
618 TestTimeouts::action_timeout()); | 620 TestTimeouts::action_timeout()); |
619 loop.Run(); | 621 loop.Run(); |
620 aos->Stop(); | 622 aos->Stop(); |
621 aos->Close(); | 623 aos->Close(); |
622 } | 624 } |
623 | 625 |
624 } // namespace media | 626 } // namespace media |
OLD | NEW |