Chromium Code Reviews| Index: media/blink/stream_texture_wrapper.h |
| diff --git a/media/blink/stream_texture_wrapper.h b/media/blink/stream_texture_wrapper.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..de0fcbb0faaf3401bb506eac1958782c2331c620 |
| --- /dev/null |
| +++ b/media/blink/stream_texture_wrapper.h |
| @@ -0,0 +1,59 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#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
|
| +#define MEDIA_BLINK_STREAM_TEXTURE_WRAPPER_H_ |
| + |
| +#include "cc/layers/video_frame_provider.h" |
| +#include "media/base/video_frame.h" |
| + |
| +namespace media { |
| +class VideoFrame; |
| + |
| +// StreamTextureWrapper encapsulates a StreamTexture's creation, initialization |
| +// 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.
|
| +// |
| +// TODO(tguilbert): Support registering the underlying SurfaceTexture so it can |
| +// be used by a MediaPlayer in the browser process. See crbug.com/627658. |
| +class MEDIA_EXPORT StreamTextureWrapper { |
| + public: |
| + StreamTextureWrapper() {} |
| + 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
|
| + |
| + // Initialize the StreamTexture and wrap the underlying texture into a frame. |
| + // The provided |compositor_task_runner| will be used to "signal" new frames |
| + // 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.
|
| + virtual void Initialize( |
| + cc::VideoFrameProvider::Client* client, |
| + const gfx::Size& natural_size, |
| + scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, |
| + const base::Closure& init_cb) = 0; |
| + |
| + // 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.
|
| + virtual void UpdateTextureSize(const gfx::Size& natural_size) = 0; |
| + |
| + // Returns the latest frame. |
| + // N.B: The frame returned is likely always the same frame, wrapping the |
| + // underlying texture. See StreamTextureWrapperImpl for more details. |
| + virtual scoped_refptr<VideoFrame> GetCurrentFrame() = 0; |
| + |
| + // 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.
|
| + virtual void Destroy() = 0; |
| +}; |
| + |
| +} // namespace media |
| + |
| +namespace std { |
| + |
| +// Specialize std::default_delete so that |
| +// std::unique_ptr<StreamTextureWrapper> uses "Destroy()" instead of trying to |
| +// use the destructor. |
| +template <> |
| +struct MEDIA_EXPORT default_delete<media::StreamTextureWrapper> { |
| + void operator()(media::StreamTextureWrapper* stw) const; |
| +}; |
| + |
| +} // namespace std |
| + |
| +#endif // MEDIA_BLINK_STREAM_TEXTURE_WRAPPER_H_ |