From 5fc2dcd64a13502e547201e4b1f5283459a4ba06 Mon Sep 17 00:00:00 2001 From: "marpan@google.com" Date: Mon, 1 Aug 2011 21:47:46 +0000 Subject: [PATCH] Change to make the VP8-RTP Fragmentation (FI bits) setting (in the payload header) agree with "draft-westin-payload-vp8-02" document. This issue was raised in: http://code.google.com/p/webrtc/issues/detail?id=31 Review URL: http://webrtc-codereview.appspot.com/92005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@285 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/modules/rtp_rtcp/source/rtp_format_vp8.cc | 21 ++++++++++++++++--- src/modules/rtp_rtcp/source/rtp_format_vp8.h | 2 ++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/modules/rtp_rtcp/source/rtp_format_vp8.cc b/src/modules/rtp_rtcp/source/rtp_format_vp8.cc index 358dd8f595..a67e1dfc3b 100644 --- a/src/modules/rtp_rtcp/source/rtp_format_vp8.cc +++ b/src/modules/rtp_rtcp/source/rtp_format_vp8.cc @@ -180,9 +180,8 @@ int RtpFormatVp8::WriteHeaderAndPayload(int payload_bytes, buffer[0] = 0; if (hdr_info_.nonReference) buffer[0] |= (0x01 << 3); // N - if (!first_fragment_) buffer[0] |= (0x01 << 2); // FI - if (!end_of_fragment) buffer[0] |= (0x01 << 1); // FI - if (beginning_) buffer[0] |= 0x01; // B + buffer[0] |= (GetFIFlag(end_of_fragment) << 1); // FI + if (beginning_) buffer[0] |= 0x01; // B int pic_id_len = WritePictureID(&buffer[vp8_header_bytes_], buffer_length - vp8_header_bytes_); @@ -252,4 +251,20 @@ int RtpFormatVp8::PictureIdLength() const } } +int RtpFormatVp8::GetFIFlag(bool end_of_fragment) const +{ + if (first_fragment_ && end_of_fragment) { + return 0x0; + } + else if (first_fragment_ && !end_of_fragment) { + return 0x1; + } + else if (!first_fragment_ && !end_of_fragment) { + return 0x2; + } + else if (!first_fragment_ && end_of_fragment) { + return 0x3; + } +} + } // namespace webrtc diff --git a/src/modules/rtp_rtcp/source/rtp_format_vp8.h b/src/modules/rtp_rtcp/source/rtp_format_vp8.h index edb34be8f0..7ee94db850 100644 --- a/src/modules/rtp_rtcp/source/rtp_format_vp8.h +++ b/src/modules/rtp_rtcp/source/rtp_format_vp8.h @@ -105,6 +105,8 @@ private: // header. Can be 0, 1, or 2. int PictureIdLength() const; + int GetFIFlag(bool end_of_fragment) const; + const WebRtc_UWord8* payload_data_; const int payload_size_; RTPFragmentationHeader part_info_;