| 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 #include <string> | 10 #include <string> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "media/blink/texttrack_impl.h" | 41 #include "media/blink/texttrack_impl.h" |
| 42 #include "media/blink/webaudiosourceprovider_impl.h" | 42 #include "media/blink/webaudiosourceprovider_impl.h" |
| 43 #include "media/blink/webcontentdecryptionmodule_impl.h" | 43 #include "media/blink/webcontentdecryptionmodule_impl.h" |
| 44 #include "media/blink/webinbandtexttrack_impl.h" | 44 #include "media/blink/webinbandtexttrack_impl.h" |
| 45 #include "media/blink/webmediaplayer_delegate.h" | 45 #include "media/blink/webmediaplayer_delegate.h" |
| 46 #include "media/blink/webmediaplayer_util.h" | 46 #include "media/blink/webmediaplayer_util.h" |
| 47 #include "media/blink/webmediasource_impl.h" | 47 #include "media/blink/webmediasource_impl.h" |
| 48 #include "media/filters/chunk_demuxer.h" | 48 #include "media/filters/chunk_demuxer.h" |
| 49 #include "media/filters/ffmpeg_demuxer.h" | 49 #include "media/filters/ffmpeg_demuxer.h" |
| 50 #include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h" | 50 #include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h" |
| 51 #include "third_party/WebKit/public/platform/WebMediaElementSource.h" |
| 51 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" | 52 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
| 52 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.
h" | 53 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.
h" |
| 53 #include "third_party/WebKit/public/platform/WebMediaSource.h" | 54 #include "third_party/WebKit/public/platform/WebMediaSource.h" |
| 54 #include "third_party/WebKit/public/platform/WebRect.h" | 55 #include "third_party/WebKit/public/platform/WebRect.h" |
| 55 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 56 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 56 #include "third_party/WebKit/public/platform/WebSize.h" | 57 #include "third_party/WebKit/public/platform/WebSize.h" |
| 57 #include "third_party/WebKit/public/platform/WebString.h" | 58 #include "third_party/WebKit/public/platform/WebString.h" |
| 58 #include "third_party/WebKit/public/platform/WebURL.h" | 59 #include "third_party/WebKit/public/platform/WebURL.h" |
| 59 #include "third_party/WebKit/public/web/WebFrame.h" | 60 #include "third_party/WebKit/public/web/WebFrame.h" |
| 60 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 61 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 253 |
| 253 if (last_reported_memory_usage_) | 254 if (last_reported_memory_usage_) |
| 254 adjust_allocated_memory_cb_.Run(-last_reported_memory_usage_); | 255 adjust_allocated_memory_cb_.Run(-last_reported_memory_usage_); |
| 255 | 256 |
| 256 compositor_task_runner_->DeleteSoon(FROM_HERE, compositor_); | 257 compositor_task_runner_->DeleteSoon(FROM_HERE, compositor_); |
| 257 | 258 |
| 258 media_log_->AddEvent( | 259 media_log_->AddEvent( |
| 259 media_log_->CreateEvent(MediaLogEvent::WEBMEDIAPLAYER_DESTROYED)); | 260 media_log_->CreateEvent(MediaLogEvent::WEBMEDIAPLAYER_DESTROYED)); |
| 260 } | 261 } |
| 261 | 262 |
| 262 void WebMediaPlayerImpl::load(LoadType load_type, const blink::WebURL& url, | 263 void WebMediaPlayerImpl::load(LoadType load_type, |
| 264 const blink::WebMediaElementSource& source, |
| 263 CORSMode cors_mode) { | 265 CORSMode cors_mode) { |
| 266 // Only URL or MSE blob URL is supported. |
| 267 DCHECK(source.isURL()); |
| 268 blink::WebURL url = source.getAsURL(); |
| 264 DVLOG(1) << __FUNCTION__ << "(" << load_type << ", " << url << ", " | 269 DVLOG(1) << __FUNCTION__ << "(" << load_type << ", " << url << ", " |
| 265 << cors_mode << ")"; | 270 << cors_mode << ")"; |
| 266 if (!defer_load_cb_.is_null()) { | 271 if (!defer_load_cb_.is_null()) { |
| 267 defer_load_cb_.Run(base::Bind( | 272 defer_load_cb_.Run(base::Bind( |
| 268 &WebMediaPlayerImpl::DoLoad, AsWeakPtr(), load_type, url, cors_mode)); | 273 &WebMediaPlayerImpl::DoLoad, AsWeakPtr(), load_type, url, cors_mode)); |
| 269 return; | 274 return; |
| 270 } | 275 } |
| 271 DoLoad(load_type, url, cors_mode); | 276 DoLoad(load_type, url, cors_mode); |
| 272 } | 277 } |
| 273 | 278 |
| (...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() { | 1550 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() { |
| 1546 #if defined(OS_ANDROID) | 1551 #if defined(OS_ANDROID) |
| 1547 return !hasVideo() || (delegate_ && !delegate_->IsHidden()); | 1552 return !hasVideo() || (delegate_ && !delegate_->IsHidden()); |
| 1548 #else | 1553 #else |
| 1549 // On non-Android platforms Resume() is always allowed. | 1554 // On non-Android platforms Resume() is always allowed. |
| 1550 return true; | 1555 return true; |
| 1551 #endif | 1556 #endif |
| 1552 } | 1557 } |
| 1553 | 1558 |
| 1554 } // namespace media | 1559 } // namespace media |
| OLD | NEW |