Skip to content
Snippets Groups Projects
Commit 7f7bc0e7 authored by Alexandre Lision's avatar Alexandre Lision Committed by Guillaume Roguez
Browse files

video: change pixfmt used by VideoMixer

YUV420P was allocating one large buffer on Linux and 3 on OSX.
This was causing read overflows. We use YUYV422 which is packed (always one buf)

Issue: #81116
Change-Id: I76456f72c6f155d181aa533aa62cb70b92f6eff1
parent b0a4abc8
No related branches found
No related tags found
No related merge requests found
...@@ -115,7 +115,7 @@ int libav_pixel_format(int fmt) ...@@ -115,7 +115,7 @@ int libav_pixel_format(int fmt)
switch (fmt) { switch (fmt) {
case video::VIDEO_PIXFMT_BGRA: return PIXEL_FORMAT(BGRA); case video::VIDEO_PIXFMT_BGRA: return PIXEL_FORMAT(BGRA);
case video::VIDEO_PIXFMT_RGBA: return PIXEL_FORMAT(RGBA); case video::VIDEO_PIXFMT_RGBA: return PIXEL_FORMAT(RGBA);
case video::VIDEO_PIXFMT_YUV420P: return PIXEL_FORMAT(YUV420P); case video::VIDEO_PIXFMT_YUYV422: return PIXEL_FORMAT(YUYV422);
} }
return fmt; return fmt;
} }
...@@ -123,7 +123,7 @@ int libav_pixel_format(int fmt) ...@@ -123,7 +123,7 @@ int libav_pixel_format(int fmt)
int ring_pixel_format(int fmt) int ring_pixel_format(int fmt)
{ {
switch (fmt) { switch (fmt) {
case PIXEL_FORMAT(YUV420P): return video::VIDEO_PIXFMT_YUV420P; case PIXEL_FORMAT(YUYV422): return video::VIDEO_PIXFMT_YUYV422;
} }
return fmt; return fmt;
} }
......
...@@ -50,7 +50,7 @@ namespace ring { namespace video { ...@@ -50,7 +50,7 @@ namespace ring { namespace video {
enum VideoPixelFormat { enum VideoPixelFormat {
VIDEO_PIXFMT_BGRA = -1, VIDEO_PIXFMT_BGRA = -1,
VIDEO_PIXFMT_YUV420P = -2, VIDEO_PIXFMT_YUYV422 = -2,
VIDEO_PIXFMT_RGBA = -3, VIDEO_PIXFMT_RGBA = -3,
}; };
......
...@@ -130,7 +130,7 @@ VideoMixer::process() ...@@ -130,7 +130,7 @@ VideoMixer::process()
VideoFrame& output = getNewFrame(); VideoFrame& output = getNewFrame();
try { try {
output.reserve(VIDEO_PIXFMT_YUV420P, width_, height_); output.reserve(VIDEO_PIXFMT_YUYV422, width_, height_);
} catch (const std::bad_alloc& e) { } catch (const std::bad_alloc& e) {
RING_ERR("VideoFrame::allocBuffer() failed"); RING_ERR("VideoFrame::allocBuffer() failed");
return; return;
...@@ -231,6 +231,6 @@ VideoMixer::getHeight() const ...@@ -231,6 +231,6 @@ VideoMixer::getHeight() const
int int
VideoMixer::getPixelFormat() const VideoMixer::getPixelFormat() const
{ return VIDEO_PIXFMT_YUV420P; } { return VIDEO_PIXFMT_YUYV422; }
}} // namespace ring::video }} // namespace ring::video
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment