Move RtcEventLog object from inside VoiceEngine to Call.

In addition to moving the logging object itself, this also moves the interface from PeerConnectionFactory to PeerConnection, which makes more sense for this functionality. An API parameter to set an upper limit to the size of the logfile is introduced.
The old interface on PeerConnectionFactory is not removed in this CL, because it is called from Chrome, it will be removed after Chrome is updated to use the PeerConnection interface.

BUG=webrtc:4741,webrtc:5603,chromium:609749
R=solenberg@webrtc.org, stefan@webrtc.org, terelius@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1748403002 .

Cr-Commit-Position: refs/heads/master@{#13321}
This commit is contained in:
Ivo Creusen 2016-06-29 13:56:45 +02:00
parent 8cf2a3a3ad
commit 1895526c61
56 changed files with 380 additions and 313 deletions

View File

@ -253,6 +253,23 @@ public class PeerConnection {
return nativeGetStats(observer, (track == null) ? 0 : track.nativeTrack);
}
// Starts recording an RTC event log. Ownership of the file is transfered to
// the native code. If an RTC event log is already being recorded, it will be
// stopped and a new one will start using the provided file. Logging will
// continue until the stopRtcEventLog function is called. The max_size_bytes
// argument is ignored, it is added for future use.
public boolean startRtcEventLog(
int file_descriptor, long max_size_bytes) {
return nativeStartRtcEventLog(
nativePeerConnection, file_descriptor, max_size_bytes);
}
// Stops recording an RTC event log. If no RTC event log is currently being
// recorded, this call will have no effect.
public void stopRtcEventLog() {
nativeStopRtcEventLog(nativePeerConnection);
}
// TODO(fischman): add support for DTMF-related methods once that API
// stabilizes.
public native SignalingState signalingState();
@ -303,4 +320,10 @@ public class PeerConnection {
private native List<RtpSender> nativeGetSenders();
private native List<RtpReceiver> nativeGetReceivers();
private static native boolean nativeStartRtcEventLog(
long nativePeerConnection, int file_descriptor, long max_size_bytes);
private static native void nativeStopRtcEventLog(long nativePeerConnection);
}

View File

@ -148,28 +148,6 @@ public class PeerConnectionFactory {
nativeStopAecDump(nativeFactory);
}
// Starts recording an RTC event log. Ownership of the file is transfered to
// the native code. If an RTC event log is already being recorded, it will be
// stopped and a new one will start using the provided file.
public boolean startRtcEventLog(int file_descriptor) {
return startRtcEventLog(file_descriptor, -1);
}
// Same as above, but allows setting an upper limit to the size of the
// generated logfile.
public boolean startRtcEventLog(int file_descriptor,
int filesize_limit_bytes) {
return nativeStartRtcEventLog(nativeFactory,
file_descriptor,
filesize_limit_bytes);
}
// Stops recording an RTC event log. If no RTC event log is currently being
// recorded, this call will have no effect.
public void stopRtcEventLog() {
nativeStopRtcEventLog(nativeFactory);
}
@Deprecated
public void setOptions(Options options) {
nativeSetOptions(nativeFactory, options);
@ -275,12 +253,6 @@ public class PeerConnectionFactory {
private static native void nativeStopAecDump(long nativeFactory);
private static native boolean nativeStartRtcEventLog(long nativeFactory,
int file_descriptor,
int filesize_limit_bytes);
private static native void nativeStopRtcEventLog(long nativeFactory);
@Deprecated
public native void nativeSetOptions(long nativeFactory, Options options);

View File

@ -31,10 +31,12 @@
#include "webrtc/api/videocapturertracksource.h"
#include "webrtc/api/videotrack.h"
#include "webrtc/base/arraysize.h"
#include "webrtc/base/bind.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/base/stringutils.h"
#include "webrtc/base/trace_event.h"
#include "webrtc/call.h"
#include "webrtc/media/sctp/sctpdataengine.h"
#include "webrtc/pc/channelmanager.h"
#include "webrtc/system_wrappers/include/field_trial.h"
@ -1263,6 +1265,18 @@ void PeerConnection::RegisterUMAObserver(UMAObserver* observer) {
}
}
bool PeerConnection::StartRtcEventLog(rtc::PlatformFile file,
int64_t max_size_bytes) {
return factory_->worker_thread()->Invoke<bool>(
RTC_FROM_HERE, rtc::Bind(&PeerConnection::StartRtcEventLog_w, this, file,
max_size_bytes));
}
void PeerConnection::StopRtcEventLog() {
factory_->worker_thread()->Invoke<void>(
RTC_FROM_HERE, rtc::Bind(&PeerConnection::StopRtcEventLog_w, this));
}
const SessionDescriptionInterface* PeerConnection::local_description() const {
return session_->local_description();
}
@ -2232,4 +2246,12 @@ bool PeerConnection::ReconfigurePortAllocator_n(
return true;
}
bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file,
int64_t max_size_bytes) {
return media_controller_->call_w()->StartEventLog(file, max_size_bytes);
}
void PeerConnection::StopRtcEventLog_w() {
media_controller_->call_w()->StopEventLog();
}
} // namespace webrtc

View File

@ -136,6 +136,10 @@ class PeerConnection : public PeerConnectionInterface,
void RegisterUMAObserver(UMAObserver* observer) override;
bool StartRtcEventLog(rtc::PlatformFile file,
int64_t max_size_bytes) override;
void StopRtcEventLog() override;
void Close() override;
// Virtual for unit tests.
@ -360,6 +364,13 @@ class PeerConnection : public PeerConnectionInterface,
// is applied.
bool ReconfigurePortAllocator_n(const RTCConfiguration& configuration);
// Starts recording an Rtc EventLog using the supplied platform file.
// This function should only be called from the worker thread.
bool StartRtcEventLog_w(rtc::PlatformFile file, int64_t max_size_bytes);
// Starts recording an Rtc EventLog using the supplied platform file.
// This function should only be called from the worker thread.
void StopRtcEventLog_w();
// Storing the factory as a scoped reference pointer ensures that the memory
// in the PeerConnectionFactoryImpl remains available as long as the
// PeerConnection is running. It is passed to PeerConnection as a raw pointer.

View File

@ -220,17 +220,6 @@ void PeerConnectionFactory::StopAecDump() {
channel_manager_->StopAecDump();
}
bool PeerConnectionFactory::StartRtcEventLog(rtc::PlatformFile file,
int64_t max_size_bytes) {
RTC_DCHECK(signaling_thread_->IsCurrent());
return channel_manager_->StartRtcEventLog(file, max_size_bytes);
}
void PeerConnectionFactory::StopRtcEventLog() {
RTC_DCHECK(signaling_thread_->IsCurrent());
channel_manager_->StopRtcEventLog();
}
rtc::scoped_refptr<PeerConnectionInterface>
PeerConnectionFactory::CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration_in,

View File

@ -80,12 +80,15 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) override;
void StopAecDump() override;
bool StartRtcEventLog(rtc::PlatformFile file) override {
return StartRtcEventLog(file, -1);
}
// TODO(ivoc) Remove after Chrome is updated.
bool StartRtcEventLog(rtc::PlatformFile file) override { return false; }
// TODO(ivoc) Remove after Chrome is updated.
bool StartRtcEventLog(rtc::PlatformFile file,
int64_t max_size_bytes) override;
void StopRtcEventLog() override;
int64_t max_size_bytes) override {
return false;
}
// TODO(ivoc) Remove after Chrome is updated.
void StopRtcEventLog() override {}
virtual webrtc::MediaControllerInterface* CreateMediaController(
const cricket::MediaConfig& config) const;

View File

@ -70,6 +70,8 @@ BEGIN_SIGNALING_PROXY_MAP(PeerConnectionFactory)
CreateAudioTrack, const std::string&, AudioSourceInterface*)
PROXY_METHOD2(bool, StartAecDump, rtc::PlatformFile, int64_t)
PROXY_METHOD0(void, StopAecDump)
// TODO(ivoc): Remove the StartRtcEventLog and StopRtcEventLog functions as
// soon as they are removed from PeerConnectionFactoryInterface.
PROXY_METHOD1(bool, StartRtcEventLog, rtc::PlatformFile)
PROXY_METHOD2(bool, StartRtcEventLog, rtc::PlatformFile, int64_t)
PROXY_METHOD0(void, StopRtcEventLog)

