Remove ViEImageProcess usage in VideoSendStream.

Replaces interface usage with direct calls on ViEEncoder removing a
layer of indirection. Also removing some methods from ViEImageProcess
that were only added for Video{Send,Receive}Stream usage.

BUG=1695
R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/45319004

Cr-Commit-Position: refs/heads/master@{#9111}
This commit is contained in:
Peter Boström 2015-04-29 14:08:41 +02:00
parent c444de6276
commit 94cc1fe4af
8 changed files with 5 additions and 131 deletions

View File

@ -1307,12 +1307,6 @@ class FakeWebRtcVideoEngine
return 0;
}
WEBRTC_STUB(EnableColorEnhancement, (const int, const bool));
WEBRTC_VOID_STUB(RegisterPreEncodeCallback,
(int, webrtc::I420FrameCallback*));
WEBRTC_VOID_STUB(DeRegisterPreEncodeCallback, (int));
WEBRTC_VOID_STUB(RegisterPreRenderCallback,
(int, webrtc::I420FrameCallback*));
WEBRTC_VOID_STUB(DeRegisterPreRenderCallback, (int));
// webrtc::ViEExternalCodec
WEBRTC_FUNC(RegisterExternalSendCodec,
(const int channel,

View File

@ -216,13 +216,9 @@ VideoSendStream::VideoSendStream(
video_engine_base_->RegisterSendSideDelayObserver(channel_, &stats_proxy_);
video_engine_base_->RegisterSendStatisticsProxy(channel_, &stats_proxy_);
image_process_ = ViEImageProcess::GetInterface(video_engine);
image_process_->RegisterPreEncodeCallback(channel_,
config_.pre_encode_callback);
if (config_.post_encode_callback) {
image_process_->RegisterPostEncodeImageCallback(channel_,
&encoded_frame_proxy_);
}
vie_encoder_->RegisterPreEncodeCallback(config_.pre_encode_callback);
if (config_.post_encode_callback)
vie_encoder_->RegisterPostEncodeImageCallback(&encoded_frame_proxy_);
if (config_.suspend_below_min_bitrate)
codec_->SuspendBelowMinBitrate(channel_);
@ -246,7 +242,8 @@ VideoSendStream::~VideoSendStream() {
vie_channel_->RegisterSendChannelRtpStatisticsCallback(nullptr);
vie_channel_->RegisterSendChannelRtcpStatisticsCallback(nullptr);
image_process_->DeRegisterPreEncodeCallback(channel_);
vie_encoder_->RegisterPreEncodeCallback(nullptr);
vie_encoder_->RegisterPostEncodeImageCallback(nullptr);
vie_channel_->DeregisterSendTransport();
@ -258,7 +255,6 @@ VideoSendStream::~VideoSendStream() {
video_engine_base_->DeleteChannel(channel_);
image_process_->Release();
video_engine_base_->Release();
capture_->Release();
codec_->Release();

View File

@ -35,7 +35,6 @@ class ViEChannel;
class ViEEncoder;
class ViEExternalCapture;
class ViEExternalCodec;
class ViEImageProcess;
namespace internal {
@ -91,7 +90,6 @@ class VideoSendStream : public webrtc::VideoSendStream,
ViECodec* codec_;
ViEEncoder* vie_encoder_;
ViEExternalCapture* external_capture_;
ViEImageProcess* image_process_;
int channel_;
int capture_id_;

View File

@ -94,27 +94,6 @@ class WEBRTC_DLLEXPORT ViEImageProcess {
virtual int EnableColorEnhancement(const int video_channel,
const bool enable) = 0;
// New-style callbacks, used by VideoSendStream/VideoReceiveStream.
virtual void RegisterPreEncodeCallback(
int video_channel,
I420FrameCallback* pre_encode_callback) = 0;
virtual void DeRegisterPreEncodeCallback(int video_channel) = 0;
virtual void RegisterPostEncodeImageCallback(
int video_channel,
EncodedImageCallback* post_encode_callback) {}
virtual void DeRegisterPostEncodeCallback(int video_channel) {}
virtual void RegisterPreDecodeImageCallback(
int video_channel,
EncodedImageCallback* pre_decode_callback) {}
virtual void DeRegisterPreDecodeCallback(int video_channel) {}
virtual void RegisterPreRenderCallback(
int video_channel,
I420FrameCallback* pre_render_callback) = 0;
virtual void DeRegisterPreRenderCallback(int video_channel) = 0;
protected:
ViEImageProcess() {}
virtual ~ViEImageProcess() {}

View File

@ -904,20 +904,11 @@ void ViEEncoder::RegisterPreEncodeCallback(
pre_encode_callback_ = pre_encode_callback;
}
void ViEEncoder::DeRegisterPreEncodeCallback() {
CriticalSectionScoped cs(callback_cs_.get());
pre_encode_callback_ = NULL;
}
void ViEEncoder::RegisterPostEncodeImageCallback(
EncodedImageCallback* post_encode_callback) {
vcm_->RegisterPostEncodeImageCallback(post_encode_callback);
}
void ViEEncoder::DeRegisterPostEncodeImageCallback() {
vcm_->RegisterPostEncodeImageCallback(NULL);
}
void ViEEncoder::RegisterSendStatisticsProxy(
SendStatisticsProxy* send_statistics_proxy) {
CriticalSectionScoped cs(callback_cs_.get());

View File

@ -169,10 +169,8 @@ class ViEEncoder
// New-style callbacks, used by VideoSendStream.
void RegisterPreEncodeCallback(I420FrameCallback* pre_encode_callback);
void DeRegisterPreEncodeCallback();
void RegisterPostEncodeImageCallback(
EncodedImageCallback* post_encode_callback);
void DeRegisterPostEncodeImageCallback();
void RegisterSendStatisticsProxy(SendStatisticsProxy* send_statistics_proxy);

View File

@ -203,66 +203,4 @@ int ViEImageProcessImpl::EnableColorEnhancement(const int video_channel,
}
return 0;
}
void ViEImageProcessImpl::RegisterPreEncodeCallback(
int video_channel,
I420FrameCallback* pre_encode_callback) {
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEEncoder* vie_encoder = cs.Encoder(video_channel);
vie_encoder->RegisterPreEncodeCallback(pre_encode_callback);
}
void ViEImageProcessImpl::DeRegisterPreEncodeCallback(int video_channel) {
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEEncoder* vie_encoder = cs.Encoder(video_channel);
assert(vie_encoder != NULL);
vie_encoder->DeRegisterPreEncodeCallback();
}
void ViEImageProcessImpl::RegisterPostEncodeImageCallback(
int video_channel,
EncodedImageCallback* post_encode_callback) {
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEEncoder* vie_encoder = cs.Encoder(video_channel);
assert(vie_encoder != NULL);
vie_encoder->RegisterPostEncodeImageCallback(post_encode_callback);
}
void ViEImageProcessImpl::DeRegisterPostEncodeCallback(int video_channel) {
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEEncoder* vie_encoder = cs.Encoder(video_channel);
assert(vie_encoder != NULL);
vie_encoder->DeRegisterPostEncodeImageCallback();
}
void ViEImageProcessImpl::RegisterPreDecodeImageCallback(
int video_channel,
EncodedImageCallback* pre_decode_callback) {
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* channel = cs.Channel(video_channel);
channel->RegisterPreDecodeImageCallback(pre_decode_callback);
}
void ViEImageProcessImpl::DeRegisterPreDecodeCallback(int video_channel) {
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* channel = cs.Channel(video_channel);
channel->RegisterPreDecodeImageCallback(NULL);
}
void ViEImageProcessImpl::RegisterPreRenderCallback(
int video_channel,
I420FrameCallback* pre_render_callback) {
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel);
assert(vie_channel != NULL);
vie_channel->RegisterPreRenderCallback(pre_render_callback);
}
void ViEImageProcessImpl::DeRegisterPreRenderCallback(int video_channel) {
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel);
assert(vie_channel != NULL);
vie_channel->RegisterPreRenderCallback(NULL);
}
} // namespace webrtc

View File

@ -37,26 +37,6 @@ class ViEImageProcessImpl
virtual int EnableDeflickering(const int capture_id, const bool enable);
virtual int EnableColorEnhancement(const int video_channel,
const bool enable);
void RegisterPreEncodeCallback(
int video_channel,
I420FrameCallback* pre_encode_callback) override;
void DeRegisterPreEncodeCallback(int video_channel) override;
void RegisterPostEncodeImageCallback(
int video_channel,
EncodedImageCallback* post_encode_callback) override;
void DeRegisterPostEncodeCallback(int video_channel) override;
void RegisterPreDecodeImageCallback(
int video_channel,
EncodedImageCallback* post_encode_callback) override;
void DeRegisterPreDecodeCallback(int video_channel) override;
void RegisterPreRenderCallback(
int video_channel,
I420FrameCallback* pre_render_callback) override;
void DeRegisterPreRenderCallback(int video_channel) override;
protected:
explicit ViEImageProcessImpl(ViESharedData* shared_data);
virtual ~ViEImageProcessImpl();