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

Unified Diff: media/base/video_frame.cc

Issue 101623006: Created VideoFramePool to avoid unnecessary VideoFrame alloc/free. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add PoolImpl destructor to make clang on the bots happy. Created 7 years 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
Index: media/base/video_frame.cc
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index fd7fd19f408b7a1f46e3cf7b0172aa87d9295e72..9d438c9b742752081503e0ca18d6d428356465b4 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -181,6 +181,24 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalYuvData(
}
// static
+scoped_refptr<VideoFrame> VideoFrame::WrapVideoFrame(
+ const scoped_refptr<VideoFrame>& frame,
+ const WrapperDestroyedCB& wrapper_destroyed_cb) {
+
DaleCurtis 2013/12/09 20:48:25 Extra line.
acolwell GONE FROM CHROMIUM 2013/12/09 21:42:11 Done.
+ scoped_refptr<VideoFrame> wrapped_frame(new VideoFrame(
+ frame->format(), frame->coded_size(), frame->visible_rect(),
+ frame->natural_size(), frame->GetTimestamp(), frame->end_of_stream()));
+
+ for (size_t i = 0; i < NumPlanes(frame->format()); ++i) {
+ wrapped_frame->strides_[i] = frame->stride(i);
+ wrapped_frame->data_[i] = frame->data(i);
+ }
+
+ wrapped_frame->no_longer_needed_cb_ = base::Bind(wrapper_destroyed_cb, frame);
+ return wrapped_frame;
+}
+
+// static
scoped_refptr<VideoFrame> VideoFrame::CreateEOSFrame() {
return new VideoFrame(VideoFrame::UNKNOWN,
gfx::Size(),

Powered by Google App Engine
This is Rietveld 408576698