Added is_last_packet_in_frame to match is_first_packet_in_frame.
Today we use |is_first_packet_in_frame| to know when a frame begins and the
|markerBit| to know when it ends, but the markerbit does not actually mark the
end of a frame, it marks the end of a picture.
Bug: webrtc:9361
Change-Id: Icc70e6075590cdc31e875a4eb9d489868adbb67c
Reviewed-on: https://webrtc-review.googlesource.com/100160
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24722}
diff --git a/modules/video_coding/frame_object.cc b/modules/video_coding/frame_object.cc
index 4f7724d..32b0cc1 100644
--- a/modules/video_coding/frame_object.cc
+++ b/modules/video_coding/frame_object.cc
@@ -72,7 +72,7 @@
VCMPacket* last_packet = packet_buffer_->GetPacket(last_seq_num);
RTC_CHECK(last_packet);
- RTC_CHECK(last_packet->markerBit);
+ RTC_CHECK(last_packet->is_last_packet_in_frame);
// http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/
// ts_126114v120700p.pdf Section 7.4.5.
// The MTSI client shall add the payload bytes as defined in this clause
diff --git a/modules/video_coding/packet.cc b/modules/video_coding/packet.cc
index 691ec62..dea72cb 100644
--- a/modules/video_coding/packet.cc
+++ b/modules/video_coding/packet.cc
@@ -28,6 +28,7 @@
frameType(kEmptyFrame),
codec(kVideoCodecGeneric),
is_first_packet_in_frame(false),
+ is_last_packet_in_frame(false),
completeNALU(kNaluUnset),
insertStartCode(false),
width(0),
@@ -52,6 +53,7 @@
codec(rtpHeader.video_header().codec),
is_first_packet_in_frame(
rtpHeader.video_header().is_first_packet_in_frame),
+ is_last_packet_in_frame(rtpHeader.video_header().is_last_packet_in_frame),
completeNALU(kNaluIncomplete),
insertStartCode(rtpHeader.video_header().codec == kVideoCodecH264 &&
rtpHeader.video_header().is_first_packet_in_frame),
diff --git a/modules/video_coding/packet.h b/modules/video_coding/packet.h
index 80a39ca..09ab983 100644
--- a/modules/video_coding/packet.h
+++ b/modules/video_coding/packet.h
@@ -36,6 +36,7 @@
VideoCodecType codec;
bool is_first_packet_in_frame;
+ bool is_last_packet_in_frame;
VCMNaluCompleteness completeNALU; // Default is kNaluIncomplete.
bool insertStartCode; // True if a start code should be inserted before this
// packet.
diff --git a/modules/video_coding/packet_buffer.cc b/modules/video_coding/packet_buffer.cc
index e1172b3..fe93fb3 100644
--- a/modules/video_coding/packet_buffer.cc
+++ b/modules/video_coding/packet_buffer.cc
@@ -107,7 +107,7 @@
}
sequence_buffer_[index].frame_begin = packet->is_first_packet_in_frame;
- sequence_buffer_[index].frame_end = packet->markerBit;
+ sequence_buffer_[index].frame_end = packet->is_last_packet_in_frame;
sequence_buffer_[index].seq_num = packet->seqNum;
sequence_buffer_[index].continuous = false;
sequence_buffer_[index].frame_created = false;
diff --git a/modules/video_coding/rtp_frame_reference_finder_unittest.cc b/modules/video_coding/rtp_frame_reference_finder_unittest.cc
index 63c94ed..50a8779 100644
--- a/modules/video_coding/rtp_frame_reference_finder_unittest.cc
+++ b/modules/video_coding/rtp_frame_reference_finder_unittest.cc
@@ -88,7 +88,7 @@
ref_packet_buffer_->InsertPacket(&packet);
packet.seqNum = seq_num_end;
- packet.markerBit = true;
+ packet.is_last_packet_in_frame = true;
ref_packet_buffer_->InsertPacket(&packet);
std::unique_ptr<RtpFrameObject> frame(new RtpFrameObject(
@@ -106,7 +106,7 @@
VCMPacket packet;
packet.codec = kVideoCodecVP8;
packet.seqNum = seq_num_start;
- packet.markerBit = (seq_num_start == seq_num_end);
+ packet.is_last_packet_in_frame = (seq_num_start == seq_num_end);
packet.frameType = keyframe ? kVideoFrameKey : kVideoFrameDelta;
auto& vp8_header =
packet.video_header.video_type_header.emplace<RTPVideoHeaderVP8>();
@@ -118,7 +118,7 @@
if (seq_num_start != seq_num_end) {
packet.seqNum = seq_num_end;
- packet.markerBit = true;
+ packet.is_last_packet_in_frame = true;
ref_packet_buffer_->InsertPacket(&packet);
}
@@ -142,7 +142,7 @@
packet.timestamp = pid;
packet.codec = kVideoCodecVP9;
packet.seqNum = seq_num_start;
- packet.markerBit = (seq_num_start == seq_num_end);
+ packet.is_last_packet_in_frame = (seq_num_start == seq_num_end);
packet.frameType = keyframe ? kVideoFrameKey : kVideoFrameDelta;
vp9_header.flexible_mode = false;
vp9_header.picture_id = pid % (1 << 15);
@@ -157,7 +157,7 @@
ref_packet_buffer_->InsertPacket(&packet);
if (seq_num_start != seq_num_end) {
- packet.markerBit = true;
+ packet.is_last_packet_in_frame = true;
vp9_header.ss_data_available = false;
packet.seqNum = seq_num_end;
ref_packet_buffer_->InsertPacket(&packet);
@@ -182,7 +182,7 @@
packet.timestamp = pid;
packet.codec = kVideoCodecVP9;
packet.seqNum = seq_num_start;
- packet.markerBit = (seq_num_start == seq_num_end);
+ packet.is_last_packet_in_frame = (seq_num_start == seq_num_end);
packet.frameType = keyframe ? kVideoFrameKey : kVideoFrameDelta;
vp9_header.inter_layer_predicted = inter;
vp9_header.flexible_mode = true;
@@ -197,7 +197,7 @@
if (seq_num_start != seq_num_end) {
packet.seqNum = seq_num_end;
- packet.markerBit = true;
+ packet.is_last_packet_in_frame = true;
ref_packet_buffer_->InsertPacket(&packet);
}
diff --git a/modules/video_coding/video_packet_buffer_unittest.cc b/modules/video_coding/video_packet_buffer_unittest.cc
index f588026..50f5a5c 100644
--- a/modules/video_coding/video_packet_buffer_unittest.cc
+++ b/modules/video_coding/video_packet_buffer_unittest.cc
@@ -68,7 +68,7 @@
packet.frameType =
keyframe == kKeyFrame ? kVideoFrameKey : kVideoFrameDelta;
packet.is_first_packet_in_frame = first == kFirst;
- packet.markerBit = last == kLast;
+ packet.is_last_packet_in_frame = last == kLast;
packet.sizeBytes = data_size;
packet.dataPtr = data;
@@ -157,7 +157,7 @@
packet.seqNum = seq_num;
packet.frameType = kVideoFrameKey;
packet.is_first_packet_in_frame = true;
- packet.markerBit = false;
+ packet.is_last_packet_in_frame = false;
packet.timesNacked = 0;
packet_buffer_->InsertPacket(&packet);
@@ -172,7 +172,7 @@
packet_buffer_->InsertPacket(&packet);
packet.seqNum++;
- packet.markerBit = true;
+ packet.is_last_packet_in_frame = true;
packet.timesNacked = 1;
packet_buffer_->InsertPacket(&packet);
@@ -524,7 +524,7 @@
}
}
packet.is_first_packet_in_frame = first == kFirst;
- packet.markerBit = last == kLast;
+ packet.is_last_packet_in_frame = last == kLast;
packet.sizeBytes = data_size;
packet.dataPtr = data;
@@ -605,7 +605,7 @@
packet.dataPtr = data;
packet.sizeBytes = sizeof(data_data);
packet.is_first_packet_in_frame = true;
- packet.markerBit = true;
+ packet.is_last_packet_in_frame = true;
packet_buffer_->InsertPacket(&packet);
ASSERT_EQ(1UL, frames_from_callback_.size());
@@ -748,7 +748,7 @@
TEST_F(TestPacketBuffer, IncomingCodecChange) {
VCMPacket packet;
packet.is_first_packet_in_frame = true;
- packet.markerBit = true;
+ packet.is_last_packet_in_frame = true;
packet.sizeBytes = 0;
packet.dataPtr = nullptr;
@@ -783,7 +783,7 @@
packet.seqNum = 1;
packet.frameType = kVideoFrameKey;
packet.is_first_packet_in_frame = true;
- packet.markerBit = true;
+ packet.is_last_packet_in_frame = true;
auto& h264_header =
packet.video_header.video_type_header.emplace<RTPVideoHeaderH264>();
h264_header.nalus_length = kMaxNalusPerPacket;
@@ -867,7 +867,7 @@
packet_.seqNum = kSeqNum;
packet_.is_first_packet_in_frame = true;
- packet_.markerBit = true;
+ packet_.is_last_packet_in_frame = true;
}
VCMPacket packet_;