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

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

Issue 2038053002: Change audio render thread checking to use new AudioRendererSink::BelongsToRendererThread() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using the new BelongsTo...() function for thread checking. Created 4 years, 6 months 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 "media/audio/null_audio_sink.h" 5 #include "media/audio/null_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 "media/audio/fake_audio_worker.h" 10 #include "media/audio/fake_audio_worker.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 bool NullAudioSink::SetVolume(double volume) { 73 bool NullAudioSink::SetVolume(double volume) {
74 // Audio is always muted. 74 // Audio is always muted.
75 return volume == 0.0; 75 return volume == 0.0;
76 } 76 }
77 77
78 OutputDeviceInfo NullAudioSink::GetOutputDeviceInfo() { 78 OutputDeviceInfo NullAudioSink::GetOutputDeviceInfo() {
79 return OutputDeviceInfo(); 79 return OutputDeviceInfo();
80 } 80 }
81 81
82 bool NullAudioSink::BelongsToRenderingThread() {
83 NOTIMPLEMENTED();
DaleCurtis 2016/06/10 18:24:49 This is used in production, so I think you want to
Henrik Grunell 2016/06/13 12:46:15 Done.
84 return false;
85 }
86
82 void NullAudioSink::SwitchOutputDevice(const std::string& device_id, 87 void NullAudioSink::SwitchOutputDevice(const std::string& device_id,
83 const url::Origin& security_origin, 88 const url::Origin& security_origin,
84 const OutputDeviceStatusCB& callback) { 89 const OutputDeviceStatusCB& callback) {
85 callback.Run(OUTPUT_DEVICE_STATUS_ERROR_INTERNAL); 90 callback.Run(OUTPUT_DEVICE_STATUS_ERROR_INTERNAL);
86 } 91 }
87 92
88 void NullAudioSink::CallRender() { 93 void NullAudioSink::CallRender() {
89 DCHECK(task_runner_->BelongsToCurrentThread()); 94 DCHECK(task_runner_->BelongsToCurrentThread());
90 95
91 int frames_received = callback_->Render(audio_bus_.get(), 0, 0); 96 int frames_received = callback_->Render(audio_bus_.get(), 0, 0);
92 if (!audio_hash_ || frames_received <= 0) 97 if (!audio_hash_ || frames_received <= 0)
93 return; 98 return;
94 99
95 audio_hash_->Update(audio_bus_.get(), frames_received); 100 audio_hash_->Update(audio_bus_.get(), frames_received);
96 } 101 }
97 102
98 void NullAudioSink::StartAudioHashForTesting() { 103 void NullAudioSink::StartAudioHashForTesting() {
99 DCHECK(!initialized_); 104 DCHECK(!initialized_);
100 audio_hash_.reset(new AudioHash()); 105 audio_hash_.reset(new AudioHash());
101 } 106 }
102 107
103 std::string NullAudioSink::GetAudioHashForTesting() { 108 std::string NullAudioSink::GetAudioHashForTesting() {
104 return audio_hash_ ? audio_hash_->ToString() : std::string(); 109 return audio_hash_ ? audio_hash_->ToString() : std::string();
105 } 110 }
106 111
107 } // namespace media 112 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698