class H264Accelerator

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

Public Methods

void H264Accelerator (const H264Accelerator & )

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

H264Accelerator & operator= (const H264Accelerator & )

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

void H264Accelerator ()

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

void ~H264Accelerator ()

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

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.

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.

Status ParseEncryptedSliceHeader (const std::vector<base::span<const uint8_t>> & data, const std::vector<SubsampleEntry> & subsamples, const std::vector<uint8_t> & sps_nalu_data, const std::vector<uint8_t> & pps_nalu_data, 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. |sps_nalu_data|

and |pps_nalu_data| are the SPS and PPS NALUs respectively.

|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 113 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 107 of file ../../src/media/third_party/chromium_media/media/gpu/h264_decoder.cc

Enumerations

enum Status
Name Value
kOk 0
kFail 1
kTryAgain 2
kNotSupported 3

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 43 of file ../../src/media/third_party/chromium_media/media/gpu/h264_decoder.h