You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
  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. #include "modules/video_coding/packet.h"
  11. #include "api/rtp_headers.h"
  12. namespace webrtc {
  13. VCMPacket::VCMPacket()
  14. : payloadType(0),
  15. timestamp(0),
  16. ntp_time_ms_(0),
  17. seqNum(0),
  18. dataPtr(NULL),
  19. sizeBytes(0),
  20. markerBit(false),
  21. timesNacked(-1),
  22. completeNALU(kNaluUnset),
  23. insertStartCode(false),
  24. video_header() {
  25. video_header.playout_delay = {-1, -1};
  26. }
  27. VCMPacket::VCMPacket(const uint8_t* ptr,
  28. size_t size,
  29. const RTPHeader& rtp_header,
  30. const RTPVideoHeader& videoHeader,
  31. int64_t ntp_time_ms,
  32. int64_t receive_time_ms)
  33. : payloadType(rtp_header.payloadType),
  34. timestamp(rtp_header.timestamp),
  35. ntp_time_ms_(ntp_time_ms),
  36. seqNum(rtp_header.sequenceNumber),
  37. dataPtr(ptr),
  38. sizeBytes(size),
  39. markerBit(rtp_header.markerBit),
  40. timesNacked(-1),
  41. completeNALU(kNaluIncomplete),
  42. insertStartCode(videoHeader.codec == kVideoCodecH264 &&
  43. videoHeader.is_first_packet_in_frame),
  44. video_header(videoHeader),
  45. packet_info(rtp_header, receive_time_ms) {
  46. if (is_first_packet_in_frame() && markerBit) {
  47. completeNALU = kNaluComplete;
  48. } else if (is_first_packet_in_frame()) {
  49. completeNALU = kNaluStart;
  50. } else if (markerBit) {
  51. completeNALU = kNaluEnd;
  52. } else {
  53. completeNALU = kNaluIncomplete;
  54. }
  55. // TODO(nisse): Delete?
  56. // Playout decisions are made entirely based on first packet in a frame.
  57. if (!is_first_packet_in_frame()) {
  58. video_header.playout_delay = {-1, -1};
  59. }
  60. }
  61. VCMPacket::~VCMPacket() = default;
  62. } // namespace webrtc