Skip to content
Snippets Groups Projects
Commit 95dd7833 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

android/video: fix setFromMemory

Tuleap: #293
Change-Id: I81aceb7a9de3e75d2d92b2abf08aafcff21ce337
parent 02765c37
No related branches found
No related tags found
No related merge requests found
...@@ -130,7 +130,7 @@ VideoFrame::setFromMemory(uint8_t* ptr, int format, int width, int height) noexc ...@@ -130,7 +130,7 @@ VideoFrame::setFromMemory(uint8_t* ptr, int format, int width, int height) noexc
void void
VideoFrame::setFromMemory(uint8_t* ptr, int format, int width, int height, VideoFrame::setFromMemory(uint8_t* ptr, int format, int width, int height,
std::function<void(void*)> cb) noexcept std::function<void(uint8_t*)> cb) noexcept
{ {
setFromMemory(ptr, format, width, height); setFromMemory(ptr, format, width, height);
if (cb) { if (cb) {
......
...@@ -80,7 +80,7 @@ class VideoFrame: public MediaFrame { ...@@ -80,7 +80,7 @@ class VideoFrame: public MediaFrame {
// Set internal pixel buffers on given memory buffer // Set internal pixel buffers on given memory buffer
// This buffer must follow given specifications. // This buffer must follow given specifications.
void setFromMemory(uint8_t* data, int format, int width, int height) noexcept; void setFromMemory(uint8_t* data, int format, int width, int height) noexcept;
void setFromMemory(uint8_t* data, int format, int width, int height, std::function<void(void*)> cb) noexcept; void setFromMemory(uint8_t* data, int format, int width, int height, std::function<void(uint8_t*)> cb) noexcept;
void noise(); void noise();
...@@ -88,8 +88,8 @@ class VideoFrame: public MediaFrame { ...@@ -88,8 +88,8 @@ class VideoFrame: public MediaFrame {
VideoFrame& operator =(const VideoFrame& src); VideoFrame& operator =(const VideoFrame& src);
private: private:
std::function<void(void*)> releaseBufferCb_ {}; std::function<void(uint8_t*)> releaseBufferCb_ {};
void *ptr_ {nullptr}; uint8_t* ptr_ {nullptr};
bool allocated_ {false}; bool allocated_ {false};
void setGeometry(int format, int width, int height) noexcept; void setGeometry(int format, int width, int height) noexcept;
}; };
......
...@@ -109,7 +109,7 @@ void VideoInput::processAndroid() ...@@ -109,7 +109,7 @@ void VideoInput::processAndroid()
buffer.status = BUFFER_PUBLISHED; buffer.status = BUFFER_PUBLISHED;
frame.setFromMemory((uint8_t*)buffer.data, format, decOpts_.width, decOpts_.height, frame.setFromMemory((uint8_t*)buffer.data, format, decOpts_.width, decOpts_.height,
std::bind(&VideoInput::releaseBufferCb, this)); std::bind(&VideoInput::releaseBufferCb, this, std::placeholders::_1));
publish_index_++; publish_index_++;
lck.unlock(); lck.unlock();
publishFrame(); publishFrame();
...@@ -240,7 +240,7 @@ void VideoInput::freeOneBuffer(struct VideoFrameBuffer& b) ...@@ -240,7 +240,7 @@ void VideoInput::freeOneBuffer(struct VideoFrameBuffer& b)
b.status = BUFFER_NOT_ALLOCATED; b.status = BUFFER_NOT_ALLOCATED;
} }
void VideoInput::releaseBufferCb(void *ptr) void VideoInput::releaseBufferCb(uint8_t* ptr)
{ {
std::lock_guard<std::mutex> lck(mutex_); std::lock_guard<std::mutex> lck(mutex_);
......
...@@ -133,7 +133,7 @@ private: ...@@ -133,7 +133,7 @@ private:
int publish_index_ = 0; int publish_index_ = 0;
/* Get notified when libav is done with this buffer */ /* Get notified when libav is done with this buffer */
static void releaseBufferCb(void *opaque, void *ptr); void releaseBufferCb(uint8_t* ptr);
std::vector<struct VideoFrameBuffer> buffers_; std::vector<struct VideoFrameBuffer> buffers_;
#endif #endif
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment