niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
stefan@webrtc.org | 94355e0 | 2012-02-06 14:06:39 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "modules/video_coding/session_info.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 12 | |
| 13 | #include <assert.h> |
| 14 | #include <string.h> |
| 15 | #include <vector> |
| 16 | |
| 17 | #include "absl/types/variant.h" |
| 18 | #include "modules/include/module_common_types.h" |
| 19 | #include "modules/include/module_common_types_public.h" |
| 20 | #include "modules/rtp_rtcp/source/rtp_video_header.h" |
| 21 | #include "modules/video_coding/codecs/interface/common_constants.h" |
| 22 | #include "modules/video_coding/codecs/vp8/include/vp8_globals.h" |
Ilya Nikolaevskiy | 8643b78 | 2018-06-07 16:15:40 +0200 | [diff] [blame] | 23 | #include "modules/video_coding/jitter_buffer_common.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 24 | #include "modules/video_coding/packet.h" |
| 25 | #include "rtc_base/logging.h" |
mikhal@webrtc.org | e185e9f | 2011-09-23 22:02:40 +0000 | [diff] [blame] | 26 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | namespace webrtc { |
agalusza@google.com | d818dcb | 2013-07-29 21:48:11 +0000 | [diff] [blame] | 28 | |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 29 | namespace { |
agalusza@google.com | d818dcb | 2013-07-29 21:48:11 +0000 | [diff] [blame] | 30 | |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 31 | uint16_t BufferToUWord16(const uint8_t* dataBuffer) { |
| 32 | return (dataBuffer[0] << 8) | dataBuffer[1]; |
| 33 | } |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 34 | |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 35 | } // namespace |
| 36 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 37 | VCMSessionInfo::VCMSessionInfo() |
Niels Möller | 425f713 | 2018-06-08 15:17:41 +0200 | [diff] [blame] | 38 | : complete_(false), |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 39 | frame_type_(kVideoFrameDelta), |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 40 | packets_(), |
| 41 | empty_seq_num_low_(-1), |
| 42 | empty_seq_num_high_(-1), |
mikhal@webrtc.org | f31a47a | 2013-08-26 17:10:11 +0000 | [diff] [blame] | 43 | first_packet_seq_num_(-1), |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 44 | last_packet_seq_num_(-1) {} |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 45 | |
Stefan Holmer | dbdb3a0 | 2018-07-17 16:03:46 +0200 | [diff] [blame] | 46 | VCMSessionInfo::~VCMSessionInfo() {} |
| 47 | |
stefan@webrtc.org | b07aa40 | 2012-01-10 11:45:05 +0000 | [diff] [blame] | 48 | void VCMSessionInfo::UpdateDataPointers(const uint8_t* old_base_ptr, |
| 49 | const uint8_t* new_base_ptr) { |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 50 | for (PacketIterator it = packets_.begin(); it != packets_.end(); ++it) |
stefan@webrtc.org | b07aa40 | 2012-01-10 11:45:05 +0000 | [diff] [blame] | 51 | if ((*it).dataPtr != NULL) { |
| 52 | assert(old_base_ptr != NULL && new_base_ptr != NULL); |
| 53 | (*it).dataPtr = new_base_ptr + ((*it).dataPtr - old_base_ptr); |
| 54 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 55 | } |
| 56 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 57 | int VCMSessionInfo::LowSequenceNumber() const { |
| 58 | if (packets_.empty()) |
| 59 | return empty_seq_num_low_; |
| 60 | return packets_.front().seqNum; |
stefan@webrtc.org | c3d8910 | 2011-09-08 06:50:28 +0000 | [diff] [blame] | 61 | } |
| 62 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 63 | int VCMSessionInfo::HighSequenceNumber() const { |
| 64 | if (packets_.empty()) |
| 65 | return empty_seq_num_high_; |
stefan@webrtc.org | 7bc465b | 2013-04-11 17:48:02 +0000 | [diff] [blame] | 66 | if (empty_seq_num_high_ == -1) |
| 67 | return packets_.back().seqNum; |
| 68 | return LatestSequenceNumber(packets_.back().seqNum, empty_seq_num_high_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 69 | } |
| 70 | |
stefan@webrtc.org | ffd28f9 | 2011-10-19 15:55:39 +0000 | [diff] [blame] | 71 | int VCMSessionInfo::PictureId() const { |
asapersson | a9455ab | 2015-07-31 06:10:09 -0700 | [diff] [blame] | 72 | if (packets_.empty()) |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 73 | return kNoPictureId; |
Niels Möller | 520ca4e | 2018-06-04 11:14:38 +0200 | [diff] [blame] | 74 | if (packets_.front().video_header.codec == kVideoCodecVP8) { |
Philip Eliasson | d52a1a6 | 2018-09-07 13:03:55 +0000 | [diff] [blame] | 75 | return absl::get<RTPVideoHeaderVP8>( |
| 76 | packets_.front().video_header.video_type_header) |
| 77 | .pictureId; |
Niels Möller | 520ca4e | 2018-06-04 11:14:38 +0200 | [diff] [blame] | 78 | } else if (packets_.front().video_header.codec == kVideoCodecVP9) { |
philipel | 29d8846 | 2018-08-08 14:26:00 +0200 | [diff] [blame] | 79 | return absl::get<RTPVideoHeaderVP9>( |
| 80 | packets_.front().video_header.video_type_header) |
| 81 | .picture_id; |
asapersson | a9455ab | 2015-07-31 06:10:09 -0700 | [diff] [blame] | 82 | } else { |
| 83 | return kNoPictureId; |
| 84 | } |
stefan@webrtc.org | ffd28f9 | 2011-10-19 15:55:39 +0000 | [diff] [blame] | 85 | } |
| 86 | |
mikhal@webrtc.org | f5ee1dc | 2011-12-08 19:04:47 +0000 | [diff] [blame] | 87 | int VCMSessionInfo::TemporalId() const { |
asapersson | a9455ab | 2015-07-31 06:10:09 -0700 | [diff] [blame] | 88 | if (packets_.empty()) |
mikhal@webrtc.org | f5ee1dc | 2011-12-08 19:04:47 +0000 | [diff] [blame] | 89 | return kNoTemporalIdx; |
Niels Möller | 520ca4e | 2018-06-04 11:14:38 +0200 | [diff] [blame] | 90 | if (packets_.front().video_header.codec == kVideoCodecVP8) { |
Philip Eliasson | d52a1a6 | 2018-09-07 13:03:55 +0000 | [diff] [blame] | 91 | return absl::get<RTPVideoHeaderVP8>( |
| 92 | packets_.front().video_header.video_type_header) |
| 93 | .temporalIdx; |
Niels Möller | 520ca4e | 2018-06-04 11:14:38 +0200 | [diff] [blame] | 94 | } else if (packets_.front().video_header.codec == kVideoCodecVP9) { |
philipel | 29d8846 | 2018-08-08 14:26:00 +0200 | [diff] [blame] | 95 | return absl::get<RTPVideoHeaderVP9>( |
| 96 | packets_.front().video_header.video_type_header) |
| 97 | .temporal_idx; |
asapersson | a9455ab | 2015-07-31 06:10:09 -0700 | [diff] [blame] | 98 | } else { |
| 99 | return kNoTemporalIdx; |
| 100 | } |
mikhal@webrtc.org | f5ee1dc | 2011-12-08 19:04:47 +0000 | [diff] [blame] | 101 | } |
| 102 | |
henrik.lundin@webrtc.org | eda86dc | 2011-12-13 14:11:06 +0000 | [diff] [blame] | 103 | bool VCMSessionInfo::LayerSync() const { |
asapersson | a9455ab | 2015-07-31 06:10:09 -0700 | [diff] [blame] | 104 | if (packets_.empty()) |
henrik.lundin@webrtc.org | eda86dc | 2011-12-13 14:11:06 +0000 | [diff] [blame] | 105 | return false; |
Niels Möller | 520ca4e | 2018-06-04 11:14:38 +0200 | [diff] [blame] | 106 | if (packets_.front().video_header.codec == kVideoCodecVP8) { |
Philip Eliasson | d52a1a6 | 2018-09-07 13:03:55 +0000 | [diff] [blame] | 107 | return absl::get<RTPVideoHeaderVP8>( |
| 108 | packets_.front().video_header.video_type_header) |
| 109 | .layerSync; |
Niels Möller | 520ca4e | 2018-06-04 11:14:38 +0200 | [diff] [blame] | 110 | } else if (packets_.front().video_header.codec == kVideoCodecVP9) { |
philipel | 29d8846 | 2018-08-08 14:26:00 +0200 | [diff] [blame] | 111 | return absl::get<RTPVideoHeaderVP9>( |
| 112 | packets_.front().video_header.video_type_header) |
| 113 | .temporal_up_switch; |
asapersson | a9455ab | 2015-07-31 06:10:09 -0700 | [diff] [blame] | 114 | } else { |
| 115 | return false; |
| 116 | } |
henrik.lundin@webrtc.org | eda86dc | 2011-12-13 14:11:06 +0000 | [diff] [blame] | 117 | } |
| 118 | |
mikhal@webrtc.org | f5ee1dc | 2011-12-08 19:04:47 +0000 | [diff] [blame] | 119 | int VCMSessionInfo::Tl0PicId() const { |
asapersson | a9455ab | 2015-07-31 06:10:09 -0700 | [diff] [blame] | 120 | if (packets_.empty()) |
mikhal@webrtc.org | f5ee1dc | 2011-12-08 19:04:47 +0000 | [diff] [blame] | 121 | return kNoTl0PicIdx; |
Niels Möller | 520ca4e | 2018-06-04 11:14:38 +0200 | [diff] [blame] | 122 | if (packets_.front().video_header.codec == kVideoCodecVP8) { |
Philip Eliasson | d52a1a6 | 2018-09-07 13:03:55 +0000 | [diff] [blame] | 123 | return absl::get<RTPVideoHeaderVP8>( |
| 124 | packets_.front().video_header.video_type_header) |
| 125 | .tl0PicIdx; |
Niels Möller | 520ca4e | 2018-06-04 11:14:38 +0200 | [diff] [blame] | 126 | } else if (packets_.front().video_header.codec == kVideoCodecVP9) { |
philipel | 29d8846 | 2018-08-08 14:26:00 +0200 | [diff] [blame] | 127 | return absl::get<RTPVideoHeaderVP9>( |
| 128 | packets_.front().video_header.video_type_header) |
| 129 | .tl0_pic_idx; |
asapersson | a9455ab | 2015-07-31 06:10:09 -0700 | [diff] [blame] | 130 | } else { |
| 131 | return kNoTl0PicIdx; |
| 132 | } |
mikhal@webrtc.org | f5ee1dc | 2011-12-08 19:04:47 +0000 | [diff] [blame] | 133 | } |
| 134 | |
stefan | a669a3a | 2016-10-06 05:04:52 -0700 | [diff] [blame] | 135 | std::vector<NaluInfo> VCMSessionInfo::GetNaluInfos() const { |
Niels Möller | 520ca4e | 2018-06-04 11:14:38 +0200 | [diff] [blame] | 136 | if (packets_.empty() || |
| 137 | packets_.front().video_header.codec != kVideoCodecH264) |
stefan | a669a3a | 2016-10-06 05:04:52 -0700 | [diff] [blame] | 138 | return std::vector<NaluInfo>(); |
| 139 | std::vector<NaluInfo> nalu_infos; |
| 140 | for (const VCMPacket& packet : packets_) { |
philipel | 7d745e5 | 2018-08-02 14:03:53 +0200 | [diff] [blame] | 141 | const auto& h264 = |
| 142 | absl::get<RTPVideoHeaderH264>(packet.video_header.video_type_header); |
| 143 | for (size_t i = 0; i < h264.nalus_length; ++i) { |
| 144 | nalu_infos.push_back(h264.nalus[i]); |
stefan | a669a3a | 2016-10-06 05:04:52 -0700 | [diff] [blame] | 145 | } |
| 146 | } |
| 147 | return nalu_infos; |
| 148 | } |
| 149 | |
asapersson | 9a4cd87 | 2015-10-23 00:27:14 -0700 | [diff] [blame] | 150 | void VCMSessionInfo::SetGofInfo(const GofInfoVP9& gof_info, size_t idx) { |
philipel | 29d8846 | 2018-08-08 14:26:00 +0200 | [diff] [blame] | 151 | if (packets_.empty()) |
asapersson | 9a4cd87 | 2015-10-23 00:27:14 -0700 | [diff] [blame] | 152 | return; |
philipel | 29d8846 | 2018-08-08 14:26:00 +0200 | [diff] [blame] | 153 | |
| 154 | auto* vp9_header = absl::get_if<RTPVideoHeaderVP9>( |
| 155 | &packets_.front().video_header.video_type_header); |
| 156 | if (!vp9_header || vp9_header->flexible_mode) |
| 157 | return; |
| 158 | |
| 159 | vp9_header->temporal_idx = gof_info.temporal_idx[idx]; |
| 160 | vp9_header->temporal_up_switch = gof_info.temporal_up_switch[idx]; |
| 161 | vp9_header->num_ref_pics = gof_info.num_ref_pics[idx]; |
asapersson | c253a1c | 2015-11-06 00:12:01 -0800 | [diff] [blame] | 162 | for (uint8_t i = 0; i < gof_info.num_ref_pics[idx]; ++i) { |
philipel | 29d8846 | 2018-08-08 14:26:00 +0200 | [diff] [blame] | 163 | vp9_header->pid_diff[i] = gof_info.pid_diff[idx][i]; |
asapersson | 9a4cd87 | 2015-10-23 00:27:14 -0700 | [diff] [blame] | 164 | } |
| 165 | } |
| 166 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 167 | void VCMSessionInfo::Reset() { |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 168 | complete_ = false; |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 169 | frame_type_ = kVideoFrameDelta; |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 170 | packets_.clear(); |
| 171 | empty_seq_num_low_ = -1; |
| 172 | empty_seq_num_high_ = -1; |
mikhal@webrtc.org | f31a47a | 2013-08-26 17:10:11 +0000 | [diff] [blame] | 173 | first_packet_seq_num_ = -1; |
| 174 | last_packet_seq_num_ = -1; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 175 | } |
| 176 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 177 | size_t VCMSessionInfo::SessionLength() const { |
| 178 | size_t length = 0; |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 179 | for (PacketIteratorConst it = packets_.begin(); it != packets_.end(); ++it) |
| 180 | length += (*it).sizeBytes; |
| 181 | return length; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 182 | } |
| 183 | |
agalusza@google.com | d818dcb | 2013-07-29 21:48:11 +0000 | [diff] [blame] | 184 | int VCMSessionInfo::NumPackets() const { |
| 185 | return packets_.size(); |
| 186 | } |
| 187 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 188 | size_t VCMSessionInfo::InsertBuffer(uint8_t* frame_buffer, |
| 189 | PacketIterator packet_it) { |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 190 | VCMPacket& packet = *packet_it; |
| 191 | PacketIterator it; |
| 192 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 193 | // Calculate the offset into the frame buffer for this packet. |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 194 | size_t offset = 0; |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 195 | for (it = packets_.begin(); it != packet_it; ++it) |
| 196 | offset += (*it).sizeBytes; |
| 197 | |
| 198 | // Set the data pointer to pointing to the start of this packet in the |
| 199 | // frame buffer. |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 200 | const uint8_t* packet_buffer = packet.dataPtr; |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 201 | packet.dataPtr = frame_buffer + offset; |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 202 | |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 203 | // We handle H.264 STAP-A packets in a special way as we need to remove the |
| 204 | // two length bytes between each NAL unit, and potentially add start codes. |
pbos | f1828e8 | 2015-07-28 08:20:59 -0700 | [diff] [blame] | 205 | // TODO(pbos): Remove H264 parsing from this step and use a fragmentation |
| 206 | // header supplied by the H264 depacketizer. |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 207 | const size_t kH264NALHeaderLengthInBytes = 1; |
| 208 | const size_t kLengthFieldLength = 2; |
philipel | 7d745e5 | 2018-08-02 14:03:53 +0200 | [diff] [blame] | 209 | const auto* h264 = |
| 210 | absl::get_if<RTPVideoHeaderH264>(&packet.video_header.video_type_header); |
| 211 | if (h264 && h264->packetization_type == kH264StapA) { |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 212 | size_t required_length = 0; |
| 213 | const uint8_t* nalu_ptr = packet_buffer + kH264NALHeaderLengthInBytes; |
| 214 | while (nalu_ptr < packet_buffer + packet.sizeBytes) { |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 215 | size_t length = BufferToUWord16(nalu_ptr); |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 216 | required_length += |
| 217 | length + (packet.insertStartCode ? kH264StartCodeLengthBytes : 0); |
| 218 | nalu_ptr += kLengthFieldLength + length; |
| 219 | } |
| 220 | ShiftSubsequentPackets(packet_it, required_length); |
| 221 | nalu_ptr = packet_buffer + kH264NALHeaderLengthInBytes; |
| 222 | uint8_t* frame_buffer_ptr = frame_buffer + offset; |
| 223 | while (nalu_ptr < packet_buffer + packet.sizeBytes) { |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 224 | size_t length = BufferToUWord16(nalu_ptr); |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 225 | nalu_ptr += kLengthFieldLength; |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 226 | frame_buffer_ptr += Insert(nalu_ptr, length, packet.insertStartCode, |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 227 | const_cast<uint8_t*>(frame_buffer_ptr)); |
| 228 | nalu_ptr += length; |
| 229 | } |
| 230 | packet.sizeBytes = required_length; |
| 231 | return packet.sizeBytes; |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 232 | } |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 233 | ShiftSubsequentPackets( |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 234 | packet_it, packet.sizeBytes + |
| 235 | (packet.insertStartCode ? kH264StartCodeLengthBytes : 0)); |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 236 | |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 237 | packet.sizeBytes = |
| 238 | Insert(packet_buffer, packet.sizeBytes, packet.insertStartCode, |
| 239 | const_cast<uint8_t*>(packet.dataPtr)); |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 240 | return packet.sizeBytes; |
| 241 | } |
| 242 | |
| 243 | size_t VCMSessionInfo::Insert(const uint8_t* buffer, |
| 244 | size_t length, |
| 245 | bool insert_start_code, |
| 246 | uint8_t* frame_buffer) { |
| 247 | if (insert_start_code) { |
| 248 | const unsigned char startCode[] = {0, 0, 0, 1}; |
| 249 | memcpy(frame_buffer, startCode, kH264StartCodeLengthBytes); |
| 250 | } |
| 251 | memcpy(frame_buffer + (insert_start_code ? kH264StartCodeLengthBytes : 0), |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 252 | buffer, length); |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 253 | length += (insert_start_code ? kH264StartCodeLengthBytes : 0); |
| 254 | |
| 255 | return length; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 256 | } |
| 257 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 258 | void VCMSessionInfo::ShiftSubsequentPackets(PacketIterator it, |
| 259 | int steps_to_shift) { |
| 260 | ++it; |
| 261 | if (it == packets_.end()) |
| 262 | return; |
pbos@webrtc.org | 7b859cc | 2013-04-02 15:54:38 +0000 | [diff] [blame] | 263 | uint8_t* first_packet_ptr = const_cast<uint8_t*>((*it).dataPtr); |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 264 | int shift_length = 0; |
| 265 | // Calculate the total move length and move the data pointers in advance. |
| 266 | for (; it != packets_.end(); ++it) { |
| 267 | shift_length += (*it).sizeBytes; |
| 268 | if ((*it).dataPtr != NULL) |
| 269 | (*it).dataPtr += steps_to_shift; |
| 270 | } |
| 271 | memmove(first_packet_ptr + steps_to_shift, first_packet_ptr, shift_length); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 272 | } |
| 273 | |
mikhal@webrtc.org | 6b9a7f8 | 2011-11-22 22:48:20 +0000 | [diff] [blame] | 274 | void VCMSessionInfo::UpdateCompleteSession() { |
mikhal@webrtc.org | f31a47a | 2013-08-26 17:10:11 +0000 | [diff] [blame] | 275 | if (HaveFirstPacket() && HaveLastPacket()) { |
mikhal@webrtc.org | 6b9a7f8 | 2011-11-22 22:48:20 +0000 | [diff] [blame] | 276 | // Do we have all the packets in this session? |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 277 | bool complete_session = true; |
| 278 | PacketIterator it = packets_.begin(); |
| 279 | PacketIterator prev_it = it; |
| 280 | ++it; |
| 281 | for (; it != packets_.end(); ++it) { |
| 282 | if (!InSequence(it, prev_it)) { |
| 283 | complete_session = false; |
mikhal@webrtc.org | 6b9a7f8 | 2011-11-22 22:48:20 +0000 | [diff] [blame] | 284 | break; |
| 285 | } |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 286 | prev_it = it; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 287 | } |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 288 | complete_ = complete_session; |
mikhal@webrtc.org | 6b9a7f8 | 2011-11-22 22:48:20 +0000 | [diff] [blame] | 289 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 290 | } |
| 291 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 292 | bool VCMSessionInfo::complete() const { |
| 293 | return complete_; |
mikhal@webrtc.org | 6b9a7f8 | 2011-11-22 22:48:20 +0000 | [diff] [blame] | 294 | } |
| 295 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 296 | // Find the end of the NAL unit which the packet pointed to by |packet_it| |
| 297 | // belongs to. Returns an iterator to the last packet of the frame if the end |
| 298 | // of the NAL unit wasn't found. |
| 299 | VCMSessionInfo::PacketIterator VCMSessionInfo::FindNaluEnd( |
| 300 | PacketIterator packet_it) const { |
| 301 | if ((*packet_it).completeNALU == kNaluEnd || |
| 302 | (*packet_it).completeNALU == kNaluComplete) { |
| 303 | return packet_it; |
| 304 | } |
| 305 | // Find the end of the NAL unit. |
| 306 | for (; packet_it != packets_.end(); ++packet_it) { |
| 307 | if (((*packet_it).completeNALU == kNaluComplete && |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 308 | (*packet_it).sizeBytes > 0) || |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 309 | // Found next NALU. |
| 310 | (*packet_it).completeNALU == kNaluStart) |
| 311 | return --packet_it; |
| 312 | if ((*packet_it).completeNALU == kNaluEnd) |
| 313 | return packet_it; |
| 314 | } |
| 315 | // The end wasn't found. |
| 316 | return --packet_it; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 317 | } |
| 318 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 319 | size_t VCMSessionInfo::DeletePacketData(PacketIterator start, |
| 320 | PacketIterator end) { |
| 321 | size_t bytes_to_delete = 0; // The number of bytes to delete. |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 322 | PacketIterator packet_after_end = end; |
| 323 | ++packet_after_end; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 324 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 325 | // Get the number of bytes to delete. |
| 326 | // Clear the size of these packets. |
| 327 | for (PacketIterator it = start; it != packet_after_end; ++it) { |
| 328 | bytes_to_delete += (*it).sizeBytes; |
| 329 | (*it).sizeBytes = 0; |
| 330 | (*it).dataPtr = NULL; |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 331 | } |
| 332 | if (bytes_to_delete > 0) |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 333 | ShiftSubsequentPackets(end, -static_cast<int>(bytes_to_delete)); |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 334 | return bytes_to_delete; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 335 | } |
| 336 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 337 | VCMSessionInfo::PacketIterator VCMSessionInfo::FindNextPartitionBeginning( |
mikhal@webrtc.org | 2b810bf | 2013-09-03 19:09:49 +0000 | [diff] [blame] | 338 | PacketIterator it) const { |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 339 | while (it != packets_.end()) { |
Philip Eliasson | d52a1a6 | 2018-09-07 13:03:55 +0000 | [diff] [blame] | 340 | if (absl::get<RTPVideoHeaderVP8>((*it).video_header.video_type_header) |
| 341 | .beginningOfPartition) { |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 342 | return it; |
stefan@webrtc.org | 4c059d8 | 2011-10-13 07:35:37 +0000 | [diff] [blame] | 343 | } |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 344 | ++it; |
stefan@webrtc.org | c3d8910 | 2011-09-08 06:50:28 +0000 | [diff] [blame] | 345 | } |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 346 | return it; |
stefan@webrtc.org | c3d8910 | 2011-09-08 06:50:28 +0000 | [diff] [blame] | 347 | } |
| 348 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 349 | VCMSessionInfo::PacketIterator VCMSessionInfo::FindPartitionEnd( |
| 350 | PacketIterator it) const { |
| 351 | assert((*it).codec == kVideoCodecVP8); |
| 352 | PacketIterator prev_it = it; |
Philip Eliasson | d52a1a6 | 2018-09-07 13:03:55 +0000 | [diff] [blame] | 353 | const int partition_id = |
| 354 | absl::get<RTPVideoHeaderVP8>((*it).video_header.video_type_header) |
| 355 | .partitionId; |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 356 | while (it != packets_.end()) { |
Philip Eliasson | d52a1a6 | 2018-09-07 13:03:55 +0000 | [diff] [blame] | 357 | bool beginning = |
| 358 | absl::get<RTPVideoHeaderVP8>((*it).video_header.video_type_header) |
| 359 | .beginningOfPartition; |
| 360 | int current_partition_id = |
| 361 | absl::get<RTPVideoHeaderVP8>((*it).video_header.video_type_header) |
| 362 | .partitionId; |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 363 | bool packet_loss_found = (!beginning && !InSequence(it, prev_it)); |
| 364 | if (packet_loss_found || |
| 365 | (beginning && current_partition_id != partition_id)) { |
stefan@webrtc.org | c3d8910 | 2011-09-08 06:50:28 +0000 | [diff] [blame] | 366 | // Missing packet, the previous packet was the last in sequence. |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 367 | return prev_it; |
stefan@webrtc.org | c3d8910 | 2011-09-08 06:50:28 +0000 | [diff] [blame] | 368 | } |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 369 | prev_it = it; |
| 370 | ++it; |
stefan@webrtc.org | c3d8910 | 2011-09-08 06:50:28 +0000 | [diff] [blame] | 371 | } |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 372 | return prev_it; |
stefan@webrtc.org | c3d8910 | 2011-09-08 06:50:28 +0000 | [diff] [blame] | 373 | } |
| 374 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 375 | bool VCMSessionInfo::InSequence(const PacketIterator& packet_it, |
| 376 | const PacketIterator& prev_packet_it) { |
| 377 | // If the two iterators are pointing to the same packet they are considered |
| 378 | // to be in sequence. |
| 379 | return (packet_it == prev_packet_it || |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 380 | (static_cast<uint16_t>((*prev_packet_it).seqNum + 1) == |
| 381 | (*packet_it).seqNum)); |
stefan@webrtc.org | c3d8910 | 2011-09-08 06:50:28 +0000 | [diff] [blame] | 382 | } |
| 383 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 384 | size_t VCMSessionInfo::MakeDecodable() { |
| 385 | size_t return_length = 0; |
stefan@webrtc.org | 4ce0ba0 | 2012-02-28 12:09:09 +0000 | [diff] [blame] | 386 | if (packets_.empty()) { |
| 387 | return 0; |
| 388 | } |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 389 | PacketIterator it = packets_.begin(); |
| 390 | // Make sure we remove the first NAL unit if it's not decodable. |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 391 | if ((*it).completeNALU == kNaluIncomplete || (*it).completeNALU == kNaluEnd) { |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 392 | PacketIterator nalu_end = FindNaluEnd(it); |
| 393 | return_length += DeletePacketData(it, nalu_end); |
| 394 | it = nalu_end; |
| 395 | } |
| 396 | PacketIterator prev_it = it; |
| 397 | // Take care of the rest of the NAL units. |
| 398 | for (; it != packets_.end(); ++it) { |
| 399 | bool start_of_nalu = ((*it).completeNALU == kNaluStart || |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 400 | (*it).completeNALU == kNaluComplete); |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 401 | if (!start_of_nalu && !InSequence(it, prev_it)) { |
| 402 | // Found a sequence number gap due to packet loss. |
| 403 | PacketIterator nalu_end = FindNaluEnd(it); |
| 404 | return_length += DeletePacketData(it, nalu_end); |
| 405 | it = nalu_end; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 406 | } |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 407 | prev_it = it; |
| 408 | } |
| 409 | return return_length; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 410 | } |
| 411 | |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 412 | bool VCMSessionInfo::HaveFirstPacket() const { |
mikhal@webrtc.org | f31a47a | 2013-08-26 17:10:11 +0000 | [diff] [blame] | 413 | return !packets_.empty() && (first_packet_seq_num_ != -1); |
stefan@webrtc.org | 885cd13 | 2013-04-16 09:38:26 +0000 | [diff] [blame] | 414 | } |
| 415 | |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 416 | bool VCMSessionInfo::HaveLastPacket() const { |
mikhal@webrtc.org | f31a47a | 2013-08-26 17:10:11 +0000 | [diff] [blame] | 417 | return !packets_.empty() && (last_packet_seq_num_ != -1); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 418 | } |
| 419 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 420 | int VCMSessionInfo::InsertPacket(const VCMPacket& packet, |
| 421 | uint8_t* frame_buffer, |
agalusza@google.com | d818dcb | 2013-07-29 21:48:11 +0000 | [diff] [blame] | 422 | const FrameData& frame_data) { |
pbos | 22993e1 | 2015-10-19 02:39:06 -0700 | [diff] [blame] | 423 | if (packet.frameType == kEmptyFrame) { |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 424 | // Update sequence number of an empty packet. |
| 425 | // Only media packets are inserted into the packet list. |
| 426 | InformOfEmptyPacket(packet.seqNum); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 427 | return 0; |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 428 | } |
| 429 | |
mikhal@webrtc.org | f31a47a | 2013-08-26 17:10:11 +0000 | [diff] [blame] | 430 | if (packets_.size() == kMaxPacketsInSession) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 431 | RTC_LOG(LS_ERROR) << "Max number of packets per frame has been reached."; |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 432 | return -1; |
mikhal@webrtc.org | f31a47a | 2013-08-26 17:10:11 +0000 | [diff] [blame] | 433 | } |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 434 | |
| 435 | // Find the position of this packet in the packet list in sequence number |
| 436 | // order and insert it. Loop over the list in reverse order. |
| 437 | ReversePacketIterator rit = packets_.rbegin(); |
| 438 | for (; rit != packets_.rend(); ++rit) |
stefan@webrtc.org | 7bc465b | 2013-04-11 17:48:02 +0000 | [diff] [blame] | 439 | if (LatestSequenceNumber(packet.seqNum, (*rit).seqNum) == packet.seqNum) |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 440 | break; |
| 441 | |
| 442 | // Check for duplicate packets. |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 443 | if (rit != packets_.rend() && (*rit).seqNum == packet.seqNum && |
| 444 | (*rit).sizeBytes > 0) |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 445 | return -2; |
| 446 | |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 447 | if (packet.codec == kVideoCodecH264) { |
mikhal@webrtc.org | f31a47a | 2013-08-26 17:10:11 +0000 | [diff] [blame] | 448 | frame_type_ = packet.frameType; |
johan | 0d1b2b6 | 2017-01-10 04:21:35 -0800 | [diff] [blame] | 449 | if (packet.is_first_packet_in_frame && |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 450 | (first_packet_seq_num_ == -1 || |
| 451 | IsNewerSequenceNumber(first_packet_seq_num_, packet.seqNum))) { |
| 452 | first_packet_seq_num_ = packet.seqNum; |
| 453 | } |
| 454 | if (packet.markerBit && |
| 455 | (last_packet_seq_num_ == -1 || |
| 456 | IsNewerSequenceNumber(packet.seqNum, last_packet_seq_num_))) { |
| 457 | last_packet_seq_num_ = packet.seqNum; |
| 458 | } |
| 459 | } else { |
| 460 | // Only insert media packets between first and last packets (when |
| 461 | // available). |
| 462 | // Placing check here, as to properly account for duplicate packets. |
| 463 | // Check if this is first packet (only valid for some codecs) |
| 464 | // Should only be set for one packet per session. |
johan | 0d1b2b6 | 2017-01-10 04:21:35 -0800 | [diff] [blame] | 465 | if (packet.is_first_packet_in_frame && first_packet_seq_num_ == -1) { |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 466 | // The first packet in a frame signals the frame type. |
| 467 | frame_type_ = packet.frameType; |
| 468 | // Store the sequence number for the first packet. |
| 469 | first_packet_seq_num_ = static_cast<int>(packet.seqNum); |
| 470 | } else if (first_packet_seq_num_ != -1 && |
pbos@webrtc.org | 4f16c87 | 2014-11-24 09:06:48 +0000 | [diff] [blame] | 471 | IsNewerSequenceNumber(first_packet_seq_num_, packet.seqNum)) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 472 | RTC_LOG(LS_WARNING) |
| 473 | << "Received packet with a sequence number which is out " |
| 474 | "of frame boundaries"; |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 475 | return -3; |
pbos | 22993e1 | 2015-10-19 02:39:06 -0700 | [diff] [blame] | 476 | } else if (frame_type_ == kEmptyFrame && packet.frameType != kEmptyFrame) { |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 477 | // Update the frame type with the type of the first media packet. |
| 478 | // TODO(mikhal): Can this trigger? |
| 479 | frame_type_ = packet.frameType; |
| 480 | } |
mikhal@webrtc.org | f31a47a | 2013-08-26 17:10:11 +0000 | [diff] [blame] | 481 | |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 482 | // Track the marker bit, should only be set for one packet per session. |
| 483 | if (packet.markerBit && last_packet_seq_num_ == -1) { |
| 484 | last_packet_seq_num_ = static_cast<int>(packet.seqNum); |
| 485 | } else if (last_packet_seq_num_ != -1 && |
| 486 | IsNewerSequenceNumber(packet.seqNum, last_packet_seq_num_)) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 487 | RTC_LOG(LS_WARNING) |
| 488 | << "Received packet with a sequence number which is out " |
| 489 | "of frame boundaries"; |
stefan@webrtc.org | 2ec5606 | 2014-07-31 14:59:24 +0000 | [diff] [blame] | 490 | return -3; |
| 491 | } |
mikhal@webrtc.org | f31a47a | 2013-08-26 17:10:11 +0000 | [diff] [blame] | 492 | } |
| 493 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 494 | // The insert operation invalidates the iterator |rit|. |
| 495 | PacketIterator packet_list_it = packets_.insert(rit.base(), packet); |
| 496 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 497 | size_t returnLength = InsertBuffer(frame_buffer, packet_list_it); |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 498 | UpdateCompleteSession(); |
Niels Möller | 375b346 | 2019-01-10 15:35:56 +0100 | [diff] [blame^] | 499 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 500 | return static_cast<int>(returnLength); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 501 | } |
| 502 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 503 | void VCMSessionInfo::InformOfEmptyPacket(uint16_t seq_num) { |
| 504 | // Empty packets may be FEC or filler packets. They are sequential and |
| 505 | // follow the data packets, therefore, we should only keep track of the high |
| 506 | // and low sequence numbers and may assume that the packets in between are |
| 507 | // empty packets belonging to the same frame (timestamp). |
stefan@webrtc.org | 7bc465b | 2013-04-11 17:48:02 +0000 | [diff] [blame] | 508 | if (empty_seq_num_high_ == -1) |
| 509 | empty_seq_num_high_ = seq_num; |
| 510 | else |
| 511 | empty_seq_num_high_ = LatestSequenceNumber(seq_num, empty_seq_num_high_); |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 512 | if (empty_seq_num_low_ == -1 || |
| 513 | IsNewerSequenceNumber(empty_seq_num_low_, seq_num)) |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 514 | empty_seq_num_low_ = seq_num; |
| 515 | } |
| 516 | |
stefan@webrtc.org | 076fa6e | 2011-12-13 07:54:56 +0000 | [diff] [blame] | 517 | } // namespace webrtc |