Make RtcpTransceiver destructor non-blocking

At cost of removing assumption callbacks can't be used after destructor.

Bug: webrtc:8239
Change-Id: Id79f7553528cf6c102d3ee0bf7aa2de5b0437d2a
Reviewed-on: https://webrtc-review.googlesource.com/98860
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24632}
This commit is contained in:
Danil Chapovalov
2018-09-07 13:03:32 +02:00
committed by Commit Bot
parent d7027dc081
commit 792df6b4b9
3 changed files with 51 additions and 37 deletions

View File

@ -29,16 +29,18 @@ namespace webrtc {
class RtcpTransceiver : public RtcpFeedbackSenderInterface {
public:
explicit RtcpTransceiver(const RtcpTransceiverConfig& config);
// Blocks unless Stop was called.
// TODO(danilchap): Change destructor to never block by breaking assumption
// callbacks are not used after destruction.
// Note that interfaces provided in constructor still might be used after the
// destructor. However they can only be used on the confic.task_queue.
// Use Stop function to get notified when they are no longer used or
// ensure those objects outlive the task queue.
~RtcpTransceiver() override;
// Start asynchronious destruction of the RtcpTransceiver.
// It is safe to call destructor right after Stop exits.
// No other methods can be called.
// Note that observers provided in constructor or registered with AddObserver
// still might be used by the transceiver until |on_destroyed| runs.
// Note that interfaces provided in constructor or registered with AddObserver
// still might be used by the transceiver on the task queue
// until |on_destroyed| runs.
void Stop(std::unique_ptr<rtc::QueuedTask> on_destroyed);
// Registers observer to be notified about incoming rtcp packets.