Commit 80749efe authored by Erik Språng's avatar Erik Språng Committed by Chromium LUCI CQ

Wires up webrtc::VideoDecoder::GetDecoderInfo() support in chrome.

This method replaces the ImplementationName() and adds support for the
explicit is_hardware_accelerated flag.

Bug: webrtc:12271
Change-Id: I22c6956077b7494b74016382f9ba304017bffc57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2599087
Auto-Submit: Erik Språng <sprang@chromium.org>
Commit-Queue: Frank Liberato <liberato@chromium.org>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844868}
parent ce45a81e
......@@ -426,8 +426,12 @@ int32_t RTCVideoDecoderAdapter::Release() {
: WEBRTC_VIDEO_CODEC_OK;
}
const char* RTCVideoDecoderAdapter::ImplementationName() const {
return "ExternalDecoder";
webrtc::VideoDecoder::DecoderInfo RTCVideoDecoderAdapter::GetDecoderInfo()
const {
DecoderInfo info;
info.implementation_name = "ExternalDecoder";
info.is_hardware_accelerated = true;
return info;
}
void RTCVideoDecoderAdapter::InitializeOnMediaThread(
......
......@@ -83,7 +83,7 @@ class PLATFORM_EXPORT RTCVideoDecoderAdapter : public webrtc::VideoDecoder {
// Called on the worker thread and on the DecodingThread.
int32_t Release() override;
// Called on the worker thread and on the DecodingThread.
const char* ImplementationName() const override;
DecoderInfo GetDecoderInfo() const override;
private:
using CreateVideoDecoderCB =
......
......@@ -157,8 +157,8 @@ class ScopedVideoDecoder : public webrtc::VideoDecoder {
return decoder_->Decode(input_image, missing_frames, render_time_ms);
}
const char* ImplementationName() const override {
return decoder_->ImplementationName();
DecoderInfo GetDecoderInfo() const override {
return decoder_->GetDecoderInfo();
}
// Runs on Chrome_libJingle_WorkerThread. The child thread is blocked while
......
......@@ -280,6 +280,8 @@ RTCVideoDecoderStreamAdapter::RTCVideoDecoderStreamAdapter(
config_(config),
max_pending_buffer_count_(kAbsoluteMaxPendingBuffers) {
DVLOG(1) << __func__;
decoder_info_.implementation_name = "unknown";
decoder_info_.is_hardware_accelerated = false;
DETACH_FROM_SEQUENCE(decoding_sequence_checker_);
weak_this_ = weak_this_factory_.GetWeakPtr();
}
......@@ -509,9 +511,10 @@ int32_t RTCVideoDecoderStreamAdapter::Release() {
: WEBRTC_VIDEO_CODEC_OK;
}
const char* RTCVideoDecoderStreamAdapter::ImplementationName() const {
webrtc::VideoDecoder::DecoderInfo RTCVideoDecoderStreamAdapter::GetDecoderInfo()
const {
base::AutoLock auto_lock(lock_);
return decoder_name_.c_str();
return decoder_info_;
}
void RTCVideoDecoderStreamAdapter::InitializeOnMediaThread(
......@@ -777,7 +780,8 @@ void RTCVideoDecoderStreamAdapter::OnDecoderChanged(
base::AutoLock auto_lock(lock_);
if (decoder->IsPlatformDecoder()) {
decoder_name_ = "ExternalDecoder";
decoder_info_.implementation_name = "ExternalDecoder";
decoder_info_.is_hardware_accelerated = true;
return;
}
......@@ -786,17 +790,18 @@ void RTCVideoDecoderStreamAdapter::OnDecoderChanged(
switch (demuxer_stream_->video_decoder_config().codec()) {
case media::VideoCodec::kCodecVP8:
case media::VideoCodec::kCodecVP9:
decoder_name_ = "libvpx (DecoderStream)";
decoder_info_.implementation_name = "libvpx (DecoderStream)";
break;
case media::VideoCodec::kCodecAV1:
decoder_name_ = "libaom (DecoderStream)";
decoder_info_.implementation_name = "libaom (DecoderStream)";
break;
case media::VideoCodec::kCodecH264:
decoder_name_ = "FFmpeg (DecoderStream)";
decoder_info_.implementation_name = "FFmpeg (DecoderStream)";
break;
default:
decoder_name_ = "unknown";
decoder_info_.implementation_name = "unknown";
}
decoder_info_.is_hardware_accelerated = false;
}
} // namespace blink
......@@ -87,7 +87,7 @@ class PLATFORM_EXPORT RTCVideoDecoderStreamAdapter
// Called on the worker thread and on the DecodingThread.
int32_t Release() override;
// Called on the worker thread and on the DecodingThread.
const char* ImplementationName() const override;
DecoderInfo GetDecoderInfo() const override;
private:
class InternalDemuxerStream;
......@@ -172,8 +172,8 @@ class PLATFORM_EXPORT RTCVideoDecoderStreamAdapter
bool init_decode_complete_ GUARDED_BY(lock_) = false;
// Have we logged init status yet?
bool logged_init_status_ GUARDED_BY(lock_) = false;
// Current decoder name, as reported by ImplementationName().
std::string decoder_name_ GUARDED_BY(lock_) = "ExternalDecoder";
// Current decoder info, as reported by GetDecoderInfo().
webrtc::VideoDecoder::DecoderInfo decoder_info_ GUARDED_BY(lock_);
// Do we have an outstanding `DecoderStream::Read()`?
// Media thread only.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment