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

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 2533443002: fallback to null sink in WebAudioSourceProvider::Initialize() + UMA stats for device status (Closed)
Patch Set: Created 4 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 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/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 media_log_->AddEvent( 259 media_log_->AddEvent(
260 media_log_->CreateEvent(MediaLogEvent::WEBMEDIAPLAYER_CREATED)); 260 media_log_->CreateEvent(MediaLogEvent::WEBMEDIAPLAYER_CREATED));
261 261
262 if (params.initial_cdm()) 262 if (params.initial_cdm())
263 SetCdm(params.initial_cdm()); 263 SetCdm(params.initial_cdm());
264 264
265 // TODO(xhwang): When we use an external Renderer, many methods won't work, 265 // TODO(xhwang): When we use an external Renderer, many methods won't work,
266 // e.g. GetCurrentFrameFromCompositor(). See http://crbug.com/434861 266 // e.g. GetCurrentFrameFromCompositor(). See http://crbug.com/434861
267 267
268 if (params.audio_renderer_sink().get()) {
Guido Urdaneta 2016/11/24 17:30:09 nit: Should a stat be collected if params.audio_re
269 media::OutputDeviceStatus device_status =
270 params.audio_renderer_sink()->GetOutputDeviceInfo().device_status();
DaleCurtis 2016/11/28 18:58:17 In retrospect we probably shouldn't do this since
o1ka 2016/11/29 13:55:58 It's not new in this CL, we have already been doin
DaleCurtis 2016/11/29 20:32:02 I know, sorry I wasn't clear, I was saying it's no
o1ka 2016/11/30 16:13:47 Ah I see. We can probably defer fallback until Web
271 UMA_HISTOGRAM_ENUMERATION("Media.AudioSinkStatus", device_status,
DaleCurtis 2016/11/28 18:58:17 Maybe Media.WebMediaPlayer.SinkStatus?
o1ka 2016/11/30 16:13:48 Done.
272 OUTPUT_DEVICE_STATUS_MAX + 1);
273
274 if (device_status == OUTPUT_DEVICE_STATUS_OK) {
275 audio_source_provider_ =
276 new WebAudioSourceProviderImpl(params.audio_renderer_sink());
277 return;
278 }
279 LOG(WARNING) << "Output device error, falling back to null sink";
DaleCurtis 2016/11/28 18:58:17 This should be a MEDIA_LOG() so it shows up in chr
o1ka 2016/11/30 16:13:47 Done.
280 }
268 // Use the null sink if no valid sink was provided. 281 // Use the null sink if no valid sink was provided.
269 audio_source_provider_ = new WebAudioSourceProviderImpl( 282 audio_source_provider_ =
270 params.audio_renderer_sink().get() && 283 new WebAudioSourceProviderImpl(new NullAudioSink(media_task_runner_));
271 params.audio_renderer_sink()
272 ->GetOutputDeviceInfo()
273 .device_status() == OUTPUT_DEVICE_STATUS_OK
274 ? params.audio_renderer_sink()
275 : new NullAudioSink(media_task_runner_));
276 } 284 }
277 285
278 WebMediaPlayerImpl::~WebMediaPlayerImpl() { 286 WebMediaPlayerImpl::~WebMediaPlayerImpl() {
279 DCHECK(main_task_runner_->BelongsToCurrentThread()); 287 DCHECK(main_task_runner_->BelongsToCurrentThread());
280 288
281 suppress_destruction_errors_ = true; 289 suppress_destruction_errors_ = true;
282 if (delegate_) { 290 if (delegate_) {
283 delegate_->PlayerGone(delegate_id_); 291 delegate_->PlayerGone(delegate_id_);
284 delegate_->RemoveObserver(delegate_id_); 292 delegate_->RemoveObserver(delegate_id_);
285 } 293 }
(...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 watch_time_reporter_->OnShown(); 1989 watch_time_reporter_->OnShown();
1982 } 1990 }
1983 1991
1984 bool WebMediaPlayerImpl::IsHidden() const { 1992 bool WebMediaPlayerImpl::IsHidden() const {
1985 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1993 DCHECK(main_task_runner_->BelongsToCurrentThread());
1986 1994
1987 return delegate_ && delegate_->IsHidden(); 1995 return delegate_ && delegate_->IsHidden();
1988 } 1996 }
1989 1997
1990 } // namespace media 1998 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698