Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 7806200

Browse files
taste1981jianjunz
authored andcommitted
Lntf (#100)
* Set generic frame descriptor extension for HEVC * Enable more rtcp feedbacks for loss/reference indication
1 parent cb00a61 commit 7806200

File tree

6 files changed

+133
-3
lines changed

6 files changed

+133
-3
lines changed

media/base/media_constants.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ const char kRtcpFbParamTransportCc[] = "transport-cc";
9393
const char kRtcpFbParamCcm[] = "ccm";
9494
const char kRtcpFbCcmParamFir[] = "fir";
9595
const char kRtcpFbParamRrtr[] = "rrtr";
96+
const char kRtcpFbNackParamRpsi[] = "rpsi";
9697
const char kCodecParamMaxBitrate[] = "x-google-max-bitrate";
9798
const char kCodecParamMinBitrate[] = "x-google-min-bitrate";
9899
const char kCodecParamStartBitrate[] = "x-google-start-bitrate";

media/base/media_constants.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ extern const char kRtcpFbCcmParamFir[];
112112
// Receiver reference time report
113113
// https://tools.ietf.org/html/rfc3611 section 4.4
114114
extern const char kRtcpFbParamRrtr[];
115-
// Google specific parameters
115+
// Reference picture selection indications
116+
// https://tools.ietf.org/html/rfc4585 section 6.3.3
117+
extern const char kRtcpFbNackParamRpsi[];
118+
// Google specific parameters
116119
extern const char kCodecParamMaxBitrate[];
117120
extern const char kCodecParamMinBitrate[];
118121
extern const char kCodecParamStartBitrate[];

media/engine/webrtc_video_engine.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,13 @@ void AddDefaultFeedbackParams(VideoCodec* codec,
101101
codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamCcm, kRtcpFbCcmParamFir));
102102
codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kParamValueEmpty));
103103
codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamPli));
104-
if (codec->name == kVp8CodecName &&
105-
IsEnabled(trials, "WebRTC-RtcpLossNotification")) {
104+
codec->AddFeedbackParam(
105+
FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamRpsi));
106+
if ((codec->name == kVp8CodecName || codec->name == kH264CodecName
107+
|| codec->name == kH265CodecName
108+
) &&
109+
(webrtc::field_trial::IsEnabled("WebRTC-RtcpLossNotification") ||
110+
(webrtc::field_trial::IsEnabled("OWT-LowLatencyMode")))) {
106111
codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamLntf, kParamValueEmpty));
107112
}
108113
}

modules/rtp_rtcp/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ rtc_library("rtp_rtcp_format") {
3535
"source/rtcp_packet/remb.h",
3636
"source/rtcp_packet/remote_estimate.h",
3737
"source/rtcp_packet/report_block.h",
38+
"source/rtcp_packet/rpsi.h",
3839
"source/rtcp_packet/rrtr.h",
3940
"source/rtcp_packet/rtpfb.h",
4041
"source/rtcp_packet/sdes.h",
@@ -74,6 +75,7 @@ rtc_library("rtp_rtcp_format") {
7475
"source/rtcp_packet/remb.cc",
7576
"source/rtcp_packet/remote_estimate.cc",
7677
"source/rtcp_packet/report_block.cc",
78+
"source/rtcp_packet/rpsi.cc",
7779
"source/rtcp_packet/rrtr.cc",
7880
"source/rtcp_packet/rtpfb.cc",
7981
"source/rtcp_packet/sdes.cc",
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree. An additional intellectual property rights grant can be found
7+
* in the file PATENTS. All contributing project authors may
8+
* be found in the AUTHORS file in the root of the source tree.
9+
*/
10+
11+
#include "modules/rtp_rtcp/source/rtcp_packet/rpsi.h"
12+
13+
#include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
14+
#include "rtc_base/checks.h"
15+
#include "rtc_base/logging.h"
16+
17+
namespace webrtc {
18+
namespace rtcp {
19+
constexpr uint8_t Rpsi::kFeedbackMessageType;
20+
// RFC 4585: Feedback format.
21+
//
22+
// Common packet format:
23+
//
24+
// 0 1 2 3
25+
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
26+
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
27+
// |V=2|P| FMT | PT | length |
28+
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
29+
// | SSRC of packet sender |
30+
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
31+
// | SSRC of media source |
32+
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
33+
// : Feedback Control Information (FCI) :
34+
// : :
35+
36+
Rpsi::Rpsi() = default;
37+
38+
Rpsi::Rpsi(const Rpsi& Rpsi) = default;
39+
40+
Rpsi::~Rpsi() = default;
41+
42+
//
43+
// Reference picture selection indication(RPSI) (RFC 4585).
44+
// FCI: no feedback control information.
45+
bool Rpsi::Parse(const CommonHeader& packet) {
46+
RTC_DCHECK_EQ(packet.type(), kPacketType);
47+
RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType);
48+
49+
if (packet.payload_size_bytes() < kCommonFeedbackLength) {
50+
RTC_LOG(LS_WARNING) << "Packet is too small to be a valid Rpsi packet";
51+
return false;
52+
}
53+
54+
ParseCommonFeedback(packet.payload());
55+
return true;
56+
}
57+
58+
size_t Rpsi::BlockLength() const {
59+
return kHeaderLength + kCommonFeedbackLength;
60+
}
61+
62+
bool Rpsi::Create(uint8_t* packet,
63+
size_t* index,
64+
size_t max_length,
65+
PacketReadyCallback callback) const {
66+
while (*index + BlockLength() > max_length) {
67+
if (!OnBufferFull(packet, index, callback))
68+
return false;
69+
}
70+
71+
CreateHeader(kFeedbackMessageType, kPacketType, HeaderLength(), packet,
72+
index);
73+
CreateCommonFeedback(packet + *index);
74+
*index += kCommonFeedbackLength;
75+
return true;
76+
}
77+
78+
} // namespace rtcp
79+
} // namespace webrtc
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree. An additional intellectual property rights grant can be found
7+
* in the file PATENTS. All contributing project authors may
8+
* be found in the AUTHORS file in the root of the source tree.
9+
*/
10+
#ifndef MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RPSI_H_
11+
#define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RPSI_H_
12+
13+
#include "modules/rtp_rtcp/source/rtcp_packet/psfb.h"
14+
15+
namespace webrtc {
16+
namespace rtcp {
17+
class CommonHeader;
18+
// Reference picture selection indication (RPSI) (RFC 4585).
19+
// Will add detailed format fields after finalizing payload.
20+
class Rpsi : public Psfb {
21+
public:
22+
static constexpr uint8_t kFeedbackMessageType = 1;
23+
24+
Rpsi();
25+
Rpsi(const Rpsi& rpsi);
26+
~Rpsi() override;
27+
28+
bool Parse(const CommonHeader& packet);
29+
30+
size_t BlockLength() const override;
31+
32+
bool Create(uint8_t* packet,
33+
size_t* index,
34+
size_t max_length,
35+
PacketReadyCallback callback) const override;
36+
};
37+
38+
} // namespace rtcp
39+
} // namespace webrtc
40+
#endif // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RPSI_H_

0 commit comments

Comments
 (0)