Remove sequenced task checker from FlexfecSender.

The packetization parts of this class are accessed from the
encoder thread, which might change under different occasions.
The use of a sequenced task checker here is thus incorrect, since
that requires the access to always be on the same thread, whenever
a task queue is not used.

The access to the instantiated object of this class, at least when
it comes to the RTP packetization parts, is however synchronized
using the lock in PayloadRouter::OnEncodedImage. We can therefore
safely remove the sequenced task checker.

BUG=webrtc:5654

Review-Url: https://codereview.webrtc.org/2562983002
Cr-Commit-Position: refs/heads/master@{#15549}
This commit is contained in:
brandtr
2016-12-12 07:13:56 -08:00
committed by Commit bot
parent e54b0c5e0d
commit fe793eb2d1
2 changed files with 9 additions and 18 deletions

View File

@ -80,10 +80,6 @@ FlexfecSender::FlexfecSender(
// This object should not have been instantiated if FlexFEC is disabled.
RTC_DCHECK_GE(payload_type, 0);
RTC_DCHECK_LE(payload_type, 127);
// It's OK to create this object on a different thread/task queue than
// the one used during main operation.
sequence_checker_.Detach();
}
FlexfecSender::~FlexfecSender() = default;
@ -91,13 +87,10 @@ FlexfecSender::~FlexfecSender() = default;
// We are reusing the implementation from UlpfecGenerator for SetFecParameters,
// AddRtpPacketAndGenerateFec, and FecAvailable.
void FlexfecSender::SetFecParameters(const FecProtectionParams& params) {
RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_);
ulpfec_generator_.SetFecParameters(params);
}
bool FlexfecSender::AddRtpPacketAndGenerateFec(
const RtpPacketToSend& packet) {
RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_);
bool FlexfecSender::AddRtpPacketAndGenerateFec(const RtpPacketToSend& packet) {
// TODO(brandtr): Generalize this SSRC check when we support multistream
// protection.
RTC_DCHECK_EQ(packet.Ssrc(), protected_media_ssrc_);
@ -106,14 +99,10 @@ bool FlexfecSender::AddRtpPacketAndGenerateFec(
}
bool FlexfecSender::FecAvailable() const {
RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_);
return ulpfec_generator_.FecAvailable();
}
std::vector<std::unique_ptr<RtpPacketToSend>>
FlexfecSender::GetFecPackets() {
RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_);
std::vector<std::unique_ptr<RtpPacketToSend>> FlexfecSender::GetFecPackets() {
std::vector<std::unique_ptr<RtpPacketToSend>> fec_packets_to_send;
fec_packets_to_send.reserve(ulpfec_generator_.generated_fec_packets_.size());
for (const auto& fec_packet : ulpfec_generator_.generated_fec_packets_) {