2016-04-20 05:25:10 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2016 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.
|
|
|
|
|
*/
|
|
|
|
|
#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_
|
|
|
|
|
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_
|
|
|
|
|
|
2017-01-02 08:42:32 -08:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2016-04-20 05:25:10 -07:00
|
|
|
#include "webrtc/common_video/rotation.h"
|
|
|
|
|
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
class AbsoluteSendTime {
|
|
|
|
|
public:
|
|
|
|
|
static constexpr RTPExtensionType kId = kRtpExtensionAbsoluteSendTime;
|
|
|
|
|
static constexpr uint8_t kValueSizeBytes = 3;
|
2016-11-09 05:46:39 -08:00
|
|
|
static constexpr const char* kUri =
|
|
|
|
|
"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time";
|
2016-10-28 07:08:58 -07:00
|
|
|
|
2016-08-26 05:42:41 -07:00
|
|
|
static bool Parse(const uint8_t* data, uint32_t* time_24bits);
|
2016-04-20 05:25:10 -07:00
|
|
|
static bool Write(uint8_t* data, int64_t time_ms);
|
2016-08-26 05:42:41 -07:00
|
|
|
|
|
|
|
|
static constexpr uint32_t MsTo24Bits(int64_t time_ms) {
|
|
|
|
|
return static_cast<uint32_t>(((time_ms << 18) + 500) / 1000) & 0x00FFFFFF;
|
|
|
|
|
}
|
2016-04-20 05:25:10 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class AudioLevel {
|
|
|
|
|
public:
|
|
|
|
|
static constexpr RTPExtensionType kId = kRtpExtensionAudioLevel;
|
|
|
|
|
static constexpr uint8_t kValueSizeBytes = 1;
|
2016-11-09 05:46:39 -08:00
|
|
|
static constexpr const char* kUri =
|
|
|
|
|
"urn:ietf:params:rtp-hdrext:ssrc-audio-level";
|
2016-10-28 07:08:58 -07:00
|
|
|
|
2016-04-20 05:25:10 -07:00
|
|
|
static bool Parse(const uint8_t* data,
|
|
|
|
|
bool* voice_activity,
|
|
|
|
|
uint8_t* audio_level);
|
|
|
|
|
static bool Write(uint8_t* data, bool voice_activity, uint8_t audio_level);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TransmissionOffset {
|
|
|
|
|
public:
|
|
|
|
|
static constexpr RTPExtensionType kId = kRtpExtensionTransmissionTimeOffset;
|
|
|
|
|
static constexpr uint8_t kValueSizeBytes = 3;
|
2016-11-09 05:46:39 -08:00
|
|
|
static constexpr const char* kUri = "urn:ietf:params:rtp-hdrext:toffset";
|
2016-10-28 07:08:58 -07:00
|
|
|
|
2016-08-03 18:27:40 +02:00
|
|
|
static bool Parse(const uint8_t* data, int32_t* rtp_time);
|
|
|
|
|
static bool Write(uint8_t* data, int32_t rtp_time);
|
2016-04-20 05:25:10 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TransportSequenceNumber {
|
|
|
|
|
public:
|
|
|
|
|
static constexpr RTPExtensionType kId = kRtpExtensionTransportSequenceNumber;
|
|
|
|
|
static constexpr uint8_t kValueSizeBytes = 2;
|
2016-11-09 05:46:39 -08:00
|
|
|
static constexpr const char* kUri =
|
|
|
|
|
"http://www.ietf.org/id/"
|
|
|
|
|
"draft-holmer-rmcat-transport-wide-cc-extensions-01";
|
2016-04-20 05:25:10 -07:00
|
|
|
static bool Parse(const uint8_t* data, uint16_t* value);
|
|
|
|
|
static bool Write(uint8_t* data, uint16_t value);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class VideoOrientation {
|
|
|
|
|
public:
|
|
|
|
|
static constexpr RTPExtensionType kId = kRtpExtensionVideoRotation;
|
|
|
|
|
static constexpr uint8_t kValueSizeBytes = 1;
|
2016-11-09 05:46:39 -08:00
|
|
|
static constexpr const char* kUri = "urn:3gpp:video-orientation";
|
2016-10-28 07:08:58 -07:00
|
|
|
|
2016-04-20 05:25:10 -07:00
|
|
|
static bool Parse(const uint8_t* data, VideoRotation* value);
|
|
|
|
|
static bool Write(uint8_t* data, VideoRotation value);
|
|
|
|
|
static bool Parse(const uint8_t* data, uint8_t* value);
|
|
|
|
|
static bool Write(uint8_t* data, uint8_t value);
|
|
|
|
|
};
|
|
|
|
|
|
2016-09-07 15:08:13 +02:00
|
|
|
class PlayoutDelayLimits {
|
|
|
|
|
public:
|
|
|
|
|
static constexpr RTPExtensionType kId = kRtpExtensionPlayoutDelay;
|
|
|
|
|
static constexpr uint8_t kValueSizeBytes = 3;
|
2016-11-09 05:46:39 -08:00
|
|
|
static constexpr const char* kUri =
|
|
|
|
|
"http://www.webrtc.org/experiments/rtp-hdrext/playout-delay";
|
2016-10-28 07:08:58 -07:00
|
|
|
|
2016-09-07 15:08:13 +02:00
|
|
|
// Playout delay in milliseconds. A playout delay limit (min or max)
|
|
|
|
|
// has 12 bits allocated. This allows a range of 0-4095 values which
|
|
|
|
|
// translates to a range of 0-40950 in milliseconds.
|
|
|
|
|
static constexpr int kGranularityMs = 10;
|
|
|
|
|
// Maximum playout delay value in milliseconds.
|
|
|
|
|
static constexpr int kMaxMs = 0xfff * kGranularityMs; // 40950.
|
|
|
|
|
|
|
|
|
|
static bool Parse(const uint8_t* data, PlayoutDelay* playout_delay);
|
|
|
|
|
static bool Write(uint8_t* data, const PlayoutDelay& playout_delay);
|
|
|
|
|
};
|
|
|
|
|
|
2016-04-20 05:25:10 -07:00
|
|
|
} // namespace webrtc
|
|
|
|
|
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_
|