View File

@ -489,6 +489,17 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
virtual IceConnectionState ice_connection_state() = 0;
virtual IceGatheringState ice_gathering_state() = 0;
// Starts RtcEventLog using existing file. Takes ownership of |file| and
// passes it on to Call, which will take the ownership. If the
// operation fails the file will be closed. The logging will stop
// automatically after 10 minutes have passed, or when the StopRtcEventLog
// function is called.
virtual bool StartRtcEventLog(rtc::PlatformFile file,
int64_t max_size_bytes) = 0;
// Stops logging the RtcEventLog.
virtual void StopRtcEventLog() = 0;
// Terminates all media and closes the transport.
virtual void Close() = 0;
@ -655,25 +666,19 @@ class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
// Stops logging the AEC dump.
virtual void StopAecDump() = 0;
// Starts RtcEventLog using existing file. Takes ownership of |file| and
// passes it on to VoiceEngine, which will take the ownership. If the
// operation fails the file will be closed. The logging will stop
// automatically after 10 minutes have passed, or when the StopRtcEventLog
// function is called. A maximum filesize in bytes can be set, the logging
// will be stopped before exceeding this limit. If max_size_bytes is set to a
// value <= 0, no limit will be used.
// This function as well as the StopRtcEventLog don't really belong on this
// interface, this is a temporary solution until we move the logging object
// from inside voice engine to webrtc::Call, which will happen when the VoE
// restructuring effort is further along.
// TODO(ivoc): Move this into being:
// PeerConnection => MediaController => webrtc::Call.
// This function is deprecated and will be removed when Chrome is updated to
// use the equivalent function on PeerConnectionInterface.
// TODO(ivoc) Remove after Chrome is updated.
virtual bool StartRtcEventLog(rtc::PlatformFile file,
int64_t max_size_bytes) = 0;
// Deprecated, use the version above.
// This function is deprecated and will be removed when Chrome is updated to
// use the equivalent function on PeerConnectionInterface.
// TODO(ivoc) Remove after Chrome is updated.
virtual bool StartRtcEventLog(rtc::PlatformFile file) = 0;
// Stops logging the RtcEventLog.
// This function is deprecated and will be removed when Chrome is updated to
// use the equivalent function on PeerConnectionInterface.
// TODO(ivoc) Remove after Chrome is updated.
virtual void StopRtcEventLog() = 0;
protected:

View File

@ -74,6 +74,8 @@ BEGIN_SIGNALING_PROXY_MAP(PeerConnection)
PROXY_METHOD0(IceState, ice_state)
PROXY_METHOD0(IceConnectionState, ice_connection_state)
PROXY_METHOD0(IceGatheringState, ice_gathering_state)
PROXY_METHOD2(bool, StartRtcEventLog, rtc::PlatformFile, int64_t)
PROXY_METHOD0(void, StopRtcEventLog)
PROXY_METHOD0(void, Close)
END_SIGNALING_PROXY()

View File

@ -9,3 +9,12 @@ include_rules = [
"+webrtc/modules/rtp_rtcp",
"+webrtc/system_wrappers",
]
specific_include_rules = {
"audio_receive_stream_unittest\.cc": [
"+webrtc/call/mock",
],
"audio_send_stream_unittest\.cc": [
"+webrtc/call/mock",
],
}

View File

