class H264Accelerator

Defined at line 34 of file ../../src/media/third_party/chromium_media/media/gpu/h264_decoder.h

Public Methods

scoped_refptr<H264Picture> CreateH264Picture (bool is_for_output)

Create a new H264Picture that the decoder client can use for decoding

and pass back to this accelerator for decoding or reference.

When the picture is no longer needed by decoder, it will just drop

its reference to it, and it may do so at any time.

Note that this may return nullptr if accelerator is not able to provide

any new pictures at given time. The decoder is expected to handle

this situation as normal and return from Decode() with kRanOutOfSurfaces.

void H264Accelerator (const H264Accelerator & )

Defined at line 62 of file ../../src/media/third_party/chromium_media/media/gpu/h264_decoder.h

Status SubmitFrameMetadata (const H264SPS * sps, const H264PPS * pps, const H264DPB & dpb, const H264Picture::Vector & ref_pic_listp0, const H264Picture::Vector & ref_pic_listb0, const H264Picture::Vector & ref_pic_listb1, scoped_refptr<H264Picture> pic)

Submit metadata for the current frame, providing the current |sps| and

|pps| for it, |dpb| has to contain all the pictures in DPB for current

frame, and |ref_pic_p0/b0/b1| as specified in the H264 spec. Note that

depending on the frame type, either p0, or b0 and b1 are used. |pic|

contains information about the picture for the current frame.

Note that this does not run decode in the accelerator and the decoder

is expected to follow this call with one or more SubmitSlice() calls

before calling SubmitDecode().

Returns kOk if successful, kFail if there are errors, or kTryAgain if

the accelerator needs additional data before being able to proceed.

H264Accelerator & operator= (const H264Accelerator & )

Defined at line 63 of file ../../src/media/third_party/chromium_media/media/gpu/h264_decoder.h

void H264Accelerator ()

Defined at line 106 of file ../../src/media/third_party/chromium_media/media/gpu/h264_decoder.cc

void ~H264Accelerator ()

Defined at line 108 of file ../../src/media/third_party/chromium_media/media/gpu/h264_decoder.cc

scoped_refptr<H264Picture> CreateH264PictureSecure (uint64_t secure_handle)

|secure_handle| is a reference to the corresponding secure memory when

doing secure decoding on ARM. This is invoked instead of CreateAV1Picture

when doing secure decoding on ARM. Default implementation returns

nullptr.

TODO(jkardatzke): Remove this once we move to the V4L2 flat stateless

decoder and add a field to media::CodecPicture instead.

Defined at line 110 of file ../../src/media/third_party/chromium_media/media/gpu/h264_decoder.cc

void ProcessSPS (const H264SPS * sps, base::span<const uint8_t> sps_nalu_data)

Provides the raw NALU data for an SPS. The |sps| passed to

SubmitFrameMetadata() is always the most recent SPS passed to

ProcessSPS() with the same |seq_parameter_set_id|.

Defined at line 115 of file ../../src/media/third_party/chromium_media/media/gpu/h264_decoder.cc

void ProcessPPS (const H264PPS * pps, base::span<const uint8_t> pps_nalu_data)

Provides the raw NALU data for a PPS. The |pps| passed to

SubmitFrameMetadata() is always the most recent PPS passed to

ProcessPPS() with the same |pic_parameter_set_id|.

Defined at line 119 of file ../../src/media/third_party/chromium_media/media/gpu/h264_decoder.cc

Status ParseEncryptedSliceHeader (const std::vector<base::span<const uint8_t>> & data, const std::vector<SubsampleEntry> & subsamples, uint64_t secure_handle, H264SliceHeader * slice_header_out)

Used for handling CENCv1 streams where the entire slice header, except

for the NALU type byte, is encrypted. |data| represents the encrypted

ranges which will include any SEI NALUs along with the encrypted slice

NALU. |subsamples| specifies what is encrypted and should have just a

single clear byte for each and the rest is encrypted. |secure_handle| is

used on ARM to store the secure buffer reference to parse the header

from. |slice_header_out| should have its fields filled in upon successful

return. Returns kOk if successful, kFail if there are errors, or

kTryAgain if the accelerator needs additional data before being able to

proceed.

Defined at line 123 of file ../../src/media/third_party/chromium_media/media/gpu/h264_decoder.cc

Status SubmitSlice (const H264PPS * pps, const H264SliceHeader * slice_hdr, const H264Picture::Vector & ref_pic_list0, const H264Picture::Vector & ref_pic_list1, scoped_refptr<H264Picture> pic, const uint8_t * data, size_t size, const std::vector<SubsampleEntry> & subsamples)

Submit one slice for the current frame, passing the current |pps| and

|pic| (same as in SubmitFrameMetadata()), the parsed header for the

current slice in |slice_hdr|, and the reordered |ref_pic_listX|,

as per H264 spec.

|data| pointing to the full slice (including the unparsed header) of

|size| in bytes.

|subsamples| specifies which part of the slice data is encrypted.

This must be called one or more times per frame, before SubmitDecode().

Note that |data| does not have to remain valid after this call returns.

Returns kOk if successful, kFail if there are errors, or kTryAgain if

the accelerator needs additional data before being able to proceed.

Status SubmitDecode (scoped_refptr<H264Picture> pic)

Execute the decode in hardware for |pic|, using all the slices and

metadata submitted via SubmitFrameMetadata() and SubmitSlice() since

the previous call to SubmitDecode().

Returns kOk if successful, kFail if there are errors, or kTryAgain if

the accelerator needs additional data before being able to proceed.

bool OutputPicture (scoped_refptr<H264Picture> pic)

Schedule output (display) of |pic|. Note that returning from this

method does not mean that |pic| has already been outputted (displayed),

but guarantees that all pictures will be outputted in the same order

as this method was called for them. Decoder may drop its reference

to |pic| after calling this method.

Return true if successful.

void Reset ()

Reset any current state that may be cached in the accelerator, dropping

any cached parameters/slices that have not been committed yet.

Status SetStream (base::span<const uint8_t> stream, const DecryptConfig * decrypt_config)

Notifies the accelerator whenever there is a new stream to process.

|stream| is the data in annex B format, which may include SPS and PPS

NALUs when there is a configuration change. The first frame must contain

the SPS and PPS NALUs. SPS and PPS NALUs may not be encrypted.

|decrypt_config| is the config for decrypting the stream. The accelerator

should use |decrypt_config| to keep track of the parts of |stream| that

are encrypted. If kTryAgain is returned, the decoder will retry this call

later. This method has a default implementation that returns

kNotSupported.

Defined at line 132 of file ../../src/media/third_party/chromium_media/media/gpu/h264_decoder.cc

bool RequiresRefLists ()

Notifies whether or not the current platform requires reference lists.

In general, implementations don't need it.

Defined at line 140 of file ../../src/media/third_party/chromium_media/media/gpu/h264_decoder.cc

Enumerations

enum class Status
Name Value Comments
kOk 0

Operation completed successfully.

kFail 1

Operation failed.

kTryAgain 2

Operation failed because some external data is missing. Retry the same
operation later, once the data has been provided.

kNotSupported 3

Operation is not supported. Used by SetStream() to indicate that the
Accelerator can not handle this operation.

Methods may return kTryAgain if they need additional data (provided

independently) in order to proceed. Examples are things like not having

an appropriate key to decode encrypted content, or needing to wait

until hardware buffers are available. This is not considered an

unrecoverable error, but rather a pause to allow an application to

independently provide the required data. When H264Decoder::Decode()

is called again, it will attempt to resume processing of the stream

by calling the same method again.

Defined at line 44 of file ../../src/media/third_party/chromium_media/media/gpu/h264_decoder.h