Skip to content
Snippets Groups Projects
Commit ac499340 authored by Maxime Callet's avatar Maxime Callet
Browse files

video sender: allow sending encoded packets

This fixes Android' accelerated video encoding

Change-Id: Ie0cc7f3699f8c74eb205a395ae4235b1b1a7af89
parent de0b7978
No related branches found
No related tags found
No related merge requests found
...@@ -375,6 +375,13 @@ MediaEncoder::encode(const std::shared_ptr<VideoFrame>& input, ...@@ -375,6 +375,13 @@ MediaEncoder::encode(const std::shared_ptr<VideoFrame>& input,
bool is_keyframe, bool is_keyframe,
int64_t frame_number) int64_t frame_number)
{ {
auto width = (input->width() >> 3) << 3;
auto height = (input->height() >> 3) << 3;
if (initialized_ && (getWidth() != width || getHeight() != height)) {
resetStreams(width, height);
is_keyframe = true;
}
if (!initialized_) { if (!initialized_) {
initStream(videoCodec_, input->pointer()->hw_frames_ctx); initStream(videoCodec_, input->pointer()->hw_frames_ctx);
startIO(); startIO();
......
...@@ -77,18 +77,6 @@ VideoSender::~VideoSender() ...@@ -77,18 +77,6 @@ VideoSender::~VideoSender()
void void
VideoSender::encodeAndSendVideo(const std::shared_ptr<VideoFrame>& input_frame) VideoSender::encodeAndSendVideo(const std::shared_ptr<VideoFrame>& input_frame)
{ {
auto width = ((input_frame->width() >> 3) << 3);
auto height = ((input_frame->height() >> 3) << 3);
if (videoEncoder_->getWidth() != width || videoEncoder_->getHeight() != height) {
videoEncoder_->resetStreams(width, height);
forceKeyFrame();
// Send local video codec in SmartInfo
Smartools::getInstance().setLocalVideoCodec(videoEncoder_->getVideoCodec());
// Send the resolution in smartInfo
Smartools::getInstance().setResolution("local", width, height);
return;
}
int angle = input_frame->getOrientation(); int angle = input_frame->getOrientation();
if (rotation_ != angle) { if (rotation_ != angle) {
rotation_ = angle; rotation_ = angle;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment