| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 401 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 402 DVLOG(1) << __FUNCTION__; | 402 DVLOG(1) << __FUNCTION__; |
| 403 media::SwitchOutputDeviceCB callback = | 403 media::SwitchOutputDeviceCB callback = |
| 404 media::ConvertToSwitchOutputDeviceCB(web_callback); | 404 media::ConvertToSwitchOutputDeviceCB(web_callback); |
| 405 OutputDevice* output_device = audio_source_provider_->GetOutputDevice(); | 405 OutputDevice* output_device = audio_source_provider_->GetOutputDevice(); |
| 406 if (output_device) { | 406 if (output_device) { |
| 407 std::string device_id_str(device_id.utf8()); | 407 std::string device_id_str(device_id.utf8()); |
| 408 GURL security_origin(frame_->securityOrigin().toString().utf8()); | 408 GURL security_origin(frame_->securityOrigin().toString().utf8()); |
| 409 output_device->SwitchOutputDevice(device_id_str, security_origin, callback); | 409 output_device->SwitchOutputDevice(device_id_str, security_origin, callback); |
| 410 } else { | 410 } else { |
| 411 callback.Run(SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED); | 411 callback.Run(SWITCH_OUTPUT_DEVICE_RESULT_ERROR_INTERNAL); |
| 412 } | 412 } |
| 413 } | 413 } |
| 414 | 414 |
| 415 #define STATIC_ASSERT_MATCHING_ENUM(webkit_name, chromium_name) \ | 415 #define STATIC_ASSERT_MATCHING_ENUM(webkit_name, chromium_name) \ |
| 416 static_assert(static_cast<int>(WebMediaPlayer::webkit_name) == \ | 416 static_assert(static_cast<int>(WebMediaPlayer::webkit_name) == \ |
| 417 static_cast<int>(BufferedDataSource::chromium_name), \ | 417 static_cast<int>(BufferedDataSource::chromium_name), \ |
| 418 "mismatching enum values: " #webkit_name) | 418 "mismatching enum values: " #webkit_name) |
| 419 STATIC_ASSERT_MATCHING_ENUM(PreloadNone, NONE); | 419 STATIC_ASSERT_MATCHING_ENUM(PreloadNone, NONE); |
| 420 STATIC_ASSERT_MATCHING_ENUM(PreloadMetaData, METADATA); | 420 STATIC_ASSERT_MATCHING_ENUM(PreloadMetaData, METADATA); |
| 421 STATIC_ASSERT_MATCHING_ENUM(PreloadAuto, AUTO); | 421 STATIC_ASSERT_MATCHING_ENUM(PreloadAuto, AUTO); |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 | 1059 |
| 1060 // pause() may be called after playback has ended and the HTMLMediaElement | 1060 // pause() may be called after playback has ended and the HTMLMediaElement |
| 1061 // requires that currentTime() == duration() after ending. We want to ensure | 1061 // requires that currentTime() == duration() after ending. We want to ensure |
| 1062 // |paused_time_| matches currentTime() in this case or a future seek() may | 1062 // |paused_time_| matches currentTime() in this case or a future seek() may |
| 1063 // incorrectly discard what it thinks is a seek to the existing time. | 1063 // incorrectly discard what it thinks is a seek to the existing time. |
| 1064 paused_time_ = | 1064 paused_time_ = |
| 1065 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); | 1065 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 } // namespace media | 1068 } // namespace media |
| OLD | NEW |