Remove ViEFrameProviderBase.
BUG=1695 R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/49349004 Cr-Commit-Position: refs/heads/master@{#9252}
This commit is contained in:
parent
af55ccc054
commit
36a1438a66
@ -160,23 +160,6 @@ name=https://code.google.com/p/webrtc/issues/detail?id=3158 (2)
|
|||||||
*!WebRtcVideoMediaChannelTest_TwoStreamsSendAndFailUnsignalledRecv_Test::TestBody
|
*!WebRtcVideoMediaChannelTest_TwoStreamsSendAndFailUnsignalledRecv_Test::TestBody
|
||||||
*!testing::internal::HandleSehExceptionsInMethodIfSupported<>
|
*!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
|
# rtc_unittest, fails on Win DrMemory Full
|
||||||
UNINITIALIZED READ
|
UNINITIALIZED READ
|
||||||
name=https://code.google.com/p/webrtc/issues/detail?id=3158 (4)
|
name=https://code.google.com/p/webrtc/issues/detail?id=3158 (4)
|
||||||
|
@ -185,24 +185,6 @@
|
|||||||
fun:StartThread
|
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
|
bug_329_5
|
||||||
Memcheck:Param
|
Memcheck:Param
|
||||||
@ -220,19 +202,6 @@
|
|||||||
fun:StartThread
|
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
|
bug_329_7
|
||||||
Memcheck:Unaddressable
|
Memcheck:Unaddressable
|
||||||
|
@ -35,8 +35,6 @@ source_set("video_engine_core") {
|
|||||||
"vie_defines.h",
|
"vie_defines.h",
|
||||||
"vie_encoder.cc",
|
"vie_encoder.cc",
|
||||||
"vie_encoder.h",
|
"vie_encoder.h",
|
||||||
"vie_frame_provider_base.cc",
|
|
||||||
"vie_frame_provider_base.h",
|
|
||||||
"vie_receiver.cc",
|
"vie_receiver.cc",
|
||||||
"vie_receiver.h",
|
"vie_receiver.h",
|
||||||
"vie_remb.cc",
|
"vie_remb.cc",
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014 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 WEBRTC_VIDEO_ENGINE_MOCK_MOCK_VIE_FRAME_PROVIDER_BASE_H_
|
|
||||||
#define WEBRTC_VIDEO_ENGINE_MOCK_MOCK_VIE_FRAME_PROVIDER_BASE_H_
|
|
||||||
|
|
||||||
#include "webrtc/video_engine/vie_frame_provider_base.h"
|
|
||||||
#include "testing/gmock/include/gmock/gmock.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
|
||||||
|
|
||||||
class MockViEFrameCallback : public ViEFrameCallback {
|
|
||||||
public:
|
|
||||||
MOCK_METHOD3(DeliverFrame,
|
|
||||||
void(int id,
|
|
||||||
const I420VideoFrame& video_frame,
|
|
||||||
const std::vector<uint32_t>& csrcs));
|
|
||||||
MOCK_METHOD2(DelayChanged, void(int id, int frame_delay));
|
|
||||||
MOCK_METHOD3(GetPreferedFrameSettings,
|
|
||||||
int(int* width, int* height, int* frame_rate));
|
|
||||||
MOCK_METHOD1(ProviderDestroyed, void(int id));
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace webrtc
|
|
||||||
|
|
||||||
#endif // WEBRTC_VIDEO_ENGINE_MOCK_MOCK_VIE_FRAME_PROVIDER_BASE_H_
|
|
@ -42,13 +42,14 @@ struct ViESyncDelay {
|
|||||||
int network_delay;
|
int network_delay;
|
||||||
};
|
};
|
||||||
|
|
||||||
StreamSynchronization::StreamSynchronization(int audio_channel_id,
|
StreamSynchronization::StreamSynchronization(uint32_t video_primary_ssrc,
|
||||||
int video_channel_id)
|
int audio_channel_id)
|
||||||
: channel_delay_(new ViESyncDelay),
|
: channel_delay_(new ViESyncDelay),
|
||||||
|
video_primary_ssrc_(video_primary_ssrc),
|
||||||
audio_channel_id_(audio_channel_id),
|
audio_channel_id_(audio_channel_id),
|
||||||
video_channel_id_(video_channel_id),
|
|
||||||
base_target_delay_ms_(0),
|
base_target_delay_ms_(0),
|
||||||
avg_diff_ms_(0) {}
|
avg_diff_ms_(0) {
|
||||||
|
}
|
||||||
|
|
||||||
StreamSynchronization::~StreamSynchronization() {
|
StreamSynchronization::~StreamSynchronization() {
|
||||||
delete channel_delay_;
|
delete channel_delay_;
|
||||||
@ -193,8 +194,8 @@ bool StreamSynchronization::ComputeDelays(int relative_delay_ms,
|
|||||||
channel_delay_->last_audio_delay_ms = new_audio_delay_ms;
|
channel_delay_->last_audio_delay_ms = new_audio_delay_ms;
|
||||||
|
|
||||||
LOG(LS_VERBOSE) << "Sync video delay " << new_video_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
|
<< " and audio delay " << channel_delay_->extra_audio_delay_ms
|
||||||
<< " for video channel " << video_channel_id_
|
|
||||||
<< " for audio channel " << audio_channel_id_;
|
<< " for audio channel " << audio_channel_id_;
|
||||||
|
|
||||||
// Return values.
|
// Return values.
|
||||||
|
@ -29,7 +29,7 @@ class StreamSynchronization {
|
|||||||
uint32_t latest_timestamp;
|
uint32_t latest_timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
StreamSynchronization(int audio_channel_id, int video_channel_id);
|
StreamSynchronization(uint32_t video_primary_ssrc, int audio_channel_id);
|
||||||
~StreamSynchronization();
|
~StreamSynchronization();
|
||||||
|
|
||||||
bool ComputeDelays(int relative_delay_ms,
|
bool ComputeDelays(int relative_delay_ms,
|
||||||
@ -49,8 +49,8 @@ class StreamSynchronization {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
ViESyncDelay* channel_delay_;
|
ViESyncDelay* channel_delay_;
|
||||||
int audio_channel_id_;
|
const uint32_t video_primary_ssrc_;
|
||||||
int video_channel_id_;
|
const int audio_channel_id_;
|
||||||
int base_target_delay_ms_;
|
int base_target_delay_ms_;
|
||||||
int avg_diff_ms_;
|
int avg_diff_ms_;
|
||||||
};
|
};
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
'vie_channel.h',
|
'vie_channel.h',
|
||||||
'vie_channel_group.h',
|
'vie_channel_group.h',
|
||||||
'vie_encoder.h',
|
'vie_encoder.h',
|
||||||
'vie_frame_provider_base.h',
|
|
||||||
'vie_receiver.h',
|
'vie_receiver.h',
|
||||||
'vie_sender.h',
|
'vie_sender.h',
|
||||||
'vie_sync_module.h',
|
'vie_sync_module.h',
|
||||||
@ -64,7 +63,6 @@
|
|||||||
'vie_channel.cc',
|
'vie_channel.cc',
|
||||||
'vie_channel_group.cc',
|
'vie_channel_group.cc',
|
||||||
'vie_encoder.cc',
|
'vie_encoder.cc',
|
||||||
'vie_frame_provider_base.cc',
|
|
||||||
'vie_receiver.cc',
|
'vie_receiver.cc',
|
||||||
'vie_remb.cc',
|
'vie_remb.cc',
|
||||||
'vie_sender.cc',
|
'vie_sender.cc',
|
||||||
|
@ -167,7 +167,7 @@ bool ViECapturer::ViECaptureProcess() {
|
|||||||
if (!deliver_frame.IsZeroSize()) {
|
if (!deliver_frame.IsZeroSize()) {
|
||||||
capture_time = deliver_frame.render_time_ms();
|
capture_time = deliver_frame.render_time_ms();
|
||||||
encode_start_time = Clock::GetRealTimeClock()->TimeInMilliseconds();
|
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.
|
// Update the overuse detector with the duration.
|
||||||
if (encode_start_time != -1) {
|
if (encode_start_time != -1) {
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
|
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
|
||||||
#include "webrtc/typedefs.h"
|
#include "webrtc/typedefs.h"
|
||||||
#include "webrtc/video_engine/vie_defines.h"
|
#include "webrtc/video_engine/vie_defines.h"
|
||||||
#include "webrtc/video_engine/vie_frame_provider_base.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -39,7 +38,13 @@ class OveruseFrameDetector;
|
|||||||
class ProcessThread;
|
class ProcessThread;
|
||||||
class RegistrableCpuOveruseMetricsObserver;
|
class RegistrableCpuOveruseMetricsObserver;
|
||||||
class ViEEffectFilter;
|
class ViEEffectFilter;
|
||||||
class ViEFrameCallback;
|
|
||||||
|
class ViEFrameCallback {
|
||||||
|
public:
|
||||||
|
virtual ~ViEFrameCallback() {}
|
||||||
|
|
||||||
|
virtual void DeliverFrame(I420VideoFrame video_frame) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
class ViECapturer {
|
class ViECapturer {
|
||||||
public:
|
public:
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "webrtc/system_wrappers/interface/event_wrapper.h"
|
#include "webrtc/system_wrappers/interface/event_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/ref_count.h"
|
#include "webrtc/system_wrappers/interface/ref_count.h"
|
||||||
#include "webrtc/system_wrappers/interface/scoped_vector.h"
|
#include "webrtc/system_wrappers/interface/scoped_vector.h"
|
||||||
#include "webrtc/video_engine/mock/mock_vie_frame_provider_base.h"
|
|
||||||
|
|
||||||
using ::testing::_;
|
using ::testing::_;
|
||||||
using ::testing::Invoke;
|
using ::testing::Invoke;
|
||||||
@ -37,6 +36,11 @@ using ::testing::WithArg;
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
class MockViEFrameCallback : public ViEFrameCallback {
|
||||||
|
public:
|
||||||
|
MOCK_METHOD1(DeliverFrame, void(I420VideoFrame video_frame));
|
||||||
|
};
|
||||||
|
|
||||||
bool EqualFrames(const I420VideoFrame& frame1,
|
bool EqualFrames(const I420VideoFrame& frame1,
|
||||||
const I420VideoFrame& frame2);
|
const I420VideoFrame& frame2);
|
||||||
bool EqualTextureFrames(const I420VideoFrame& frame1,
|
bool EqualTextureFrames(const I420VideoFrame& frame1,
|
||||||
@ -55,9 +59,9 @@ class ViECapturerTest : public ::testing::Test {
|
|||||||
output_frame_event_(EventWrapper::Create()) {}
|
output_frame_event_(EventWrapper::Create()) {}
|
||||||
|
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
EXPECT_CALL(*mock_frame_callback_, DeliverFrame(_, _, _))
|
EXPECT_CALL(*mock_frame_callback_, DeliverFrame(_))
|
||||||
.WillRepeatedly(
|
.WillRepeatedly(
|
||||||
WithArg<1>(Invoke(this, &ViECapturerTest::AddOutputFrame)));
|
WithArg<0>(Invoke(this, &ViECapturerTest::AddOutputFrame)));
|
||||||
|
|
||||||
Config config;
|
Config config;
|
||||||
vie_capturer_.reset(new ViECapturer(mock_process_thread_.get(),
|
vie_capturer_.reset(new ViECapturer(mock_process_thread_.get(),
|
||||||
|
@ -91,8 +91,7 @@ ViEChannel::ViEChannel(int32_t channel_id,
|
|||||||
PacedSender* paced_sender,
|
PacedSender* paced_sender,
|
||||||
PacketRouter* packet_router,
|
PacketRouter* packet_router,
|
||||||
bool sender)
|
bool sender)
|
||||||
: ViEFrameProviderBase(channel_id, engine_id),
|
: channel_id_(channel_id),
|
||||||
channel_id_(channel_id),
|
|
||||||
engine_id_(engine_id),
|
engine_id_(engine_id),
|
||||||
number_of_cores_(number_of_cores),
|
number_of_cores_(number_of_cores),
|
||||||
num_socket_threads_(kViESocketThreads),
|
num_socket_threads_(kViESocketThreads),
|
||||||
@ -104,7 +103,7 @@ ViEChannel::ViEChannel(int32_t channel_id,
|
|||||||
nullptr,
|
nullptr,
|
||||||
nullptr)),
|
nullptr)),
|
||||||
vie_receiver_(channel_id, vcm_, remote_bitrate_estimator, this),
|
vie_receiver_(channel_id, vcm_, remote_bitrate_estimator, this),
|
||||||
vie_sync_(vcm_, this),
|
vie_sync_(vcm_),
|
||||||
stats_observer_(new ChannelStatsObserver(this)),
|
stats_observer_(new ChannelStatsObserver(this)),
|
||||||
vcm_receive_stats_callback_(NULL),
|
vcm_receive_stats_callback_(NULL),
|
||||||
incoming_video_stream_(nullptr),
|
incoming_video_stream_(nullptr),
|
||||||
@ -1462,21 +1461,7 @@ int32_t ViEChannel::FrameToRender(
|
|||||||
pre_render_callback_->FrameCallback(&video_frame);
|
pre_render_callback_->FrameCallback(&video_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
// New API bypass.
|
incoming_video_stream_->RenderFrame(channel_id_, video_frame);
|
||||||
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);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "webrtc/system_wrappers/interface/tick_util.h"
|
#include "webrtc/system_wrappers/interface/tick_util.h"
|
||||||
#include "webrtc/typedefs.h"
|
#include "webrtc/typedefs.h"
|
||||||
#include "webrtc/video_engine/vie_defines.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_receiver.h"
|
||||||
#include "webrtc/video_engine/vie_sender.h"
|
#include "webrtc/video_engine/vie_sender.h"
|
||||||
#include "webrtc/video_engine/vie_sync_module.h"
|
#include "webrtc/video_engine/vie_sync_module.h"
|
||||||
@ -92,14 +91,12 @@ class ViEDecoderObserver {
|
|||||||
protected:
|
protected:
|
||||||
virtual ~ViEDecoderObserver() {}
|
virtual ~ViEDecoderObserver() {}
|
||||||
};
|
};
|
||||||
class ViEChannel
|
class ViEChannel : public VCMFrameTypeCallback,
|
||||||
: public VCMFrameTypeCallback,
|
public VCMReceiveCallback,
|
||||||
public VCMReceiveCallback,
|
public VCMReceiveStatisticsCallback,
|
||||||
public VCMReceiveStatisticsCallback,
|
public VCMDecoderTimingCallback,
|
||||||
public VCMDecoderTimingCallback,
|
public VCMPacketRequestCallback,
|
||||||
public VCMPacketRequestCallback,
|
public RtpFeedback {
|
||||||
public RtpFeedback,
|
|
||||||
public ViEFrameProviderBase {
|
|
||||||
public:
|
public:
|
||||||
friend class ChannelStatsObserver;
|
friend class ChannelStatsObserver;
|
||||||
friend class ViEChannelProtectionCallback;
|
friend class ViEChannelProtectionCallback;
|
||||||
@ -339,9 +336,6 @@ class ViEChannel
|
|||||||
VoEVideoSync* ve_sync_interface);
|
VoEVideoSync* ve_sync_interface);
|
||||||
int32_t VoiceChannel();
|
int32_t VoiceChannel();
|
||||||
|
|
||||||
// Implements ViEFrameProviderBase.
|
|
||||||
virtual int FrameCallbackChanged() {return -1;}
|
|
||||||
|
|
||||||
// New-style callbacks, used by VideoReceiveStream.
|
// New-style callbacks, used by VideoReceiveStream.
|
||||||
void RegisterPreRenderCallback(I420FrameCallback* pre_render_callback);
|
void RegisterPreRenderCallback(I420FrameCallback* pre_render_callback);
|
||||||
void RegisterPreDecodeImageCallback(
|
void RegisterPreDecodeImageCallback(
|
||||||
|
@ -444,11 +444,8 @@ void ViEEncoder::TraceFrameDropEnd() {
|
|||||||
encoder_paused_and_dropped_frame_ = false;
|
encoder_paused_and_dropped_frame_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViEEncoder::DeliverFrame(int id,
|
void ViEEncoder::DeliverFrame(I420VideoFrame video_frame) {
|
||||||
const I420VideoFrame& video_frame,
|
|
||||||
const std::vector<uint32_t>& csrcs) {
|
|
||||||
DCHECK(send_payload_router_ != NULL);
|
DCHECK(send_payload_router_ != NULL);
|
||||||
DCHECK(csrcs.empty());
|
|
||||||
if (!send_payload_router_->active()) {
|
if (!send_payload_router_->active()) {
|
||||||
// We've paused or we have no channels attached, don't waste resources on
|
// We've paused or we have no channels attached, don't waste resources on
|
||||||
// encoding.
|
// encoding.
|
||||||
@ -531,24 +528,6 @@ void ViEEncoder::DeliverFrame(int id,
|
|||||||
vcm_->AddVideoFrame(*output_frame);
|
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() {
|
int ViEEncoder::SendKeyFrame() {
|
||||||
return vcm_->IntraFrameRequest(0);
|
return vcm_->IntraFrameRequest(0);
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
#include "webrtc/typedefs.h"
|
#include "webrtc/typedefs.h"
|
||||||
#include "webrtc/frame_callback.h"
|
#include "webrtc/frame_callback.h"
|
||||||
#include "webrtc/system_wrappers/interface/scoped_refptr.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_defines.h"
|
||||||
#include "webrtc/video_engine/vie_frame_provider_base.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -122,15 +122,7 @@ class ViEEncoder
|
|||||||
int32_t ScaleInputImage(bool enable);
|
int32_t ScaleInputImage(bool enable);
|
||||||
|
|
||||||
// Implementing ViEFrameCallback.
|
// Implementing ViEFrameCallback.
|
||||||
void DeliverFrame(int id,
|
void DeliverFrame(I420VideoFrame video_frame) override;
|
||||||
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; }
|
|
||||||
|
|
||||||
int32_t SendKeyFrame();
|
int32_t SendKeyFrame();
|
||||||
int32_t SendCodecStatistics(uint32_t* num_key_frames,
|
int32_t SendCodecStatistics(uint32_t* num_key_frames,
|
||||||
|
@ -1,186 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2012 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "webrtc/video_engine/vie_frame_provider_base.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
#include "webrtc/base/checks.h"
|
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
|
||||||
#include "webrtc/system_wrappers/interface/logging.h"
|
|
||||||
#include "webrtc/system_wrappers/interface/tick_util.h"
|
|
||||||
#include "webrtc/video_engine/vie_defines.h"
|
|
||||||
#include "webrtc/video_frame.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
|
||||||
|
|
||||||
ViEFrameProviderBase::ViEFrameProviderBase(int Id, int engine_id)
|
|
||||||
: id_(Id),
|
|
||||||
engine_id_(engine_id),
|
|
||||||
provider_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
|
||||||
frame_delay_(0) {
|
|
||||||
frame_delivery_thread_checker_.DetachFromThread();
|
|
||||||
}
|
|
||||||
|
|
||||||
ViEFrameProviderBase::~ViEFrameProviderBase() {
|
|
||||||
DCHECK(thread_checker_.CalledOnValidThread());
|
|
||||||
DCHECK(frame_callbacks_.empty());
|
|
||||||
|
|
||||||
// TODO(tommi): Remove this when we're confident we've fixed the places where
|
|
||||||
// cleanup wasn't being done.
|
|
||||||
for (ViEFrameCallback* callback : frame_callbacks_) {
|
|
||||||
LOG_F(LS_WARNING) << "FrameCallback still registered.";
|
|
||||||
callback->ProviderDestroyed(id_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int ViEFrameProviderBase::Id() const {
|
|
||||||
return id_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViEFrameProviderBase::DeliverFrame(const I420VideoFrame& video_frame,
|
|
||||||
const std::vector<uint32_t>& csrcs) {
|
|
||||||
DCHECK(frame_delivery_thread_checker_.CalledOnValidThread());
|
|
||||||
#ifdef DEBUG_
|
|
||||||
const TickTime start_process_time = TickTime::Now();
|
|
||||||
#endif
|
|
||||||
CriticalSectionScoped cs(provider_cs_.get());
|
|
||||||
|
|
||||||
// Deliver the frame to all registered callbacks.
|
|
||||||
for (ViEFrameCallback* callback : frame_callbacks_)
|
|
||||||
callback->DeliverFrame(id_, video_frame, csrcs);
|
|
||||||
|
|
||||||
#ifdef DEBUG_
|
|
||||||
const int process_time =
|
|
||||||
static_cast<int>((TickTime::Now() - start_process_time).Milliseconds());
|
|
||||||
if (process_time > 25) {
|
|
||||||
// Warn if the delivery time is too long.
|
|
||||||
LOG(LS_WARNING) << "Too long time delivering frame " << process_time;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViEFrameProviderBase::SetFrameDelay(int frame_delay) {
|
|
||||||
// Called on the capture thread (see OnIncomingCapturedFrame).
|
|
||||||
// To test, run ViEStandardIntegrationTest.RunsBaseTestWithoutErrors
|
|
||||||
// in vie_auto_tests.
|
|
||||||
// In the same test, it appears that it's also called on a thread that's
|
|
||||||
// neither the ctor thread nor the capture thread.
|
|
||||||
CriticalSectionScoped cs(provider_cs_.get());
|
|
||||||
frame_delay_ = frame_delay;
|
|
||||||
|
|
||||||
for (ViEFrameCallback* callback : frame_callbacks_) {
|
|
||||||
callback->DelayChanged(id_, frame_delay);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int ViEFrameProviderBase::FrameDelay() {
|
|
||||||
// Called on the default thread in WebRtcVideoMediaChannelTest.SetSend
|
|
||||||
// (libjingle_media_unittest).
|
|
||||||
|
|
||||||
// Called on neither the ctor thread nor the capture thread in
|
|
||||||
// BitrateEstimatorTest.ImmediatelySwitchToAST (video_engine_tests).
|
|
||||||
|
|
||||||
// Most of the time Called on the capture thread (see OnCaptureDelayChanged).
|
|
||||||
// To test, run ViEStandardIntegrationTest.RunsBaseTestWithoutErrors
|
|
||||||
// in vie_auto_tests.
|
|
||||||
return frame_delay_;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ViEFrameProviderBase::GetBestFormat(int* best_width,
|
|
||||||
int* best_height,
|
|
||||||
int* best_frame_rate) {
|
|
||||||
DCHECK(thread_checker_.CalledOnValidThread());
|
|
||||||
int largest_width = 0;
|
|
||||||
int largest_height = 0;
|
|
||||||
int highest_frame_rate = 0;
|
|
||||||
|
|
||||||
// Here we don't need to grab the provider_cs_ lock to run through the list
|
|
||||||
// of callbacks. The reason is that we know that we're currently on the same
|
|
||||||
// thread that is the only thread that will modify the callback list and
|
|
||||||
// we can be sure that the thread won't race with itself.
|
|
||||||
for (ViEFrameCallback* callback : frame_callbacks_) {
|
|
||||||
int prefered_width = 0;
|
|
||||||
int prefered_height = 0;
|
|
||||||
int prefered_frame_rate = 0;
|
|
||||||
if (callback->GetPreferedFrameSettings(&prefered_width, &prefered_height,
|
|
||||||
&prefered_frame_rate) == 0) {
|
|
||||||
if (prefered_width > largest_width) {
|
|
||||||
largest_width = prefered_width;
|
|
||||||
}
|
|
||||||
if (prefered_height > largest_height) {
|
|
||||||
largest_height = prefered_height;
|
|
||||||
}
|
|
||||||
if (prefered_frame_rate > highest_frame_rate) {
|
|
||||||
highest_frame_rate = prefered_frame_rate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*best_width = largest_width;
|
|
||||||
*best_height = largest_height;
|
|
||||||
*best_frame_rate = highest_frame_rate;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ViEFrameProviderBase::RegisterFrameCallback(
|
|
||||||
int observer_id, ViEFrameCallback* callback_object) {
|
|
||||||
DCHECK(thread_checker_.CalledOnValidThread());
|
|
||||||
DCHECK(callback_object);
|
|
||||||
{
|
|
||||||
CriticalSectionScoped cs(provider_cs_.get());
|
|
||||||
if (std::find(frame_callbacks_.begin(), frame_callbacks_.end(),
|
|
||||||
callback_object) != frame_callbacks_.end()) {
|
|
||||||
DCHECK(false && "frameObserver already registered");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
frame_callbacks_.push_back(callback_object);
|
|
||||||
}
|
|
||||||
// Report current capture delay.
|
|
||||||
callback_object->DelayChanged(id_, frame_delay_);
|
|
||||||
|
|
||||||
// Notify implementer of this class that the callback list have changed.
|
|
||||||
FrameCallbackChanged();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ViEFrameProviderBase::DeregisterFrameCallback(
|
|
||||||
const ViEFrameCallback* callback_object) {
|
|
||||||
DCHECK(thread_checker_.CalledOnValidThread());
|
|
||||||
DCHECK(callback_object);
|
|
||||||
{
|
|
||||||
CriticalSectionScoped cs(provider_cs_.get());
|
|
||||||
FrameCallbacks::iterator it = std::find(frame_callbacks_.begin(),
|
|
||||||
frame_callbacks_.end(),
|
|
||||||
callback_object);
|
|
||||||
if (it == frame_callbacks_.end()) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
frame_callbacks_.erase(it);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notify implementer of this class that the callback list have changed.
|
|
||||||
FrameCallbackChanged();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ViEFrameProviderBase::IsFrameCallbackRegistered(
|
|
||||||
const ViEFrameCallback* callback_object) {
|
|
||||||
DCHECK(thread_checker_.CalledOnValidThread());
|
|
||||||
DCHECK(callback_object);
|
|
||||||
|
|
||||||
// Here we don't need to grab the lock to do this lookup.
|
|
||||||
// The reason is that we know that we're currently on the same thread that
|
|
||||||
// is the only thread that will modify the callback list and subsequently the
|
|
||||||
// thread doesn't race with itself.
|
|
||||||
return std::find(frame_callbacks_.begin(), frame_callbacks_.end(),
|
|
||||||
callback_object) != frame_callbacks_.end();
|
|
||||||
}
|
|
||||||
} // namespac webrtc
|
|
@ -1,106 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2012 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 WEBRTC_VIDEO_ENGINE_VIE_FRAME_PROVIDER_BASE_H_
|
|
||||||
#define WEBRTC_VIDEO_ENGINE_VIE_FRAME_PROVIDER_BASE_H_
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "webrtc/base/scoped_ptr.h"
|
|
||||||
#include "webrtc/base/thread_checker.h"
|
|
||||||
#include "webrtc/common_types.h"
|
|
||||||
#include "webrtc/typedefs.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
|
||||||
|
|
||||||
class CriticalSectionWrapper;
|
|
||||||
class VideoEncoder;
|
|
||||||
class I420VideoFrame;
|
|
||||||
|
|
||||||
// ViEFrameCallback shall be implemented by all classes receiving frames from a
|
|
||||||
// frame provider.
|
|
||||||
class ViEFrameCallback {
|
|
||||||
public:
|
|
||||||
virtual void DeliverFrame(int id,
|
|
||||||
const I420VideoFrame& video_frame,
|
|
||||||
const std::vector<uint32_t>& csrcs) = 0;
|
|
||||||
|
|
||||||
// The capture delay has changed from the provider. |frame_delay| is given in
|
|
||||||
// ms.
|
|
||||||
virtual void DelayChanged(int id, int frame_delay) = 0;
|
|
||||||
|
|
||||||
// Get the width, height and frame rate preferred by this observer.
|
|
||||||
virtual int GetPreferedFrameSettings(int* width,
|
|
||||||
int* height,
|
|
||||||
int* frame_rate) = 0;
|
|
||||||
|
|
||||||
// ProviderDestroyed is called when the frame is about to be destroyed. There
|
|
||||||
// must not be any more calls to the frame provider after this.
|
|
||||||
virtual void ProviderDestroyed(int id) = 0;
|
|
||||||
|
|
||||||
virtual ~ViEFrameCallback() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
// ViEFrameProviderBase is a base class that will deliver frames to all
|
|
||||||
// registered ViEFrameCallbacks.
|
|
||||||
class ViEFrameProviderBase {
|
|
||||||
public:
|
|
||||||
ViEFrameProviderBase(int Id, int engine_id);
|
|
||||||
virtual ~ViEFrameProviderBase();
|
|
||||||
|
|
||||||
// Returns the frame provider id.
|
|
||||||
int Id() const;
|
|
||||||
|
|
||||||
// Register frame callbacks, i.e. a receiver of the captured frame.
|
|
||||||
// Must be called on the same thread as the provider was constructed on.
|
|
||||||
int RegisterFrameCallback(int observer_id, ViEFrameCallback* callback);
|
|
||||||
|
|
||||||
// Unregisters a previously registered callback. Returns -1 if the callback
|
|
||||||
// object hasn't been registered.
|
|
||||||
// Must be called on the same thread as the provider was constructed on.
|
|
||||||
int DeregisterFrameCallback(const ViEFrameCallback* callback);
|
|
||||||
|
|
||||||
// Determines if a callback is currently registered.
|
|
||||||
// Must be called on the same thread as the provider was constructed on.
|
|
||||||
bool IsFrameCallbackRegistered(const ViEFrameCallback* callback);
|
|
||||||
|
|
||||||
// FrameCallbackChanged
|
|
||||||
// Inherited classes should check for new frame_settings and reconfigure
|
|
||||||
// output if possible.
|
|
||||||
virtual int FrameCallbackChanged() = 0;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void DeliverFrame(const I420VideoFrame& video_frame,
|
|
||||||
const std::vector<uint32_t>& csrcs);
|
|
||||||
void SetFrameDelay(int frame_delay);
|
|
||||||
int FrameDelay();
|
|
||||||
int GetBestFormat(int* best_width,
|
|
||||||
int* best_height,
|
|
||||||
int* best_frame_rate);
|
|
||||||
|
|
||||||
rtc::ThreadChecker thread_checker_;
|
|
||||||
rtc::ThreadChecker frame_delivery_thread_checker_;
|
|
||||||
|
|
||||||
const int id_;
|
|
||||||
const int engine_id_;
|
|
||||||
|
|
||||||
// Frame callbacks.
|
|
||||||
typedef std::vector<ViEFrameCallback*> FrameCallbacks;
|
|
||||||
FrameCallbacks frame_callbacks_;
|
|
||||||
const rtc::scoped_ptr<CriticalSectionWrapper> provider_cs_;
|
|
||||||
|
|
||||||
private:
|
|
||||||
rtc::scoped_ptr<I420VideoFrame> extra_frame_;
|
|
||||||
int frame_delay_;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace webrtc
|
|
||||||
|
|
||||||
#endif // WEBRTC_VIDEO_ENGINE_VIE_FRAME_PROVIDER_BASE_H_
|
|
@ -17,7 +17,6 @@
|
|||||||
#include "webrtc/system_wrappers/interface/logging.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace_event.h"
|
#include "webrtc/system_wrappers/interface/trace_event.h"
|
||||||
#include "webrtc/video_engine/stream_synchronization.h"
|
#include "webrtc/video_engine/stream_synchronization.h"
|
||||||
#include "webrtc/video_engine/vie_channel.h"
|
|
||||||
#include "webrtc/voice_engine/include/voe_video_sync.h"
|
#include "webrtc/voice_engine/include/voe_video_sync.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -49,11 +48,9 @@ int UpdateMeasurements(StreamSynchronization::Measurements* stream,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ViESyncModule::ViESyncModule(VideoCodingModule* vcm,
|
ViESyncModule::ViESyncModule(VideoCodingModule* vcm)
|
||||||
ViEChannel* vie_channel)
|
|
||||||
: data_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
: data_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
vcm_(vcm),
|
vcm_(vcm),
|
||||||
vie_channel_(vie_channel),
|
|
||||||
video_receiver_(NULL),
|
video_receiver_(NULL),
|
||||||
video_rtp_rtcp_(NULL),
|
video_rtp_rtcp_(NULL),
|
||||||
voe_channel_id_(-1),
|
voe_channel_id_(-1),
|
||||||
@ -74,7 +71,8 @@ int ViESyncModule::ConfigureSync(int voe_channel_id,
|
|||||||
voe_sync_interface_ = voe_sync_interface;
|
voe_sync_interface_ = voe_sync_interface;
|
||||||
video_receiver_ = video_receiver;
|
video_receiver_ = video_receiver;
|
||||||
video_rtp_rtcp_ = video_rtcp_module;
|
video_rtp_rtcp_ = video_rtcp_module;
|
||||||
sync_.reset(new StreamSynchronization(voe_channel_id, vie_channel_->Id()));
|
sync_.reset(
|
||||||
|
new StreamSynchronization(video_rtp_rtcp_->SSRC(), voe_channel_id));
|
||||||
|
|
||||||
if (!voe_sync_interface) {
|
if (!voe_sync_interface) {
|
||||||
voe_channel_id_ = -1;
|
voe_channel_id_ = -1;
|
||||||
|
@ -30,8 +30,7 @@ class VoEVideoSync;
|
|||||||
|
|
||||||
class ViESyncModule : public Module {
|
class ViESyncModule : public Module {
|
||||||
public:
|
public:
|
||||||
ViESyncModule(VideoCodingModule* vcm,
|
explicit ViESyncModule(VideoCodingModule* vcm);
|
||||||
ViEChannel* vie_channel);
|
|
||||||
~ViESyncModule();
|
~ViESyncModule();
|
||||||
|
|
||||||
int ConfigureSync(int voe_channel_id,
|
int ConfigureSync(int voe_channel_id,
|
||||||
@ -50,8 +49,7 @@ class ViESyncModule : public Module {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
rtc::scoped_ptr<CriticalSectionWrapper> data_cs_;
|
rtc::scoped_ptr<CriticalSectionWrapper> data_cs_;
|
||||||
VideoCodingModule* vcm_;
|
VideoCodingModule* const vcm_;
|
||||||
ViEChannel* vie_channel_;
|
|
||||||
RtpReceiver* video_receiver_;
|
RtpReceiver* video_receiver_;
|
||||||
RtpRtcp* video_rtp_rtcp_;
|
RtpRtcp* video_rtp_rtcp_;
|
||||||
int voe_channel_id_;
|
int voe_channel_id_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user