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

Side by Side Diff: media/base/fake_audio_renderer_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/base/fake_audio_renderer_sink.h ('k') | media/blink/webaudiosourceprovider_impl.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/base/fake_audio_renderer_sink.h" 5 #include "media/base/fake_audio_renderer_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/logging.h" 9 #include "base/logging.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 54
55 bool FakeAudioRendererSink::SetVolume(double volume) { 55 bool FakeAudioRendererSink::SetVolume(double volume) {
56 return true; 56 return true;
57 } 57 }
58 58
59 OutputDevice* FakeAudioRendererSink::GetOutputDevice() { 59 OutputDevice* FakeAudioRendererSink::GetOutputDevice() {
60 return output_device_.get(); 60 return output_device_.get();
61 } 61 }
62 62
63 bool FakeAudioRendererSink::Render(AudioBus* dest, int audio_delay_milliseconds, 63 bool FakeAudioRendererSink::Render(AudioBus* dest,
64 uint32_t audio_delay_milliseconds,
64 int* frames_written) { 65 int* frames_written) {
65 if (state_ != kPlaying) 66 if (state_ != kPlaying)
66 return false; 67 return false;
67 68
68 *frames_written = callback_->Render(dest, audio_delay_milliseconds); 69 *frames_written = callback_->Render(dest, audio_delay_milliseconds, 0);
69 return true; 70 return true;
70 } 71 }
71 72
72 void FakeAudioRendererSink::OnRenderError() { 73 void FakeAudioRendererSink::OnRenderError() {
73 DCHECK_NE(state_, kUninitialized); 74 DCHECK_NE(state_, kUninitialized);
74 DCHECK_NE(state_, kStopped); 75 DCHECK_NE(state_, kStopped);
75 76
76 callback_->OnRenderError(); 77 callback_->OnRenderError();
77 } 78 }
78 79
79 void FakeAudioRendererSink::ChangeState(State new_state) { 80 void FakeAudioRendererSink::ChangeState(State new_state) {
80 static const char* kStateNames[] = { 81 static const char* kStateNames[] = {
81 "kUninitialized", 82 "kUninitialized",
82 "kInitialized", 83 "kInitialized",
83 "kStarted", 84 "kStarted",
84 "kPaused", 85 "kPaused",
85 "kPlaying", 86 "kPlaying",
86 "kStopped" 87 "kStopped"
87 }; 88 };
88 89
89 DVLOG(1) << __FUNCTION__ << " : " 90 DVLOG(1) << __FUNCTION__ << " : "
90 << kStateNames[state_] << " -> " << kStateNames[new_state]; 91 << kStateNames[state_] << " -> " << kStateNames[new_state];
91 state_ = new_state; 92 state_ = new_state;
92 } 93 }
93 94
94 } // namespace media 95 } // namespace media
OLDNEW
« no previous file with comments | « media/base/fake_audio_renderer_sink.h ('k') | media/blink/webaudiosourceprovider_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698