diff options
Diffstat (limited to 'third_party/libwebrtc/modules/video_coding/utility')
-rw-r--r-- | third_party/libwebrtc/modules/video_coding/utility/qp_parser.cc | 16 | ||||
-rw-r--r-- | third_party/libwebrtc/modules/video_coding/utility/qp_parser.h | 18 |
2 files changed, 33 insertions, 1 deletions
diff --git a/third_party/libwebrtc/modules/video_coding/utility/qp_parser.cc b/third_party/libwebrtc/modules/video_coding/utility/qp_parser.cc index 3b9aaa377e..a531b54a7e 100644 --- a/third_party/libwebrtc/modules/video_coding/utility/qp_parser.cc +++ b/third_party/libwebrtc/modules/video_coding/utility/qp_parser.cc @@ -37,7 +37,10 @@ absl::optional<uint32_t> QpParser::Parse(VideoCodecType codec_type, } else if (codec_type == kVideoCodecH264) { return h264_parsers_[spatial_idx].Parse(frame_data, frame_size); } else if (codec_type == kVideoCodecH265) { - // TODO(bugs.webrtc.org/13485) + // H.265 bitstream parser is conditionally built. +#ifdef RTC_ENABLE_H265 + return h265_parsers_[spatial_idx].Parse(frame_data, frame_size); +#endif } return absl::nullopt; @@ -52,4 +55,15 @@ absl::optional<uint32_t> QpParser::H264QpParser::Parse( return bitstream_parser_.GetLastSliceQp(); } +#ifdef RTC_ENABLE_H265 +absl::optional<uint32_t> QpParser::H265QpParser::Parse( + const uint8_t* frame_data, + size_t frame_size) { + MutexLock lock(&mutex_); + bitstream_parser_.ParseBitstream( + rtc::ArrayView<const uint8_t>(frame_data, frame_size)); + return bitstream_parser_.GetLastSliceQp(); +} +#endif + } // namespace webrtc diff --git a/third_party/libwebrtc/modules/video_coding/utility/qp_parser.h b/third_party/libwebrtc/modules/video_coding/utility/qp_parser.h index f132ff9337..210fe02bc3 100644 --- a/third_party/libwebrtc/modules/video_coding/utility/qp_parser.h +++ b/third_party/libwebrtc/modules/video_coding/utility/qp_parser.h @@ -15,6 +15,9 @@ #include "api/video/video_codec_constants.h" #include "api/video/video_codec_type.h" #include "common_video/h264/h264_bitstream_parser.h" +#ifdef RTC_ENABLE_H265 +#include "common_video/h265/h265_bitstream_parser.h" +#endif #include "rtc_base/synchronization/mutex.h" namespace webrtc { @@ -38,6 +41,21 @@ class QpParser { }; H264QpParser h264_parsers_[kMaxSimulcastStreams]; + +#ifdef RTC_ENABLE_H265 + // A thread safe wrapper for H.265 bitstream parser. + class H265QpParser { + public: + absl::optional<uint32_t> Parse(const uint8_t* frame_data, + size_t frame_size); + + private: + Mutex mutex_; + H265BitstreamParser bitstream_parser_ RTC_GUARDED_BY(mutex_); + }; + + H265QpParser h265_parsers_[kMaxSimulcastStreams]; +#endif }; } // namespace webrtc |