Update RTC_DCHECK_IS_ON checks in SdpOfferAnswerHandler
...and OperationsChain. Bug: none Change-Id: Iac07db38deb02fda0a9194b73755cd329def8e98 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186840 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32327}
This commit is contained in:
parent
f8e62fcb14
commit
3699236fca
@ -744,12 +744,14 @@ class CreateSessionDescriptionObserverOperationWrapper
|
||||
RTC_DCHECK(observer_);
|
||||
}
|
||||
~CreateSessionDescriptionObserverOperationWrapper() override {
|
||||
#if RTC_DCHECK_IS_ON
|
||||
RTC_DCHECK(was_called_);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OnSuccess(SessionDescriptionInterface* desc) override {
|
||||
#if RTC_DCHECK_IS_ON
|
||||
RTC_DCHECK(!was_called_);
|
||||
#ifdef RTC_DCHECK_IS_ON
|
||||
was_called_ = true;
|
||||
#endif // RTC_DCHECK_IS_ON
|
||||
// Completing the operation before invoking the observer allows the observer
|
||||
@ -759,8 +761,8 @@ class CreateSessionDescriptionObserverOperationWrapper
|
||||
}
|
||||
|
||||
void OnFailure(RTCError error) override {
|
||||
#if RTC_DCHECK_IS_ON
|
||||
RTC_DCHECK(!was_called_);
|
||||
#ifdef RTC_DCHECK_IS_ON
|
||||
was_called_ = true;
|
||||
#endif // RTC_DCHECK_IS_ON
|
||||
operation_complete_callback_();
|
||||
@ -768,7 +770,7 @@ class CreateSessionDescriptionObserverOperationWrapper
|
||||
}
|
||||
|
||||
private:
|
||||
#ifdef RTC_DCHECK_IS_ON
|
||||
#if RTC_DCHECK_IS_ON
|
||||
bool was_called_ = false;
|
||||
#endif // RTC_DCHECK_IS_ON
|
||||
rtc::scoped_refptr<CreateSessionDescriptionObserver> observer_;
|
||||
@ -2919,6 +2921,7 @@ SdpOfferAnswerHandler::AssociateTransceiver(
|
||||
const ContentInfo* old_local_content,
|
||||
const ContentInfo* old_remote_content) {
|
||||
RTC_DCHECK(IsUnifiedPlan());
|
||||
#if RTC_DCHECK_IS_ON
|
||||
// If this is an offer then the m= section might be recycled. If the m=
|
||||
// section is being recycled (defined as: rejected in the current local or
|
||||
// remote description and not rejected in new description), the transceiver
|
||||
@ -2933,6 +2936,8 @@ SdpOfferAnswerHandler::AssociateTransceiver(
|
||||
// The transceiver should be disassociated in RemoveStoppedTransceivers()
|
||||
RTC_DCHECK(!old_transceiver);
|
||||
}
|
||||
#endif
|
||||
|
||||
const MediaContentDescription* media_desc = content.media_description();
|
||||
auto transceiver = transceivers().FindByMid(content.name);
|
||||
if (source == cricket::CS_LOCAL) {
|
||||
@ -2984,6 +2989,9 @@ SdpOfferAnswerHandler::AssociateTransceiver(
|
||||
transceivers().StableState(transceiver)->set_newly_created();
|
||||
}
|
||||
}
|
||||
|
||||
RTC_DCHECK(transceiver);
|
||||
|
||||
// Check if the offer indicated simulcast but the answer rejected it.
|
||||
// This can happen when simulcast is not supported on the remote party.
|
||||
if (SimulcastIsRejected(old_local_content, *media_desc)) {
|
||||
@ -2996,12 +3004,13 @@ SdpOfferAnswerHandler::AssociateTransceiver(
|
||||
}
|
||||
}
|
||||
}
|
||||
RTC_DCHECK(transceiver);
|
||||
|
||||
if (transceiver->media_type() != media_desc->type()) {
|
||||
LOG_AND_RETURN_ERROR(
|
||||
RTCErrorType::INVALID_PARAMETER,
|
||||
"Transceiver type does not match media description type.");
|
||||
}
|
||||
|
||||
if (media_desc->HasSimulcast()) {
|
||||
std::vector<SimulcastLayer> layers =
|
||||
source == cricket::CS_LOCAL
|
||||
|
||||
@ -19,12 +19,14 @@ OperationsChain::CallbackHandle::CallbackHandle(
|
||||
: operations_chain_(std::move(operations_chain)) {}
|
||||
|
||||
OperationsChain::CallbackHandle::~CallbackHandle() {
|
||||
#if RTC_DCHECK_IS_ON
|
||||
RTC_DCHECK(has_run_);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OperationsChain::CallbackHandle::OnOperationComplete() {
|
||||
#if RTC_DCHECK_IS_ON
|
||||
RTC_DCHECK(!has_run_);
|
||||
#ifdef RTC_DCHECK_IS_ON
|
||||
has_run_ = true;
|
||||
#endif // RTC_DCHECK_IS_ON
|
||||
operations_chain_->OnOperationComplete();
|
||||
|
||||
@ -51,11 +51,15 @@ class OperationWithFunctor final : public Operation {
|
||||
: functor_(std::forward<FunctorT>(functor)),
|
||||
callback_(std::move(callback)) {}
|
||||
|
||||
~OperationWithFunctor() override { RTC_DCHECK(has_run_); }
|
||||
~OperationWithFunctor() override {
|
||||
#if RTC_DCHECK_IS_ON
|
||||
RTC_DCHECK(has_run_);
|
||||
#endif // RTC_DCHECK_IS_ON
|
||||
}
|
||||
|
||||
void Run() override {
|
||||
#if RTC_DCHECK_IS_ON
|
||||
RTC_DCHECK(!has_run_);
|
||||
#ifdef RTC_DCHECK_IS_ON
|
||||
has_run_ = true;
|
||||
#endif // RTC_DCHECK_IS_ON
|
||||
// The functor being executed may invoke the callback synchronously,
|
||||
@ -71,7 +75,7 @@ class OperationWithFunctor final : public Operation {
|
||||
private:
|
||||
typename std::remove_reference<FunctorT>::type functor_;
|
||||
std::function<void()> callback_;
|
||||
#ifdef RTC_DCHECK_IS_ON
|
||||
#if RTC_DCHECK_IS_ON
|
||||
bool has_run_ = false;
|
||||
#endif // RTC_DCHECK_IS_ON
|
||||
};
|
||||
@ -168,7 +172,7 @@ class OperationsChain final : public RefCountedObject<RefCountInterface> {
|
||||
|
||||
private:
|
||||
scoped_refptr<OperationsChain> operations_chain_;
|
||||
#ifdef RTC_DCHECK_IS_ON
|
||||
#if RTC_DCHECK_IS_ON
|
||||
bool has_run_ = false;
|
||||
#endif // RTC_DCHECK_IS_ON
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user