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

Side by Side Diff: media/blink/stream_texture_wrapper.h

Issue 2136103010: Add StreamTextureWrapper/StreamTextureWrapperImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed include guards Created 4 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_BLINK_STREAM_TEXTURE_WRAPPER_H_
watk 2016/07/23 03:13:40 Does this need to go in media/blink for some reaso
tguilbert 2016/07/26 00:13:52 I had it in media/base/android earlier, but ran in
6 #define MEDIA_BLINK_STREAM_TEXTURE_WRAPPER_H_
7
8 #include "cc/layers/video_frame_provider.h"
9 #include "media/base/video_frame.h"
10
11 namespace media {
12 class VideoFrame;
13
14 // StreamTextureWrapper encapsulates a StreamTexture's creation, initialization
15 // and registration for latter retrieval (in the Browser process).
watk 2016/07/23 03:13:40 later
tguilbert 2016/07/26 00:13:52 Done.
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 {
20 public:
21 StreamTextureWrapper() {}
22 virtual ~StreamTextureWrapper() {}
liberato (no reviews please) 2016/07/22 16:13:57 since this has special requirements for delete, ma
tguilbert 2016/07/26 00:13:52 I have moved this destructor to protected. It doe
23
24 // Initialize the StreamTexture and wrap the underlying texture into a frame.
25 // The provided |compositor_task_runner| will be used to "signal" new frames
26 // to |client|.
watk 2016/07/23 03:13:40 should be a comment about where/when init_cb is ru
tguilbert 2016/07/26 00:13:52 Done.
27 virtual void Initialize(
28 cc::VideoFrameProvider::Client* client,
29 const gfx::Size& natural_size,
30 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner,
31 const base::Closure& init_cb) = 0;
32
33 // Should be called whenever the Video's natural size changes.
watk 2016/07/23 03:13:40 uncapitalize Video
tguilbert 2016/07/26 00:13:52 Done.
34 virtual void UpdateTextureSize(const gfx::Size& natural_size) = 0;
35
36 // Returns the latest frame.
37 // N.B: The frame returned is likely always the same frame, wrapping the
38 // underlying texture. See StreamTextureWrapperImpl for more details.
39 virtual scoped_refptr<VideoFrame> GetCurrentFrame() = 0;
40
41 // Safely destroys the StreamTextureWrapper on the appropritate thread.
watk 2016/07/23 03:13:40 appropriate I would delete the comment about thre
watk 2016/07/25 21:47:14 Actually, I was thinking about this. I think the r
tguilbert 2016/07/26 00:13:52 I did it one way in this patch. I can also remove
tguilbert 2016/07/26 00:13:52 Done.
42 virtual void Destroy() = 0;
43 };
44
45 } // namespace media
46
47 namespace std {
48
49 // Specialize std::default_delete so that
50 // std::unique_ptr<StreamTextureWrapper> uses "Destroy()" instead of trying to
51 // use the destructor.
52 template <>
53 struct MEDIA_EXPORT default_delete<media::StreamTextureWrapper> {
54 void operator()(media::StreamTextureWrapper* stw) const;
55 };
56
57 } // namespace std
58
59 #endif // MEDIA_BLINK_STREAM_TEXTURE_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698