From 9a8f66e3e511ed9cf45dc2b7c4d7c0453802117c Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 2 Dec 2016 19:14:59 -0800 Subject: [PATCH] SourceImpl: Add no-copy PutFrame. --- src/SourceImpl.cpp | 4 ++++ src/SourceImpl.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/SourceImpl.cpp b/src/SourceImpl.cpp index d5db1f9604..c259bfa84d 100644 --- a/src/SourceImpl.cpp +++ b/src/SourceImpl.cpp @@ -301,6 +301,10 @@ void SourceImpl::PutFrame(VideoMode::PixelFormat pixelFormat, int width, << " bytes)"); std::memcpy(frameData->data, data.data(), data.size()); + PutFrame(std::move(frameData)); +} + +void SourceImpl::PutFrame(std::unique_ptr frameData) { // Update frame { std::lock_guard lock{m_frameMutex}; diff --git a/src/SourceImpl.h b/src/SourceImpl.h index 7a8ec05165..c72ba94ce6 100644 --- a/src/SourceImpl.h +++ b/src/SourceImpl.h @@ -122,6 +122,7 @@ class SourceImpl { protected: void PutFrame(VideoMode::PixelFormat pixelFormat, int width, int height, llvm::StringRef data, Frame::Time time); + void PutFrame(std::unique_ptr frameData); void PutError(llvm::StringRef msg, Frame::Time time) { PutFrame(VideoMode::kUnknown, 0, 0, msg, time); }