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

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

Issue 1323403005: Allow AudioOutputDevice objects to be initialized with a specific hardware output device and store … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Palmer's comments Created 5 years, 3 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 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 10
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 399
400 void WebMediaPlayerImpl::setSinkId(const blink::WebString& device_id, 400 void WebMediaPlayerImpl::setSinkId(const blink::WebString& device_id,
401 WebSetSinkIdCB* web_callback) { 401 WebSetSinkIdCB* web_callback) {
402 DCHECK(main_task_runner_->BelongsToCurrentThread()); 402 DCHECK(main_task_runner_->BelongsToCurrentThread());
403 DVLOG(1) << __FUNCTION__; 403 DVLOG(1) << __FUNCTION__;
404 media::SwitchOutputDeviceCB callback = 404 media::SwitchOutputDeviceCB callback =
405 media::ConvertToSwitchOutputDeviceCB(web_callback); 405 media::ConvertToSwitchOutputDeviceCB(web_callback);
406 OutputDevice* output_device = audio_source_provider_->GetOutputDevice(); 406 OutputDevice* output_device = audio_source_provider_->GetOutputDevice();
407 if (output_device) { 407 if (output_device) {
408 std::string device_id_str(device_id.utf8()); 408 std::string device_id_str(device_id.utf8());
409 GURL security_origin(frame_->securityOrigin().toString().utf8()); 409 url::Origin security_origin(
410 GURL(frame_->securityOrigin().toString().utf8()));
410 output_device->SwitchOutputDevice(device_id_str, security_origin, callback); 411 output_device->SwitchOutputDevice(device_id_str, security_origin, callback);
411 } else { 412 } else {
412 callback.Run(SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED); 413 callback.Run(SWITCH_OUTPUT_DEVICE_RESULT_ERROR_INTERNAL);
413 } 414 }
414 } 415 }
415 416
416 #define STATIC_ASSERT_MATCHING_ENUM(webkit_name, chromium_name) \ 417 #define STATIC_ASSERT_MATCHING_ENUM(webkit_name, chromium_name) \
417 static_assert(static_cast<int>(WebMediaPlayer::webkit_name) == \ 418 static_assert(static_cast<int>(WebMediaPlayer::webkit_name) == \
418 static_cast<int>(BufferedDataSource::chromium_name), \ 419 static_cast<int>(BufferedDataSource::chromium_name), \
419 "mismatching enum values: " #webkit_name) 420 "mismatching enum values: " #webkit_name)
420 STATIC_ASSERT_MATCHING_ENUM(PreloadNone, NONE); 421 STATIC_ASSERT_MATCHING_ENUM(PreloadNone, NONE);
421 STATIC_ASSERT_MATCHING_ENUM(PreloadMetaData, METADATA); 422 STATIC_ASSERT_MATCHING_ENUM(PreloadMetaData, METADATA);
422 STATIC_ASSERT_MATCHING_ENUM(PreloadAuto, AUTO); 423 STATIC_ASSERT_MATCHING_ENUM(PreloadAuto, AUTO);
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 1064
1064 // pause() may be called after playback has ended and the HTMLMediaElement 1065 // pause() may be called after playback has ended and the HTMLMediaElement
1065 // requires that currentTime() == duration() after ending. We want to ensure 1066 // requires that currentTime() == duration() after ending. We want to ensure
1066 // |paused_time_| matches currentTime() in this case or a future seek() may 1067 // |paused_time_| matches currentTime() in this case or a future seek() may
1067 // incorrectly discard what it thinks is a seek to the existing time. 1068 // incorrectly discard what it thinks is a seek to the existing time.
1068 paused_time_ = 1069 paused_time_ =
1069 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); 1070 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime();
1070 } 1071 }
1071 1072
1072 } // namespace media 1073 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698