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

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

Issue 2452183003: Revert of Make more media APIs aware of |delay| and |delay_timestamp| (Closed)
Patch Set: Created 4 years, 1 month 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_output_stream_sink.cc ('k') | media/audio/null_audio_sink.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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 std::string GetAudioHash() { 44 std::string GetAudioHash() {
45 DCHECK(audio_hash_); 45 DCHECK(audio_hash_);
46 return audio_hash_->ToString(); 46 return audio_hash_->ToString();
47 } 47 }
48 48
49 private: 49 private:
50 // Call Render() repeatedly, keeping track of the rendering time. 50 // Call Render() repeatedly, keeping track of the rendering time.
51 void Run() override { 51 void Run() override {
52 base::TimeTicks start; 52 base::TimeTicks start;
53 while (!stop_event_->IsSignaled()) { 53 while (!stop_event_->IsSignaled()) {
54 const int frames_received = callback_->Render( 54 const int frames_received = callback_->Render(audio_bus_.get(), 0, 0);
55 base::TimeDelta(), base::TimeTicks::Now(), 0, audio_bus_.get());
56 DCHECK_GE(frames_received, 0); 55 DCHECK_GE(frames_received, 0);
57 if (audio_hash_) 56 if (audio_hash_)
58 audio_hash_->Update(audio_bus_.get(), frames_received); 57 audio_hash_->Update(audio_bus_.get(), frames_received);
59 if (!frames_received) { 58 if (!frames_received) {
60 // No data received, so let other threads run to provide data. 59 // No data received, so let other threads run to provide data.
61 base::PlatformThread::YieldCurrentThread(); 60 base::PlatformThread::YieldCurrentThread();
62 } else if (start.is_null()) { 61 } else if (start.is_null()) {
63 // First time we processed some audio, so record the starting time. 62 // First time we processed some audio, so record the starting time.
64 start = base::TimeTicks::Now(); 63 start = base::TimeTicks::Now();
65 } else { 64 } else {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 void ClocklessAudioSink::StartAudioHashForTesting() { 141 void ClocklessAudioSink::StartAudioHashForTesting() {
143 DCHECK(!initialized_); 142 DCHECK(!initialized_);
144 hashing_ = true; 143 hashing_ = true;
145 } 144 }
146 145
147 std::string ClocklessAudioSink::GetAudioHashForTesting() { 146 std::string ClocklessAudioSink::GetAudioHashForTesting() {
148 return thread_ && hashing_ ? thread_->GetAudioHash() : std::string(); 147 return thread_ && hashing_ ? thread_->GetAudioHash() : std::string();
149 } 148 }
150 149
151 } // namespace media 150 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_output_stream_sink.cc ('k') | media/audio/null_audio_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698