webrtc/call/flexfec_receive_stream_impl.h
Harald Alvestrand d7b28ebba1 Move all the receiver SSRC choices to the AudioChannel/VideoChannel
This makes the mediachannels not have to care about reportig SSRCs,
these are a concern of the RTP/RTCP module and the Channel only.

This allows deleting ~300 lines of code propagating and caching
SSRCs for sending RTCP reports that were following the wrong abstraction.

Bug: webrtc:41480926
Change-Id: I56eee4628011a13613ed8d977f3ef91ea912e4fe
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/442881
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46966}
2026-02-20 10:02:57 -08:00

101 lines
3.4 KiB
C++

/*
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef CALL_FLEXFEC_RECEIVE_STREAM_IMPL_H_
#define CALL_FLEXFEC_RECEIVE_STREAM_IMPL_H_
#include <cstdint>
#include <memory>
#include "api/environment/environment.h"
#include "api/rtp_headers.h"
#include "api/sequence_checker.h"
#include "call/flexfec_receive_stream.h"
#include "call/rtp_packet_sink_interface.h"
#include "modules/pacing/packet_router.h"
#include "modules/rtp_rtcp/source/rtp_rtcp_impl2.h"
#include "rtc_base/system/no_unique_address.h"
#include "rtc_base/thread_annotations.h"
namespace webrtc {
class FlexfecReceiver;
class ReceiveStatistics;
class RecoveredPacketReceiver;
class RtcpRttStats;
class RtpPacketReceived;
class RtpStreamReceiverControllerInterface;
class RtpStreamReceiverInterface;
class FlexfecReceiveStreamImpl : public FlexfecReceiveStream {
public:
FlexfecReceiveStreamImpl(const Environment& env,
Config config,
RecoveredPacketReceiver* recovered_packet_receiver,
PacketRouter* packet_router,
RtcpRttStats* rtt_stats);
// Destruction happens on the worker thread. Prior to destruction the caller
// must ensure that a registration with the transport has been cleared. See
// `RegisterWithTransport` for details.
// TODO(tommi): As a further improvement to this, performing the full
// destruction on the network thread could be made the default.
~FlexfecReceiveStreamImpl() override;
// Called on the network thread to register/unregister with the network
// transport.
void RegisterWithTransport(
RtpStreamReceiverControllerInterface* receiver_controller);
// If registration has previously been done (via `RegisterWithTransport`) then
// `UnregisterFromTransport` must be called prior to destruction, on the
// network thread.
void UnregisterFromTransport();
// RtpPacketSinkInterface.
void OnRtpPacket(const RtpPacketReceived& packet) override;
void SetPayloadType(int payload_type) override;
int payload_type() const override;
uint32_t remote_ssrc() const { return remote_ssrc_; }
void SetRtcpMode(RtcpMode mode) override {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
rtp_rtcp_->SetRTCPStatus(mode);
}
const ReceiveStatistics* GetStats() const override {
return rtp_receive_statistics_.get();
}
private:
const Environment env_;
RTC_NO_UNIQUE_ADDRESS SequenceChecker packet_sequence_checker_;
const uint32_t remote_ssrc_;
// `payload_type_` is initially set to -1, indicating that FlexFec is
// disabled.
int payload_type_ RTC_GUARDED_BY(packet_sequence_checker_) = -1;
// Erasure code interfacing.
const std::unique_ptr<FlexfecReceiver> receiver_;
// RTCP reporting.
const std::unique_ptr<ReceiveStatistics> rtp_receive_statistics_;
const std::unique_ptr<ModuleRtpRtcpImpl2> rtp_rtcp_;
std::unique_ptr<RtpStreamReceiverInterface> rtp_stream_receiver_
RTC_GUARDED_BY(packet_sequence_checker_);
};
} // namespace webrtc
#endif // CALL_FLEXFEC_RECEIVE_STREAM_IMPL_H_