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

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

Issue 1487983002: Forward the number of skipped frames by the OS in audio playout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Writing skipped frames to shared memory. Created 5 years 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/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698