forked from webrtc-sdk/webrtc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update M83 code to work with owt-sdk (webrtc-sdk#68)
* Add HEVC support for iOS/Android * Some changes for building with OWT * Enable openssl * Add create_peerconnection_factory to WebRTC.framework. (webrtc-sdk#46) * Set kVTCompressionPropertyKey_RealTime to true. (webrtc-sdk#51) * H265 packetization_mode setting fix (webrtc-sdk#53) * add H.265 QP parsing logic (webrtc-sdk#47) * Fix linux build error. (webrtc-sdk#54) * Add h264 prefix NAL parser implmentation for enabling frame-marking for h.264 (webrtc-sdk#58) * Make hevc rtp depacketizer/tracker conforming to h.264 design Co-authored-by: jianjunz <jianjun.zhu@intel.com> Co-authored-by: Cyril Lashkevich <notorca@gmail.com> Co-authored-by: Piasy <xz4215@gmail.com> Co-authored-by: ShiJinCheng <874042641@qq.com>
- Loading branch information
1 parent
b15faaa
commit 0abff7c
Showing
85 changed files
with
5,286 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
#include "common_video/h264/prefix_parser.h" | ||
|
||
#include <cstdint> | ||
#include <vector> | ||
|
||
#include "common_video/h264/h264_common.h" | ||
#include "rtc_base/bit_buffer.h" | ||
|
||
namespace { | ||
typedef absl::optional<webrtc::PrefixParser::PrefixState> OptionalPrefix; | ||
|
||
#define RETURN_EMPTY_ON_FAIL(x) \ | ||
if (!(x)) { \ | ||
return OptionalPrefix(); \ | ||
} | ||
} // namespace | ||
|
||
namespace webrtc { | ||
|
||
PrefixParser::PrefixState::PrefixState() = default; | ||
PrefixParser::PrefixState::PrefixState(const PrefixState&) = default; | ||
PrefixParser::PrefixState::~PrefixState() = default; | ||
|
||
// General note: this is based off the 02/2016 version of the H.264 standard. | ||
// You can find it on this page: | ||
// http://www.itu.int/rec/T-REC-H.264 | ||
|
||
// Unpack RBSP and parse SVC extension state from the supplied buffer. | ||
absl::optional<PrefixParser::PrefixState> PrefixParser::ParsePrefix( | ||
const uint8_t* data, | ||
size_t length) { | ||
std::vector<uint8_t> unpacked_buffer = H264::ParseRbsp(data, length); | ||
rtc::BitBuffer bit_buffer(unpacked_buffer.data(), unpacked_buffer.size()); | ||
return ParsePrefixUpToSvcExtension(&bit_buffer); | ||
} | ||
|
||
absl::optional<PrefixParser::PrefixState> PrefixParser::ParsePrefixUpToSvcExtension( | ||
rtc::BitBuffer* buffer) { | ||
// Now, we need to use a bit buffer to parse through the actual SVC extension | ||
// format. See Section 7.3.1 ("NAL unit syntax") and 7.3.1.1 ("NAL unit header | ||
// SVC extension syntax") of the H.264 standard for a complete description. | ||
|
||
PrefixState svc_extension; | ||
|
||
uint32_t svc_extension_flag = 0; | ||
// Make sure the svc_extension_flag is on. | ||
RETURN_EMPTY_ON_FAIL(buffer->ReadBits(&svc_extension_flag, 1)); | ||
if (!svc_extension_flag) | ||
return OptionalPrefix(); | ||
|
||
// idr_flag: u(1) | ||
RETURN_EMPTY_ON_FAIL(buffer->ReadBits(&svc_extension.idr_flag, 1)); | ||
// priority_id: u(6) | ||
RETURN_EMPTY_ON_FAIL(buffer->ReadBits(&svc_extension.priority_id, 6)); | ||
// no_inter_layer_pred_flag: u(1) | ||
RETURN_EMPTY_ON_FAIL( | ||
buffer->ReadBits(&svc_extension.no_inter_layer_pred_flag, 1)); | ||
// dependency_id: u(3) | ||
RETURN_EMPTY_ON_FAIL(buffer->ReadBits(&svc_extension.dependency_id, 3)); | ||
// quality_id: u(4) | ||
RETURN_EMPTY_ON_FAIL(buffer->ReadBits(&svc_extension.quality_id, 4)); | ||
// temporal_id: u(3) | ||
RETURN_EMPTY_ON_FAIL(buffer->ReadBits(&svc_extension.temporal_id, 3)); | ||
// use_ref_base_pic_flag: u(1) | ||
RETURN_EMPTY_ON_FAIL( | ||
buffer->ReadBits(&svc_extension.use_ref_base_pic_flag, 1)); | ||
// discardable_flag: u(1) | ||
RETURN_EMPTY_ON_FAIL(buffer->ReadBits(&svc_extension.discardable_flag, 1)); | ||
// output_flag: u(1) | ||
RETURN_EMPTY_ON_FAIL(buffer->ReadBits(&svc_extension.output_flag, 1)); | ||
|
||
return OptionalPrefix(svc_extension); | ||
} | ||
|
||
} // namespace webrtc |
Oops, something went wrong.