Skip to content

Commit

Permalink
Remove ViEFrameProviderBase.
Browse files Browse the repository at this point in the history
BUG=1695
R=stefan@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9252}
  • Loading branch information
Peter Boström committed May 21, 2015
1 parent af55ccc commit 36a1438
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 461 deletions.
17 changes: 0 additions & 17 deletions tools/valgrind-webrtc/drmemory/suppressions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,23 +160,6 @@ name=https://code.google.com/p/webrtc/issues/detail?id=3158 (2)
*!WebRtcVideoMediaChannelTest_TwoStreamsSendAndFailUnsignalledRecv_Test::TestBody
*!testing::internal::HandleSehExceptionsInMethodIfSupported<>

UNINITIALIZED READ
name=https://code.google.com/p/webrtc/issues/detail?id=3158 (3)
*!_output_l
*!_vsnprintf_l
*!_vsnprintf
*!webrtc::Trace::Add
*!webrtc::ViEEncoder::DeliverFrame
*!webrtc::ViEFrameProviderBase::DeliverFrame
*!webrtc::ViECapturer::DeliverI420Frame
*!webrtc::ViECapturer::ViECaptureProcess
*!webrtc::ViECapturer::ViECaptureThreadFunction
*!webrtc::ThreadWindows::Run
*!webrtc::ThreadWindows::StartThread
*!_callthreadstartex
*!_threadstartex
KERNEL32.dll!BaseThreadInitThunk

# rtc_unittest, fails on Win DrMemory Full
UNINITIALIZED READ
name=https://code.google.com/p/webrtc/issues/detail?id=3158 (4)
Expand Down
31 changes: 0 additions & 31 deletions tools/valgrind-webrtc/memcheck/suppressions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,24 +185,6 @@
fun:StartThread
}

{
bug_329_4
Memcheck:Param
socketcall.sendto(msg)
obj:*libpthread-*.so
fun:_ZN6webrtc14UdpSocketPosix6SendToEPKaiRKNS_13SocketAddressE
...
fun:_ZN6webrtc17ModuleRtpRtcpImpl16SendOutgoingDataENS_9FrameTypeEajlPKhjPKNS_22RTPFragmentationHeaderEPKNS_14RTPVideoHeaderE
...
fun:_ZN6webrtc10ViEEncoder12DeliverFrameEiPNS_10VideoFrameEiPKj
fun:_ZN6webrtc20ViEFrameProviderBase12DeliverFrameEPNS_10VideoFrameEiPKj
fun:_ZN6webrtc11ViECapturer16DeliverI420FrameEPNS_10VideoFrameE
fun:_ZN6webrtc11ViECapturer17ViECaptureProcessEv
fun:_ZN6webrtc11ViECapturer24ViECaptureThreadFunctionEPv
fun:_ZN6webrtc11ThreadPosix3RunEv
fun:StartThread
}

{
bug_329_5
Memcheck:Param
Expand All @@ -220,19 +202,6 @@
fun:StartThread
}

{
bug_329_6
Memcheck:Param
socketcall.sendto(msg)
obj:*libpthread-*.so
fun:_ZN6webrtc14UdpSocketPosix6SendToEPKaiRKNS_13SocketAddressE
...
fun:_ZN6webrtc10ViEEncoder12DeliverFrameEiPNS_10VideoFrameEiPKj
fun:_ZN6webrtc20ViEFrameProviderBase12DeliverFrameEPNS_10VideoFrameEiPKj
fun:_ZN6webrtc11ViECapturer16DeliverI420FrameEPNS_10VideoFrameE
fun:_ZN6webrtc11ViECapturer17ViECaptureProcessEv
}

