Use RtcpPacket to send SLI in RtcpSender
BUG=webrtc:2450 Review URL: https://codereview.webrtc.org/1268383002 Cr-Commit-Position: refs/heads/master@{#9695}
This commit is contained in:
@ -593,31 +593,18 @@ RTCPSender::BuildResult RTCPSender::BuildFIR(RtcpContext* ctx) {
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
RTCPSender::BuildResult RTCPSender::BuildSLI(RtcpContext* ctx) {
|
||||
// sanity
|
||||
if (ctx->position + 16 >= IP_PACKET_SIZE)
|
||||
rtcp::Sli sli;
|
||||
sli.From(ssrc_);
|
||||
sli.To(remote_ssrc_);
|
||||
// Crop picture id to 6 least significant bits.
|
||||
sli.WithPictureId(ctx->picture_id & 0x3F);
|
||||
sli.WithFirstMb(0);
|
||||
sli.WithNumberOfMb(0x1FFF); // 13 bits, only ones for now.
|
||||
|
||||
PacketBuiltCallback callback(ctx);
|
||||
if (!callback.BuildPacket(sli))
|
||||
return BuildResult::kTruncated;
|
||||
|
||||
// add slice loss indicator
|
||||
uint8_t FMT = 2;
|
||||
*ctx->AllocateData(1) = 0x80 + FMT;
|
||||
*ctx->AllocateData(1) = 206;
|
||||
|
||||
// Used fixed length of 3
|
||||
*ctx->AllocateData(1) = 0;
|
||||
*ctx->AllocateData(1) = 3;
|
||||
|
||||
// Add our own SSRC
|
||||
ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), ssrc_);
|
||||
|
||||
// Add the remote SSRC
|
||||
ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), remote_ssrc_);
|
||||
|
||||
// Add first, number & picture ID 6 bits
|
||||
// first = 0, 13 - bits
|
||||
// number = 0x1fff, 13 - bits only ones for now
|
||||
uint32_t sliField = (0x1fff << 6) + (0x3f & ctx->picture_id);
|
||||
ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), sliField);
|
||||
|
||||
return BuildResult::kSuccess;
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
using namespace webrtc;
|
||||
|
||||
const uint64_t kTestPictureId = 12345678;
|
||||
const uint8_t kSliPictureId = 156;
|
||||
|
||||
class RtcpCallback : public RtcpIntraFrameObserver {
|
||||
public:
|
||||
@ -38,7 +39,7 @@ class RtcpCallback : public RtcpIntraFrameObserver {
|
||||
};
|
||||
virtual void OnReceivedSLI(uint32_t ssrc,
|
||||
uint8_t pictureId) {
|
||||
EXPECT_EQ(28, pictureId);
|
||||
EXPECT_EQ(kSliPictureId & 0x3f, pictureId);
|
||||
};
|
||||
virtual void OnReceivedRPSI(uint32_t ssrc,
|
||||
uint64_t pictureId) {
|
||||
@ -204,7 +205,7 @@ class RtpRtcpRtcpTest : public ::testing::Test {
|
||||
|
||||
TEST_F(RtpRtcpRtcpTest, RTCP_PLI_RPSI) {
|
||||
EXPECT_EQ(0, module1->SendRTCPReferencePictureSelection(kTestPictureId));
|
||||
EXPECT_EQ(0, module1->SendRTCPSliceLossIndication(156));
|
||||
EXPECT_EQ(0, module1->SendRTCPSliceLossIndication(kSliPictureId));
|
||||
}
|
||||
|
||||
TEST_F(RtpRtcpRtcpTest, RTCP_CNAME) {
|
||||
|
Reference in New Issue
Block a user