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}
This commit is contained in:
@ -72,7 +72,7 @@ RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer,
|
||||
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ VCMPacket::VCMPacket()
|
||||
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 @@ VCMPacket::VCMPacket(const uint8_t* ptr,
|
||||
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),
|
||||
|
@ -36,6 +36,7 @@ class VCMPacket {
|
||||
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.
|
||||
|
@ -107,7 +107,7 @@ bool PacketBuffer::InsertPacket(VCMPacket* packet) {
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -88,7 +88,7 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
||||
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 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
||||
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 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
||||
|
||||
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 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
||||
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 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
||||
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 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
||||
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 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ class TestPacketBuffer : public ::testing::Test,
|
||||
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 @@ TEST_F(TestPacketBuffer, NackCount) {
|
||||
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 @@ TEST_F(TestPacketBuffer, NackCount) {
|
||||
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 @@ class TestPacketBufferH264 : public TestPacketBuffer {
|
||||
}
|
||||
}
|
||||
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 @@ TEST_P(TestPacketBufferH264Parameterized, GetBitstreamBufferPadding) {
|
||||
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, PacketTimestamps) {
|
||||
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 @@ TEST_F(TestPacketBuffer, TooManyNalusInPacket) {
|
||||
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 @@ class TestPacketBufferH264XIsKeyframe : public TestPacketBufferH264 {
|
||||
packet_.seqNum = kSeqNum;
|
||||
|
||||
packet_.is_first_packet_in_frame = true;
|
||||
packet_.markerBit = true;
|
||||
packet_.is_last_packet_in_frame = true;
|
||||
}
|
||||
|
||||
VCMPacket packet_;
|
||||
|
Reference in New Issue
Block a user