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

Side by Side Diff: media/audio/clockless_audio_sink.cc

Issue 1538563002: 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: Code review fix. git cl format. Rebase. 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
« no previous file with comments | « media/audio/audio_parameters.h ('k') | media/audio/cras/cras_unified.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/clockless_audio_sink.h" 5 #include "media/audio/clockless_audio_sink.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/simple_thread.h" 10 #include "base/threading/simple_thread.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 std::string GetAudioHash() { 42 std::string GetAudioHash() {
43 DCHECK(audio_hash_); 43 DCHECK(audio_hash_);
44 return audio_hash_->ToString(); 44 return audio_hash_->ToString();
45 } 45 }
46 46
47 private: 47 private:
48 // Call Render() repeatedly, keeping track of the rendering time. 48 // Call Render() repeatedly, keeping track of the rendering time.
49 void Run() override { 49 void Run() override {
50 base::TimeTicks start; 50 base::TimeTicks start;
51 while (!stop_event_->IsSignaled()) { 51 while (!stop_event_->IsSignaled()) {
52 const int frames_received = callback_->Render(audio_bus_.get(), 0); 52 const int frames_received = callback_->Render(audio_bus_.get(), 0, 0);
53 DCHECK_GE(frames_received, 0); 53 DCHECK_GE(frames_received, 0);
54 if (audio_hash_) 54 if (audio_hash_)
55 audio_hash_->Update(audio_bus_.get(), frames_received); 55 audio_hash_->Update(audio_bus_.get(), frames_received);
56 if (!frames_received) { 56 if (!frames_received) {
57 // No data received, so let other threads run to provide data. 57 // No data received, so let other threads run to provide data.
58 base::PlatformThread::YieldCurrentThread(); 58 base::PlatformThread::YieldCurrentThread();
59 } else if (start.is_null()) { 59 } else if (start.is_null()) {
60 // First time we processed some audio, so record the starting time. 60 // First time we processed some audio, so record the starting time.
61 start = base::TimeTicks::Now(); 61 start = base::TimeTicks::Now();
62 } else { 62 } else {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 void ClocklessAudioSink::StartAudioHashForTesting() { 128 void ClocklessAudioSink::StartAudioHashForTesting() {
129 DCHECK(!initialized_); 129 DCHECK(!initialized_);
130 hashing_ = true; 130 hashing_ = true;
131 } 131 }
132 132
133 std::string ClocklessAudioSink::GetAudioHashForTesting() { 133 std::string ClocklessAudioSink::GetAudioHashForTesting() {
134 return thread_ && hashing_ ? thread_->GetAudioHash() : std::string(); 134 return thread_ && hashing_ ? thread_->GetAudioHash() : std::string();
135 } 135 }
136 136
137 } // namespace media 137 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_parameters.h ('k') | media/audio/cras/cras_unified.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698