Cast sequence number in RtpFrameObject.

BUG=webrtc:7700

Review-Url: https://codereview.webrtc.org/2902743002
Cr-Commit-Position: refs/heads/master@{#18237}
This commit is contained in:
philipel
2017-05-23 08:19:11 -07:00
committed by Commit bot
parent 916170ae46
commit 7d79e63a48
2 changed files with 24 additions and 4 deletions

View File

@ -35,7 +35,7 @@ RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer,
received_time_(received_time),
times_nacked_(times_nacked) {
VCMPacket* first_packet = packet_buffer_->GetPacket(first_seq_num);
RTC_DCHECK(first_packet);
RTC_CHECK(first_packet);
// RtpFrameObject members
frame_type_ = first_packet->frameType;
@ -74,10 +74,11 @@ RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer,
_frameType = kVideoFrameDelta;
frame_type_ = kVideoFrameDelta;
for (uint16_t seq_num = first_seq_num;
seq_num != last_seq_num + 1 && _frameType == kVideoFrameDelta;
seq_num != static_cast<uint16_t>(last_seq_num + 1) &&
_frameType == kVideoFrameDelta;
++seq_num) {
VCMPacket* packet = packet_buffer_->GetPacket(seq_num);
RTC_DCHECK(packet);
RTC_CHECK(packet);
const RTPVideoHeaderH264& header = packet->video_header.codecHeader.H264;
for (size_t i = 0; i < header.nalus_length; ++i) {
if (header.nalus[i].type == H264::NaluType::kIdr) {
@ -100,7 +101,7 @@ RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer,
timestamp = first_packet->timestamp;
VCMPacket* last_packet = packet_buffer_->GetPacket(last_seq_num);
RTC_DCHECK(last_packet && last_packet->markerBit);
RTC_CHECK(last_packet && last_packet->markerBit);
// 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

View File

@ -502,6 +502,25 @@ TEST_F(TestPacketBuffer, OneH264FrameFillBuffer) {
CheckFrame(0);
}
TEST_F(TestPacketBuffer, OneH264FrameMaxSeqNum) {
VCMPacket packet;
packet.seqNum = 65534;
packet.codec = kVideoCodecH264;
packet.dataPtr = nullptr;
packet.sizeBytes = 0;
packet.is_first_packet_in_frame = true;
packet.markerBit = false;
packet_buffer_->InsertPacket(&packet);
packet.is_first_packet_in_frame = false;
packet.seqNum = 65535;
packet.markerBit = true;
packet_buffer_->InsertPacket(&packet);
EXPECT_EQ(1UL, frames_from_callback_.size());
CheckFrame(65534);
}
TEST_F(TestPacketBuffer, PacketTimestamps) {
rtc::Optional<int64_t> packet_ms;
rtc::Optional<int64_t> packet_keyframe_ms;