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

Side by Side Diff: media/base/android/stream_texture_wrapper.h

Issue 2282633002: Integrate Surface requests with MediaPlayerRenderer (Closed)
Patch Set: Addressed last comments Created 4 years, 2 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
« no previous file with comments | « gpu/ipc/service/stream_texture_android.cc ('k') | media/mojo/clients/mojo_renderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 MEDIA_BASE_ANDROID_STREAM_TEXTURE_WRAPPER_H_ 5 #ifndef MEDIA_BASE_ANDROID_STREAM_TEXTURE_WRAPPER_H_
6 #define MEDIA_BASE_ANDROID_STREAM_TEXTURE_WRAPPER_H_ 6 #define MEDIA_BASE_ANDROID_STREAM_TEXTURE_WRAPPER_H_
7 7
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/unguessable_token.h"
9 #include "media/base/video_frame.h" 10 #include "media/base/video_frame.h"
10 11
11 namespace media { 12 namespace media {
12 class VideoFrame;
13 13
14 // StreamTextureWrapper encapsulates a StreamTexture's creation, initialization 14 // StreamTextureWrapper encapsulates a StreamTexture's creation, initialization
15 // and registration for later retrieval (in the Browser process). 15 // and registration for later retrieval (in the Browser process).
16 //
17 // TODO(tguilbert): Support registering the underlying SurfaceTexture so it can
18 // be used by a MediaPlayer in the browser process. See crbug.com/627658.
19 class MEDIA_EXPORT StreamTextureWrapper { 16 class MEDIA_EXPORT StreamTextureWrapper {
20 public: 17 public:
21 StreamTextureWrapper() {} 18 StreamTextureWrapper() {}
22 19
23 // Initialize the underlying StreamTexture. 20 // Initialize the underlying StreamTexture.
24 // See StreamTextureWrapperImpl. 21 // See StreamTextureWrapperImpl.
25 virtual void Initialize( 22 virtual void Initialize(
26 const base::Closure& received_frame_cb, 23 const base::Closure& received_frame_cb,
27 const gfx::Size& natural_size, 24 const gfx::Size& natural_size,
28 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, 25 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner,
29 const base::Closure& init_cb) = 0; 26 const base::Closure& init_cb) = 0;
30 27
31 // Called whenever the video's natural size changes. 28 // Called whenever the video's natural size changes.
32 // See StreamTextureWrapperImpl. 29 // See StreamTextureWrapperImpl.
33 virtual void UpdateTextureSize(const gfx::Size& natural_size) = 0; 30 virtual void UpdateTextureSize(const gfx::Size& natural_size) = 0;
34 31
35 // Returns the latest frame. 32 // Returns the latest frame.
36 // See StreamTextureWrapperImpl. 33 // See StreamTextureWrapperImpl.
37 virtual scoped_refptr<VideoFrame> GetCurrentFrame() = 0; 34 virtual scoped_refptr<VideoFrame> GetCurrentFrame() = 0;
38 35
36 // Sends the StreamTexture to the browser process, to fulfill the request
37 // identified by |request_token|.
38 // See StreamTextureWrapperImpl.
39 virtual void ForwardStreamTextureForSurfaceRequest(
40 const base::UnguessableToken& request_token) = 0;
41
39 struct Deleter { 42 struct Deleter {
40 inline void operator()(StreamTextureWrapper* ptr) const { ptr->Destroy(); } 43 inline void operator()(StreamTextureWrapper* ptr) const { ptr->Destroy(); }
41 }; 44 };
42 45
43 protected: 46 protected:
44 virtual ~StreamTextureWrapper() {} 47 virtual ~StreamTextureWrapper() {}
45 48
46 // Safely destroys the StreamTextureWrapper. 49 // Safely destroys the StreamTextureWrapper.
47 // See StreamTextureWrapperImpl. 50 // See StreamTextureWrapperImpl.
48 virtual void Destroy() = 0; 51 virtual void Destroy() = 0;
49 }; 52 };
50 53
51 typedef std::unique_ptr<StreamTextureWrapper, StreamTextureWrapper::Deleter> 54 typedef std::unique_ptr<StreamTextureWrapper, StreamTextureWrapper::Deleter>
52 ScopedStreamTextureWrapper; 55 ScopedStreamTextureWrapper;
53 56
54 } // namespace media 57 } // namespace media
55 58
56 #endif // MEDIA_BASE_ANDROID_STREAM_TEXTURE_WRAPPER_H_ 59 #endif // MEDIA_BASE_ANDROID_STREAM_TEXTURE_WRAPPER_H_
OLDNEW
« no previous file with comments | « gpu/ipc/service/stream_texture_android.cc ('k') | media/mojo/clients/mojo_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698