diff --git a/src/media/media_encoder.cpp b/src/media/media_encoder.cpp index 506f5dc8aee14e34a3c49056a34e86134784efb2..ccbae447efd747f06fa16a62ef80eb17abd51a96 100644 --- a/src/media/media_encoder.cpp +++ b/src/media/media_encoder.cpp @@ -273,6 +273,11 @@ int MediaEncoder::encode(VideoFrame& input, bool is_keyframe, int64_t frame_number) { + /* Prepare a frame suitable to our encoder frame format, + * keeping also the input aspect ratio. + */ + yuv422_clear_to_black(scaledFrame_); // to fill blank space left by the "keep aspect" + scaler_.scale_with_aspect(input, scaledFrame_); auto frame = scaledFrame_.pointer(); diff --git a/src/media/video/video_mixer.cpp b/src/media/video/video_mixer.cpp index 85f6cbe790fde2abfb42f8ef69e3e3b6d44278cd..654a06f780d074826b13ebfc7e8b2f1990a4bbf1 100644 --- a/src/media/video/video_mixer.cpp +++ b/src/media/video/video_mixer.cpp @@ -189,6 +189,8 @@ VideoMixer::setDimensions(int width, int height) // cleanup the previous frame to have a nice copy in rendering method std::shared_ptr<VideoFrame> previous_p(obtainLastFrame()); + if (previous_p) + yuv422_clear_to_black(*previous_p); start_sink(); }