Prevent decoder busy loop for send-only channels.

ViEChannels without default encoders doesn't register a receive codec by
default. This makes VideoReceiver::Decode return early, causing a
high-priority thread to effectively be busy looping. This would be
expected to wreck more havoc in a more cross-platform manner than it has
visibly done. On Windows XP however it manages to bring the whole
machine to a grinding halt forcing a reboot if CPU usage hits 100%.

BUG=chromium:470013
R=stefan@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#8976}
This commit is contained in:
Peter Boström 2015-04-10 15:36:33 +02:00
parent a125d7d7ad
commit 3949e8666e
3 changed files with 2 additions and 9 deletions

View File

@ -218,7 +218,6 @@ class VideoReceiver {
Clock* const clock_;
rtc::scoped_ptr<CriticalSectionWrapper> process_crit_sect_;
CriticalSectionWrapper* _receiveCritSect;
bool _receiverInited GUARDED_BY(_receiveCritSect);
VCMTiming _timing;
VCMReceiver _receiver;
VCMDecodedFrameCallback _decodedFrameCallback;

View File

@ -28,7 +28,6 @@ VideoReceiver::VideoReceiver(Clock* clock, EventFactory* event_factory)
: clock_(clock),
process_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
_receiveCritSect(CriticalSectionWrapper::CreateCriticalSection()),
_receiverInited(false),
_timing(clock_),
_receiver(&_timing, clock_, event_factory, true),
_decodedFrameCallback(_timing, clock_),
@ -257,7 +256,6 @@ int32_t VideoReceiver::InitializeReceiver() {
CriticalSectionScoped receive_cs(_receiveCritSect);
_codecDataBase.ResetReceiver();
_timing.Reset();
_receiverInited = true;
}
{
@ -349,12 +347,6 @@ int32_t VideoReceiver::Decode(uint16_t maxWaitTimeMs) {
bool supports_render_scheduling;
{
CriticalSectionScoped cs(_receiveCritSect);
if (!_receiverInited) {
return VCM_UNINITIALIZED;
}
if (!_codecDataBase.DecoderRegistered()) {
return VCM_NO_CODEC_REGISTERED;
}
supports_render_scheduling = _codecDataBase.SupportsRenderScheduling();
}

View File

@ -1752,6 +1752,8 @@ bool ViEChannel::ChannelDecodeThreadFunction(void* obj) {
}
bool ViEChannel::ChannelDecodeProcess() {
// TODO(pbos): Make sure the decoder thread doesn't run for send-only
// channels.
vcm_->Decode(kMaxDecodeWaitTimeMs);
return true;
}