@ -81,7 +81,8 @@ namespace internal {
AudioReceiveStream::AudioReceiveStream(
CongestionController* congestion_controller,
const webrtc::AudioReceiveStream::Config& config,
const rtc::scoped_refptr<webrtc::AudioState>& audio_state)
const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
webrtc::RtcEventLog* event_log)
: config_(config),
audio_state_(audio_state),
rtp_header_parser_(RtpHeaderParser::Create()) {
@ -93,6 +94,7 @@ AudioReceiveStream::AudioReceiveStream(
VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine());
channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id);
channel_proxy_->SetRtcEventLog(event_log);
channel_proxy_->SetLocalSSRC(config.rtp.local_ssrc);
// TODO(solenberg): Config NACK history window (which is a packet count),
// using the actual packet size for the configured codec.
@ -144,6 +146,7 @@ AudioReceiveStream::~AudioReceiveStream() {
LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString();
channel_proxy_->DeRegisterExternalTransport();
channel_proxy_->ResetCongestionControlObjects();
channel_proxy_->SetRtcEventLog(nullptr);
if (remote_bitrate_estimator_) {
remote_bitrate_estimator_->RemoveStream(config_.rtp.remote_ssrc);
}

View File

@ -22,6 +22,7 @@
namespace webrtc {
class CongestionController;
class RemoteBitrateEstimator;
class RtcEventLog;
namespace voe {
class ChannelProxy;
@ -33,7 +34,8 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream {
public:
AudioReceiveStream(CongestionController* congestion_controller,
const webrtc::AudioReceiveStream::Config& config,
const rtc::scoped_refptr<webrtc::AudioState>& audio_state);
const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
webrtc::RtcEventLog* event_log);
~AudioReceiveStream() override;
// webrtc::AudioReceiveStream implementation.

View File

@ -15,6 +15,7 @@
#include "webrtc/audio/audio_receive_stream.h"
#include "webrtc/audio/conversion.h"
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
#include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h"
#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"
@ -70,7 +71,8 @@ struct ConfigHelper {
decoder_factory_(new rtc::RefCountedObject<MockAudioDecoderFactory>),
congestion_controller_(&simulated_clock_,
&bitrate_observer_,
&remote_bitrate_observer_) {
&remote_bitrate_observer_,
&event_log_) {
using testing::Invoke;
EXPECT_CALL(voice_engine_,
@ -109,6 +111,12 @@ struct ConfigHelper {
.Times(1);
EXPECT_CALL(*channel_proxy_, GetAudioDecoderFactory())
.WillOnce(ReturnRef(decoder_factory_));
testing::Expectation expect_set =
EXPECT_CALL(*channel_proxy_, SetRtcEventLog(&event_log_))
.Times(1);
EXPECT_CALL(*channel_proxy_, SetRtcEventLog(testing::IsNull()))
.Times(1)
.After(expect_set);
return channel_proxy_;
}));
stream_config_.voe_channel_id = kChannelId;
@ -130,6 +138,7 @@ struct ConfigHelper {
MockRemoteBitrateEstimator* remote_bitrate_estimator() {
return &remote_bitrate_estimator_;
}
MockRtcEventLog* event_log() { return &event_log_; }
AudioReceiveStream::Config& config() { return stream_config_; }
rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; }
MockVoiceEngine& voice_engine() { return voice_engine_; }
@ -171,6 +180,7 @@ struct ConfigHelper {
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_;
MockCongestionController congestion_controller_;
MockRemoteBitrateEstimator remote_bitrate_estimator_;
MockRtcEventLog event_log_;
testing::StrictMock<MockVoiceEngine> voice_engine_;
rtc::scoped_refptr<AudioState> audio_state_;
AudioReceiveStream::Config stream_config_;
@ -248,7 +258,8 @@ TEST(AudioReceiveStreamTest, ConfigToString) {
TEST(AudioReceiveStreamTest, ConstructDestruct) {
ConfigHelper helper;
internal::AudioReceiveStream recv_stream(
helper.congestion_controller(), helper.config(), helper.audio_state());
helper.congestion_controller(), helper.config(), helper.audio_state(),
helper.event_log());
}
MATCHER_P(VerifyHeaderExtension, expected_extension, "") {
@ -267,7 +278,8 @@ TEST(AudioReceiveStreamTest, ReceiveRtpPacket) {
helper.config().rtp.transport_cc = true;
helper.SetupMockForBweFeedback(true);
internal::AudioReceiveStream recv_stream(
helper.congestion_controller(), helper.config(), helper.audio_state());
helper.congestion_controller(), helper.config(), helper.audio_state(),
helper.event_log());
const int kTransportSequenceNumberValue = 1234;
std::vector<uint8_t> rtp_packet = CreateRtpHeaderWithOneByteExtension(
kTransportSequenceNumberId, kTransportSequenceNumberValue, 2);
@ -295,7 +307,8 @@ TEST(AudioReceiveStreamTest, ReceiveRtcpPacket) {
helper.config().rtp.transport_cc = true;
helper.SetupMockForBweFeedback(true);
internal::AudioReceiveStream recv_stream(
helper.congestion_controller(), helper.config(), helper.audio_state());
helper.congestion_controller(), helper.config(), helper.audio_state(),
helper.event_log());
std::vector<uint8_t> rtcp_packet = CreateRtcpSenderReport();
EXPECT_CALL(*helper.channel_proxy(),
@ -307,7 +320,8 @@ TEST(AudioReceiveStreamTest, ReceiveRtcpPacket) {
TEST(AudioReceiveStreamTest, GetStats) {
ConfigHelper helper;
internal::AudioReceiveStream recv_stream(
helper.congestion_controller(), helper.config(), helper.audio_state());
helper.congestion_controller(), helper.config(), helper.audio_state(),
helper.event_log());
helper.SetupMockForGetStats();
AudioReceiveStream::Stats stats = recv_stream.GetStats();
EXPECT_EQ(kRemoteSsrc, stats.remote_ssrc);
@ -349,7 +363,8 @@ TEST(AudioReceiveStreamTest, GetStats) {
TEST(AudioReceiveStreamTest, SetGain) {
ConfigHelper helper;
internal::AudioReceiveStream recv_stream(
helper.congestion_controller(), helper.config(), helper.audio_state());
helper.congestion_controller(), helper.config(), helper.audio_state(),
helper.event_log());
EXPECT_CALL(*helper.channel_proxy(),
SetChannelOutputVolumeScaling(FloatEq(0.765f)));
recv_stream.SetGain(0.765f);

View File

@ -17,6 +17,7 @@
#include "webrtc/audio/audio_state.h"
#include "webrtc/audio/conversion.h"
#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
#include "webrtc/modules/pacing/paced_sender.h"
#include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h"
@ -55,7 +56,8 @@ struct ConfigHelper {
stream_config_(nullptr),
congestion_controller_(&simulated_clock_,
&bitrate_observer_,
&remote_bitrate_observer_) {
&remote_bitrate_observer_,
&event_log_) {
using testing::Invoke;
using testing::StrEq;
@ -167,6 +169,7 @@ struct ConfigHelper {
testing::NiceMock<MockCongestionObserver> bitrate_observer_;
testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_;
CongestionController congestion_controller_;
MockRtcEventLog event_log_;
};
} // namespace

View File

@ -18,6 +18,7 @@
#include "webrtc/audio_send_stream.h"
#include "webrtc/audio_state.h"
#include "webrtc/base/networkroute.h"
#include "webrtc/base/platform_file.h"
#include "webrtc/base/socket.h"
#include "webrtc/video_receive_stream.h"
#include "webrtc/video_send_stream.h"
@ -147,6 +148,10 @@ class Call {
virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0;
virtual bool StartEventLog(rtc::PlatformFile log_file,
int64_t max_size_bytes) = 0;
virtual void StopEventLog() = 0;
virtual ~Call() {}
};

View File

@ -35,6 +35,7 @@
#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
#include "webrtc/modules/utility/include/process_thread.h"
#include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/system_wrappers/include/cpu_info.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
#include "webrtc/system_wrappers/include/metrics.h"
@ -107,6 +108,13 @@ class Call : public webrtc::Call,
void OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps,
uint32_t max_padding_bitrate_bps) override;
bool StartEventLog(rtc::PlatformFile log_file,
int64_t max_size_bytes) override {
return event_log_->StartLogging(log_file, max_size_bytes);
}
void StopEventLog() override { event_log_->StopLogging(); }
private:
DeliveryStatus DeliverRtcp(MediaType media_type, const uint8_t* packet,
size_t length);
@ -162,7 +170,7 @@ class Call : public webrtc::Call,
VideoSendStream::RtpStateMap suspended_video_send_ssrcs_;
RtcEventLog* event_log_ = nullptr;
std::unique_ptr<webrtc::RtcEventLog> event_log_;
// The following members are only accessed (exclusively) from one thread and
// from the destructor, and therefore doesn't need any explicit
@ -210,6 +218,7 @@ Call::Call(const Call::Config& config)
video_network_state_(kNetworkUp),
receive_crit_(RWLockWrapper::CreateRWLock()),
send_crit_(RWLockWrapper::CreateRWLock()),
event_log_(RtcEventLog::Create(webrtc::Clock::GetRealTimeClock())),
received_video_bytes_(0),
received_audio_bytes_(0),
received_rtcp_bytes_(0),
@ -221,7 +230,8 @@ Call::Call(const Call::Config& config)
min_allocated_send_bitrate_bps_(0),
num_bitrate_updates_(0),
remb_(clock_),
congestion_controller_(new CongestionController(clock_, this, &remb_)),
congestion_controller_(
new CongestionController(clock_, this, &remb_, event_log_.get())),
video_send_delay_stats_(new SendDelayStats(clock_)) {
RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0);
@ -231,10 +241,6 @@ Call::Call(const Call::Config& config)
RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps,
config.bitrate_config.start_bitrate_bps);
}
if (config.audio_state.get()) {
ScopedVoEInterface<VoECodec> voe_codec(voice_engine());
event_log_ = voe_codec->GetEventLog();
}
Trace::CreateTrace();
call_stats_->RegisterStatsObserver(congestion_controller_.get());
@ -243,7 +249,6 @@ Call::Call(const Call::Config& config)
config_.bitrate_config.min_bitrate_bps,
config_.bitrate_config.start_bitrate_bps,
config_.bitrate_config.max_bitrate_bps);
congestion_controller_->GetBitrateController()->SetEventLog(event_log_);
module_process_thread_->Start();
module_process_thread_->RegisterModule(call_stats_.get());
@ -371,8 +376,9 @@ webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream(
const webrtc::AudioReceiveStream::Config& config) {
TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream");
RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
AudioReceiveStream* receive_stream = new AudioReceiveStream(
congestion_controller_.get(), config, config_.audio_state);
AudioReceiveStream* receive_stream =
new AudioReceiveStream(congestion_controller_.get(), config,
config_.audio_state, event_log_.get());
{
WriteLockScoped write_lock(*receive_crit_);
RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) ==
@ -421,8 +427,8 @@ webrtc::VideoSendStream* Call::CreateVideoSendStream(
VideoSendStream* send_stream = new VideoSendStream(
num_cpu_cores_, module_process_thread_.get(), call_stats_.get(),
congestion_controller_.get(), bitrate_allocator_.get(),
video_send_delay_stats_.get(), &remb_, event_log_, config, encoder_config,
suspended_video_send_ssrcs_);
video_send_delay_stats_.get(), &remb_, event_log_.get(), config,
encoder_config, suspended_video_send_ssrcs_);
{
WriteLockScoped write_lock(*send_crit_);
for (uint32_t ssrc : config.rtp.ssrcs) {
@ -433,8 +439,7 @@ webrtc::VideoSendStream* Call::CreateVideoSendStream(
}
send_stream->SignalNetworkState(video_network_state_);
UpdateAggregateNetworkState();
if (event_log_)
event_log_->LogVideoSendStreamConfig(config);
event_log_->LogVideoSendStreamConfig(config);
return send_stream;
}
@ -493,13 +498,11 @@ webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream(
if (it != config.rtp.rtx.end())
video_receive_ssrcs_[it->second.ssrc] = receive_stream;
video_receive_streams_.insert(receive_stream);
ConfigureSync(config.sync_group);
}
receive_stream->SignalNetworkState(video_network_state_);
UpdateAggregateNetworkState();
if (event_log_)
event_log_->LogVideoReceiveStreamConfig(config);
event_log_->LogVideoReceiveStreamConfig(config);
return receive_stream;
}
@ -827,7 +830,7 @@ PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type,
auto status = it->second->DeliverRtp(packet, length, packet_time)
? DELIVERY_OK
: DELIVERY_PACKET_ERROR;
if (status == DELIVERY_OK && event_log_)
if (status == DELIVERY_OK)
event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length);
return status;
}
@ -839,7 +842,7 @@ PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type,
auto status = it->second->DeliverRtp(packet, length, packet_time)
? DELIVERY_OK
: DELIVERY_PACKET_ERROR;
if (status == DELIVERY_OK && event_log_)
if (status == DELIVERY_OK)
event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length);
return status;
}

View File

@ -38,9 +38,7 @@
namespace webrtc {
#ifndef ENABLE_RTC_EVENT_LOG
// No-op implementation if flag is not set.
// No-op implementation is used if flag is not set, or in tests.
class RtcEventLogNullImpl final : public RtcEventLog {
public:
bool StartLogging(const std::string& file_name,
@ -74,7 +72,7 @@ class RtcEventLogNullImpl final : public RtcEventLog {
int32_t total_packets) override {}
};
#else // ENABLE_RTC_EVENT_LOG is defined
#ifdef ENABLE_RTC_EVENT_LOG
class RtcEventLogImpl final : public RtcEventLog {
public:
@ -465,4 +463,8 @@ std::unique_ptr<RtcEventLog> RtcEventLog::Create(const Clock* clock) {
#endif // ENABLE_RTC_EVENT_LOG
}
std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() {
return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
}
} // namespace webrtc

View File

@ -40,6 +40,9 @@ class RtcEventLog {
// Factory method to create an RtcEventLog object.
static std::unique_ptr<RtcEventLog> Create(const Clock* clock);
// Create an RtcEventLog object that does nothing.
static std::unique_ptr<RtcEventLog> CreateNull();
// Starts logging a maximum of max_size_bytes bytes to the specified file.
// If the file already exists it will be overwritten.
// If max_size_bytes <= 0, logging will be active until StopLogging is called.

View File

@ -88,15 +88,6 @@ class MediaEngineInterface {
// Stops recording AEC dump.
virtual void StopAecDump() = 0;
// Starts RtcEventLog using existing file. A maximum file size in bytes can be
// specified. Logging is stopped just before the size limit is exceeded.
// If max_size_bytes is set to a value <= 0, no limit will be used.
virtual bool StartRtcEventLog(rtc::PlatformFile file,
int64_t max_size_bytes) = 0;
// Stops recording an RtcEventLog.
virtual void StopRtcEventLog() = 0;
};
@ -175,13 +166,6 @@ class CompositeMediaEngine : public MediaEngineInterface {
voice_.StopAecDump();
}
virtual bool StartRtcEventLog(rtc::PlatformFile file,
int64_t max_size_bytes) {
return voice_.StartRtcEventLog(file, max_size_bytes);
}
virtual void StopRtcEventLog() { voice_.StopRtcEventLog(); }
protected:
VOICE voice_;
VIDEO video_;

View File

@ -478,4 +478,11 @@ void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) {
}
}
bool FakeCall::StartEventLog(rtc::PlatformFile log_file,
int64_t max_size_bytes) {
return false;
}
void FakeCall::StopEventLog() {}
} // namespace cricket

View File

@ -231,6 +231,10 @@ class FakeCall final : public webrtc::Call, public webrtc::PacketReceiver {
webrtc::NetworkState state) override;
void OnSentPacket(const rtc::SentPacket& sent_packet) override;
bool StartEventLog(rtc::PlatformFile log_file,
int64_t max_size_bytes) override;
void StopEventLog() override;
webrtc::Call::Config config_;
webrtc::NetworkState audio_network_state_;
webrtc::NetworkState video_network_state_;

View File

@ -272,7 +272,6 @@ class FakeWebRtcVoiceEngine
channels_[channel]->associate_send_channel = accociate_send_channel;
return 0;
}
webrtc::RtcEventLog* GetEventLog() override { return nullptr; }
// webrtc::VoECodec
WEBRTC_STUB(NumOfCodecs, ());

View File

@ -28,7 +28,6 @@
#include "webrtc/base/stringencode.h"
#include "webrtc/base/stringutils.h"
#include "webrtc/base/trace_event.h"
#include "webrtc/call/rtc_event_log.h"
#include "webrtc/common.h"
#include "webrtc/media/base/audiosource.h"
#include "webrtc/media/base/mediaconstants.h"
@ -1040,27 +1039,6 @@ void WebRtcVoiceEngine::StopAecDump() {
}
}
bool WebRtcVoiceEngine::StartRtcEventLog(rtc::PlatformFile file,
int64_t max_size_bytes) {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
webrtc::RtcEventLog* event_log = voe_wrapper_->codec()->GetEventLog();
if (event_log) {
return event_log->StartLogging(file, max_size_bytes);
}
LOG_RTCERR0(StartRtcEventLog);
return false;
}
void WebRtcVoiceEngine::StopRtcEventLog() {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
webrtc::RtcEventLog* event_log = voe_wrapper_->codec()->GetEventLog();
if (event_log) {
event_log->StopLogging();
return;
}
LOG_RTCERR0(StopRtcEventLog);
}
int WebRtcVoiceEngine::CreateVoEChannel() {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
return voe_wrapper_->base()->CreateChannel(voe_config_);

View File

@ -109,14 +109,6 @@ class WebRtcVoiceEngine final : public webrtc::TraceCallback {
// Stops AEC dump.
void StopAecDump();
// Starts recording an RtcEventLog using an existing file until the log file
// reaches the maximum filesize or the StopRtcEventLog function is called.
// If the value of max_size_bytes is <= 0, no limit is used.
bool StartRtcEventLog(rtc::PlatformFile file, int64_t max_size_bytes);
// Stops recording the RtcEventLog.
void StopRtcEventLog();
private:
// Every option that is "set" will be applied. Every option not "set" will be
// ignored. This allows us to selectively turn on and off different options

View File

@ -79,20 +79,25 @@ class BitrateControllerImpl::RtcpBandwidthObserverImpl
BitrateController* BitrateController::CreateBitrateController(
Clock* clock,
BitrateObserver* observer) {
return new BitrateControllerImpl(clock, observer);
BitrateObserver* observer,
RtcEventLog* event_log) {
return new BitrateControllerImpl(clock, observer, event_log);
}
BitrateController* BitrateController::CreateBitrateController(Clock* clock) {
return new BitrateControllerImpl(clock, nullptr);
BitrateController* BitrateController::CreateBitrateController(
Clock* clock,
RtcEventLog* event_log) {
return CreateBitrateController(clock, nullptr, event_log);
}
BitrateControllerImpl::BitrateControllerImpl(Clock* clock,
BitrateObserver* observer)
BitrateObserver* observer,
RtcEventLog* event_log)
: clock_(clock),
observer_(observer),
last_bitrate_update_ms_(clock_->TimeInMilliseconds()),
bandwidth_estimation_(),
event_log_(event_log),
bandwidth_estimation_(event_log),
reserved_bitrate_bps_(0),
last_bitrate_bps_(0),
last_fraction_loss_(0),
@ -143,7 +148,7 @@ void BitrateControllerImpl::ResetBitrates(int bitrate_bps,
int max_bitrate_bps) {
{
rtc::CritScope cs(&critsect_);
bandwidth_estimation_ = SendSideBandwidthEstimation();
bandwidth_estimation_ = SendSideBandwidthEstimation(event_log_);
bandwidth_estimation_.SetBitrates(bitrate_bps, min_bitrate_bps,
max_bitrate_bps);
}
@ -158,11 +163,6 @@ void BitrateControllerImpl::SetReservedBitrate(uint32_t reserved_bitrate_bps) {
MaybeTriggerOnNetworkChanged();
}
void BitrateControllerImpl::SetEventLog(RtcEventLog* event_log) {
rtc::CritScope cs(&critsect_);
bandwidth_estimation_.SetEventLog(event_log);
}
void BitrateControllerImpl::OnReceivedEstimatedBitrate(uint32_t bitrate) {
{
rtc::CritScope cs(&critsect_);

View File

@ -30,7 +30,9 @@ class BitrateControllerImpl : public BitrateController {
public:
// TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC.
// |observer| is left for project that is not yet updated.
BitrateControllerImpl(Clock* clock, BitrateObserver* observer);
BitrateControllerImpl(Clock* clock,
BitrateObserver* observer,
RtcEventLog* event_log);
virtual ~BitrateControllerImpl() {}
bool AvailableBandwidth(uint32_t* bandwidth) const override;
@ -54,8 +56,6 @@ class BitrateControllerImpl : public BitrateController {
void SetReservedBitrate(uint32_t reserved_bitrate_bps) override;
void SetEventLog(RtcEventLog* event_log) override;
// Returns true if the parameters have changed since the last call.
bool GetNetworkParameters(uint32_t* bitrate,
uint8_t* fraction_loss,
@ -86,6 +86,7 @@ class BitrateControllerImpl : public BitrateController {
Clock* const clock_;
BitrateObserver* const observer_;
int64_t last_bitrate_update_ms_;
RtcEventLog* const event_log_;
rtc::CriticalSection critsect_;
SendSideBandwidthEstimation bandwidth_estimation_ GUARDED_BY(critsect_);

View File

@ -13,6 +13,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
#include "webrtc/modules/pacing/mock/mock_paced_sender.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
@ -66,8 +67,8 @@ class BitrateControllerTest : public ::testing::Test {
~BitrateControllerTest() {}
virtual void SetUp() {
controller_ =
BitrateController::CreateBitrateController(&clock_, &bitrate_observer_);
controller_ = BitrateController::CreateBitrateController(
&clock_, &bitrate_observer_, &event_log_);
controller_->SetStartBitrate(kStartBitrateBps);
EXPECT_EQ(kStartBitrateBps, bitrate_observer_.last_bitrate_);
controller_->SetMinMaxBitrate(kMinBitrateBps, kMaxBitrateBps);
@ -91,6 +92,7 @@ class BitrateControllerTest : public ::testing::Test {
TestBitrateObserver bitrate_observer_;
BitrateController* controller_;
RtcpBandwidthObserver* bandwidth_observer_;
webrtc::MockRtcEventLog event_log_;
};
TEST_F(BitrateControllerTest, DefaultMinMaxBitrate) {
@ -107,6 +109,7 @@ TEST_F(BitrateControllerTest, DefaultMinMaxBitrate) {
TEST_F(BitrateControllerTest, OneBitrateObserverOneRtcpObserver) {
// First REMB applies immediately.
EXPECT_CALL(event_log_, LogBwePacketLossEvent(testing::Gt(0), 0, 0)).Times(8);
int64_t time_ms = 1001;
webrtc::ReportBlockList report_blocks;
report_blocks.push_back(CreateReportBlock(1, 2, 0, 1));
@ -183,6 +186,7 @@ TEST_F(BitrateControllerTest, OneBitrateObserverOneRtcpObserver) {
TEST_F(BitrateControllerTest, OneBitrateObserverTwoRtcpObservers) {
// REMBs during the first 2 seconds apply immediately.
EXPECT_CALL(event_log_, LogBwePacketLossEvent(testing::Gt(0), 0, 0)).Times(9);
int64_t time_ms = 1;
webrtc::ReportBlockList report_blocks;
report_blocks.push_back(CreateReportBlock(1, 2, 0, 1));
@ -278,6 +282,13 @@ TEST_F(BitrateControllerTest, OneBitrateObserverTwoRtcpObservers) {
}
TEST_F(BitrateControllerTest, OneBitrateObserverMultipleReportBlocks) {
testing::Expectation first_calls =
EXPECT_CALL(event_log_, LogBwePacketLossEvent(testing::Gt(0), 0, 0))
.Times(7);
EXPECT_CALL(event_log_,
LogBwePacketLossEvent(testing::Gt(0), testing::Gt(0), 0))
.Times(2)
.After(first_calls);
uint32_t sequence_number[2] = {0, 0xFF00};
const int kStartBitrate = 200000;
const int kMinBitrate = 100000;

View File

@ -55,8 +55,11 @@ class BitrateController : public Module {
// TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC.
// Remove this method once other other projects does not use it.
static BitrateController* CreateBitrateController(Clock* clock,
BitrateObserver* observer);
static BitrateController* CreateBitrateController(Clock* clock);
BitrateObserver* observer,
RtcEventLog* event_log);
static BitrateController* CreateBitrateController(Clock* clock,
RtcEventLog* event_log);
virtual ~BitrateController() {}
@ -76,8 +79,6 @@ class BitrateController : public Module {
virtual void UpdateDelayBasedEstimate(uint32_t bitrate_bps) = 0;
virtual void SetEventLog(RtcEventLog* event_log) = 0;
// Gets the available payload bandwidth in bits per second. Note that
// this bandwidth excludes packet headers.
virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0;

View File

@ -44,7 +44,7 @@ const size_t kNumUmaRampupMetrics =
} // namespace
SendSideBandwidthEstimation::SendSideBandwidthEstimation()
SendSideBandwidthEstimation::SendSideBandwidthEstimation(RtcEventLog* event_log)
: lost_packets_since_last_loss_update_Q8_(0),
expected_packets_since_last_loss_update_(0),
bitrate_(0),
@ -63,7 +63,9 @@ SendSideBandwidthEstimation::SendSideBandwidthEstimation()
bitrate_at_2_seconds_kbps_(0),
uma_update_state_(kNoUpdate),
rampup_uma_stats_updated_(kNumUmaRampupMetrics, false),
event_log_(nullptr) {}
event_log_(event_log) {
RTC_DCHECK(event_log);
}
SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {}
@ -227,11 +229,9 @@ void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) {
// rates).
bitrate_ += 1000;
if (event_log_) {
event_log_->LogBwePacketLossEvent(
bitrate_, last_fraction_loss_,
expected_packets_since_last_loss_update_);
}
event_log_->LogBwePacketLossEvent(
bitrate_, last_fraction_loss_,
expected_packets_since_last_loss_update_);
} else if (last_fraction_loss_ <= 26) {
// Loss between 2% - 10%: Do nothing.
} else {
@ -250,11 +250,9 @@ void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) {
512.0);
has_decreased_since_last_fraction_loss_ = true;
}
if (event_log_) {
event_log_->LogBwePacketLossEvent(
bitrate_, last_fraction_loss_,
expected_packets_since_last_loss_update_);
}
event_log_->LogBwePacketLossEvent(
bitrate_, last_fraction_loss_,
expected_packets_since_last_loss_update_);
}
}
bitrate_ = CapBitrateToThresholds(now_ms, bitrate_);
@ -308,9 +306,4 @@ uint32_t SendSideBandwidthEstimation::CapBitrateToThresholds(
}
return bitrate;
}
void SendSideBandwidthEstimation::SetEventLog(RtcEventLog* event_log) {
event_log_ = event_log;
}
} // namespace webrtc

View File

@ -26,7 +26,8 @@ class RtcEventLog;
class SendSideBandwidthEstimation {
public:
SendSideBandwidthEstimation();
SendSideBandwidthEstimation() = delete;
explicit SendSideBandwidthEstimation(RtcEventLog* event_log);
virtual ~SendSideBandwidthEstimation();
void CurrentEstimate(int* bitrate, uint8_t* loss, int64_t* rtt) const;
@ -53,8 +54,6 @@ class SendSideBandwidthEstimation {
void SetMinMaxBitrate(int min_bitrate, int max_bitrate);
int GetMinBitrate() const;
void SetEventLog(RtcEventLog* event_log);
private:
enum UmaState { kNoUpdate, kFirstDone, kDone };

View File

@ -12,12 +12,14 @@
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h"
namespace webrtc {
void TestProbing(bool use_delay_based) {
SendSideBandwidthEstimation bwe;
MockRtcEventLog event_log;
SendSideBandwidthEstimation bwe(&event_log);
bwe.SetMinMaxBitrate(100000, 1500000);
bwe.SetSendBitrate(200000);
@ -62,7 +64,11 @@ TEST(SendSideBweTest, InitialDelayBasedBweWithProbing) {
}
TEST(SendSideBweTest, DoesntReapplyBitrateDecreaseWithoutFollowingRemb) {
SendSideBandwidthEstimation bwe;
MockRtcEventLog event_log;
EXPECT_CALL(event_log,
LogBwePacketLossEvent(testing::Gt(0), testing::Gt(0), 0))
.Times(3);
SendSideBandwidthEstimation bwe(&event_log);
static const int kMinBitrateBps = 100000;
static const int kInitialBitrateBps = 1000000;
bwe.SetMinMaxBitrate(kMinBitrateBps, 1500000);

View File

@ -1,5 +1,6 @@
include_rules = [
"+webrtc/base",
"+webrtc/call/mock",
"+webrtc/system_wrappers",
"+webrtc/video",
]

View File

@ -151,39 +151,19 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator {
} // namespace
CongestionController::CongestionController(
Clock* clock,
BitrateObserver* bitrate_observer,
RemoteBitrateObserver* remote_bitrate_observer)
: clock_(clock),
observer_(nullptr),
packet_router_(new PacketRouter()),
pacer_(new PacedSender(clock_, packet_router_.get())),
remote_bitrate_estimator_(
new WrappingBitrateEstimator(remote_bitrate_observer, clock_)),
bitrate_controller_(
BitrateController::CreateBitrateController(clock_, bitrate_observer)),
remote_estimator_proxy_(clock_, packet_router_.get()),
transport_feedback_adapter_(bitrate_controller_.get(), clock_),
min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps),
last_reported_bitrate_bps_(0),
last_reported_fraction_loss_(0),
last_reported_rtt_(0),
network_state_(kNetworkUp) {
Init();
}
CongestionController::CongestionController(
Clock* clock,
Observer* observer,
RemoteBitrateObserver* remote_bitrate_observer)
RemoteBitrateObserver* remote_bitrate_observer,
RtcEventLog* event_log)
: clock_(clock),
observer_(observer),
packet_router_(new PacketRouter()),
pacer_(new PacedSender(clock_, packet_router_.get())),
remote_bitrate_estimator_(
new WrappingBitrateEstimator(remote_bitrate_observer, clock_)),
bitrate_controller_(BitrateController::CreateBitrateController(clock_)),
bitrate_controller_(
BitrateController::CreateBitrateController(clock_, event_log)),
remote_estimator_proxy_(clock_, packet_router_.get()),
transport_feedback_adapter_(bitrate_controller_.get(), clock_),
min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps),
@ -198,6 +178,7 @@ CongestionController::CongestionController(
Clock* clock,
Observer* observer,
RemoteBitrateObserver* remote_bitrate_observer,
RtcEventLog* event_log,
std::unique_ptr<PacketRouter> packet_router,
std::unique_ptr<PacedSender> pacer)
: clock_(clock),
@ -208,7 +189,8 @@ CongestionController::CongestionController(
new WrappingBitrateEstimator(remote_bitrate_observer, clock_)),
// Constructed last as this object calls the provided callback on
// construction.
bitrate_controller_(BitrateController::CreateBitrateController(clock_)),
bitrate_controller_(
BitrateController::CreateBitrateController(clock_, event_log)),
remote_estimator_proxy_(clock_, packet_router_.get()),
transport_feedback_adapter_(bitrate_controller_.get(), clock_),
min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps),

View File

@ -10,6 +10,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/modules/pacing/mock/mock_paced_sender.h"
#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"
@ -34,9 +35,9 @@ class CongestionControllerTest : public ::testing::Test {
pacer_ = new NiceMock<MockPacedSender>();
std::unique_ptr<PacedSender> pacer(pacer_); // Passes ownership.
std::unique_ptr<PacketRouter> packet_router(new PacketRouter());
controller_.reset(
new CongestionController(&clock_, &observer_, &remote_bitrate_observer_,
std::move(packet_router), std::move(pacer)));
controller_.reset(new CongestionController(
&clock_, &observer_, &remote_bitrate_observer_, &event_log_,
std::move(packet_router), std::move(pacer)));
bandwidth_observer_.reset(
controller_->GetBitrateController()->CreateRtcpBandwidthObserver());
@ -51,6 +52,7 @@ class CongestionControllerTest : public ::testing::Test {
StrictMock<MockCongestionObserver> observer_;
NiceMock<MockPacedSender>* pacer_;
NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_;
MockRtcEventLog event_log_;
std::unique_ptr<RtcpBandwidthObserver> bandwidth_observer_;
std::unique_ptr<CongestionController> controller_;
const uint32_t kInitialBitrateBps = 60000;

View File

@ -29,11 +29,11 @@ struct SentPacket;
namespace webrtc {
class BitrateController;
class BitrateObserver;
class Clock;
class ProcessThread;
class RemoteBitrateEstimator;
class RemoteBitrateObserver;
class RtcEventLog;
class TransportFeedbackObserver;
class CongestionController : public CallStatsObserver, public Module {
@ -52,17 +52,14 @@ class CongestionController : public CallStatsObserver, public Module {
protected:
virtual ~Observer() {}
};
// Deprecated
// TODO(perkj): Remove once no other clients use this ctor.
CongestionController(Clock* clock,
BitrateObserver* bitrate_observer,
RemoteBitrateObserver* remote_bitrate_observer);
CongestionController(Clock* clock,
Observer* observer,
RemoteBitrateObserver* remote_bitrate_observer);
CongestionController(Clock* clock,
Observer* observer,
RemoteBitrateObserver* remote_bitrate_observer,
RtcEventLog* event_log);
CongestionController(Clock* clock,
Observer* observer,
RemoteBitrateObserver* remote_bitrate_observer,
RtcEventLog* event_log,
std::unique_ptr<PacketRouter> packet_router,
std::unique_ptr<PacedSender> pacer);
virtual ~CongestionController();

View File

@ -31,8 +31,12 @@ class MockCongestionController : public CongestionController {
public:
MockCongestionController(Clock* clock,
Observer* observer,
RemoteBitrateObserver* remote_bitrate_observer)
: CongestionController(clock, observer, remote_bitrate_observer) {}
RemoteBitrateObserver* remote_bitrate_observer,
RtcEventLog* event_log)
: CongestionController(clock,
observer,
remote_bitrate_observer,
event_log) {}
MOCK_METHOD3(SetBweBitrates,
void(int min_bitrate_bps,
int start_bitrate_bps,

View File

@ -7,4 +7,10 @@ specific_include_rules = {
"nada\.h": [
"+webrtc/voice_engine",
],
"remb\.h": [
"+webrtc/call/mock",
],
"send_side\.h": [
"+webrtc/call/mock",
],
}

View File

@ -25,7 +25,9 @@ namespace bwe {
RembBweSender::RembBweSender(int kbps, BitrateObserver* observer, Clock* clock)
: bitrate_controller_(
BitrateController::CreateBitrateController(clock, observer)),
BitrateController::CreateBitrateController(clock,
observer,
&event_log_)),
feedback_observer_(bitrate_controller_->CreateRtcpBandwidthObserver()),
clock_(clock) {
assert(kbps >= kMinBitrateKbps);

View File

@ -16,6 +16,7 @@
#include <vector>
#include "webrtc/base/constructormagic.h"
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe.h"
namespace webrtc {
@ -45,6 +46,7 @@ class RembBweSender : public BweSender {
private:
Clock* clock_;
MockRtcEventLog event_log_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RembBweSender);
};

View File

@ -22,7 +22,9 @@ const int kFeedbackIntervalMs = 50;
FullBweSender::FullBweSender(int kbps, BitrateObserver* observer, Clock* clock)
: bitrate_controller_(
BitrateController::CreateBitrateController(clock, observer)),
BitrateController::CreateBitrateController(clock,
observer,
&event_log_)),
rbe_(new RemoteBitrateEstimatorAbsSendTime(this)),
feedback_observer_(bitrate_controller_->CreateRtcpBandwidthObserver()),
clock_(clock),

View File

@ -14,6 +14,7 @@
#include <memory>
#include <vector>
#include "webrtc/call/mock/mock_rtc_event_log.h"
#include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe.h"
@ -46,6 +47,7 @@ class FullBweSender : public BweSender, public RemoteBitrateObserver {
bool has_received_ack_;
uint16_t last_acked_seq_num_;
int64_t last_log_time_ms_;
MockRtcEventLog event_log_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FullBweSender);
};

View File

@ -389,17 +389,4 @@ void ChannelManager::StopAecDump() {
Bind(&MediaEngineInterface::StopAecDump, media_engine_.get()));
}
bool ChannelManager::StartRtcEventLog(rtc::PlatformFile file,
int64_t max_size_bytes) {
return worker_thread_->Invoke<bool>(
RTC_FROM_HERE, Bind(&MediaEngineInterface::StartRtcEventLog,
media_engine_.get(), file, max_size_bytes));
}
void ChannelManager::StopRtcEventLog() {
worker_thread_->Invoke<void>(
RTC_FROM_HERE,
Bind(&MediaEngineInterface::StopRtcEventLog, media_engine_.get()));
}
} // namespace cricket

View File

@ -138,12 +138,6 @@ class ChannelManager {
// Stops recording AEC dump.
void StopAecDump();
// Starts RtcEventLog using existing file.
bool StartRtcEventLog(rtc::PlatformFile file, int64_t max_size_bytes);
// Stops logging RtcEventLog.
void StopRtcEventLog();
private:
typedef std::vector<VoiceChannel*> VoiceChannels;
typedef std::vector<VideoChannel*> VideoChannels;

View File

@ -57,6 +57,7 @@ class MockVoEChannelProxy : public voe::ChannelProxy {
MOCK_CONST_METHOD0(GetAudioDecoderFactory,
const rtc::scoped_refptr<AudioDecoderFactory>&());
MOCK_METHOD1(SetChannelOutputVolumeScaling, void(float scaling));
MOCK_METHOD1(SetRtcEventLog, void(RtcEventLog* event_log));
};
} // namespace test
} // namespace webrtc

View File

@ -157,7 +157,6 @@ class MockVoiceEngine : public VoiceEngineImpl {
int(int channel, bool& enabled, VadModes& mode, bool& disabledDTX));
MOCK_METHOD2(SetOpusMaxPlaybackRate, int(int channel, int frequency_hz));
MOCK_METHOD2(SetOpusDtx, int(int channel, bool enable_dtx));
MOCK_METHOD0(GetEventLog, RtcEventLog*());
// VoEExternalMedia
MOCK_METHOD3(RegisterExternalMediaProcessing,

View File

@ -19,6 +19,7 @@
#include "webrtc/base/logging.h"
#include "webrtc/base/thread_checker.h"
#include "webrtc/base/timeutils.h"
#include "webrtc/call/rtc_event_log.h"
#include "webrtc/common.h"
#include "webrtc/config.h"
#include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h"
@ -58,6 +59,87 @@ bool RegisterReceiveCodec(std::unique_ptr<AudioCodingModule>* acm,
const int kTelephoneEventAttenuationdB = 10;
class RtcEventLogProxy final : public webrtc::RtcEventLog {
public:
RtcEventLogProxy() : event_log_(nullptr) {}
bool StartLogging(const std::string& file_name,
int64_t max_size_bytes) override {
RTC_NOTREACHED();
return false;
}
bool StartLogging(rtc::PlatformFile log_file,
int64_t max_size_bytes) override {
RTC_NOTREACHED();
return false;
}
void StopLogging() override { RTC_NOTREACHED(); }
void LogVideoReceiveStreamConfig(
const webrtc::VideoReceiveStream::Config& config) override {
rtc::CritScope lock(&crit_);
if (event_log_) {
event_log_->LogVideoReceiveStreamConfig(config);
}
}
void LogVideoSendStreamConfig(
const webrtc::VideoSendStream::Config& config) override {
rtc::CritScope lock(&crit_);
if (event_log_) {
event_log_->LogVideoSendStreamConfig(config);
}
}
void LogRtpHeader(webrtc::PacketDirection direction,
webrtc::MediaType media_type,
const uint8_t* header,
size_t packet_length) override {
rtc::CritScope lock(&crit_);
if (event_log_) {
event_log_->LogRtpHeader(direction, media_type, header, packet_length);
}
}
void LogRtcpPacket(webrtc::PacketDirection direction,
webrtc::MediaType media_type,
const uint8_t* packet,
size_t length) override {
rtc::CritScope lock(&crit_);
if (event_log_) {
event_log_->LogRtcpPacket(direction, media_type, packet, length);
}
}
void LogAudioPlayout(uint32_t ssrc) override {
rtc::CritScope lock(&crit_);
if (event_log_) {
event_log_->LogAudioPlayout(ssrc);
}
}
void LogBwePacketLossEvent(int32_t bitrate,
uint8_t fraction_loss,
int32_t total_packets) override {
rtc::CritScope lock(&crit_);
if (event_log_) {
event_log_->LogBwePacketLossEvent(bitrate, fraction_loss, total_packets);
}
}
void SetEventLog(RtcEventLog* event_log) {
rtc::CritScope lock(&crit_);
event_log_ = event_log;
}
private:
rtc::CriticalSection crit_;
RtcEventLog* event_log_ GUARDED_BY(crit_);
RTC_DISALLOW_COPY_AND_ASSIGN(RtcEventLogProxy);
};
class TransportFeedbackProxy : public TransportFeedbackObserver {
public:
TransportFeedbackProxy() : feedback_observer_(nullptr) {
@ -480,11 +562,9 @@ bool Channel::OnRecoveredPacket(const uint8_t* rtp_packet,
MixerParticipant::AudioFrameInfo Channel::GetAudioFrameWithMuted(
int32_t id,
AudioFrame* audioFrame) {
if (event_log_) {
unsigned int ssrc;
RTC_CHECK_EQ(GetLocalSSRC(ssrc), 0);
event_log_->LogAudioPlayout(ssrc);
}
unsigned int ssrc;
RTC_CHECK_EQ(GetLocalSSRC(ssrc), 0);
event_log_proxy_->LogAudioPlayout(ssrc);
// Get 10ms raw PCM data from the ACM (mixer limits output frequency)
bool muted;
if (audio_coding_->PlayoutData10Ms(audioFrame->sample_rate_hz_, audioFrame,
@ -671,9 +751,8 @@ int32_t Channel::NeededFrequency(int32_t id) const {
int32_t Channel::CreateChannel(Channel*& channel,
int32_t channelId,
uint32_t instanceId,
RtcEventLog* const event_log,
const Config& config) {
return CreateChannel(channel, channelId, instanceId, event_log, config,
return CreateChannel(channel, channelId, instanceId, config,
CreateBuiltinAudioDecoderFactory());
}
@ -681,15 +760,13 @@ int32_t Channel::CreateChannel(
Channel*& channel,
int32_t channelId,
uint32_t instanceId,
RtcEventLog* const event_log,
const Config& config,
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) {
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId),
"Channel::CreateChannel(channelId=%d, instanceId=%d)", channelId,
instanceId);
channel =
new Channel(channelId, instanceId, event_log, config, decoder_factory);
channel = new Channel(channelId, instanceId, config, decoder_factory);
if (channel == NULL) {
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId),
"Channel::CreateChannel() unable to allocate memory for"
@ -748,12 +825,11 @@ void Channel::RecordFileEnded(int32_t id) {
Channel::Channel(int32_t channelId,
uint32_t instanceId,
RtcEventLog* const event_log,
const Config& config,
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory)
: _instanceId(instanceId),
_channelId(channelId),
event_log_(event_log),
event_log_proxy_(new RtcEventLogProxy()),
rtp_header_parser_(RtpHeaderParser::Create()),
rtp_payload_registry_(
new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))),
@ -856,7 +932,7 @@ Channel::Channel(int32_t channelId,
seq_num_allocator_proxy_.get();
configuration.transport_feedback_callback = feedback_observer_proxy_.get();
}
configuration.event_log = event_log;
configuration.event_log = &(*event_log_proxy_);
_rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration));
_rtpRtcpModule->SetSendingMediaStatus(false);
@ -3008,6 +3084,10 @@ void Channel::DisassociateSendChannel(int channel_id) {
}
}
void Channel::SetRtcEventLog(RtcEventLog* event_log) {
event_log_proxy_->SetEventLog(event_log);
}
int Channel::RegisterExternalMediaProcessing(ProcessingTypes type,
VoEMediaProcess& processObject) {
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),

View File

@ -66,6 +66,7 @@ struct SenderInfo;
namespace voe {
class OutputMixer;
class RtcEventLogProxy;
class RtpPacketSenderProxy;
class Statistics;
class StatisticsProxy;
@ -173,18 +174,15 @@ class Channel
static int32_t CreateChannel(Channel*& channel,
int32_t channelId,
uint32_t instanceId,
RtcEventLog* const event_log,
const Config& config);
static int32_t CreateChannel(
Channel*& channel,
int32_t channelId,
uint32_t instanceId,
RtcEventLog* const event_log,
const Config& config,
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory);
Channel(int32_t channelId,
uint32_t instanceId,
RtcEventLog* const event_log,
const Config& config,
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory);
int32_t Init();
@ -451,6 +449,9 @@ class Channel
// Disassociate a send channel if it was associated.
void DisassociateSendChannel(int channel_id);
// Set a RtcEventLog logging object.
void SetRtcEventLog(RtcEventLog* event_log);
protected:
void OnIncomingFractionLoss(int fraction_lost);
@ -486,7 +487,7 @@ class Channel
ChannelState channel_state_;
RtcEventLog* const event_log_;
std::unique_ptr<voe::RtcEventLogProxy> event_log_proxy_;
std::unique_ptr<RtpHeaderParser> rtp_header_parser_;
std::unique_ptr<RTPPayloadRegistry> rtp_payload_registry_;

View File

@ -47,10 +47,7 @@ ChannelOwner::ChannelRef::ChannelRef(class Channel* channel)
: channel(channel), ref_count(1) {}
ChannelManager::ChannelManager(uint32_t instance_id, const Config& config)
: instance_id_(instance_id),
last_channel_id_(-1),
config_(config),
event_log_(RtcEventLog::Create(Clock::GetRealTimeClock())) {}
: instance_id_(instance_id), last_channel_id_(-1), config_(config) {}
ChannelOwner ChannelManager::CreateChannel() {
return CreateChannel(CreateBuiltinAudioDecoderFactory());
@ -75,8 +72,8 @@ ChannelOwner ChannelManager::CreateChannelInternal(
const Config& config,
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) {
Channel* channel;
Channel::CreateChannel(channel, ++last_channel_id_, instance_id_,
event_log_.get(), config, decoder_factory);
Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, config,
decoder_factory);
ChannelOwner channel_owner(channel);
rtc::CritScope crit(&lock_);
@ -143,10 +140,6 @@ size_t ChannelManager::NumOfChannels() const {
return channels_.size();
}
RtcEventLog* ChannelManager::GetEventLog() const {
return event_log_.get();
}
ChannelManager::Iterator::Iterator(ChannelManager* channel_manager)
: iterator_pos_(0) {
channel_manager->GetAllChannels(&channels_);

View File

@ -17,7 +17,6 @@
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/call/rtc_event_log.h"
#include "webrtc/system_wrappers/include/atomic32.h"
#include "webrtc/typedefs.h"
@ -119,9 +118,6 @@ class ChannelManager {
size_t NumOfChannels() const;
// Returns a pointer to the event log object stored within the ChannelManager.
RtcEventLog* GetEventLog() const;
private:
// Create a channel given a configuration, |config|.
ChannelOwner CreateChannelInternal(
@ -136,7 +132,6 @@ class ChannelManager {
std::vector<ChannelOwner> channels_;
const Config& config_;
std::unique_ptr<RtcEventLog> event_log_;
RTC_DISALLOW_COPY_AND_ASSIGN(ChannelManager);
};

View File

@ -204,6 +204,11 @@ void ChannelProxy::SetChannelOutputVolumeScaling(float scaling) {
RTC_DCHECK_EQ(0, error);
}
void ChannelProxy::SetRtcEventLog(RtcEventLog* event_log) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
channel()->SetRtcEventLog(event_log);
}
Channel* ChannelProxy::channel() const {
RTC_DCHECK(channel_owner_.channel());
return channel_owner_.channel();

View File

@ -24,6 +24,7 @@ namespace webrtc {
class AudioSinkInterface;
class PacketRouter;
class RtcEventLog;
class RtpPacketSender;
class Transport;
class TransportFeedbackObserver;
@ -87,6 +88,8 @@ class ChannelProxy {
virtual void SetChannelOutputVolumeScaling(float scaling);
virtual void SetRtcEventLog(RtcEventLog* event_log);
private:
Channel* channel() const;

View File

@ -35,7 +35,6 @@
namespace webrtc {
class RtcEventLog;
class VoiceEngine;
class WEBRTC_DLLEXPORT VoECodec {
@ -132,10 +131,6 @@ class WEBRTC_DLLEXPORT VoECodec {
// success, and -1 if failed.
virtual int SetOpusDtx(int channel, bool enable_dtx) = 0;
// Get a pointer to the event logging object associated with this Voice
// Engine. This pointer will remain valid until VoiceEngine is destroyed.
virtual RtcEventLog* GetEventLog() = 0;
protected:
VoECodec() {}
virtual ~VoECodec() {}

View File

@ -176,30 +176,6 @@ TEST_F(CodecTest, OpusDtxCannotBeSetForNonOpus) {
}
}
#ifdef ENABLE_RTC_EVENT_LOG
TEST_F(CodecTest, RtcEventLogIntegrationTest) {
webrtc::RtcEventLog* event_log = voe_codec_->GetEventLog();
ASSERT_TRUE(event_log);
// Find the name of the current test, in order to use it as a temporary
// filename.
auto test_info = ::testing::UnitTest::GetInstance()->current_test_info();
const std::string temp_filename = webrtc::test::OutputPath() +
test_info->test_case_name() +
test_info->name();
// Create a log file.
event_log->StartLogging(temp_filename, 1000);
event_log->StopLogging();
// Check if the file has been created.
FILE* event_file = fopen(temp_filename.c_str(), "r");
ASSERT_TRUE(event_file);
fclose(event_file);
// Remove the temporary file.
remove(temp_filename.c_str());
}
#endif // ENABLE_RTC_EVENT_LOG
// TODO(xians, phoglund): Re-enable when issue 372 is resolved.
TEST_F(CodecTest, DISABLED_ManualVerifySendCodecsForAllPacketSizes) {
for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) {

View File

@ -21,7 +21,6 @@
#include "gflags/gflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/format_macros.h"
#include "webrtc/call/rtc_event_log.h"
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/test/channel_transport/channel_transport.h"
@ -448,7 +447,6 @@ void RunTest(std::string out_path) {
printf("%i. Set bit rate (only take effect on codecs that allow the "
"change) \n", option_index++);
printf("%i. Toggle AECdump recording \n", option_index++);
printf("%i. Record RtcEventLog file of 30 seconds \n", option_index++);
printf("Select action or %i to stop the call: ", option_index);
int option_selection;
@ -795,9 +793,6 @@ void RunTest(std::string out_path) {
printf("Debug recording named %s started\n", kDebugFileName);
}
debug_recording_started = !debug_recording_started;
} else if (option_selection == option_index++) {
const char* kDebugFileName = "eventlog.rel";
codec->GetEventLog()->StartLogging(kDebugFileName, 30000);
} else {
break;
}

View File

@ -376,10 +376,6 @@ int VoECodecImpl::SetOpusDtx(int channel, bool enable_dtx) {
return channelPtr->SetOpusDtx(enable_dtx);
}
RtcEventLog* VoECodecImpl::GetEventLog() {
return _shared->channel_manager().GetEventLog();
}
#endif // WEBRTC_VOICE_ENGINE_CODEC_API
} // namespace webrtc

View File

@ -58,8 +58,6 @@ class VoECodecImpl : public VoECodec {
int SetOpusDtx(int channel, bool enable_dtx) override;
RtcEventLog* GetEventLog() override;
protected:
VoECodecImpl(voe::SharedData* shared);
~VoECodecImpl() override;