Skip to content

Commit

Permalink
Remove webrtc::VideoDecoder::PrefersLateDecoding.
Browse files Browse the repository at this point in the history
This is just general cleanup.

The assumed behavior is late decoding, and this function is not used to make any decision (except in the deprecated jitter buffer).

Bug: webrtc:12271
Change-Id: Ifb48186d55903f068f25e44c5f73e7a724f6f456
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/200804
Commit-Queue: Philip Eliasson <[email protected]>
Reviewed-by: Sami Kalliomäki <[email protected]>
Reviewed-by: Christoffer Rodbro <[email protected]>
Reviewed-by: Erik Språng <[email protected]>
Cr-Commit-Position: refs/heads/master@{#32940}
  • Loading branch information
Philipel-WebRTC authored and Commit Bot committed Jan 11, 2021
1 parent d892e6e commit 360da05
Show file tree
Hide file tree
Showing 16 changed files with 6 additions and 52 deletions.
1 change: 1 addition & 0 deletions api/video_codecs/video_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class RTC_EXPORT VideoDecoder {
// Returns true if the decoder prefer to decode frames late.
// That is, it can not decode infinite number of frames before the decoded
// frame is consumed.
// TODO(bugs.webrtc.org/12271): Remove when downstream has been updated.
virtual bool PrefersLateDecoding() const;

virtual const char* ImplementationName() const;
Expand Down
5 changes: 0 additions & 5 deletions api/video_codecs/video_decoder_software_fallback_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class VideoDecoderSoftwareFallbackWrapper final : public VideoDecoder {
DecodedImageCallback* callback) override;

int32_t Release() override;
bool PrefersLateDecoding() const override;

const char* ImplementationName() const override;

Expand Down Expand Up @@ -262,10 +261,6 @@ int32_t VideoDecoderSoftwareFallbackWrapper::Release() {
return status;
}

bool VideoDecoderSoftwareFallbackWrapper::PrefersLateDecoding() const {
return active_decoder().PrefersLateDecoding();
}

const char* VideoDecoderSoftwareFallbackWrapper::ImplementationName() const {
return decoder_type_ == DecoderType::kFallback
? fallback_implementation_name_.c_str()
Expand Down
4 changes: 0 additions & 4 deletions modules/video_coding/decoder_database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ VCMGenericDecoder* VCMDecoderDataBase::GetDecoder(
return ptr_decoder_.get();
}

bool VCMDecoderDataBase::PrefersLateDecoding() const {
return ptr_decoder_ ? ptr_decoder_->PrefersLateDecoding() : true;
}

std::unique_ptr<VCMGenericDecoder> VCMDecoderDataBase::CreateAndInitDecoder(
const VCMEncodedFrame& frame,
VideoCodec* new_codec) const {
Expand Down
4 changes: 0 additions & 4 deletions modules/video_coding/decoder_database.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ class VCMDecoderDataBase {
const VCMEncodedFrame& frame,
VCMDecodedFrameCallback* decoded_frame_callback);

// Returns true if the currently active decoder prefer to decode frames late.
// That means that frames must be decoded near the render times stamp.
bool PrefersLateDecoding() const;

private:
typedef std::map<uint8_t, VCMDecoderMapItem*> DecoderMap;
typedef std::map<uint8_t, VCMExtDecoderMapItem*> ExternalDecoderMap;
Expand Down
4 changes: 0 additions & 4 deletions modules/video_coding/generic_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,4 @@ int32_t VCMGenericDecoder::RegisterDecodeCompleteCallback(
return decoder_->RegisterDecodeCompleteCallback(callback);
}

bool VCMGenericDecoder::PrefersLateDecoding() const {
return decoder_->PrefersLateDecoding();
}

} // namespace webrtc
1 change: 0 additions & 1 deletion modules/video_coding/generic_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ class VCMGenericDecoder {
*/
int32_t RegisterDecodeCompleteCallback(VCMDecodedFrameCallback* callback);

bool PrefersLateDecoding() const;
bool IsSameDecoder(VideoDecoder* decoder) const {
return decoder_.get() == decoder;
}
Expand Down
3 changes: 1 addition & 2 deletions modules/video_coding/video_receiver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ int32_t VideoReceiver::RegisterPacketRequestCallback(
// Should be called as often as possible to get the most out of the decoder.
int32_t VideoReceiver::Decode(uint16_t maxWaitTimeMs) {
RTC_DCHECK_RUN_ON(&decoder_thread_checker_);
VCMEncodedFrame* frame = _receiver.FrameForDecoding(
maxWaitTimeMs, _codecDataBase.PrefersLateDecoding());
VCMEncodedFrame* frame = _receiver.FrameForDecoding(maxWaitTimeMs, true);

if (!frame)
return VCM_FRAME_NOT_READY;
Expand Down
5 changes: 4 additions & 1 deletion sdk/android/api/org/webrtc/VideoDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ default long createNativeVideoDecoder() {
* The decoder should return true if it prefers late decoding. That is, it can not decode
* infinite number of frames before the decoded frame is consumed.
*/
@CalledByNative boolean getPrefersLateDecoding();
// TODO(bugs.webrtc.org/12271): Remove when downstream has been updated.
default boolean getPrefersLateDecoding() {
return true;
}
/**
* Should return a descriptive name for the implementation. Gets called once and cached. May be
* called from arbitrary thread.
Expand Down
5 changes: 0 additions & 5 deletions sdk/android/api/org/webrtc/WrappedNativeVideoDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ public final VideoCodecStatus decode(EncodedImage frame, DecodeInfo info) {
throw new UnsupportedOperationException("Not implemented.");
}

@Override
public final boolean getPrefersLateDecoding() {
throw new UnsupportedOperationException("Not implemented.");
}

@Override
public final String getImplementationName() {
throw new UnsupportedOperationException("Not implemented.");
Expand Down
5 changes: 0 additions & 5 deletions sdk/android/src/java/org/webrtc/AndroidVideoDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,6 @@ public VideoCodecStatus decode(EncodedImage frame, DecodeInfo info) {
return VideoCodecStatus.OK;
}

@Override
public boolean getPrefersLateDecoding() {
return true;
}

@Override
public String getImplementationName() {
return codecName;
Expand Down
5 changes: 0 additions & 5 deletions sdk/android/src/jni/video_decoder_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,6 @@ int32_t VideoDecoderWrapper::Release() {
return status;
}

bool VideoDecoderWrapper::PrefersLateDecoding() const {
JNIEnv* jni = AttachCurrentThreadIfNeeded();
return Java_VideoDecoder_getPrefersLateDecoding(jni, decoder_);
}

const char* VideoDecoderWrapper::ImplementationName() const {
return implementation_name_.c_str();
}
Expand Down
5 changes: 0 additions & 5 deletions sdk/android/src/jni/video_decoder_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ class VideoDecoderWrapper : public VideoDecoder {
// still safe and synchronous.
int32_t Release() override RTC_NO_THREAD_SAFETY_ANALYSIS;

// Returns true if the decoder prefer to decode frames late.
// That is, it can not decode infinite number of frames before the decoded
// frame is consumed.
bool PrefersLateDecoding() const override;

const char* ImplementationName() const override;

// Wraps the frame to a AndroidVideoBuffer and passes it to the callback.
Expand Down
4 changes: 0 additions & 4 deletions test/pc/e2e/analyzer/video/quality_analyzing_video_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ int32_t QualityAnalyzingVideoDecoder::Release() {
return result;
}

bool QualityAnalyzingVideoDecoder::PrefersLateDecoding() const {
return delegate_->PrefersLateDecoding();
}

const char* QualityAnalyzingVideoDecoder::ImplementationName() const {
return implementation_name_.c_str();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class QualityAnalyzingVideoDecoder : public VideoDecoder {
int32_t RegisterDecodeCompleteCallback(
DecodedImageCallback* callback) override;
int32_t Release() override;
bool PrefersLateDecoding() const override;
const char* ImplementationName() const override;

private:
Expand Down
1 change: 0 additions & 1 deletion test/video_decoder_proxy_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class VideoDecoderProxyFactory final : public VideoDecoderFactory {
return decoder_->RegisterDecodeCompleteCallback(callback);
}
int32_t Release() override { return decoder_->Release(); }
bool PrefersLateDecoding() const { return decoder_->PrefersLateDecoding(); }
const char* ImplementationName() const override {
return decoder_->ImplementationName();
}
Expand Down
5 changes: 0 additions & 5 deletions video/frame_dumping_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class FrameDumpingDecoder : public VideoDecoder {
int32_t RegisterDecodeCompleteCallback(
DecodedImageCallback* callback) override;
int32_t Release() override;
bool PrefersLateDecoding() const override;
const char* ImplementationName() const override;

private:
Expand Down Expand Up @@ -73,10 +72,6 @@ int32_t FrameDumpingDecoder::Release() {
return decoder_->Release();
}

bool FrameDumpingDecoder::PrefersLateDecoding() const {
return decoder_->PrefersLateDecoding();
}

const char* FrameDumpingDecoder::ImplementationName() const {
return decoder_->ImplementationName();
}
Expand Down

0 comments on commit 360da05

Please sign in to comment.