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.
|
|
|
|
|
*/
|
|
|
|
|
|
2023-03-02 11:34:53 +01:00
|
|
|
#include "modules/video_coding/deprecated/packet.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "api/rtp_headers.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
|
|
|
completeNALU(kNaluUnset),
|
|
|
|
|
insertStartCode(false),
|
2025-01-07 23:39:20 -08:00
|
|
|
video_header() {}
|
2011-09-08 06:50:28 +00:00
|
|
|
|
2019-03-06 14:09:54 +01:00
|
|
|
VCMPacket::VCMPacket(const uint8_t* ptr,
|
|
|
|
|
size_t size,
|
|
|
|
|
const RTPHeader& rtp_header,
|
|
|
|
|
const RTPVideoHeader& videoHeader,
|
2019-06-20 10:05:55 +02:00
|
|
|
int64_t ntp_time_ms,
|
2021-04-30 13:10:56 +02:00
|
|
|
Timestamp receive_time)
|
2019-03-06 14:09:54 +01:00
|
|
|
: payloadType(rtp_header.payloadType),
|
|
|
|
|
timestamp(rtp_header.timestamp),
|
|
|
|
|
ntp_time_ms_(ntp_time_ms),
|
|
|
|
|
seqNum(rtp_header.sequenceNumber),
|
2015-12-21 04:12:39 -08:00
|
|
|
dataPtr(ptr),
|
|
|
|
|
sizeBytes(size),
|
2019-03-06 14:09:54 +01:00
|
|
|
markerBit(rtp_header.markerBit),
|
2016-05-24 10:20:47 +02:00
|
|
|
timesNacked(-1),
|
2018-07-11 14:27:49 +02:00
|
|
|
completeNALU(kNaluIncomplete),
|
2019-03-06 14:09:54 +01:00
|
|
|
insertStartCode(videoHeader.codec == kVideoCodecH264 &&
|
|
|
|
|
videoHeader.is_first_packet_in_frame),
|
2019-06-20 10:05:55 +02:00
|
|
|
video_header(videoHeader),
|
2021-04-30 13:10:56 +02:00
|
|
|
packet_info(rtp_header, receive_time) {
|
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
|
|
|
|
|
|
|
|
// 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()) {
|
2024-08-29 13:00:40 +00:00
|
|
|
video_header.playout_delay = std::nullopt;
|
2016-06-08 00:24:21 -07:00
|
|
|
}
|
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
|