{
bug_329_7
Memcheck:Unaddressable
Expand Down
2 changes: 0 additions & 2 deletions webrtc/video_engine/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ source_set("video_engine_core") {
"vie_defines.h",
"vie_encoder.cc",
"vie_encoder.h",
"vie_frame_provider_base.cc",
"vie_frame_provider_base.h",
"vie_receiver.cc",
"vie_receiver.h",
"vie_remb.cc",
Expand Down
32 changes: 0 additions & 32 deletions webrtc/video_engine/mock/mock_vie_frame_provider_base.h

This file was deleted.

11 changes: 6 additions & 5 deletions webrtc/video_engine/stream_synchronization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ struct ViESyncDelay {
int network_delay;
};

StreamSynchronization::StreamSynchronization(int audio_channel_id,
int video_channel_id)
StreamSynchronization::StreamSynchronization(uint32_t video_primary_ssrc,
int audio_channel_id)
: channel_delay_(new ViESyncDelay),
video_primary_ssrc_(video_primary_ssrc),
audio_channel_id_(audio_channel_id),
video_channel_id_(video_channel_id),
base_target_delay_ms_(0),
avg_diff_ms_(0) {}
avg_diff_ms_(0) {
}

StreamSynchronization::~StreamSynchronization() {
delete channel_delay_;
Expand Down Expand Up @@ -193,8 +194,8 @@ bool StreamSynchronization::ComputeDelays(int relative_delay_ms,
channel_delay_->last_audio_delay_ms = new_audio_delay_ms;

LOG(LS_VERBOSE) << "Sync video delay " << new_video_delay_ms
<< " for video primary SSRC " << video_primary_ssrc_
<< " and audio delay " << channel_delay_->extra_audio_delay_ms
<< " for video channel " << video_channel_id_
<< " for audio channel " << audio_channel_id_;

// Return values.
Expand Down
6 changes: 3 additions & 3 deletions webrtc/video_engine/stream_synchronization.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class StreamSynchronization {
uint32_t latest_timestamp;
};

StreamSynchronization(int audio_channel_id, int video_channel_id);
StreamSynchronization(uint32_t video_primary_ssrc, int audio_channel_id);
~StreamSynchronization();

bool ComputeDelays(int relative_delay_ms,
Expand All @@ -49,8 +49,8 @@ class StreamSynchronization {

private:
ViESyncDelay* channel_delay_;
int audio_channel_id_;
int video_channel_id_;
const uint32_t video_primary_ssrc_;
const int audio_channel_id_;
int base_target_delay_ms_;
int avg_diff_ms_;
};
Expand Down
2 changes: 0 additions & 2 deletions webrtc/video_engine/video_engine_core.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
'vie_channel.h',
'vie_channel_group.h',
'vie_encoder.h',
'vie_frame_provider_base.h',
'vie_receiver.h',
'vie_sender.h',
'vie_sync_module.h',
Expand All @@ -64,7 +63,6 @@
'vie_channel.cc',
'vie_channel_group.cc',
'vie_encoder.cc',
'vie_frame_provider_base.cc',
'vie_receiver.cc',
'vie_remb.cc',
'vie_sender.cc',
Expand Down
2 changes: 1 addition & 1 deletion webrtc/video_engine/vie_capturer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ bool ViECapturer::ViECaptureProcess() {
if (!deliver_frame.IsZeroSize()) {
capture_time = deliver_frame.render_time_ms();
encode_start_time = Clock::GetRealTimeClock()->TimeInMilliseconds();
frame_callback_->DeliverFrame(0, deliver_frame, std::vector<uint32_t>());
frame_callback_->DeliverFrame(deliver_frame);
}
// Update the overuse detector with the duration.
if (encode_start_time != -1) {
Expand Down
9 changes: 7 additions & 2 deletions webrtc/video_engine/vie_capturer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
#include "webrtc/typedefs.h"
#include "webrtc/video_engine/vie_defines.h"
#include "webrtc/video_engine/vie_frame_provider_base.h"

namespace webrtc {

Expand All @@ -39,7 +38,13 @@ class OveruseFrameDetector;
class ProcessThread;
class RegistrableCpuOveruseMetricsObserver;
class ViEEffectFilter;
class ViEFrameCallback;

class ViEFrameCallback {
public:
virtual ~ViEFrameCallback() {}

virtual void DeliverFrame(I420VideoFrame video_frame) = 0;
};

class ViECapturer {
public:
Expand Down
10 changes: 7 additions & 3 deletions webrtc/video_engine/vie_capturer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "webrtc/system_wrappers/interface/event_wrapper.h"
#include "webrtc/system_wrappers/interface/ref_count.h"
#include "webrtc/system_wrappers/interface/scoped_vector.h"
#include "webrtc/video_engine/mock/mock_vie_frame_provider_base.h"

using ::testing::_;
using ::testing::Invoke;
Expand All @@ -37,6 +36,11 @@ using ::testing::WithArg;

namespace webrtc {

class MockViEFrameCallback : public ViEFrameCallback {
public:
MOCK_METHOD1(DeliverFrame, void(I420VideoFrame video_frame));
};

bool EqualFrames(const I420VideoFrame& frame1,
const I420VideoFrame& frame2);
bool EqualTextureFrames(const I420VideoFrame& frame1,
Expand All @@ -55,9 +59,9 @@ class ViECapturerTest : public ::testing::Test {
output_frame_event_(EventWrapper::Create()) {}

virtual void SetUp() {
EXPECT_CALL(*mock_frame_callback_, DeliverFrame(_, _, _))
EXPECT_CALL(*mock_frame_callback_, DeliverFrame(_))
.WillRepeatedly(
WithArg<1>(Invoke(this, &ViECapturerTest::AddOutputFrame)));
WithArg<0>(Invoke(this, &ViECapturerTest::AddOutputFrame)));

Config config;
vie_capturer_.reset(new ViECapturer(mock_process_thread_.get(),
Expand Down
21 changes: 3 additions & 18 deletions webrtc/video_engine/vie_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ ViEChannel::ViEChannel(int32_t channel_id,
PacedSender* paced_sender,
PacketRouter* packet_router,
bool sender)
: ViEFrameProviderBase(channel_id, engine_id),
channel_id_(channel_id),
: channel_id_(channel_id),
engine_id_(engine_id),
number_of_cores_(number_of_cores),
num_socket_threads_(kViESocketThreads),
Expand All @@ -104,7 +103,7 @@ ViEChannel::ViEChannel(int32_t channel_id,
nullptr,
nullptr)),
vie_receiver_(channel_id, vcm_, remote_bitrate_estimator, this),
vie_sync_(vcm_, this),
vie_sync_(vcm_),
stats_observer_(new ChannelStatsObserver(this)),
vcm_receive_stats_callback_(NULL),
incoming_video_stream_(nullptr),
Expand Down Expand Up @@ -1462,21 +1461,7 @@ int32_t ViEChannel::FrameToRender(
pre_render_callback_->FrameCallback(&video_frame);
}

// New API bypass.
if (incoming_video_stream_) {
incoming_video_stream_->RenderFrame(channel_id_, video_frame);
return 0;
}

uint32_t arr_ofCSRC[kRtpCsrcSize];
int32_t no_of_csrcs = vie_receiver_.GetCsrcs(arr_ofCSRC);
if (no_of_csrcs <= 0) {
arr_ofCSRC[0] = vie_receiver_.GetRemoteSsrc();
no_of_csrcs = 1;
}
std::vector<uint32_t> csrcs(arr_ofCSRC, arr_ofCSRC + no_of_csrcs);
DeliverFrame(video_frame, csrcs);

incoming_video_stream_->RenderFrame(channel_id_, video_frame);
return 0;
}

Expand Down
18 changes: 6 additions & 12 deletions webrtc/video_engine/vie_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "webrtc/system_wrappers/interface/tick_util.h"
#include "webrtc/typedefs.h"
#include "webrtc/video_engine/vie_defines.h"
#include "webrtc/video_engine/vie_frame_provider_base.h"
#include "webrtc/video_engine/vie_receiver.h"
#include "webrtc/video_engine/vie_sender.h"
#include "webrtc/video_engine/vie_sync_module.h"
Expand Down Expand Up @@ -92,14 +91,12 @@ class ViEDecoderObserver {
protected:
virtual ~ViEDecoderObserver() {}
};
class ViEChannel
: public VCMFrameTypeCallback,
public VCMReceiveCallback,
public VCMReceiveStatisticsCallback,
public VCMDecoderTimingCallback,
public VCMPacketRequestCallback,
public RtpFeedback,
public ViEFrameProviderBase {
class ViEChannel : public VCMFrameTypeCallback,
public VCMReceiveCallback,
public VCMReceiveStatisticsCallback,
public VCMDecoderTimingCallback,
public VCMPacketRequestCallback,
public RtpFeedback {
public:
friend class ChannelStatsObserver;
friend class ViEChannelProtectionCallback;
Expand Down Expand Up @@ -339,9 +336,6 @@ class ViEChannel
VoEVideoSync* ve_sync_interface);
int32_t VoiceChannel();

// Implements ViEFrameProviderBase.
virtual int FrameCallbackChanged() {return -1;}

// New-style callbacks, used by VideoReceiveStream.
void RegisterPreRenderCallback(I420FrameCallback* pre_render_callback);
void RegisterPreDecodeImageCallback(
Expand Down
23 changes: 1 addition & 22 deletions webrtc/video_engine/vie_encoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,8 @@ void ViEEncoder::TraceFrameDropEnd() {
encoder_paused_and_dropped_frame_ = false;
}

void ViEEncoder::DeliverFrame(int id,
const I420VideoFrame& video_frame,
const std::vector<uint32_t>& csrcs) {
void ViEEncoder::DeliverFrame(I420VideoFrame video_frame) {
DCHECK(send_payload_router_ != NULL);
DCHECK(csrcs.empty());
if (!send_payload_router_->active()) {
// We've paused or we have no channels attached, don't waste resources on
// encoding.
Expand Down Expand Up @@ -531,24 +528,6 @@ void ViEEncoder::DeliverFrame(int id,
vcm_->AddVideoFrame(*output_frame);
}

void ViEEncoder::DelayChanged(int id, int frame_delay) {
}

int ViEEncoder::GetPreferedFrameSettings(int* width,
int* height,
int* frame_rate) {
webrtc::VideoCodec video_codec;
memset(&video_codec, 0, sizeof(video_codec));
if (vcm_->SendCodec(&video_codec) != VCM_OK) {
return -1;
}

*width = video_codec.width;
*height = video_codec.height;
*frame_rate = video_codec.maxFramerate;
return 0;
}

int ViEEncoder::SendKeyFrame() {
return vcm_->IntraFrameRequest(0);
}
Expand Down
12 changes: 2 additions & 10 deletions webrtc/video_engine/vie_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include "webrtc/typedefs.h"
#include "webrtc/frame_callback.h"
#include "webrtc/system_wrappers/interface/scoped_refptr.h"
#include "webrtc/video_engine/vie_capturer.h"
#include "webrtc/video_engine/vie_defines.h"
#include "webrtc/video_engine/vie_frame_provider_base.h"

namespace webrtc {

Expand Down Expand Up @@ -122,15 +122,7 @@ class ViEEncoder
int32_t ScaleInputImage(bool enable);

// Implementing ViEFrameCallback.
void DeliverFrame(int id,
const I420VideoFrame& video_frame,
const std::vector<uint32_t>& csrcs) override;
void DelayChanged(int id, int frame_delay) override;
int GetPreferedFrameSettings(int* width,
int* height,
int* frame_rate) override;

void ProviderDestroyed(int id) override { return; }
void DeliverFrame(I420VideoFrame video_frame) override;

int32_t SendKeyFrame();
int32_t SendCodecStatistics(uint32_t* num_key_frames,
Expand Down
Loading

0 comments on commit 36a1438

Please sign in to comment.