diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc index 28cf957481..ec2f656422 100644 --- a/pc/peer_connection.cc +++ b/pc/peer_connection.cc @@ -3628,13 +3628,18 @@ void PeerConnection::SetBitrateAllocationStrategy( std::unique_ptr bitrate_allocation_strategy) { if (!worker_thread()->IsCurrent()) { - rtc::BitrateAllocationStrategy* strategy_raw = - bitrate_allocation_strategy.release(); - worker_thread()->Invoke(RTC_FROM_HERE, [this, strategy_raw]() { - RTC_DCHECK_RUN_ON(worker_thread()); - call_->SetBitrateAllocationStrategy( - absl::WrapUnique(strategy_raw)); - }); + // TODO(kwiberg): Use a lambda instead when C++14 makes it possible to + // move-capture values in lambdas. + struct Task { + PeerConnection* const pc; + std::unique_ptr strategy; + void operator()() { + RTC_DCHECK_RUN_ON(pc->worker_thread()); + pc->call_->SetBitrateAllocationStrategy(std::move(strategy)); + } + }; + worker_thread()->Invoke( + RTC_FROM_HERE, Task{this, std::move(bitrate_allocation_strategy)}); return; } RTC_DCHECK_RUN_ON(worker_thread());