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:
@ -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