| OLD | NEW |
| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 GURL security_origin(frame_->securityOrigin().toString().utf8()); |
| 410 output_device->SwitchOutputDevice(device_id_str, security_origin, callback); | 410 output_device->SwitchOutputDevice(device_id_str, security_origin, callback); |
| 411 } else { | 411 } else { |
| 412 callback.Run(SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED); | 412 callback.Run(SWITCH_OUTPUT_DEVICE_RESULT_ERROR_INTERNAL); |
| 413 } | 413 } |
| 414 } | 414 } |
| 415 | 415 |
| 416 #define STATIC_ASSERT_MATCHING_ENUM(webkit_name, chromium_name) \ | 416 #define STATIC_ASSERT_MATCHING_ENUM(webkit_name, chromium_name) \ |
| 417 static_assert(static_cast<int>(WebMediaPlayer::webkit_name) == \ | 417 static_assert(static_cast<int>(WebMediaPlayer::webkit_name) == \ |
| 418 static_cast<int>(BufferedDataSource::chromium_name), \ | 418 static_cast<int>(BufferedDataSource::chromium_name), \ |
| 419 "mismatching enum values: " #webkit_name) | 419 "mismatching enum values: " #webkit_name) |
| 420 STATIC_ASSERT_MATCHING_ENUM(PreloadNone, NONE); | 420 STATIC_ASSERT_MATCHING_ENUM(PreloadNone, NONE); |
| 421 STATIC_ASSERT_MATCHING_ENUM(PreloadMetaData, METADATA); | 421 STATIC_ASSERT_MATCHING_ENUM(PreloadMetaData, METADATA); |
| 422 STATIC_ASSERT_MATCHING_ENUM(PreloadAuto, AUTO); | 422 STATIC_ASSERT_MATCHING_ENUM(PreloadAuto, AUTO); |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 | 1063 |
| 1064 // pause() may be called after playback has ended and the HTMLMediaElement | 1064 // pause() may be called after playback has ended and the HTMLMediaElement |
| 1065 // requires that currentTime() == duration() after ending. We want to ensure | 1065 // requires that currentTime() == duration() after ending. We want to ensure |
| 1066 // |paused_time_| matches currentTime() in this case or a future seek() may | 1066 // |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. | 1067 // incorrectly discard what it thinks is a seek to the existing time. |
| 1068 paused_time_ = | 1068 paused_time_ = |
| 1069 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); | 1069 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); |
| 1070 } | 1070 } |
| 1071 | 1071 |
| 1072 } // namespace media | 1072 } // namespace media |
| OLD | NEW |