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() { ...@@ -426,8 +426,12 @@ int32_t RTCVideoDecoderAdapter::Release() {
: WEBRTC_VIDEO_CODEC_OK; : WEBRTC_VIDEO_CODEC_OK;
} }
const char* RTCVideoDecoderAdapter::ImplementationName() const { webrtc::VideoDecoder::DecoderInfo RTCVideoDecoderAdapter::GetDecoderInfo()
return "ExternalDecoder"; const {
DecoderInfo info;
info.implementation_name = "ExternalDecoder";
info.is_hardware_accelerated = true;
return info;
} }
void RTCVideoDecoderAdapter::InitializeOnMediaThread( void RTCVideoDecoderAdapter::InitializeOnMediaThread(
......
...@@ -83,7 +83,7 @@ class PLATFORM_EXPORT RTCVideoDecoderAdapter : public webrtc::VideoDecoder { ...@@ -83,7 +83,7 @@ class PLATFORM_EXPORT RTCVideoDecoderAdapter : public webrtc::VideoDecoder {
// Called on the worker thread and on the DecodingThread. // Called on the worker thread and on the DecodingThread.
int32_t Release() override; int32_t Release() override;
// Called on the worker thread and on the DecodingThread. // Called on the worker thread and on the DecodingThread.
const char* ImplementationName() const override; DecoderInfo GetDecoderInfo() const override;
private: private:
using CreateVideoDecoderCB = using CreateVideoDecoderCB =
......
...@@ -157,8 +157,8 @@ class ScopedVideoDecoder : public webrtc::VideoDecoder { ...@@ -157,8 +157,8 @@ class ScopedVideoDecoder : public webrtc::VideoDecoder {
return decoder_->Decode(input_image, missing_frames, render_time_ms); return decoder_->Decode(input_image, missing_frames, render_time_ms);
} }
const char* ImplementationName() const override { DecoderInfo GetDecoderInfo() const override {
return decoder_->ImplementationName(); return decoder_->GetDecoderInfo();
} }
// Runs on Chrome_libJingle_WorkerThread. The child thread is blocked while // Runs on Chrome_libJingle_WorkerThread. The child thread is blocked while
......
...@@ -280,6 +280,8 @@ RTCVideoDecoderStreamAdapter::RTCVideoDecoderStreamAdapter( ...@@ -280,6 +280,8 @@ RTCVideoDecoderStreamAdapter::RTCVideoDecoderStreamAdapter(
config_(config), config_(config),
max_pending_buffer_count_(kAbsoluteMaxPendingBuffers) { max_pending_buffer_count_(kAbsoluteMaxPendingBuffers) {
DVLOG(1) << __func__; DVLOG(1) << __func__;
decoder_info_.implementation_name = "unknown";
decoder_info_.is_hardware_accelerated = false;
DETACH_FROM_SEQUENCE(decoding_sequence_checker_); DETACH_FROM_SEQUENCE(decoding_sequence_checker_);
weak_this_ = weak_this_factory_.GetWeakPtr(); weak_this_ = weak_this_factory_.GetWeakPtr();
} }
...@@ -509,9 +511,10 @@ int32_t RTCVideoDecoderStreamAdapter::Release() { ...@@ -509,9 +511,10 @@ int32_t RTCVideoDecoderStreamAdapter::Release() {
: WEBRTC_VIDEO_CODEC_OK; : WEBRTC_VIDEO_CODEC_OK;
} }
const char* RTCVideoDecoderStreamAdapter::ImplementationName() const { webrtc::VideoDecoder::DecoderInfo RTCVideoDecoderStreamAdapter::GetDecoderInfo()
const {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
return decoder_name_.c_str(); return decoder_info_;
} }
void RTCVideoDecoderStreamAdapter::InitializeOnMediaThread( void RTCVideoDecoderStreamAdapter::InitializeOnMediaThread(
...@@ -777,7 +780,8 @@ void RTCVideoDecoderStreamAdapter::OnDecoderChanged( ...@@ -777,7 +780,8 @@ void RTCVideoDecoderStreamAdapter::OnDecoderChanged(
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
if (decoder->IsPlatformDecoder()) { if (decoder->IsPlatformDecoder()) {
decoder_name_ = "ExternalDecoder"; decoder_info_.implementation_name = "ExternalDecoder";
decoder_info_.is_hardware_accelerated = true;
return; return;
} }
...@@ -786,17 +790,18 @@ void RTCVideoDecoderStreamAdapter::OnDecoderChanged( ...@@ -786,17 +790,18 @@ void RTCVideoDecoderStreamAdapter::OnDecoderChanged(
switch (demuxer_stream_->video_decoder_config().codec()) { switch (demuxer_stream_->video_decoder_config().codec()) {
case media::VideoCodec::kCodecVP8: case media::VideoCodec::kCodecVP8:
case media::VideoCodec::kCodecVP9: case media::VideoCodec::kCodecVP9:
decoder_name_ = "libvpx (DecoderStream)"; decoder_info_.implementation_name = "libvpx (DecoderStream)";
break; break;
case media::VideoCodec::kCodecAV1: case media::VideoCodec::kCodecAV1:
decoder_name_ = "libaom (DecoderStream)"; decoder_info_.implementation_name = "libaom (DecoderStream)";
break; break;
case media::VideoCodec::kCodecH264: case media::VideoCodec::kCodecH264:
decoder_name_ = "FFmpeg (DecoderStream)"; decoder_info_.implementation_name = "FFmpeg (DecoderStream)";
break; break;
default: default:
decoder_name_ = "unknown"; decoder_info_.implementation_name = "unknown";
} }
decoder_info_.is_hardware_accelerated = false;
} }
} // namespace blink } // namespace blink
...@@ -87,7 +87,7 @@ class PLATFORM_EXPORT RTCVideoDecoderStreamAdapter ...@@ -87,7 +87,7 @@ class PLATFORM_EXPORT RTCVideoDecoderStreamAdapter
// Called on the worker thread and on the DecodingThread. // Called on the worker thread and on the DecodingThread.
int32_t Release() override; int32_t Release() override;
// Called on the worker thread and on the DecodingThread. // Called on the worker thread and on the DecodingThread.
const char* ImplementationName() const override; DecoderInfo GetDecoderInfo() const override;
private: private:
class InternalDemuxerStream; class InternalDemuxerStream;
...@@ -172,8 +172,8 @@ class PLATFORM_EXPORT RTCVideoDecoderStreamAdapter ...@@ -172,8 +172,8 @@ class PLATFORM_EXPORT RTCVideoDecoderStreamAdapter
bool init_decode_complete_ GUARDED_BY(lock_) = false; bool init_decode_complete_ GUARDED_BY(lock_) = false;
// Have we logged init status yet? // Have we logged init status yet?
bool logged_init_status_ GUARDED_BY(lock_) = false; bool logged_init_status_ GUARDED_BY(lock_) = false;
// Current decoder name, as reported by ImplementationName(). // Current decoder info, as reported by GetDecoderInfo().
std::string decoder_name_ GUARDED_BY(lock_) = "ExternalDecoder"; webrtc::VideoDecoder::DecoderInfo decoder_info_ GUARDED_BY(lock_);
// Do we have an outstanding `DecoderStream::Read()`? // Do we have an outstanding `DecoderStream::Read()`?
// Media thread only. // 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