Skip to content

Should the spec require copying init.data when constructing EncodedAudioChunk and EncodedVideoChunk? #127

@OllieJones

Description

@OllieJones

Sections 9.1.1 and 9.2.1 of the draft WebCodecs spec say:

  1. Assign a copy of init.data to chunk.data.

I suggest the words a copy of be removed from the spec. It seems like leaving those words in requires unnecessary copying of compressed bitstream data.

Leaving these words out would allow a client of these constructors to make the decision about copying that data. It's possible for a client to pass a .subarray() of some ArrayBuffer. If that ArrayBuffer is volatile for some reason, it should be up to the client to copy the data.

Of course, if a decoder implementation requires the compressed bitstream data to be copied, the implementation can do so. But promising to do so adds a required copying step.

How about this wording?

  1. Assign init.data to chunk.data. The client must not allow init.data to change after using this ctor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions