#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/parsers/temporal_scalability_id_extractor.h"
#include <bitset>
#include "base/notimplemented.h"
namespace media {
TemporalScalabilityIdExtractor::TemporalScalabilityIdExtractor(VideoCodec codec,
int layer_count)
: … { … }
bool TemporalScalabilityIdExtractor::ParseChunk(base::span<const uint8_t> chunk,
uint32_t frame_id,
BitstreamMetadata& md) { … }
bool TemporalScalabilityIdExtractor::ParseH264(base::span<const uint8_t> chunk,
BitstreamMetadata& md) { … }
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
bool TemporalScalabilityIdExtractor::ParseHEVC(base::span<const uint8_t> chunk,
BitstreamMetadata& md) {
h265_->SetStream(chunk.data(), chunk.size());
H265NALU nalu;
H265NaluParser::Result result;
while ((result = h265_->AdvanceToNextNALU(&nalu)) !=
H265NaluParser::kEOStream) {
if (result == H265NaluParser::Result::kInvalidStream) {
return false;
}
if (nalu.nal_unit_type <= H265NALU::RSV_VCL31) {
md.temporal_id = nalu.nuh_temporal_id_plus1 - 1;
return true;
}
}
return true;
}
#endif
bool TemporalScalabilityIdExtractor::ParseVP9(base::span<const uint8_t> chunk,
uint32_t frame_id,
int tid_by_svc_spec,
BitstreamMetadata& md) { … }
int TemporalScalabilityIdExtractor::AssignTemporalIdBySvcSpec(
uint32_t frame_id) { … }
TemporalScalabilityIdExtractor::~TemporalScalabilityIdExtractor() = default;
TemporalScalabilityIdExtractor::BitstreamMetadata::BitstreamMetadata() =
default;
TemporalScalabilityIdExtractor::BitstreamMetadata::~BitstreamMetadata() =
default;
}