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

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. 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 "content/renderer/media/android/webmediaplayer_android.h" 5 #include "content/renderer/media/android/webmediaplayer_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 29 matching lines...) Expand all
40 #include "media/base/media_keys.h" 40 #include "media/base/media_keys.h"
41 #include "media/base/media_log.h" 41 #include "media/base/media_log.h"
42 #include "media/base/media_switches.h" 42 #include "media/base/media_switches.h"
43 #include "media/base/timestamp_constants.h" 43 #include "media/base/timestamp_constants.h"
44 #include "media/base/video_frame.h" 44 #include "media/base/video_frame.h"
45 #include "media/blink/webcontentdecryptionmodule_impl.h" 45 #include "media/blink/webcontentdecryptionmodule_impl.h"
46 #include "media/blink/webmediaplayer_cast_android.h" 46 #include "media/blink/webmediaplayer_cast_android.h"
47 #include "media/blink/webmediaplayer_delegate.h" 47 #include "media/blink/webmediaplayer_delegate.h"
48 #include "media/blink/webmediaplayer_util.h" 48 #include "media/blink/webmediaplayer_util.h"
49 #include "net/base/mime_util.h" 49 #include "net/base/mime_util.h"
50 #include "skia/ext/cdl_paint.h"
50 #include "skia/ext/texture_handle.h" 51 #include "skia/ext/texture_handle.h"
51 #include "third_party/WebKit/public/platform/Platform.h" 52 #include "third_party/WebKit/public/platform/Platform.h"
52 #include "third_party/WebKit/public/platform/URLConversion.h" 53 #include "third_party/WebKit/public/platform/URLConversion.h"
53 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" 54 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
54 #include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h" 55 #include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h"
55 #include "third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h" 56 #include "third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h"
56 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" 57 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h"
57 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient. h" 58 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient. h"
58 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" 59 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h"
59 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 60 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
60 #include "third_party/WebKit/public/platform/WebString.h" 61 #include "third_party/WebKit/public/platform/WebString.h"
61 #include "third_party/WebKit/public/platform/WebURL.h" 62 #include "third_party/WebKit/public/platform/WebURL.h"
62 #include "third_party/WebKit/public/web/WebDocument.h" 63 #include "third_party/WebKit/public/web/WebDocument.h"
63 #include "third_party/WebKit/public/web/WebFrame.h" 64 #include "third_party/WebKit/public/web/WebFrame.h"
64 #include "third_party/WebKit/public/web/WebView.h" 65 #include "third_party/WebKit/public/web/WebView.h"
65 #include "third_party/skia/include/core/SkCanvas.h" 66 #include "third_party/skia/include/core/SkCanvas.h"
66 #include "third_party/skia/include/core/SkImage.h" 67 #include "third_party/skia/include/core/SkImage.h"
67 #include "third_party/skia/include/core/SkPaint.h"
68 #include "third_party/skia/include/core/SkTypeface.h" 68 #include "third_party/skia/include/core/SkTypeface.h"
69 #include "ui/gfx/image/image.h" 69 #include "ui/gfx/image/image.h"
70 #include "url/gurl.h" 70 #include "url/gurl.h"
71 #include "url/origin.h" 71 #include "url/origin.h"
72 72
73 static const uint32_t kGLTextureExternalOES = 0x8D65; 73 static const uint32_t kGLTextureExternalOES = 0x8D65;
74 static const int kSDKVersionToSupportSecurityOriginCheck = 20; 74 static const int kSDKVersionToSupportSecurityOriginCheck = 20;
75 75
76 using blink::WebMediaPlayer; 76 using blink::WebMediaPlayer;
77 using blink::WebSize; 77 using blink::WebSize;
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 } 501 }
502 502
503 bool WebMediaPlayerAndroid::didLoadingProgress() { 503 bool WebMediaPlayerAndroid::didLoadingProgress() {
504 bool ret = did_loading_progress_; 504 bool ret = did_loading_progress_;
505 did_loading_progress_ = false; 505 did_loading_progress_ = false;
506 return ret; 506 return ret;
507 } 507 }
508 508
509 void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas, 509 void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas,
510 const blink::WebRect& rect, 510 const blink::WebRect& rect,
511 SkPaint& paint) { 511 CdlPaint& paint) {
512 DCHECK(main_thread_checker_.CalledOnValidThread()); 512 DCHECK(main_thread_checker_.CalledOnValidThread());
513 std::unique_ptr<blink::WebGraphicsContext3DProvider> provider( 513 std::unique_ptr<blink::WebGraphicsContext3DProvider> provider(
514 blink::Platform::current() 514 blink::Platform::current()
515 ->createSharedOffscreenGraphicsContext3DProvider()); 515 ->createSharedOffscreenGraphicsContext3DProvider());
516 if (!provider) 516 if (!provider)
517 return; 517 return;
518 gpu::gles2::GLES2Interface* gl = provider->contextGL(); 518 gpu::gles2::GLES2Interface* gl = provider->contextGL();
519 519
520 scoped_refptr<VideoFrame> video_frame; 520 scoped_refptr<VideoFrame> video_frame;
521 { 521 {
(...skipping 27 matching lines...) Expand all
549 kOpaque_SkAlphaType)); 549 kOpaque_SkAlphaType));
550 if (!image) 550 if (!image)
551 return; 551 return;
552 552
553 // Draw the texture based image onto the Canvas. If the canvas is 553 // Draw the texture based image onto the Canvas. If the canvas is
554 // hardware based, this will do a GPU-GPU texture copy. 554 // hardware based, this will do a GPU-GPU texture copy.
555 // If the canvas is software based, the texture based bitmap will be 555 // If the canvas is software based, the texture based bitmap will be
556 // readbacked to system memory then draw onto the canvas. 556 // readbacked to system memory then draw onto the canvas.
557 SkRect dest; 557 SkRect dest;
558 dest.set(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height); 558 dest.set(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height);
559 SkPaint video_paint; 559 CdlPaint video_paint;
560 video_paint.setAlpha(paint.getAlpha()); 560 video_paint.setAlpha(paint.getAlpha());
561 video_paint.setBlendMode(paint.getBlendMode()); 561 video_paint.setBlendMode(paint.getBlendMode());
562 // It is not necessary to pass the dest into the drawBitmap call since all 562 // It is not necessary to pass the dest into the drawBitmap call since all
563 // the context have been set up before calling paintCurrentFrameInContext. 563 // the context have been set up before calling paintCurrentFrameInContext.
564 canvas->drawImageRect(image, dest, &video_paint); 564 canvas->drawImageRect(image, dest, &video_paint);
565 565
566 // Ensure the Skia draw of the GL texture is flushed to GL, delete the 566 // Ensure the Skia draw of the GL texture is flushed to GL, delete the
567 // mailboxed texture from this context, and then signal that we're done with 567 // mailboxed texture from this context, and then signal that we're done with
568 // the video frame. 568 // the video frame.
569 canvas->flush(); 569 canvas->flush();
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1319 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1320 switches::kDisableMediaSuspend)) { 1320 switches::kDisableMediaSuspend)) {
1321 return false; 1321 return false;
1322 } 1322 }
1323 1323
1324 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) && 1324 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) &&
1325 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden(); 1325 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden();
1326 } 1326 }
1327 1327
1328 } // namespace content 1328 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | content/renderer/media/html_video_element_capturer_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698