Remove thread_checker in playout_delay_oracle

It appears there the encode and send operation can happen over multiple
threads. Also, padding data itself may be sent on a different thread.
Remove thread checker and protect all data with crit_sect.

BUG=webrtc:5998
TBR=stefan@webrtc.org

Review-Url: https://codereview.webrtc.org/2066863002
Cr-Commit-Position: refs/heads/master@{#13137}
This commit is contained in:
isheriff 2016-06-14 10:55:36 -07:00 committed by Commit bot
parent 971cab0d93
commit 5aaa9faa9b
2 changed files with 9 additions and 16 deletions

View File

@ -22,16 +22,14 @@ PlayoutDelayOracle::PlayoutDelayOracle()
send_playout_delay_(false),
ssrc_(0),
min_playout_delay_ms_(-1),
max_playout_delay_ms_(-1) {
thread_checker_.DetachFromThread();
}
max_playout_delay_ms_(-1) {}
PlayoutDelayOracle::~PlayoutDelayOracle() {}
void PlayoutDelayOracle::UpdateRequest(uint32_t ssrc,
PlayoutDelay playout_delay,
uint16_t seq_num) {
rtc::CritScope lock(&crit_sect_);
RTC_DCHECK_RUN_ON(&thread_checker_);
RTC_DCHECK_LE(playout_delay.min_ms, kPlayoutDelayMaxMs);
RTC_DCHECK_LE(playout_delay.max_ms, kPlayoutDelayMaxMs);
RTC_DCHECK_LE(playout_delay.min_ms, playout_delay.max_ms);

View File

@ -13,7 +13,6 @@
#include "webrtc/base/basictypes.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/thread_checker.h"
#include "webrtc/base/thread_annotations.h"
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
@ -45,13 +44,13 @@ class PlayoutDelayOracle {
// Returns current minimum playout delay in milliseconds.
int min_playout_delay_ms() const {
RTC_DCHECK_RUN_ON(&thread_checker_);
rtc::CritScope lock(&crit_sect_);
return min_playout_delay_ms_;
}
// Returns current maximum playout delay in milliseconds.
int max_playout_delay_ms() const {
RTC_DCHECK_RUN_ON(&thread_checker_);
rtc::CritScope lock(&crit_sect_);
return max_playout_delay_ms_;
}
@ -64,10 +63,9 @@ class PlayoutDelayOracle {
void OnReceivedRtcpReportBlocks(const ReportBlockList& report_blocks);
private:
// The playout delay information is updated from the encoder thread or
// a thread controlled by application in case of external encoder.
// The playout delay information is updated from the encoder thread(s).
// The sequence number feedback is updated from the worker thread.
// Guards access to data across the two threads.
// Guards access to data across multiple threads.
rtc::CriticalSection crit_sect_;
// The current highest sequence number on which playout delay has been sent.
int64_t high_sequence_number_ GUARDED_BY(crit_sect_);
@ -75,15 +73,12 @@ class PlayoutDelayOracle {
bool send_playout_delay_ GUARDED_BY(crit_sect_);
// Sender ssrc.
uint32_t ssrc_ GUARDED_BY(crit_sect_);
// Data in this section is accessed on the sending/encoder thread alone.
rtc::ThreadChecker thread_checker_;
// Sequence number unwrapper.
SequenceNumberUnwrapper unwrapper_ GUARDED_BY(thread_checker_);
SequenceNumberUnwrapper unwrapper_ GUARDED_BY(crit_sect_);
// Min playout delay value on the next frame if |send_playout_delay_| is set.
int min_playout_delay_ms_ GUARDED_BY(thread_checker_);
int min_playout_delay_ms_ GUARDED_BY(crit_sect_);
// Max playout delay value on the next frame if |send_playout_delay_| is set.
int max_playout_delay_ms_ GUARDED_BY(thread_checker_);
int max_playout_delay_ms_ GUARDED_BY(crit_sect_);
RTC_DISALLOW_COPY_AND_ASSIGN(PlayoutDelayOracle);
};