Delete unused send-side methods of VideoCodingModule
Bug: webrtc:8064 Change-Id: Icb7a452dfefce01ff59f6568b4766d609c2725bf Reviewed-on: https://webrtc-review.googlesource.com/c/14900 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26023}
This commit is contained in:
@ -47,65 +47,6 @@ class VideoCodingModule : public Module {
|
||||
// DEPRECATED.
|
||||
static VideoCodingModule* Create(Clock* clock);
|
||||
|
||||
/*
|
||||
* Sender
|
||||
*/
|
||||
|
||||
// Registers a codec to be used for encoding. Calling this
|
||||
// API multiple times overwrites any previously registered codecs.
|
||||
//
|
||||
// NOTE: Must be called on the thread that constructed the VCM instance.
|
||||
//
|
||||
// Input:
|
||||
// - sendCodec : Settings for the codec to be registered.
|
||||
// - numberOfCores : The number of cores the codec is allowed
|
||||
// to use.
|
||||
// - maxPayloadSize : The maximum size each payload is allowed
|
||||
// to have. Usually MTU - overhead.
|
||||
//
|
||||
// Return value : VCM_OK, on success.
|
||||
// < 0, on error.
|
||||
virtual int32_t RegisterSendCodec(const VideoCodec* sendCodec,
|
||||
uint32_t numberOfCores,
|
||||
uint32_t maxPayloadSize) = 0;
|
||||
|
||||
// Register an external encoder object. This can not be used together with
|
||||
// external decoder callbacks.
|
||||
//
|
||||
// Input:
|
||||
// - externalEncoder : Encoder object to be used for encoding frames
|
||||
// inserted
|
||||
// with the AddVideoFrame API.
|
||||
// - payloadType : The payload type bound which this encoder is bound
|
||||
// to.
|
||||
//
|
||||
// Return value : VCM_OK, on success.
|
||||
// < 0, on error.
|
||||
// TODO(pbos): Remove return type when unused elsewhere.
|
||||
virtual int32_t RegisterExternalEncoder(VideoEncoder* externalEncoder,
|
||||
uint8_t payloadType,
|
||||
bool internalSource = false) = 0;
|
||||
|
||||
// Sets the parameters describing the send channel. These parameters are
|
||||
// inputs to the
|
||||
// Media Optimization inside the VCM and also specifies the target bit rate
|
||||
// for the
|
||||
// encoder. Bit rate used by NACK should already be compensated for by the
|
||||
// user.
|
||||
//
|
||||
// Input:
|
||||
// - target_bitrate : The target bitrate for VCM in bits/s.
|
||||
// - lossRate : Fractions of lost packets the past second.
|
||||
// (loss rate in percent = 100 * packetLoss /
|
||||
// 255)
|
||||
// - rtt : Current round-trip time in ms.
|
||||
//
|
||||
// Return value : VCM_OK, on success.
|
||||
// < 0, on error.
|
||||
virtual int32_t SetChannelParameters(uint32_t target_bitrate,
|
||||
uint8_t lossRate,
|
||||
int64_t rtt) = 0;
|
||||
|
||||
// Enable or disable a video protection method.
|
||||
//
|
||||
// Input:
|
||||
@ -118,45 +59,6 @@ class VideoCodingModule : public Module {
|
||||
virtual int32_t SetVideoProtection(VCMVideoProtection videoProtection,
|
||||
bool enable) = 0;
|
||||
|
||||
// Add one raw video frame to the encoder. This function does all the
|
||||
// necessary
|
||||
// processing, then decides what frame type to encode, or if the frame should
|
||||
// be
|
||||
// dropped. If the frame should be encoded it passes the frame to the encoder
|
||||
// before it returns.
|
||||
//
|
||||
// Input:
|
||||
// - videoFrame : Video frame to encode.
|
||||
// - codecSpecificInfo : Extra codec information, e.g., pre-parsed
|
||||
// in-band signaling.
|
||||
//
|
||||
// Return value : VCM_OK, on success.
|
||||
// < 0, on error.
|
||||
virtual int32_t AddVideoFrame(
|
||||
const VideoFrame& videoFrame,
|
||||
const CodecSpecificInfo* codecSpecificInfo = NULL) = 0;
|
||||
|
||||
// Next frame encoded should be an intra frame (keyframe).
|
||||
//
|
||||
// Return value : VCM_OK, on success.
|
||||
// < 0, on error.
|
||||
virtual int32_t IntraFrameRequest(size_t stream_index) = 0;
|
||||
|
||||
// Frame Dropper enable. Can be used to disable the frame dropping when the
|
||||
// encoder
|
||||
// over-uses its bit rate. This API is designed to be used when the encoded
|
||||
// frames
|
||||
// are supposed to be stored to an AVI file, or when the I420 codec is used
|
||||
// and the
|
||||
// target bit rate shouldn't affect the frame rate.
|
||||
//
|
||||
// Input:
|
||||
// - enable : True to enable the setting, false to disable it.
|
||||
//
|
||||
// Return value : VCM_OK, on success.
|
||||
// < 0, on error.
|
||||
virtual int32_t EnableFrameDropper(bool enable) = 0;
|
||||
|
||||
/*
|
||||
* Receiver
|
||||
*/
|
||||
@ -288,9 +190,6 @@ class VideoCodingModule : public Module {
|
||||
virtual void SetNackSettings(size_t max_nack_list_size,
|
||||
int max_packet_age_to_nack,
|
||||
int max_incomplete_time_ms) = 0;
|
||||
|
||||
virtual void RegisterPostEncodeImageCallback(
|
||||
EncodedImageCallback* post_encode_callback) = 0;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -13,10 +13,7 @@
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include "api/video/builtin_video_bitrate_allocator_factory.h"
|
||||
#include "api/video/encoded_image.h"
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "api/video/video_bitrate_allocator_factory.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "modules/video_coding/include/video_codec_interface.h"
|
||||
#include "modules/video_coding/timing.h"
|
||||
@ -43,34 +40,6 @@ void VCMProcessTimer::Processed() {
|
||||
} // namespace vcm
|
||||
|
||||
namespace {
|
||||
// This wrapper provides a way to modify the callback without the need to expose
|
||||
// a register method all the way down to the function calling it.
|
||||
class EncodedImageCallbackWrapper : public EncodedImageCallback {
|
||||
public:
|
||||
EncodedImageCallbackWrapper() : callback_(nullptr) {}
|
||||
|
||||
virtual ~EncodedImageCallbackWrapper() {}
|
||||
|
||||
void Register(EncodedImageCallback* callback) {
|
||||
rtc::CritScope lock(&cs_);
|
||||
callback_ = callback;
|
||||
}
|
||||
|
||||
virtual Result OnEncodedImage(const EncodedImage& encoded_image,
|
||||
const CodecSpecificInfo* codec_specific_info,
|
||||
const RTPFragmentationHeader* fragmentation) {
|
||||
rtc::CritScope lock(&cs_);
|
||||
if (callback_) {
|
||||
return callback_->OnEncodedImage(encoded_image, codec_specific_info,
|
||||
fragmentation);
|
||||
}
|
||||
return Result(Result::ERROR_SEND_FAILED);
|
||||
}
|
||||
|
||||
private:
|
||||
rtc::CriticalSection cs_;
|
||||
EncodedImageCallback* callback_ RTC_GUARDED_BY(cs_);
|
||||
};
|
||||
|
||||
class VideoCodingModuleImpl : public VideoCodingModule {
|
||||
public:
|
||||
@ -78,8 +47,6 @@ class VideoCodingModuleImpl : public VideoCodingModule {
|
||||
NackSender* nack_sender,
|
||||
KeyFrameRequestSender* keyframe_request_sender)
|
||||
: VideoCodingModule(),
|
||||
sender_(clock, &post_encode_callback_),
|
||||
rate_allocator_factory_(CreateBuiltinVideoBitrateAllocatorFactory()),
|
||||
timing_(new VCMTiming(clock)),
|
||||
receiver_(clock, timing_.get(), nack_sender, keyframe_request_sender) {}
|
||||
|
||||
@ -93,57 +60,12 @@ class VideoCodingModuleImpl : public VideoCodingModule {
|
||||
|
||||
void Process() override { receiver_.Process(); }
|
||||
|
||||
int32_t RegisterSendCodec(const VideoCodec* sendCodec,
|
||||
uint32_t numberOfCores,
|
||||
uint32_t maxPayloadSize) override {
|
||||
if (sendCodec != nullptr && ((sendCodec->codecType == kVideoCodecVP8) ||
|
||||
(sendCodec->codecType == kVideoCodecH264))) {
|
||||
// Set up a rate allocator and temporal layers factory for this codec
|
||||
// instance. The codec impl will have a raw pointer to the TL factory,
|
||||
// and will call it when initializing. Since this can happen
|
||||
// asynchronously keep the instance alive until destruction or until a
|
||||
// new send codec is registered.
|
||||
VideoCodec codec = *sendCodec;
|
||||
rate_allocator_ =
|
||||
rate_allocator_factory_->CreateVideoBitrateAllocator(codec);
|
||||
return sender_.RegisterSendCodec(&codec, numberOfCores, maxPayloadSize);
|
||||
}
|
||||
return sender_.RegisterSendCodec(sendCodec, numberOfCores, maxPayloadSize);
|
||||
}
|
||||
|
||||
int32_t RegisterExternalEncoder(VideoEncoder* externalEncoder,
|
||||
uint8_t /* payloadType */,
|
||||
bool internalSource) override {
|
||||
sender_.RegisterExternalEncoder(externalEncoder, internalSource);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t SetChannelParameters(uint32_t target_bitrate, // bits/s.
|
||||
uint8_t lossRate,
|
||||
int64_t rtt) override {
|
||||
return sender_.SetChannelParameters(target_bitrate, rate_allocator_.get(),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
int32_t SetVideoProtection(VCMVideoProtection videoProtection,
|
||||
bool enable) override {
|
||||
// TODO(pbos): Remove enable from receive-side protection modes as well.
|
||||
return receiver_.SetVideoProtection(videoProtection, enable);
|
||||
}
|
||||
|
||||
int32_t AddVideoFrame(const VideoFrame& videoFrame,
|
||||
const CodecSpecificInfo* codecSpecificInfo) override {
|
||||
return sender_.AddVideoFrame(videoFrame, codecSpecificInfo, absl::nullopt);
|
||||
}
|
||||
|
||||
int32_t IntraFrameRequest(size_t stream_index) override {
|
||||
return sender_.IntraFrameRequest(stream_index);
|
||||
}
|
||||
|
||||
int32_t EnableFrameDropper(bool enable) override {
|
||||
return sender_.EnableFrameDropper(enable);
|
||||
}
|
||||
|
||||
int32_t RegisterReceiveCodec(const VideoCodec* receiveCodec,
|
||||
int32_t numberOfCores,
|
||||
bool requireKeyFrame) override {
|
||||
@ -195,17 +117,8 @@ class VideoCodingModuleImpl : public VideoCodingModule {
|
||||
max_incomplete_time_ms);
|
||||
}
|
||||
|
||||
void RegisterPostEncodeImageCallback(
|
||||
EncodedImageCallback* observer) override {
|
||||
post_encode_callback_.Register(observer);
|
||||
}
|
||||
|
||||
private:
|
||||
rtc::ThreadChecker construction_thread_;
|
||||
EncodedImageCallbackWrapper post_encode_callback_;
|
||||
vcm::VideoSender sender_;
|
||||
const std::unique_ptr<VideoBitrateAllocatorFactory> rate_allocator_factory_;
|
||||
std::unique_ptr<VideoBitrateAllocator> rate_allocator_;
|
||||
const std::unique_ptr<VCMTiming> timing_;
|
||||
vcm::VideoReceiver receiver_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user