mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-18 16:17:50 +01:00

In order to eliminate the WebRTC Subtree mirror in Chromium, WebRTC is moving the content of the src/webrtc directory up to the src/ directory. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true TBR=tommi@webrtc.org Bug: chromium:611808 Change-Id: Iac59c5b51b950f174119565bac87955a7994bc38 Reviewed-on: https://webrtc-review.googlesource.com/1560 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Henrik Kjellander <kjellander@webrtc.org> Cr-Commit-Position: refs/heads/master@{#19845}
82 lines
3 KiB
C++
82 lines
3 KiB
C++
/*
|
|
* Copyright (c) 2012 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.
|
|
*/
|
|
|
|
// This file contains codec dependent definitions that are needed in
|
|
// order to compile the WebRTC codebase, even if this codec is not used.
|
|
|
|
#ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_GLOBALS_H_
|
|
#define WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_GLOBALS_H_
|
|
|
|
namespace webrtc {
|
|
|
|
// The packetization types that we support: single, aggregated, and fragmented.
|
|
enum H264PacketizationTypes {
|
|
kH264SingleNalu, // This packet contains a single NAL unit.
|
|
kH264StapA, // This packet contains STAP-A (single time
|
|
// aggregation) packets. If this packet has an
|
|
// associated NAL unit type, it'll be for the
|
|
// first such aggregated packet.
|
|
kH264FuA, // This packet contains a FU-A (fragmentation
|
|
// unit) packet, meaning it is a part of a frame
|
|
// that was too large to fit into a single packet.
|
|
};
|
|
|
|
// Packetization modes are defined in RFC 6184 section 6
|
|
// Due to the structure containing this being initialized with zeroes
|
|
// in some places, and mode 1 being default, mode 1 needs to have the value
|
|
// zero. https://crbug.com/webrtc/6803
|
|
enum class H264PacketizationMode {
|
|
NonInterleaved = 0, // Mode 1 - STAP-A, FU-A is allowed
|
|
SingleNalUnit // Mode 0 - only single NALU allowed
|
|
};
|
|
|
|
// This function is declared inline because it is not clear which
|
|
// .cc file it should belong to.
|
|
// TODO(hta): Refactor. https://bugs.webrtc.org/6842
|
|
inline std::ostream& operator<<(std::ostream& stream,
|
|
H264PacketizationMode mode) {
|
|
switch (mode) {
|
|
case H264PacketizationMode::NonInterleaved:
|
|
stream << "NonInterleaved";
|
|
break;
|
|
case H264PacketizationMode::SingleNalUnit:
|
|
stream << "SingleNalUnit";
|
|
break;
|
|
}
|
|
return stream;
|
|
}
|
|
|
|
struct NaluInfo {
|
|
uint8_t type;
|
|
int sps_id;
|
|
int pps_id;
|
|
};
|
|
|
|
const size_t kMaxNalusPerPacket = 10;
|
|
|
|
struct RTPVideoHeaderH264 {
|
|
// The NAL unit type. If this is a header for a
|
|
// fragmented packet, it's the NAL unit type of
|
|
// the original data. If this is the header for an
|
|
// aggregated packet, it's the NAL unit type of
|
|
// the first NAL unit in the packet.
|
|
uint8_t nalu_type;
|
|
// The packetization type of this buffer - single, aggregated or fragmented.
|
|
H264PacketizationTypes packetization_type;
|
|
NaluInfo nalus[kMaxNalusPerPacket];
|
|
size_t nalus_length;
|
|
// The packetization mode of this transport. Packetization mode
|
|
// determines which packetization types are allowed when packetizing.
|
|
H264PacketizationMode packetization_mode;
|
|
};
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_GLOBALS_H_
|