Skip to content

Commit

Permalink
Prevent decoder busy loop for send-only channels.
Browse files Browse the repository at this point in the history
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
[email protected]

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

Cr-Commit-Position: refs/heads/master@{#8976}
(cherry picked from commit 3949e86)

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

Cr-Commit-Position: refs/branch-heads/43@{#2}
Cr-Branched-From: 7351f46-refs/heads/master@{#8926}
  • Loading branch information
Peter Boström committed Apr 14, 2015
1 parent a9ad4d9 commit 6af691d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions webrtc/modules/video_coding/main/source/video_receiver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_),
Expand Down Expand Up @@ -257,7 +256,6 @@ int32_t VideoReceiver::InitializeReceiver() {
CriticalSectionScoped receive_cs(_receiveCritSect);
_codecDataBase.ResetReceiver();
_timing.Reset();
_receiverInited = true;
}

{
Expand Down Expand Up @@ -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();
}

Expand Down
2 changes: 2 additions & 0 deletions webrtc/video_engine/vie_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 6af691d

Please sign in to comment.