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

Unified Diff: webrtc/common_video/interface/video_frame_buffer.h

Issue 1158273010: Re-land "Convert native handles to buffers before encoding." (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/common_video/i420_video_frame_unittest.cc ('k') | webrtc/common_video/video_frame.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_video/interface/video_frame_buffer.h
diff --git a/webrtc/common_video/interface/video_frame_buffer.h b/webrtc/common_video/interface/video_frame_buffer.h
index 1aefa6c611464d9890682d9b3f56233524844bd2..4079019ccc8cb220221134dd43f6a4c514c7238a 100644
--- a/webrtc/common_video/interface/video_frame_buffer.h
+++ b/webrtc/common_video/interface/video_frame_buffer.h
@@ -52,6 +52,10 @@ class VideoFrameBuffer : public rtc::RefCountInterface {
// frame is backed by a texture.
virtual void* native_handle() const = 0;
+ // Returns a new memory-backed frame buffer converted from this buffer's
+ // native handle.
+ virtual rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() = 0;
+
protected:
virtual ~VideoFrameBuffer();
};
@@ -68,6 +72,7 @@ class I420Buffer : public VideoFrameBuffer {
uint8_t* data(PlaneType type) override;
int stride(PlaneType type) const override;
void* native_handle() const override;
+ rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
protected:
~I420Buffer() override;
@@ -81,15 +86,14 @@ class I420Buffer : public VideoFrameBuffer {
const rtc::scoped_ptr<uint8_t, AlignedFreeDeleter> data_;
};
-// Texture buffer is a VideoFrameBuffer wrapper around a |native_handle|.
-// |native_handle| must be valid for the lifetime of an instance of this object.
-// |no_longer_used| can be used to manage the lifetime of |native_handle|.
-class TextureBuffer : public VideoFrameBuffer {
+// Base class for native-handle buffer is a wrapper around a |native_handle|.
+// This is used for convenience as most native-handle implementations can share
+// many VideoFrame implementations, but need to implement a few others (such
+// as their own destructors or conversion methods back to software I420).
+class NativeHandleBuffer : public VideoFrameBuffer {
public:
- TextureBuffer(void* native_handle,
- int width,
- int height,
- const rtc::Callback0<void>& no_longer_used);
+ NativeHandleBuffer(void* native_handle, int width, int height);
+
int width() const override;
int height() const override;
const uint8_t* data(PlaneType type) const override;
@@ -97,15 +101,10 @@ class TextureBuffer : public VideoFrameBuffer {
int stride(PlaneType type) const override;
void* native_handle() const override;
- private:
- friend class rtc::RefCountedObject<TextureBuffer>;
- ~TextureBuffer() override;
-
- // |native_handle_| is a raw pointer and not owned by TextureBuffer.
+ protected:
void* native_handle_;
const int width_;
const int height_;
- rtc::Callback0<void> no_longer_used_cb_;
};
class WrappedI420Buffer : public webrtc::VideoFrameBuffer {
@@ -130,6 +129,8 @@ class WrappedI420Buffer : public webrtc::VideoFrameBuffer {
int stride(PlaneType type) const override;
void* native_handle() const override;
+ rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
+
private:
friend class rtc::RefCountedObject<WrappedI420Buffer>;
~WrappedI420Buffer() override;
« no previous file with comments | « webrtc/common_video/i420_video_frame_unittest.cc ('k') | webrtc/common_video/video_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698