OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 if (LatestSequenceNumber(packet.seqNum, (*rit).seqNum) == packet.seqNum) | 448 if (LatestSequenceNumber(packet.seqNum, (*rit).seqNum) == packet.seqNum) |
449 break; | 449 break; |
450 | 450 |
451 // Check for duplicate packets. | 451 // Check for duplicate packets. |
452 if (rit != packets_.rend() && (*rit).seqNum == packet.seqNum && | 452 if (rit != packets_.rend() && (*rit).seqNum == packet.seqNum && |
453 (*rit).sizeBytes > 0) | 453 (*rit).sizeBytes > 0) |
454 return -2; | 454 return -2; |
455 | 455 |
456 if (packet.codec == kVideoCodecH264) { | 456 if (packet.codec == kVideoCodecH264) { |
457 frame_type_ = packet.frameType; | 457 frame_type_ = packet.frameType; |
458 if (packet.isFirstPacket && | 458 if (packet.is_first_packet_in_frame && |
459 (first_packet_seq_num_ == -1 || | 459 (first_packet_seq_num_ == -1 || |
460 IsNewerSequenceNumber(first_packet_seq_num_, packet.seqNum))) { | 460 IsNewerSequenceNumber(first_packet_seq_num_, packet.seqNum))) { |
461 first_packet_seq_num_ = packet.seqNum; | 461 first_packet_seq_num_ = packet.seqNum; |
462 } | 462 } |
463 if (packet.markerBit && | 463 if (packet.markerBit && |
464 (last_packet_seq_num_ == -1 || | 464 (last_packet_seq_num_ == -1 || |
465 IsNewerSequenceNumber(packet.seqNum, last_packet_seq_num_))) { | 465 IsNewerSequenceNumber(packet.seqNum, last_packet_seq_num_))) { |
466 last_packet_seq_num_ = packet.seqNum; | 466 last_packet_seq_num_ = packet.seqNum; |
467 } | 467 } |
468 } else { | 468 } else { |
469 // Only insert media packets between first and last packets (when | 469 // Only insert media packets between first and last packets (when |
470 // available). | 470 // available). |
471 // Placing check here, as to properly account for duplicate packets. | 471 // Placing check here, as to properly account for duplicate packets. |
472 // Check if this is first packet (only valid for some codecs) | 472 // Check if this is first packet (only valid for some codecs) |
473 // Should only be set for one packet per session. | 473 // Should only be set for one packet per session. |
474 if (packet.isFirstPacket && first_packet_seq_num_ == -1) { | 474 if (packet.is_first_packet_in_frame && first_packet_seq_num_ == -1) { |
475 // The first packet in a frame signals the frame type. | 475 // The first packet in a frame signals the frame type. |
476 frame_type_ = packet.frameType; | 476 frame_type_ = packet.frameType; |
477 // Store the sequence number for the first packet. | 477 // Store the sequence number for the first packet. |
478 first_packet_seq_num_ = static_cast<int>(packet.seqNum); | 478 first_packet_seq_num_ = static_cast<int>(packet.seqNum); |
479 } else if (first_packet_seq_num_ != -1 && | 479 } else if (first_packet_seq_num_ != -1 && |
480 IsNewerSequenceNumber(first_packet_seq_num_, packet.seqNum)) { | 480 IsNewerSequenceNumber(first_packet_seq_num_, packet.seqNum)) { |
481 LOG(LS_WARNING) << "Received packet with a sequence number which is out " | 481 LOG(LS_WARNING) << "Received packet with a sequence number which is out " |
482 "of frame boundaries"; | 482 "of frame boundaries"; |
483 return -3; | 483 return -3; |
484 } else if (frame_type_ == kEmptyFrame && packet.frameType != kEmptyFrame) { | 484 } else if (frame_type_ == kEmptyFrame && packet.frameType != kEmptyFrame) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 if (empty_seq_num_high_ == -1) | 518 if (empty_seq_num_high_ == -1) |
519 empty_seq_num_high_ = seq_num; | 519 empty_seq_num_high_ = seq_num; |
520 else | 520 else |
521 empty_seq_num_high_ = LatestSequenceNumber(seq_num, empty_seq_num_high_); | 521 empty_seq_num_high_ = LatestSequenceNumber(seq_num, empty_seq_num_high_); |
522 if (empty_seq_num_low_ == -1 || | 522 if (empty_seq_num_low_ == -1 || |
523 IsNewerSequenceNumber(empty_seq_num_low_, seq_num)) | 523 IsNewerSequenceNumber(empty_seq_num_low_, seq_num)) |
524 empty_seq_num_low_ = seq_num; | 524 empty_seq_num_low_ = seq_num; |
525 } | 525 } |
526 | 526 |
527 } // namespace webrtc | 527 } // namespace webrtc |
OLD | NEW |