Commit db6c3ddf authored by Philippe Gorley's avatar Philippe Gorley Committed by Philippe Gorley

encoder: make resolution even

An even width/height is required by at least x264. This is especially
for image and gif streaming, as video usually already has an even
width/height.

Change-Id: Ie660d8eb61dca48641cba89dd02e187481e3a127
parent e1436a12
......@@ -71,6 +71,10 @@ MediaEncoder::~MediaEncoder()
void MediaEncoder::setDeviceOptions(const DeviceParams& args)
{
device_ = args;
// Make sure width and height are even (required by x264)
// This is especially for image/gif streaming, as video files and cameras usually have even resolutions
device_.width -= device_.width % 2;
device_.height -= device_.height % 2;
if (device_.width)
av_dict_set(&options_, "width", ring::to_string(device_.width).c_str(), 0);
if (device_.height)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment