Skip to content

Commit

Permalink
[webcodecs] make queue size attributes unsigned
Browse files Browse the repository at this point in the history
Minor editorial update to reflect change in
w3c/webcodecs#440

Change-Id: Ibaae685cfb19ff4006e4c1e645b4d413be964b20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3451175
Reviewed-by: Dan Sanders <sandersd@chromium.org>
Commit-Queue: Chrome Cunningham <chcunningham@chromium.org>
Auto-Submit: Chrome Cunningham <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/main@{#969687}
  • Loading branch information
chcunningham authored and Chromium LUCI CQ committed Feb 10, 2022
1 parent 5bde0c9 commit 3b4f8f7
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
//
// Applications can minimize underflow by enqueueing decode requests until
// |decodeQueueSize| is greater than a constant.
readonly attribute long decodeQueueSize;
readonly attribute unsigned long decodeQueueSize;

// Which state the decoder is in, indicating which methods can be called.
readonly attribute CodecState state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ void AudioEncoder::ProcessEncode(Request* request) {
DCHECK_EQ(state_, V8CodecState::Enum::kConfigured);
DCHECK(media_encoder_);
DCHECK_EQ(request->type, Request::Type::kEncode);
DCHECK_GT(requested_encodes_, 0);
DCHECK_GT(requested_encodes_, 0u);

request->StartTracing();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

// The number of pending encode requests. This does not include requests
// that have been sent to the underlying codec.
readonly attribute long encodeQueueSize;
readonly attribute unsigned long encodeQueueSize;

// Enqueues a control message to configure the audio encoder for encoding
// audio data as described by config.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ DecoderTemplate<Traits>::~DecoderTemplate() {
}

template <typename Traits>
int32_t DecoderTemplate<Traits>::decodeQueueSize() {
uint32_t DecoderTemplate<Traits>::decodeQueueSize() {
return num_pending_decodes_;
}

Expand Down Expand Up @@ -370,7 +370,7 @@ bool DecoderTemplate<Traits>::ProcessDecodeRequest(Request* request) {
DCHECK_EQ(state_, V8CodecState::Enum::kConfigured);
DCHECK(!pending_request_);
DCHECK_EQ(request->type, Request::Type::kDecode);
DCHECK_GT(num_pending_decodes_, 0);
DCHECK_GT(num_pending_decodes_, 0u);

if (!decoder()) {
Shutdown(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class MODULES_EXPORT DecoderTemplate
DecoderTemplate(ScriptState*, const InitType*, ExceptionState&);
~DecoderTemplate() override;

int32_t decodeQueueSize();
uint32_t decodeQueueSize();
void configure(const ConfigType*, ExceptionState&);
void decode(const InputType*, ExceptionState&);
ScriptPromise flush(ExceptionState&);
Expand Down Expand Up @@ -190,7 +190,7 @@ class MODULES_EXPORT DecoderTemplate
Member<V8WebCodecsErrorCallback> error_cb_;

HeapDeque<Member<Request>> requests_;
int32_t num_pending_decodes_ = 0;
uint32_t num_pending_decodes_ = 0;

// Monotonic increasing generation counter for calls to ResetAlgorithm().
uint32_t reset_generation_ = 0;
Expand Down
4 changes: 2 additions & 2 deletions third_party/blink/renderer/modules/webcodecs/encoder_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MODULES_EXPORT EncoderBase
~EncoderBase() override;

// *_encoder.idl implementation.
int32_t encodeQueueSize() { return requested_encodes_; }
uint32_t encodeQueueSize() { return requested_encodes_; }

void configure(const ConfigType*, ExceptionState&);

Expand Down Expand Up @@ -147,7 +147,7 @@ class MODULES_EXPORT EncoderBase
Member<OutputCallbackType> output_callback_;
Member<V8WebCodecsErrorCallback> error_callback_;
HeapDeque<Member<Request>> requests_;
int32_t requested_encodes_ = 0;
uint32_t requested_encodes_ = 0;

// How many times reset() was called on the encoder. It's used to decide
// when a callback needs to be dismissed because reset() was called between
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
// TODO(sandersd): Consider adding a predicted output count or other
// backpressure mechanism that considers the state of the underlying codec.
// TODO(sandersd): Consider emitting an event when this number decreases.
readonly attribute long decodeQueueSize;
readonly attribute unsigned long decodeQueueSize;

// Which state the decoder is in, indicating which methods can be called.
readonly attribute CodecState state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ void VideoEncoder::ProcessEncode(Request* request) {
DCHECK_EQ(state_, V8CodecState::Enum::kConfigured);
DCHECK(media_encoder_);
DCHECK_EQ(request->type, Request::Type::kEncode);
DCHECK_GT(requested_encodes_, 0);
DCHECK_GT(requested_encodes_, 0u);

bool keyframe = request->encodeOpts->hasKeyFrameNonNull() &&
request->encodeOpts->keyFrameNonNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

// The number of pending encode requests. This does not include requests
// that have been sent to the underlying codec.
readonly attribute long encodeQueueSize;
readonly attribute unsigned long encodeQueueSize;

// Enqueues a control message to configure the video encoder for encoding
// frames as described by config.
Expand Down

0 comments on commit 3b4f8f7

Please sign in to comment.