Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Unified Diff: webrtc/modules/rtp_rtcp/source/forward_error_correction.h

Issue 2918333002: Reland of Only compare sequence numbers from the same SSRC in ForwardErrorCorrection. (Closed)
Patch Set: Let ForwardErrorCorrection be aware of its SSRCs. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/forward_error_correction.h
diff --git a/webrtc/modules/rtp_rtcp/source/forward_error_correction.h b/webrtc/modules/rtp_rtcp/source/forward_error_correction.h
index f45473cb1f417cbb36dcdabb0f2c99542af9ccca..e70d7db493192cb32b19c17588fda1497c0445d9 100644
--- a/webrtc/modules/rtp_rtcp/source/forward_error_correction.h
+++ b/webrtc/modules/rtp_rtcp/source/forward_error_correction.h
@@ -33,6 +33,8 @@ class FecHeaderWriter;
// Option exists to enable unequal protection (UEP) across packets.
// This is not to be confused with protection within packets
// (referred to as uneven level protection (ULP) in RFC 5109).
+// TODO(brandtr): Split this class into a separate encoder
+// and a separate decoder.
class ForwardErrorCorrection {
public:
// TODO(holmer): As a next step all these struct-like packet classes should be
@@ -62,29 +64,25 @@ class ForwardErrorCorrection {
class SortablePacket {
public:
// Functor which returns true if the sequence number of |first|
- // is < the sequence number of |second|.
+ // is < the sequence number of |second|. Should only ever be called for
+ // packets belonging to the same SSRC.
struct LessThan {
template <typename S, typename T>
bool operator() (const S& first, const T& second);
};
+ uint32_t ssrc;
uint16_t seq_num;
};
// The received list parameter of DecodeFec() references structs of this type.
//
- // The ssrc member is needed to ensure that we can restore the SSRC field of
- // recovered packets. In most situations this could be retrieved from other
- // media packets, but in the case of an FEC packet protecting a single
- // missing media packet, we have no other means of obtaining it.
// TODO(holmer): Refactor into a proper class.
class ReceivedPacket : public SortablePacket {
public:
ReceivedPacket();
~ReceivedPacket();
- uint32_t ssrc; // SSRC of the current frame. Must be set for FEC
- // packets, but not required for media packets.
bool is_fec; // Set to true if this is an FEC packet and false
// otherwise.
rtc::scoped_refptr<Packet> pkt; // Pointer to the packet storage.
@@ -109,7 +107,7 @@ class ForwardErrorCorrection {
// Used to link media packets to their protecting FEC packets.
//
// TODO(holmer): Refactor into a proper class.
- class ProtectedPacket : public ForwardErrorCorrection::SortablePacket {
+ class ProtectedPacket : public SortablePacket {
public:
ProtectedPacket();
~ProtectedPacket();
@@ -122,7 +120,7 @@ class ForwardErrorCorrection {
// Used for internal storage of received FEC packets in a list.
//
// TODO(holmer): Refactor into a proper class.
- class ReceivedFecPacket : public ForwardErrorCorrection::SortablePacket {
+ class ReceivedFecPacket : public SortablePacket {
public:
ReceivedFecPacket();
~ReceivedFecPacket();
@@ -150,8 +148,10 @@ class ForwardErrorCorrection {
~ForwardErrorCorrection();
// Creates a ForwardErrorCorrection tailored for a specific FEC scheme.
- static std::unique_ptr<ForwardErrorCorrection> CreateUlpfec();
- static std::unique_ptr<ForwardErrorCorrection> CreateFlexfec();
+ static std::unique_ptr<ForwardErrorCorrection> CreateUlpfec(uint32_t ssrc);
+ static std::unique_ptr<ForwardErrorCorrection> CreateFlexfec(
+ uint32_t ssrc,
+ uint32_t protected_media_ssrc);
// Generates a list of FEC packets from supplied media packets.
//
@@ -242,7 +242,9 @@ class ForwardErrorCorrection {
protected:
ForwardErrorCorrection(std::unique_ptr<FecHeaderReader> fec_header_reader,
- std::unique_ptr<FecHeaderWriter> fec_header_writer);
+ std::unique_ptr<FecHeaderWriter> fec_header_writer,
+ uint32_t ssrc,
+ uint32_t protected_media_ssrc);
private:
// Analyzes |media_packets| for holes in the sequence and inserts zero columns
@@ -330,6 +332,10 @@ class ForwardErrorCorrection {
// for recovering lost packets.
void DiscardOldRecoveredPackets(RecoveredPacketList* recovered_packets);
+ // These SSRCs are only used by the decoder.
+ const uint32_t ssrc_;
+ const uint32_t protected_media_ssrc_;
+
std::unique_ptr<FecHeaderReader> fec_header_reader_;
std::unique_ptr<FecHeaderWriter> fec_header_writer_;

Powered by Google App Engine
This is Rietveld 408576698