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

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

Issue 445013002: media: Optimize HW Video to 2D Canvas copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use scratch texture Created 6 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 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_
6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ 6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "cc/layers/video_frame_provider.h" 18 #include "cc/layers/video_frame_provider.h"
19 #include "content/common/media/media_player_messages_enums_android.h" 19 #include "content/common/media/media_player_messages_enums_android.h"
20 #include "content/public/renderer/render_frame_observer.h" 20 #include "content/public/renderer/render_frame_observer.h"
21 #include "content/renderer/media/android/media_info_loader.h" 21 #include "content/renderer/media/android/media_info_loader.h"
22 #include "content/renderer/media/android/media_source_delegate.h" 22 #include "content/renderer/media/android/media_source_delegate.h"
23 #include "content/renderer/media/android/stream_texture_factory.h" 23 #include "content/renderer/media/android/stream_texture_factory.h"
24 #include "content/renderer/media/crypto/proxy_decryptor.h" 24 #include "content/renderer/media/crypto/proxy_decryptor.h"
25 #include "gpu/command_buffer/common/mailbox.h" 25 #include "gpu/command_buffer/common/mailbox.h"
26 #include "media/base/android/media_player_android.h" 26 #include "media/base/android/media_player_android.h"
27 #include "media/base/demuxer_stream.h" 27 #include "media/base/demuxer_stream.h"
28 #include "media/base/media_keys.h" 28 #include "media/base/media_keys.h"
29 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 29 #include "media/filters/skcanvas_video_renderer.h"
30 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" 30 #include "third_party/WebKit/public/platform/WebMediaPlayer.h"
31 #include "third_party/WebKit/public/platform/WebSize.h" 31 #include "third_party/WebKit/public/platform/WebSize.h"
32 #include "third_party/WebKit/public/platform/WebURL.h" 32 #include "third_party/WebKit/public/platform/WebURL.h"
33 #include "third_party/skia/include/core/SkBitmap.h"
34 #include "third_party/skia/include/gpu/GrContext.h"
35 #include "third_party/skia/include/gpu/SkGrPixelRef.h"
36 #include "ui/gfx/rect_f.h" 33 #include "ui/gfx/rect_f.h"
37 34
38 namespace base { 35 namespace base {
39 class SingleThreadTaskRunner; 36 class SingleThreadTaskRunner;
40 } 37 }
41 38
42 namespace blink { 39 namespace blink {
43 class WebContentDecryptionModule; 40 class WebContentDecryptionModule;
44 class WebContentDecryptionModuleResult; 41 class WebContentDecryptionModuleResult;
45 class WebFrame; 42 class WebFrame;
43 class WebGraphicsContext3D;
46 class WebURL; 44 class WebURL;
47 } 45 }
48 46
49 namespace cc_blink { 47 namespace cc_blink {
50 class WebLayerImpl; 48 class WebLayerImpl;
51 } 49 }
52 50
53 namespace gpu { 51 namespace gpu {
54 struct MailboxHolder; 52 struct MailboxHolder;
55 } 53 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 virtual bool supportsSave() const; 103 virtual bool supportsSave() const;
106 virtual void setRate(double rate); 104 virtual void setRate(double rate);
107 virtual void setVolume(double volume); 105 virtual void setVolume(double volume);
108 virtual blink::WebTimeRanges buffered() const; 106 virtual blink::WebTimeRanges buffered() const;
109 virtual double maxTimeSeekable() const; 107 virtual double maxTimeSeekable() const;
110 108
111 // Poster image, as defined in the <video> element. 109 // Poster image, as defined in the <video> element.
112 virtual void setPoster(const blink::WebURL& poster) OVERRIDE; 110 virtual void setPoster(const blink::WebURL& poster) OVERRIDE;
113 111
114 // Methods for painting. 112 // Methods for painting.
115 // FIXME: This path "only works" on Android. It is a workaround for the
116 // issue that Skia could not handle Android's GL_TEXTURE_EXTERNAL_OES texture
117 // internally. It should be removed and replaced by the normal paint path.
118 // https://code.google.com/p/skia/issues/detail?id=1189
119 virtual void paint(blink::WebCanvas* canvas, 113 virtual void paint(blink::WebCanvas* canvas,
120 const blink::WebRect& rect, 114 const blink::WebRect& rect,
121 unsigned char alpha, 115 unsigned char alpha,
122 SkXfermode::Mode mode); 116 SkXfermode::Mode mode);
123 // TODO(dshwang): remove it because above method replaces. crbug.com/401027 117 // TODO(dshwang): remove it because above method replaces. crbug.com/401027
124 virtual void paint(blink::WebCanvas* canvas, 118 virtual void paint(blink::WebCanvas* canvas,
125 const blink::WebRect& rect, 119 const blink::WebRect& rect,
126 unsigned char alpha); 120 unsigned char alpha);
127 121
128 virtual bool copyVideoTextureToPlatformTexture( 122 virtual bool copyVideoTextureToPlatformTexture(
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 // If |decryptor_ready_cb| is null, the existing callback will be fired with 301 // If |decryptor_ready_cb| is null, the existing callback will be fired with
308 // NULL immediately and reset. 302 // NULL immediately and reset.
309 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); 303 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb);
310 304
311 // Called when the ContentDecryptionModule has been attached to the 305 // Called when the ContentDecryptionModule has been attached to the
312 // pipeline/decoders. 306 // pipeline/decoders.
313 void ContentDecryptionModuleAttached( 307 void ContentDecryptionModuleAttached(
314 blink::WebContentDecryptionModuleResult result, 308 blink::WebContentDecryptionModuleResult result,
315 bool success); 309 bool success);
316 310
317 bool EnsureTextureBackedSkBitmap(GrContext* gr, SkBitmap& bitmap,
318 const blink::WebSize& size,
319 GrSurfaceOrigin origin,
320 GrPixelConfig config);
321
322 bool IsHLSStream() const; 311 bool IsHLSStream() const;
323 312
324 blink::WebFrame* const frame_; 313 blink::WebFrame* const frame_;
325 314
326 blink::WebMediaPlayerClient* const client_; 315 blink::WebMediaPlayerClient* const client_;
327 316
328 // |delegate_| is used to notify the browser process of the player status, so 317 // |delegate_| is used to notify the browser process of the player status, so
329 // that the browser process can control screen locks. 318 // that the browser process can control screen locks.
330 // TODO(qinmin): Currently android mediaplayer takes care of the screen 319 // TODO(qinmin): Currently android mediaplayer takes care of the screen
331 // lock. So this is only used for media source. Will apply this to regular 320 // lock. So this is only used for media source. Will apply this to regular
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 // Non-owned pointer to the CDM. Updated via calls to 466 // Non-owned pointer to the CDM. Updated via calls to
478 // setContentDecryptionModule(). 467 // setContentDecryptionModule().
479 WebContentDecryptionModuleImpl* web_cdm_; 468 WebContentDecryptionModuleImpl* web_cdm_;
480 469
481 // This is only Used by Clear Key key system implementation, where a renderer 470 // This is only Used by Clear Key key system implementation, where a renderer
482 // side CDM will be used. This is similar to WebMediaPlayerImpl. For other key 471 // side CDM will be used. This is similar to WebMediaPlayerImpl. For other key
483 // systems, a browser side CDM will be used and we set CDM by calling 472 // systems, a browser side CDM will be used and we set CDM by calling
484 // player_manager_->SetCdm() directly. 473 // player_manager_->SetCdm() directly.
485 media::DecryptorReadyCB decryptor_ready_cb_; 474 media::DecryptorReadyCB decryptor_ready_cb_;
486 475
487 SkBitmap bitmap_; 476 media::SkCanvasVideoRenderer skcanvas_video_renderer_;
488 477
489 // Whether stored credentials are allowed to be passed to the server. 478 // Whether stored credentials are allowed to be passed to the server.
490 bool allow_stored_credentials_; 479 bool allow_stored_credentials_;
491 480
492 // NOTE: Weak pointers must be invalidated before all other member variables. 481 // NOTE: Weak pointers must be invalidated before all other member variables.
493 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; 482 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_;
494 483
495 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); 484 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid);
496 }; 485 };
497 486
498 } // namespace content 487 } // namespace content
499 488
500 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ 489 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/android/webmediaplayer_android.cc » ('j') | content/renderer/media/webmediaplayer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698