2014-12-09 10:36:40 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "media/engine/simulcast_encoder_adapter.h"
|
2014-12-09 10:36:40 +00:00
|
|
|
|
|
|
|
|
#include <algorithm>
|
2018-08-27 11:07:48 +02:00
|
|
|
#include <string>
|
|
|
|
|
#include <utility>
|
2014-12-09 10:36:40 +00:00
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/video/i420_buffer.h"
|
2018-05-22 15:37:23 +02:00
|
|
|
#include "api/video/video_bitrate_allocation.h"
|
2017-11-17 14:44:55 +01:00
|
|
|
#include "api/video_codecs/video_encoder_factory.h"
|
2018-06-21 16:16:38 +02:00
|
|
|
#include "modules/video_coding/utility/simulcast_rate_allocator.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/checks.h"
|
2018-11-07 14:53:32 +01:00
|
|
|
#include "rtc_base/logging.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "system_wrappers/include/clock.h"
|
2018-08-27 11:07:48 +02:00
|
|
|
#include "system_wrappers/include/field_trial.h"
|
2017-12-11 09:32:13 +01:00
|
|
|
#include "third_party/libyuv/include/libyuv/scale.h"
|
2014-12-09 10:36:40 +00:00
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
const unsigned int kDefaultMinQp = 2;
|
|
|
|
|
const unsigned int kDefaultMaxQp = 56;
|
|
|
|
|
// Max qp for lowest spatial resolution when doing simulcast.
|
|
|
|
|
const unsigned int kLowestResMaxQp = 45;
|
|
|
|
|
|
2018-08-27 11:07:48 +02:00
|
|
|
absl::optional<unsigned int> GetScreenshareBoostedQpValue() {
|
|
|
|
|
std::string experiment_group =
|
|
|
|
|
webrtc::field_trial::FindFullName("WebRTC-BoostedScreenshareQp");
|
|
|
|
|
unsigned int qp;
|
|
|
|
|
if (sscanf(experiment_group.c_str(), "%u", &qp) != 1)
|
|
|
|
|
return absl::nullopt;
|
|
|
|
|
qp = std::min(qp, 63u);
|
|
|
|
|
qp = std::max(qp, 1u);
|
|
|
|
|
return qp;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-09 10:36:40 +00:00
|
|
|
uint32_t SumStreamMaxBitrate(int streams, const webrtc::VideoCodec& codec) {
|
|
|
|
|
uint32_t bitrate_sum = 0;
|
|
|
|
|
for (int i = 0; i < streams; ++i) {
|
|
|
|
|
bitrate_sum += codec.simulcastStream[i].maxBitrate;
|
|
|
|
|
}
|
|
|
|
|
return bitrate_sum;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int NumberOfStreams(const webrtc::VideoCodec& codec) {
|
|
|
|
|
int streams =
|
|
|
|
|
codec.numberOfSimulcastStreams < 1 ? 1 : codec.numberOfSimulcastStreams;
|
|
|
|
|
uint32_t simulcast_max_bitrate = SumStreamMaxBitrate(streams, codec);
|
|
|
|
|
if (simulcast_max_bitrate == 0) {
|
|
|
|
|
streams = 1;
|
|
|
|
|
}
|
|
|
|
|
return streams;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ValidSimulcastResolutions(const webrtc::VideoCodec& codec,
|
|
|
|
|
int num_streams) {
|
|
|
|
|
if (codec.width != codec.simulcastStream[num_streams - 1].width ||
|
|
|
|
|
codec.height != codec.simulcastStream[num_streams - 1].height) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < num_streams; ++i) {
|
|
|
|
|
if (codec.width * codec.simulcastStream[i].height !=
|
|
|
|
|
codec.height * codec.simulcastStream[i].width) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int VerifyCodec(const webrtc::VideoCodec* inst) {
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
if (inst == nullptr) {
|
2014-12-09 10:36:40 +00:00
|
|
|
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
|
|
|
|
}
|
|
|
|
|
if (inst->maxFramerate < 1) {
|
|
|
|
|
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
|
|
|
|
}
|
|
|
|
|
// allow zero to represent an unspecified maxBitRate
|
|
|
|
|
if (inst->maxBitrate > 0 && inst->startBitrate > inst->maxBitrate) {
|
|
|
|
|
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
|
|
|
|
}
|
|
|
|
|
if (inst->width <= 1 || inst->height <= 1) {
|
|
|
|
|
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
|
|
|
|
}
|
2018-06-21 16:16:38 +02:00
|
|
|
if (inst->codecType == webrtc::kVideoCodecVP8 &&
|
|
|
|
|
inst->VP8().automaticResizeOn && inst->numberOfSimulcastStreams > 1) {
|
2014-12-09 10:36:40 +00:00
|
|
|
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
|
|
|
|
}
|
|
|
|
|
return WEBRTC_VIDEO_CODEC_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-15 09:24:26 -07:00
|
|
|
// An EncodedImageCallback implementation that forwards on calls to a
|
|
|
|
|
// SimulcastEncoderAdapter, but with the stream index it's registered with as
|
|
|
|
|
// the first parameter to Encoded.
|
|
|
|
|
class AdapterEncodedImageCallback : public webrtc::EncodedImageCallback {
|
|
|
|
|
public:
|
|
|
|
|
AdapterEncodedImageCallback(webrtc::SimulcastEncoderAdapter* adapter,
|
|
|
|
|
size_t stream_idx)
|
|
|
|
|
: adapter_(adapter), stream_idx_(stream_idx) {}
|
|
|
|
|
|
2016-08-02 17:46:41 -07:00
|
|
|
EncodedImageCallback::Result OnEncodedImage(
|
|
|
|
|
const webrtc::EncodedImage& encoded_image,
|
|
|
|
|
const webrtc::CodecSpecificInfo* codec_specific_info,
|
|
|
|
|
const webrtc::RTPFragmentationHeader* fragmentation) override {
|
|
|
|
|
return adapter_->OnEncodedImage(stream_idx_, encoded_image,
|
|
|
|
|
codec_specific_info, fragmentation);
|
2015-04-15 09:24:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
webrtc::SimulcastEncoderAdapter* const adapter_;
|
|
|
|
|
const size_t stream_idx_;
|
|
|
|
|
};
|
2014-12-09 10:36:40 +00:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2018-05-28 10:24:22 +02:00
|
|
|
SimulcastEncoderAdapter::SimulcastEncoderAdapter(VideoEncoderFactory* factory,
|
|
|
|
|
const SdpVideoFormat& format)
|
2017-11-17 14:44:55 +01:00
|
|
|
: inited_(0),
|
|
|
|
|
factory_(factory),
|
2018-05-28 10:24:22 +02:00
|
|
|
video_format_(format),
|
2017-11-17 14:44:55 +01:00
|
|
|
encoded_complete_callback_(nullptr),
|
2018-10-11 14:33:39 +00:00
|
|
|
experimental_boosted_screenshare_qp_(GetScreenshareBoostedQpValue()) {
|
2018-02-05 13:03:25 +01:00
|
|
|
RTC_DCHECK(factory_);
|
2018-11-07 14:53:32 +01:00
|
|
|
encoder_info_.implementation_name = "SimulcastEncoderAdapter";
|
2017-11-17 14:44:55 +01:00
|
|
|
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
// The adapter is typically created on the worker thread, but operated on
|
|
|
|
|
// the encoder task queue.
|
|
|
|
|
encoder_queue_.Detach();
|
|
|
|
|
|
2014-12-09 10:36:40 +00:00
|
|
|
memset(&codec_, 0, sizeof(webrtc::VideoCodec));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SimulcastEncoderAdapter::~SimulcastEncoderAdapter() {
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
RTC_DCHECK(!Initialized());
|
|
|
|
|
DestroyStoredEncoders();
|
2014-12-09 10:36:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int SimulcastEncoderAdapter::Release() {
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
RTC_DCHECK_CALLED_SEQUENTIALLY(&encoder_queue_);
|
|
|
|
|
|
2014-12-09 10:36:40 +00:00
|
|
|
while (!streaminfos_.empty()) {
|
2017-08-28 08:05:42 -07:00
|
|
|
std::unique_ptr<VideoEncoder> encoder =
|
|
|
|
|
std::move(streaminfos_.back().encoder);
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
// Even though it seems very unlikely, there are no guarantees that the
|
2017-09-28 13:02:58 +02:00
|
|
|
// encoder will not call back after being Release()'d. Therefore, we first
|
|
|
|
|
// disable the callbacks here.
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
encoder->RegisterEncodeCompleteCallback(nullptr);
|
2017-09-28 13:02:58 +02:00
|
|
|
encoder->Release();
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
streaminfos_.pop_back(); // Deletes callback adapter.
|
2017-08-28 08:05:42 -07:00
|
|
|
stored_encoders_.push(std::move(encoder));
|
2014-12-09 10:36:40 +00:00
|
|
|
}
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
|
|
|
|
|
// It's legal to move the encoder to another queue now.
|
|
|
|
|
encoder_queue_.Detach();
|
|
|
|
|
|
|
|
|
|
rtc::AtomicOps::ReleaseStore(&inited_, 0);
|
|
|
|
|
|
2014-12-09 10:36:40 +00:00
|
|
|
return WEBRTC_VIDEO_CODEC_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int SimulcastEncoderAdapter::InitEncode(const VideoCodec* inst,
|
|
|
|
|
int number_of_cores,
|
|
|
|
|
size_t max_payload_size) {
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
RTC_DCHECK_CALLED_SEQUENTIALLY(&encoder_queue_);
|
|
|
|
|
|
2014-12-09 10:36:40 +00:00
|
|
|
if (number_of_cores < 1) {
|
|
|
|
|
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ret = VerifyCodec(inst);
|
|
|
|
|
if (ret < 0) {
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = Release();
|
|
|
|
|
if (ret < 0) {
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int number_of_streams = NumberOfStreams(*inst);
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
RTC_DCHECK_LE(number_of_streams, kMaxSimulcastStreams);
|
2016-03-30 17:03:52 +02:00
|
|
|
const bool doing_simulcast = (number_of_streams > 1);
|
2014-12-09 10:36:40 +00:00
|
|
|
|
|
|
|
|
if (doing_simulcast && !ValidSimulcastResolutions(*inst, number_of_streams)) {
|
|
|
|
|
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
codec_ = *inst;
|
2018-03-21 09:57:23 +01:00
|
|
|
SimulcastRateAllocator rate_allocator(codec_);
|
2018-04-23 12:32:22 +02:00
|
|
|
VideoBitrateAllocation allocation = rate_allocator.GetAllocation(
|
2016-11-16 16:41:30 +01:00
|
|
|
codec_.startBitrate * 1000, codec_.maxFramerate);
|
|
|
|
|
std::vector<uint32_t> start_bitrates;
|
|
|
|
|
for (int i = 0; i < kMaxSimulcastStreams; ++i) {
|
|
|
|
|
uint32_t stream_bitrate = allocation.GetSpatialLayerSum(i) / 1000;
|
|
|
|
|
start_bitrates.push_back(stream_bitrate);
|
2014-12-09 10:36:40 +00:00
|
|
|
}
|
|
|
|
|
|
2018-11-07 14:53:32 +01:00
|
|
|
encoder_info_.supports_native_handle = true;
|
|
|
|
|
encoder_info_.scaling_settings.thresholds = absl::nullopt;
|
2014-12-09 10:36:40 +00:00
|
|
|
// Create |number_of_streams| of encoder instances and init them.
|
|
|
|
|
for (int i = 0; i < number_of_streams; ++i) {
|
|
|
|
|
VideoCodec stream_codec;
|
2016-09-12 16:04:43 +02:00
|
|
|
uint32_t start_bitrate_kbps = start_bitrates[i];
|
2018-09-12 17:04:10 +02:00
|
|
|
const bool send_stream = start_bitrate_kbps > 0;
|
2014-12-09 10:36:40 +00:00
|
|
|
if (!doing_simulcast) {
|
|
|
|
|
stream_codec = codec_;
|
|
|
|
|
stream_codec.numberOfSimulcastStreams = 1;
|
2018-11-07 14:53:32 +01:00
|
|
|
|
2014-12-09 10:36:40 +00:00
|
|
|
} else {
|
2016-09-12 16:04:43 +02:00
|
|
|
// Cap start bitrate to the min bitrate in order to avoid strange codec
|
2018-09-12 17:04:10 +02:00
|
|
|
// behavior. Since sending will be false, this should not matter.
|
2016-09-12 16:04:43 +02:00
|
|
|
start_bitrate_kbps =
|
|
|
|
|
std::max(codec_.simulcastStream[i].minBitrate, start_bitrate_kbps);
|
2014-12-09 10:36:40 +00:00
|
|
|
bool highest_resolution_stream = (i == (number_of_streams - 1));
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
PopulateStreamCodec(codec_, i, start_bitrate_kbps,
|
2016-09-12 16:04:43 +02:00
|
|
|
highest_resolution_stream, &stream_codec);
|
2014-12-09 10:36:40 +00:00
|
|
|
}
|
|
|
|
|
|
2018-03-14 17:52:55 +01:00
|
|
|
// TODO(ronghuawu): Remove once this is handled in LibvpxVp8Encoder.
|
2014-12-09 10:36:40 +00:00
|
|
|
if (stream_codec.qpMax < kDefaultMinQp) {
|
|
|
|
|
stream_codec.qpMax = kDefaultMaxQp;
|
|
|
|
|
}
|
|
|
|
|
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
// If an existing encoder instance exists, reuse it.
|
|
|
|
|
// TODO(brandtr): Set initial RTP state (e.g., picture_id/tl0_pic_idx) here,
|
|
|
|
|
// when we start storing that state outside the encoder wrappers.
|
2017-08-28 08:05:42 -07:00
|
|
|
std::unique_ptr<VideoEncoder> encoder;
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
if (!stored_encoders_.empty()) {
|
2017-08-28 08:05:42 -07:00
|
|
|
encoder = std::move(stored_encoders_.top());
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
stored_encoders_.pop();
|
|
|
|
|
} else {
|
2018-06-21 16:16:38 +02:00
|
|
|
encoder = factory_->CreateVideoEncoder(SdpVideoFormat(
|
|
|
|
|
codec_.codecType == webrtc::kVideoCodecVP8 ? "VP8" : "H264"));
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
}
|
|
|
|
|
|
2015-12-21 03:04:49 -08:00
|
|
|
ret = encoder->InitEncode(&stream_codec, number_of_cores, max_payload_size);
|
2014-12-09 10:36:40 +00:00
|
|
|
if (ret < 0) {
|
2016-12-12 13:08:27 -08:00
|
|
|
// Explicitly destroy the current encoder; because we haven't registered a
|
|
|
|
|
// StreamInfo for it yet, Release won't do anything about it.
|
2017-08-28 08:05:42 -07:00
|
|
|
encoder.reset();
|
2014-12-09 10:36:40 +00:00
|
|
|
Release();
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
std::unique_ptr<EncodedImageCallback> callback(
|
|
|
|
|
new AdapterEncodedImageCallback(this, i));
|
|
|
|
|
encoder->RegisterEncodeCompleteCallback(callback.get());
|
2017-08-28 08:05:42 -07:00
|
|
|
streaminfos_.emplace_back(std::move(encoder), std::move(callback),
|
|
|
|
|
stream_codec.width, stream_codec.height,
|
2018-09-12 17:04:10 +02:00
|
|
|
send_stream);
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
|
2018-11-07 14:53:32 +01:00
|
|
|
if (!doing_simulcast) {
|
|
|
|
|
// Without simulcast, just pass through the encoder info from the one
|
|
|
|
|
// active encoder.
|
|
|
|
|
encoder_info_ = streaminfos_[0].encoder->GetEncoderInfo();
|
|
|
|
|
} else {
|
|
|
|
|
const EncoderInfo encoder_impl_info =
|
|
|
|
|
streaminfos_[i].encoder->GetEncoderInfo();
|
|
|
|
|
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
// Quality scaling not enabled for simulcast.
|
|
|
|
|
encoder_info_.scaling_settings = VideoEncoder::ScalingSettings::kOff;
|
|
|
|
|
|
|
|
|
|
// Encoder name indicates names of all sub-encoders.
|
|
|
|
|
encoder_info_.implementation_name = "SimulcastEncoderAdapter (";
|
|
|
|
|
encoder_info_.implementation_name +=
|
|
|
|
|
encoder_impl_info.implementation_name;
|
|
|
|
|
|
|
|
|
|
encoder_info_.supports_native_handle =
|
|
|
|
|
encoder_impl_info.supports_native_handle;
|
|
|
|
|
} else {
|
|
|
|
|
encoder_info_.implementation_name += ", ";
|
|
|
|
|
encoder_info_.implementation_name +=
|
|
|
|
|
encoder_impl_info.implementation_name;
|
|
|
|
|
|
|
|
|
|
// Native handle supported only if all encoders supports it.
|
|
|
|
|
encoder_info_.supports_native_handle &=
|
|
|
|
|
encoder_impl_info.supports_native_handle;
|
|
|
|
|
}
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
}
|
2014-12-09 10:36:40 +00:00
|
|
|
}
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
|
2016-03-30 17:03:52 +02:00
|
|
|
if (doing_simulcast) {
|
2018-11-07 14:53:32 +01:00
|
|
|
encoder_info_.implementation_name += ")";
|
2016-03-30 17:03:52 +02:00
|
|
|
}
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
|
|
|
|
|
// To save memory, don't store encoders that we don't use.
|
|
|
|
|
DestroyStoredEncoders();
|
|
|
|
|
|
|
|
|
|
rtc::AtomicOps::ReleaseStore(&inited_, 1);
|
|
|
|
|
|
2014-12-09 10:36:40 +00:00
|
|
|
return WEBRTC_VIDEO_CODEC_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int SimulcastEncoderAdapter::Encode(
|
2015-05-29 17:21:40 -07:00
|
|
|
const VideoFrame& input_image,
|
2014-12-09 10:36:40 +00:00
|
|
|
const CodecSpecificInfo* codec_specific_info,
|
2015-10-19 02:39:06 -07:00
|
|
|
const std::vector<FrameType>* frame_types) {
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
RTC_DCHECK_CALLED_SEQUENTIALLY(&encoder_queue_);
|
|
|
|
|
|
2014-12-09 10:36:40 +00:00
|
|
|
if (!Initialized()) {
|
|
|
|
|
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
|
|
|
|
}
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
if (encoded_complete_callback_ == nullptr) {
|
2014-12-09 10:36:40 +00:00
|
|
|
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// All active streams should generate a key frame if
|
|
|
|
|
// a key frame is requested by any stream.
|
|
|
|
|
bool send_key_frame = false;
|
|
|
|
|
if (frame_types) {
|
|
|
|
|
for (size_t i = 0; i < frame_types->size(); ++i) {
|
2015-10-23 15:58:18 +02:00
|
|
|
if (frame_types->at(i) == kVideoFrameKey) {
|
2014-12-09 10:36:40 +00:00
|
|
|
send_key_frame = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (size_t stream_idx = 0; stream_idx < streaminfos_.size(); ++stream_idx) {
|
|
|
|
|
if (streaminfos_[stream_idx].key_frame_request &&
|
|
|
|
|
streaminfos_[stream_idx].send_stream) {
|
|
|
|
|
send_key_frame = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int src_width = input_image.width();
|
|
|
|
|
int src_height = input_image.height();
|
|
|
|
|
for (size_t stream_idx = 0; stream_idx < streaminfos_.size(); ++stream_idx) {
|
2015-10-06 14:04:51 +02:00
|
|
|
// Don't encode frames in resolutions that we don't intend to send.
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
if (!streaminfos_[stream_idx].send_stream) {
|
2015-10-06 14:04:51 +02:00
|
|
|
continue;
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
}
|
2015-10-06 14:04:51 +02:00
|
|
|
|
2015-10-19 02:39:06 -07:00
|
|
|
std::vector<FrameType> stream_frame_types;
|
2014-12-09 10:36:40 +00:00
|
|
|
if (send_key_frame) {
|
2015-10-23 15:58:18 +02:00
|
|
|
stream_frame_types.push_back(kVideoFrameKey);
|
2014-12-09 10:36:40 +00:00
|
|
|
streaminfos_[stream_idx].key_frame_request = false;
|
|
|
|
|
} else {
|
2015-10-23 15:58:18 +02:00
|
|
|
stream_frame_types.push_back(kVideoFrameDelta);
|
2014-12-09 10:36:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int dst_width = streaminfos_[stream_idx].width;
|
|
|
|
|
int dst_height = streaminfos_[stream_idx].height;
|
|
|
|
|
// If scaling isn't required, because the input resolution
|
|
|
|
|
// matches the destination or the input image is empty (e.g.
|
|
|
|
|
// a keyframe request for encoders with internal camera
|
2016-07-01 09:05:54 -07:00
|
|
|
// sources) or the source image has a native handle, pass the image on
|
|
|
|
|
// directly. Otherwise, we'll scale it to match what the encoder expects
|
|
|
|
|
// (below).
|
|
|
|
|
// For texture frames, the underlying encoder is expected to be able to
|
|
|
|
|
// correctly sample/scale the source texture.
|
|
|
|
|
// TODO(perkj): ensure that works going forward, and figure out how this
|
|
|
|
|
// affects webrtc:5683.
|
2014-12-09 10:36:40 +00:00
|
|
|
if ((dst_width == src_width && dst_height == src_height) ||
|
Revert "Revert "Update video_coding/codecs to new VideoFrameBuffer interface""
This reverts commit 88f94fa36aa61f7904d30251205c544ada2c4301.
Chromium code has been updated.
Original change's description:
> Revert "Update video_coding/codecs to new VideoFrameBuffer interface"
>
> This reverts commit 20ebf4ede803cd4f628ef9378700f60b72f2eab0.
>
> Reason for revert:
>
> Suspect of breaking FYI bots.
> See https://build.chromium.org/p/chromium.webrtc.fyi/builders/Win7%20Tester/builds/9036 and others.
>
> Sample logs:
> Backtrace:
> [5024:1036:0607/173649.857:FATAL:webrtc_video_frame_adapter.cc(98)] Check failed: false.
> Backtrace:
> base::debug::StackTrace::StackTrace [0x02D04A37+55]
> base::debug::StackTrace::StackTrace [0x02CCBB8A+10]
> content::WebRtcVideoFrameAdapter::NativeToI420Buffer [0x0508AD71+305]
> webrtc::VideoFrameBuffer::ToI420 [0x0230BF67+39]
> webrtc::H264EncoderImpl::Encode [0x057E8D0B+267]
> webrtc::VCMGenericEncoder::Encode [0x057E0E34+333]
> webrtc::vcm::VideoSender::AddVideoFrame [0x057DED9B+796]
> webrtc::ViEEncoder::EncodeVideoFrame [0x057C00F6+884]
> webrtc::ViEEncoder::EncodeTask::Run [0x057C12D7+215]
> rtc::TaskQueue::PostTask [0x03EE5CFB+194]
> base::internal::Invoker<base::internal::BindState<enum extensions::`anonymous namespace'::VerificationResult (__cdecl*)(std::unique_ptr<extensions::NetworkingCastPrivateDelegate::Credentials,std::default_delete<extensions::NetworkingCastPrivateDelegate::C [0x02DDCAA5+31]
> base::internal::Invoker<base::internal::BindState<enum extensions::`anonymous namespace'::VerificationResult (__cdecl*)(std::unique_ptr<extensions::NetworkingCastPrivateDelegate::Credentials,std::default_delete<extensions::NetworkingCastPrivateDelegate::C [0x02DDEE86+22]
> base::debug::TaskAnnotator::RunTask [0x02D08289+409]
> base::MessageLoop::RunTask [0x02C8CEC1+1233]
> base::MessageLoop::DoWork [0x02C8C1AD+765]
> base::MessagePumpDefault::Run [0x02D0A20B+219]
> base::MessageLoop::Run [0x02C8C9DB+107]
> base::RunLoop::Run [0x02C89583+147]
> base::Thread::Run [0x02CBEFCD+173]
> base::Thread::ThreadMain [0x02CBFADE+622]
> base::PlatformThread::Sleep [0x02C9E1A2+290]
> BaseThreadInitThunk [0x75C3338A+18]
> RtlInitializeExceptionChain [0x773A9902+99]
> RtlInitializeExceptionChain [0x773A98D5+54]
>
> Original change's description:
> > Update video_coding/codecs to new VideoFrameBuffer interface
> >
> > This is a follow-up cleanup for CL
> > https://codereview.webrtc.org/2847383002/.
> >
> > Bug: webrtc:7632
> > Change-Id: I47861d779968f2fee94db9c017102a8e87e67fb7
> > Reviewed-on: https://chromium-review.googlesource.com/524163
> > Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#18477}
>
> TBR=magjed@webrtc.org,nisse@webrtc.org,brandtr@webrtc.org
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:7632
>
> Change-Id: I3b73fc7d16ff19ceba196e964dcb36a36510912c
> Reviewed-on: https://chromium-review.googlesource.com/527793
> Reviewed-by: Guido Urdaneta <guidou@chromium.org>
> Commit-Queue: Guido Urdaneta <guidou@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#18489}
TBR=tterriberry@mozilla.com,mflodman@webrtc.org,magjed@webrtc.org,stefan@webrtc.org,guidou@chromium.org,nisse@webrtc.org,brandtr@webrtc.org,webrtc-reviews@webrtc.org
# Not skipping CQ checks because original CL landed > 1 day ago.
No-Presubmit: true
Bug: webrtc:7632
Change-Id: I0962a704e8a9939d4364ce9069c863c9951654c9
Reviewed-on: https://chromium-review.googlesource.com/530684
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18527}
2017-06-10 17:03:37 +00:00
|
|
|
input_image.video_frame_buffer()->type() ==
|
|
|
|
|
VideoFrameBuffer::Type::kNative) {
|
2016-05-25 06:48:46 -07:00
|
|
|
int ret = streaminfos_[stream_idx].encoder->Encode(
|
|
|
|
|
input_image, codec_specific_info, &stream_frame_types);
|
|
|
|
|
if (ret != WEBRTC_VIDEO_CODEC_OK) {
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2014-12-09 10:36:40 +00:00
|
|
|
} else {
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
rtc::scoped_refptr<I420Buffer> dst_buffer =
|
Revert "Revert "Update video_coding/codecs to new VideoFrameBuffer interface""
This reverts commit 88f94fa36aa61f7904d30251205c544ada2c4301.
Chromium code has been updated.
Original change's description:
> Revert "Update video_coding/codecs to new VideoFrameBuffer interface"
>
> This reverts commit 20ebf4ede803cd4f628ef9378700f60b72f2eab0.
>
> Reason for revert:
>
> Suspect of breaking FYI bots.
> See https://build.chromium.org/p/chromium.webrtc.fyi/builders/Win7%20Tester/builds/9036 and others.
>
> Sample logs:
> Backtrace:
> [5024:1036:0607/173649.857:FATAL:webrtc_video_frame_adapter.cc(98)] Check failed: false.
> Backtrace:
> base::debug::StackTrace::StackTrace [0x02D04A37+55]
> base::debug::StackTrace::StackTrace [0x02CCBB8A+10]
> content::WebRtcVideoFrameAdapter::NativeToI420Buffer [0x0508AD71+305]
> webrtc::VideoFrameBuffer::ToI420 [0x0230BF67+39]
> webrtc::H264EncoderImpl::Encode [0x057E8D0B+267]
> webrtc::VCMGenericEncoder::Encode [0x057E0E34+333]
> webrtc::vcm::VideoSender::AddVideoFrame [0x057DED9B+796]
> webrtc::ViEEncoder::EncodeVideoFrame [0x057C00F6+884]
> webrtc::ViEEncoder::EncodeTask::Run [0x057C12D7+215]
> rtc::TaskQueue::PostTask [0x03EE5CFB+194]
> base::internal::Invoker<base::internal::BindState<enum extensions::`anonymous namespace'::VerificationResult (__cdecl*)(std::unique_ptr<extensions::NetworkingCastPrivateDelegate::Credentials,std::default_delete<extensions::NetworkingCastPrivateDelegate::C [0x02DDCAA5+31]
> base::internal::Invoker<base::internal::BindState<enum extensions::`anonymous namespace'::VerificationResult (__cdecl*)(std::unique_ptr<extensions::NetworkingCastPrivateDelegate::Credentials,std::default_delete<extensions::NetworkingCastPrivateDelegate::C [0x02DDEE86+22]
> base::debug::TaskAnnotator::RunTask [0x02D08289+409]
> base::MessageLoop::RunTask [0x02C8CEC1+1233]
> base::MessageLoop::DoWork [0x02C8C1AD+765]
> base::MessagePumpDefault::Run [0x02D0A20B+219]
> base::MessageLoop::Run [0x02C8C9DB+107]
> base::RunLoop::Run [0x02C89583+147]
> base::Thread::Run [0x02CBEFCD+173]
> base::Thread::ThreadMain [0x02CBFADE+622]
> base::PlatformThread::Sleep [0x02C9E1A2+290]
> BaseThreadInitThunk [0x75C3338A+18]
> RtlInitializeExceptionChain [0x773A9902+99]
> RtlInitializeExceptionChain [0x773A98D5+54]
>
> Original change's description:
> > Update video_coding/codecs to new VideoFrameBuffer interface
> >
> > This is a follow-up cleanup for CL
> > https://codereview.webrtc.org/2847383002/.
> >
> > Bug: webrtc:7632
> > Change-Id: I47861d779968f2fee94db9c017102a8e87e67fb7
> > Reviewed-on: https://chromium-review.googlesource.com/524163
> > Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#18477}
>
> TBR=magjed@webrtc.org,nisse@webrtc.org,brandtr@webrtc.org
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:7632
>
> Change-Id: I3b73fc7d16ff19ceba196e964dcb36a36510912c
> Reviewed-on: https://chromium-review.googlesource.com/527793
> Reviewed-by: Guido Urdaneta <guidou@chromium.org>
> Commit-Queue: Guido Urdaneta <guidou@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#18489}
TBR=tterriberry@mozilla.com,mflodman@webrtc.org,magjed@webrtc.org,stefan@webrtc.org,guidou@chromium.org,nisse@webrtc.org,brandtr@webrtc.org,webrtc-reviews@webrtc.org
# Not skipping CQ checks because original CL landed > 1 day ago.
No-Presubmit: true
Bug: webrtc:7632
Change-Id: I0962a704e8a9939d4364ce9069c863c9951654c9
Reviewed-on: https://chromium-review.googlesource.com/530684
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18527}
2017-06-10 17:03:37 +00:00
|
|
|
I420Buffer::Create(dst_width, dst_height);
|
|
|
|
|
rtc::scoped_refptr<I420BufferInterface> src_buffer =
|
|
|
|
|
input_image.video_frame_buffer()->ToI420();
|
|
|
|
|
libyuv::I420Scale(src_buffer->DataY(), src_buffer->StrideY(),
|
|
|
|
|
src_buffer->DataU(), src_buffer->StrideU(),
|
|
|
|
|
src_buffer->DataV(), src_buffer->StrideV(), src_width,
|
|
|
|
|
src_height, dst_buffer->MutableDataY(),
|
|
|
|
|
dst_buffer->StrideY(), dst_buffer->MutableDataU(),
|
|
|
|
|
dst_buffer->StrideU(), dst_buffer->MutableDataV(),
|
|
|
|
|
dst_buffer->StrideV(), dst_width, dst_height,
|
Reland of Delete webrtc::VideoFrame methods buffer and stride. (patchset #1 id:1 of https://codereview.webrtc.org/1983583002/ )
Reason for revert:
Should work after cl https://codereview.webrtc.org/1985693002/ is landed, which initializes the frames used by FakeWebRtcVideoCaptureModule. So intend to reland after that, with no changes.
Original issue's description:
> Revert of Delete webrtc::VideoFrame methods buffer and stride. (patchset #2 id:290001 of https://codereview.webrtc.org/1963413004/ )
>
> Reason for revert:
> Speculative revert to see if failures on the DrMemory bot are related to this cl. See e.g. here:
> https://build.chromium.org/p/client.webrtc/builders/Win%20DrMemory%20Full/builds/4243
>
> UNINITIALIZED READ: reading 0x04980040-0x04980060 32 byte(s) within 0x04980040-0x04980060
> # 0 CopyRow_AVX
> # 1 CopyPlane
> # 2 I420Copy
> # 3 webrtc::ExtractBuffer
> # 4 cricket::WebRtcVideoCapturer::SignalFrameCapturedOnStartThread
> # 5 cricket::WebRtcVideoCapturer::OnIncomingCapturedFrame
> # 6 FakeWebRtcVideoCaptureModule::SendFrame
> # 7 WebRtcVideoCapturerTest_TestCaptureVcm_Test::TestBody
> # 8 testing::internal::HandleSehExceptionsInMethodIfSupported<>
>
> Original issue's description:
> > Reland of Delete webrtc::VideoFrame methods buffer and stride. (patchset #1 id:1 of https://codereview.webrtc.org/1935443002/ )
> >
> > Reason for revert:
> > I plan to reland this change in a week or two, after downstream users are updated.
> >
> > Original issue's description:
> > > Revert of Delete webrtc::VideoFrame methods buffer and stride. (patchset #14 id:250001 of https://codereview.webrtc.org/1900673002/ )
> > >
> > > Reason for revert:
> > > Breaks chrome FYI bots.
> > >
> > > Original issue's description:
> > > > Delete webrtc::VideoFrame methods buffer and stride.
> > > >
> > > > To make the HasOneRef/IsMutable hack work, also had to change the
> > > > video_frame_buffer method to return a const ref to a scoped_ref_ptr,
> > > > to not imply an AddRef.
> > > >
> > > > BUG=webrtc:5682
> > >
> > > TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:5682
> > >
> > > Committed: https://crrev.com/5b3c443d301f2c2f18dac5b02652c08b91ea3828
> > > Cr-Commit-Position: refs/heads/master@{#12558}
> >
> > TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/d0dc66e0ea30c8614001e425a4ae0aa7dd56c2a7
> > Cr-Commit-Position: refs/heads/master@{#12721}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org,nisse@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/d49c30cd2fe442f2b5b4ecec8d5cbaa430464725
> Cr-Commit-Position: refs/heads/master@{#12745}
TBR=perkj@webrtc.org,magjed@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,stefan@webrtc.org,tommi@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/1979193003
Cr-Commit-Position: refs/heads/master@{#12773}
2016-05-17 04:05:47 -07:00
|
|
|
libyuv::kFilterBilinear);
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
|
2016-05-25 06:48:46 -07:00
|
|
|
int ret = streaminfos_[stream_idx].encoder->Encode(
|
Reland of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #1 id:1 of https://codereview.webrtc.org/2354223002/ )
Reason for revert:
Downstream application now fixed.
Original issue's description:
> Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (patchset #14 id:260001 of https://codereview.webrtc.org/2278883002/ )
>
> Reason for revert:
> Broke downstream application.
>
> Original issue's description:
> > Move MutableDataY{,U,V} methods to I420Buffer only.
> >
> > Deleted from the VideoFrameBuffer base class.
> >
> > BUG=webrtc:5921
> >
> > Committed: https://crrev.com/5539ef6c03c273f39fadae41ace47fdc11ac6d60
> > Cr-Commit-Position: refs/heads/master@{#14317}
>
> TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5921
>
> Committed: https://crrev.com/776870a2599b8f43ad56987f9031690e3ccecde8
> Cr-Commit-Position: refs/heads/master@{#14325}
TBR=perkj@webrtc.org,magjed@webrtc.org,pthatcher@webrtc.org,honghaiz@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5921
Review-Url: https://codereview.webrtc.org/2372483002
Cr-Commit-Position: refs/heads/master@{#14389}
2016-09-27 00:17:25 -07:00
|
|
|
VideoFrame(dst_buffer, input_image.timestamp(),
|
|
|
|
|
input_image.render_time_ms(), webrtc::kVideoRotation_0),
|
|
|
|
|
codec_specific_info, &stream_frame_types);
|
2016-05-25 06:48:46 -07:00
|
|
|
if (ret != WEBRTC_VIDEO_CODEC_OK) {
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2014-12-09 10:36:40 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return WEBRTC_VIDEO_CODEC_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int SimulcastEncoderAdapter::RegisterEncodeCompleteCallback(
|
|
|
|
|
EncodedImageCallback* callback) {
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
RTC_DCHECK_CALLED_SEQUENTIALLY(&encoder_queue_);
|
2014-12-09 10:36:40 +00:00
|
|
|
encoded_complete_callback_ = callback;
|
|
|
|
|
return WEBRTC_VIDEO_CODEC_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-23 12:32:22 +02:00
|
|
|
int SimulcastEncoderAdapter::SetRateAllocation(
|
|
|
|
|
const VideoBitrateAllocation& bitrate,
|
|
|
|
|
uint32_t new_framerate) {
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
RTC_DCHECK_CALLED_SEQUENTIALLY(&encoder_queue_);
|
|
|
|
|
|
|
|
|
|
if (!Initialized()) {
|
2014-12-09 10:36:40 +00:00
|
|
|
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
}
|
2016-11-16 16:41:30 +01:00
|
|
|
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
if (new_framerate < 1) {
|
2016-11-16 16:41:30 +01:00
|
|
|
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
}
|
2016-11-16 16:41:30 +01:00
|
|
|
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
if (codec_.maxBitrate > 0 && bitrate.get_sum_kbps() > codec_.maxBitrate) {
|
2014-12-09 10:36:40 +00:00
|
|
|
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
}
|
2016-09-12 16:04:43 +02:00
|
|
|
|
2016-11-16 16:41:30 +01:00
|
|
|
if (bitrate.get_sum_bps() > 0) {
|
2016-09-09 10:27:15 -07:00
|
|
|
// Make sure the bitrate fits the configured min bitrates. 0 is a special
|
|
|
|
|
// value that means paused, though, so leave it alone.
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
if (bitrate.get_sum_kbps() < codec_.minBitrate) {
|
2016-11-16 16:41:30 +01:00
|
|
|
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
}
|
2016-11-16 16:41:30 +01:00
|
|
|
|
2016-09-09 10:27:15 -07:00
|
|
|
if (codec_.numberOfSimulcastStreams > 0 &&
|
2016-11-16 16:41:30 +01:00
|
|
|
bitrate.get_sum_kbps() < codec_.simulcastStream[0].minBitrate) {
|
|
|
|
|
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
2016-09-09 10:27:15 -07:00
|
|
|
}
|
2014-12-09 10:36:40 +00:00
|
|
|
}
|
2016-11-09 05:09:06 -08:00
|
|
|
|
2016-11-16 16:41:30 +01:00
|
|
|
codec_.maxFramerate = new_framerate;
|
2016-11-10 06:46:20 -08:00
|
|
|
|
2016-11-10 08:30:33 -08:00
|
|
|
for (size_t stream_idx = 0; stream_idx < streaminfos_.size(); ++stream_idx) {
|
2016-11-16 16:41:30 +01:00
|
|
|
uint32_t stream_bitrate_kbps =
|
|
|
|
|
bitrate.GetSpatialLayerSum(stream_idx) / 1000;
|
|
|
|
|
|
2014-12-09 10:36:40 +00:00
|
|
|
// Need a key frame if we have not sent this stream before.
|
2016-09-12 16:04:43 +02:00
|
|
|
if (stream_bitrate_kbps > 0 && !streaminfos_[stream_idx].send_stream) {
|
2014-12-09 10:36:40 +00:00
|
|
|
streaminfos_[stream_idx].key_frame_request = true;
|
|
|
|
|
}
|
2016-09-12 16:04:43 +02:00
|
|
|
streaminfos_[stream_idx].send_stream = stream_bitrate_kbps > 0;
|
2014-12-09 10:36:40 +00:00
|
|
|
|
2016-11-16 16:41:30 +01:00
|
|
|
// Slice the temporal layers out of the full allocation and pass it on to
|
|
|
|
|
// the encoder handling the current simulcast stream.
|
2018-04-23 12:32:22 +02:00
|
|
|
VideoBitrateAllocation stream_allocation;
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
for (int i = 0; i < kMaxTemporalStreams; ++i) {
|
2017-11-15 14:58:23 +01:00
|
|
|
if (bitrate.HasBitrate(stream_idx, i)) {
|
|
|
|
|
stream_allocation.SetBitrate(0, i, bitrate.GetBitrate(stream_idx, i));
|
|
|
|
|
}
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
}
|
2016-11-16 16:41:30 +01:00
|
|
|
streaminfos_[stream_idx].encoder->SetRateAllocation(stream_allocation,
|
|
|
|
|
new_framerate);
|
2014-12-09 10:36:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return WEBRTC_VIDEO_CODEC_OK;
|
|
|
|
|
}
|
|
|
|
|
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
// TODO(brandtr): Add task checker to this member function, when all encoder
|
|
|
|
|
// callbacks are coming in on the encoder queue.
|
2016-08-02 17:46:41 -07:00
|
|
|
EncodedImageCallback::Result SimulcastEncoderAdapter::OnEncodedImage(
|
2015-04-15 09:24:26 -07:00
|
|
|
size_t stream_idx,
|
2014-12-09 10:36:40 +00:00
|
|
|
const EncodedImage& encodedImage,
|
|
|
|
|
const CodecSpecificInfo* codecSpecificInfo,
|
|
|
|
|
const RTPFragmentationHeader* fragmentation) {
|
2018-08-27 15:33:42 +02:00
|
|
|
EncodedImage stream_image(encodedImage);
|
2014-12-09 10:36:40 +00:00
|
|
|
CodecSpecificInfo stream_codec_specific = *codecSpecificInfo;
|
2018-08-27 15:33:42 +02:00
|
|
|
|
|
|
|
|
stream_image.SetSpatialIndex(stream_idx);
|
2014-12-09 10:36:40 +00:00
|
|
|
|
2016-08-02 17:46:41 -07:00
|
|
|
return encoded_complete_callback_->OnEncodedImage(
|
2018-08-27 15:33:42 +02:00
|
|
|
stream_image, &stream_codec_specific, fragmentation);
|
2014-12-09 10:36:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SimulcastEncoderAdapter::PopulateStreamCodec(
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
const webrtc::VideoCodec& inst,
|
2014-12-09 10:36:40 +00:00
|
|
|
int stream_index,
|
2016-09-12 16:04:43 +02:00
|
|
|
uint32_t start_bitrate_kbps,
|
2014-12-09 10:36:40 +00:00
|
|
|
bool highest_resolution_stream,
|
2016-09-12 16:04:43 +02:00
|
|
|
webrtc::VideoCodec* stream_codec) {
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
*stream_codec = inst;
|
2014-12-09 10:36:40 +00:00
|
|
|
|
|
|
|
|
// Stream specific settings.
|
|
|
|
|
stream_codec->numberOfSimulcastStreams = 0;
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
stream_codec->width = inst.simulcastStream[stream_index].width;
|
|
|
|
|
stream_codec->height = inst.simulcastStream[stream_index].height;
|
|
|
|
|
stream_codec->maxBitrate = inst.simulcastStream[stream_index].maxBitrate;
|
|
|
|
|
stream_codec->minBitrate = inst.simulcastStream[stream_index].minBitrate;
|
|
|
|
|
stream_codec->qpMax = inst.simulcastStream[stream_index].qpMax;
|
2014-12-09 10:36:40 +00:00
|
|
|
// Settings that are based on stream/resolution.
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
const bool lowest_resolution_stream = (stream_index == 0);
|
2018-08-27 11:07:48 +02:00
|
|
|
if (lowest_resolution_stream) {
|
2014-12-09 10:36:40 +00:00
|
|
|
// Settings for lowest spatial resolutions.
|
2018-08-27 11:07:48 +02:00
|
|
|
if (inst.mode == VideoCodecMode::kScreensharing) {
|
|
|
|
|
if (experimental_boosted_screenshare_qp_) {
|
|
|
|
|
stream_codec->qpMax = *experimental_boosted_screenshare_qp_;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
stream_codec->qpMax = kLowestResMaxQp;
|
|
|
|
|
}
|
2014-12-09 10:36:40 +00:00
|
|
|
}
|
2018-06-21 16:16:38 +02:00
|
|
|
if (inst.codecType == webrtc::kVideoCodecVP8) {
|
|
|
|
|
stream_codec->VP8()->numberOfTemporalLayers =
|
|
|
|
|
inst.simulcastStream[stream_index].numberOfTemporalLayers;
|
|
|
|
|
if (!highest_resolution_stream) {
|
|
|
|
|
// For resolutions below CIF, set the codec |complexity| parameter to
|
|
|
|
|
// kComplexityHigher, which maps to cpu_used = -4.
|
|
|
|
|
int pixels_per_frame = stream_codec->width * stream_codec->height;
|
|
|
|
|
if (pixels_per_frame < 352 * 288) {
|
|
|
|
|
stream_codec->VP8()->complexity =
|
|
|
|
|
webrtc::VideoCodecComplexity::kComplexityHigher;
|
|
|
|
|
}
|
|
|
|
|
// Turn off denoising for all streams but the highest resolution.
|
|
|
|
|
stream_codec->VP8()->denoisingOn = false;
|
2014-12-09 10:36:40 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// TODO(ronghuawu): what to do with targetBitrate.
|
|
|
|
|
|
2016-09-12 16:04:43 +02:00
|
|
|
stream_codec->startBitrate = start_bitrate_kbps;
|
2014-12-09 10:36:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool SimulcastEncoderAdapter::Initialized() const {
|
Reland of use allocated encoders in SimulcastEncoderAdapter. (patchset #1 id:1 of https://codereview.webrtc.org/2893003002/ )
Reason for reland:
Chrome encoder implementation fixed.
Original issue's description:
> Revert of Reuse allocated encoders in SimulcastEncoderAdapter. (patchset #15 id:320001 of https://codereview.webrtc.org/2830793005/ )
>
> Reason for revert:
> Breaks Chrome tests.
>
> Original issue's description:
> > Reuse allocated encoders in SimulcastEncoderAdapter.
> >
> > Prior to this change, the SimulcastEncoderAdapter would destroy and create
> > encoders whenever it is being reinitialized. After this change, the
> > SimulcastEncoderAdapter will cache the already allocated encoders, and reuse
> > them after reinitialization.
> >
> > This change will help in reducing the number of PictureID "jumps" that have
> > been seen around encoder reinitialization.
> >
> > TESTED=AppRTCMobile, Chrome desktop, and internal app, with forced encoder reinits every 30 frames and https://codereview.webrtc.org/2833493003/ applied.
> > BUG=webrtc:7475
> >
> > Review-Url: https://codereview.webrtc.org/2830793005
> > Cr-Commit-Position: refs/heads/master@{#18215}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/0b8bfb9d98b7a2011d80bcdf3f430bc040370dad
>
> TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7475
>
> Review-Url: https://codereview.webrtc.org/2893003002
> Cr-Commit-Position: refs/heads/master@{#18216}
> Committed: https://chromium.googlesource.com/external/webrtc/+/56e119e2e8b30d2d41c55c3a7983b077a5262718
TBR=stefan@webrtc.org,noahric@chromium.org,glaznev@webrtc.org,sprang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7475
Review-Url: https://codereview.webrtc.org/2901493002
Cr-Commit-Position: refs/heads/master@{#18228}
2017-05-23 03:32:16 -07:00
|
|
|
return rtc::AtomicOps::AcquireLoad(&inited_) == 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SimulcastEncoderAdapter::DestroyStoredEncoders() {
|
|
|
|
|
while (!stored_encoders_.empty()) {
|
|
|
|
|
stored_encoders_.pop();
|
|
|
|
|
}
|
2014-12-09 10:36:40 +00:00
|
|
|
}
|
|
|
|
|
|
2018-11-01 14:52:30 +01:00
|
|
|
VideoEncoder::EncoderInfo SimulcastEncoderAdapter::GetEncoderInfo() const {
|
2018-11-07 14:53:32 +01:00
|
|
|
return encoder_info_;
|
2016-01-07 08:03:05 -08:00
|
|
|
}
|
|
|
|
|
|
2014-12-09 10:36:40 +00:00
|
|
|
} // namespace webrtc
|