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_;