This reverts commit a2cb93d8b9659292f7ec73db53421d481f84c22c. Reason for revert: Reland with no changes after downstream projects are updated. Original change's description: > Revert "Wire up internal libvpx VP9 scaler to statistics proxy" > > This reverts commit 50327a51007c3e25bc3bcd35b5d0945fe0f27d05. > > Reason for revert: Breaks downstream tests > > Original change's description: > > Wire up internal libvpx VP9 scaler to statistics proxy > > > > Bug: webrtc:11396 > > Change-Id: I5ac69208b00cc75d4e5dbb3ab86f234b3e1f29f8 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/169922 > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Reviewed-by: Henrik Boström <hbos@webrtc.org> > > Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#30725} > > TBR=ilnik@webrtc.org,hbos@webrtc.org,nisse@webrtc.org > > Change-Id: I53dcb41bdf8f8dccfcd43b717509ec047f590648 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:11396 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170102 > Reviewed-by: Sebastian Jansson <srte@webrtc.org> > Commit-Queue: Sebastian Jansson <srte@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#30734} TBR=ilnik@webrtc.org,hbos@webrtc.org,nisse@webrtc.org,srte@webrtc.org Change-Id: Ie47df4aec199701256c1dba8fa64176683becabc No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:11396 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170105 Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30738}
112 lines
4.0 KiB
C++
112 lines
4.0 KiB
C++
/*
|
|
* Copyright (c) 2018 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.
|
|
*/
|
|
|
|
#ifndef API_VIDEO_VIDEO_STREAM_ENCODER_OBSERVER_H_
|
|
#define API_VIDEO_VIDEO_STREAM_ENCODER_OBSERVER_H_
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "absl/types/optional.h"
|
|
#include "api/video/video_bitrate_allocation.h"
|
|
#include "api/video/video_codec_constants.h"
|
|
#include "api/video_codecs/video_encoder.h"
|
|
#include "api/video_codecs/video_encoder_config.h"
|
|
|
|
namespace webrtc {
|
|
|
|
// TODO(nisse): Used for the OnSendEncodedImage callback below. The callback
|
|
// wants metadata such as size, encode timing, qp, but doesn't need actual
|
|
// encoded data. So use some other type to represent that.
|
|
class EncodedImage;
|
|
|
|
// Broken out into a base class, with public inheritance below, only to ease
|
|
// unit testing of the internal class OveruseFrameDetector.
|
|
class CpuOveruseMetricsObserver {
|
|
public:
|
|
virtual ~CpuOveruseMetricsObserver() = default;
|
|
virtual void OnEncodedFrameTimeMeasured(int encode_duration_ms,
|
|
int encode_usage_percent) = 0;
|
|
};
|
|
|
|
class VideoStreamEncoderObserver : public CpuOveruseMetricsObserver {
|
|
public:
|
|
// Number of resolution and framerate reductions (unset if disabled).
|
|
struct AdaptationSteps {
|
|
AdaptationSteps();
|
|
absl::optional<int> num_resolution_reductions = 0;
|
|
absl::optional<int> num_framerate_reductions = 0;
|
|
};
|
|
|
|
// TODO(nisse): There are too many enums to represent this. Besides
|
|
// this one, see AdaptationObserverInterface::AdaptReason and
|
|
// WebRtcVideoChannel::AdaptReason.
|
|
enum class AdaptationReason {
|
|
kNone, // Used for reset of counters.
|
|
kCpu,
|
|
kQuality,
|
|
};
|
|
|
|
// TODO(nisse): Duplicates enum EncodedImageCallback::DropReason.
|
|
enum class DropReason {
|
|
kSource,
|
|
kEncoderQueue,
|
|
kEncoder,
|
|
kMediaOptimization,
|
|
kCongestionWindow
|
|
};
|
|
|
|
~VideoStreamEncoderObserver() override = default;
|
|
|
|
virtual void OnIncomingFrame(int width, int height) = 0;
|
|
|
|
// TODO(nisse): Merge into one callback per encoded frame.
|
|
using CpuOveruseMetricsObserver::OnEncodedFrameTimeMeasured;
|
|
virtual void OnSendEncodedImage(const EncodedImage& encoded_image,
|
|
const CodecSpecificInfo* codec_info) = 0;
|
|
|
|
virtual void OnEncoderImplementationChanged(
|
|
const std::string& implementation_name) = 0;
|
|
|
|
virtual void OnFrameDropped(DropReason reason) = 0;
|
|
|
|
// Used to indicate change in content type, which may require a change in
|
|
// how stats are collected and set the configured preferred media bitrate.
|
|
virtual void OnEncoderReconfigured(
|
|
const VideoEncoderConfig& encoder_config,
|
|
const std::vector<VideoStream>& streams) = 0;
|
|
|
|
virtual void OnAdaptationChanged(AdaptationReason reason,
|
|
const AdaptationSteps& cpu_steps,
|
|
const AdaptationSteps& quality_steps) = 0;
|
|
virtual void OnMinPixelLimitReached() = 0;
|
|
virtual void OnInitialQualityResolutionAdaptDown() = 0;
|
|
|
|
virtual void OnSuspendChange(bool is_suspended) = 0;
|
|
|
|
virtual void OnBitrateAllocationUpdated(
|
|
const VideoCodec& codec,
|
|
const VideoBitrateAllocation& allocation) {}
|
|
|
|
// Informes observer if an internal encoder scaler has reduced video
|
|
// resolution or not. |is_scaled| is a flag indicating if the video is scaled
|
|
// down.
|
|
virtual void OnEncoderInternalScalerUpdate(bool is_scaled) {}
|
|
|
|
// TODO(nisse): VideoStreamEncoder wants to query the stats, which makes this
|
|
// not a pure observer. GetInputFrameRate is needed for the cpu adaptation, so
|
|
// can be deleted if that responsibility is moved out to a VideoStreamAdaptor
|
|
// class.
|
|
virtual int GetInputFrameRate() const = 0;
|
|
};
|
|
|
|
} // namespace webrtc
|
|
#endif // API_VIDEO_VIDEO_STREAM_ENCODER_OBSERVER_H_
|