2011-07-07 08:21:25 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/video_coding/packet.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "api/rtp_headers.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/include/module_common_types.h"
|
2015-12-21 04:12:39 -08:00
|
|
|
|
2011-07-07 08:21:25 +00:00
|
|
|
namespace webrtc {
|
|
|
|
|
|
2011-09-08 06:50:28 +00:00
|
|
|
VCMPacket::VCMPacket()
|
2015-10-19 02:39:06 -07:00
|
|
|
: payloadType(0),
|
|
|
|
|
timestamp(0),
|
|
|
|
|
ntp_time_ms_(0),
|
|
|
|
|
seqNum(0),
|
|
|
|
|
dataPtr(NULL),
|
|
|
|
|
sizeBytes(0),
|
|
|
|
|
markerBit(false),
|
2016-05-24 10:20:47 +02:00
|
|
|
timesNacked(-1),
|
2015-10-19 02:39:06 -07:00
|
|
|
frameType(kEmptyFrame),
|
|
|
|
|
completeNALU(kNaluUnset),
|
|
|
|
|
insertStartCode(false),
|
2017-06-19 07:18:55 -07:00
|
|
|
video_header(),
|
|
|
|
|
receive_time_ms(0) {
|
2016-06-08 00:24:21 -07:00
|
|
|
video_header.playout_delay = {-1, -1};
|
|
|
|
|
}
|
2011-09-08 06:50:28 +00:00
|
|
|
|
2013-04-02 15:54:38 +00:00
|
|
|
VCMPacket::VCMPacket(const uint8_t* ptr,
|
Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information.
This CL was reviewed and approved in pieces in the following CLs:
https://webrtc-codereview.appspot.com/24209004/
https://webrtc-codereview.appspot.com/24229004/
https://webrtc-codereview.appspot.com/24259004/
https://webrtc-codereview.appspot.com/25109004/
https://webrtc-codereview.appspot.com/26099004/
https://webrtc-codereview.appspot.com/27069004/
https://webrtc-codereview.appspot.com/27969004/
https://webrtc-codereview.appspot.com/27989004/
https://webrtc-codereview.appspot.com/29009004/
https://webrtc-codereview.appspot.com/30929004/
https://webrtc-codereview.appspot.com/30939004/
https://webrtc-codereview.appspot.com/31999004/
Committing as TBR to the original reviewers.
BUG=chromium:81439
TEST=none
TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom
Review URL: https://webrtc-codereview.appspot.com/23129004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-11-20 22:28:14 +00:00
|
|
|
const size_t size,
|
2015-12-21 04:12:39 -08:00
|
|
|
const WebRtcRTPHeader& rtpHeader)
|
|
|
|
|
: payloadType(rtpHeader.header.payloadType),
|
|
|
|
|
timestamp(rtpHeader.header.timestamp),
|
|
|
|
|
ntp_time_ms_(rtpHeader.ntp_time_ms),
|
|
|
|
|
seqNum(rtpHeader.header.sequenceNumber),
|
|
|
|
|
dataPtr(ptr),
|
|
|
|
|
sizeBytes(size),
|
|
|
|
|
markerBit(rtpHeader.header.markerBit),
|
2016-05-24 10:20:47 +02:00
|
|
|
timesNacked(-1),
|
2015-12-21 04:12:39 -08:00
|
|
|
frameType(rtpHeader.frameType),
|
2018-07-11 14:27:49 +02:00
|
|
|
completeNALU(kNaluIncomplete),
|
|
|
|
|
insertStartCode(rtpHeader.video_header().codec == kVideoCodecH264 &&
|
|
|
|
|
rtpHeader.video_header().is_first_packet_in_frame),
|
2018-07-02 14:41:58 +02:00
|
|
|
video_header(rtpHeader.video_header()) {
|
2019-02-20 13:12:21 +01:00
|
|
|
if (is_first_packet_in_frame() && markerBit) {
|
2018-07-11 14:27:49 +02:00
|
|
|
completeNALU = kNaluComplete;
|
2019-02-20 13:12:21 +01:00
|
|
|
} else if (is_first_packet_in_frame()) {
|
2018-07-11 14:27:49 +02:00
|
|
|
completeNALU = kNaluStart;
|
|
|
|
|
} else if (markerBit) {
|
|
|
|
|
completeNALU = kNaluEnd;
|
|
|
|
|
} else {
|
|
|
|
|
completeNALU = kNaluIncomplete;
|
|
|
|
|
}
|
2016-06-08 00:24:21 -07:00
|
|
|
|
2019-02-20 13:12:21 +01:00
|
|
|
// TODO(nisse): Delete?
|
2016-06-08 00:24:21 -07:00
|
|
|
// Playout decisions are made entirely based on first packet in a frame.
|
2019-02-20 13:12:21 +01:00
|
|
|
if (!is_first_packet_in_frame()) {
|
2016-06-08 00:24:21 -07:00
|
|
|
video_header.playout_delay = {-1, -1};
|
|
|
|
|
}
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2018-10-02 13:55:47 +02:00
|
|
|
VCMPacket::~VCMPacket() = default;
|
|
|
|
|
|
2014-07-31 14:59:24 +00:00
|
|
|
} // namespace webrtc
|