Commit c57359af authored by Anthony Léonard's avatar Anthony Léonard Committed by Olivier SOLDANO

add height and width in Video::Frame structure

By adding those member variables, this information is now conveyed from
daemon to client on a per-frame basis. This is necessary as ffmpeg may
output frames with a size different than what is returned by
Renderer::size().

This later value is set when a video stream reception is established
with height and width corresponding to format of frame sent by the
other end. After decoding, this first size may not be equal to the size
of the frame decoded by ffmpeg (seen at least on macOS with hardware
acceleration enabled).

Finally, doing so is more secure as we are protected by the Renderer
mutex. Previously, getting size and frame were 2 different operations
(method calls) with no guarantee of atomicity, and thus consistency.

Change-Id: I05699b71d2afd38deeea36374830ff00d7d66ad7
Reviewed-by: default avatarOlivier Soldano <olivier.soldano@savoirfairelinux.com>
parent 296a054a
......@@ -125,6 +125,9 @@ Video::Frame Video::DirectRenderer::currentFrame() const
frame.storage = std::move(d_ptr->daemonFramePtr_->storage);
frame.ptr = frame.storage.data();
frame.size = frame.storage.size();
frame.height = d_ptr->daemonFramePtr_->height;
frame.width = d_ptr->daemonFramePtr_->width;
return std::move(frame);
}
......
......@@ -52,6 +52,9 @@ struct Frame {
uint8_t* ptr { nullptr };
std::size_t size { 0 };
std::vector<uint8_t> storage { };
// Next variables are currently used with DirectRenderer only
unsigned int height { 0 };
unsigned int width { 0 };
};
/**
......
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