Adds VideoDecoder::GetDecoderInfo()
This adds a new way to poll decoder metadata. A default implementation still delegates to the old methods. Root call site is updates to not use the olds methods. Follow-ups will dismantle usage of the olds methods in wrappers. Bug: webrtc:12271 Change-Id: Id0fa6863c96ff9e3b849da452d6540e7c5da4512 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196520 Commit-Queue: Erik Språng <sprang@webrtc.org> Reviewed-by: Per Kjellander <perkj@webrtc.org> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32976}
This commit is contained in:
@ -238,8 +238,12 @@ int32_t VCMGenericDecoder::InitDecode(const VideoCodec* settings,
|
||||
_codecType = settings->codecType;
|
||||
|
||||
int err = decoder_->InitDecode(settings, numberOfCores);
|
||||
implementation_name_ = decoder_->ImplementationName();
|
||||
RTC_LOG(LS_INFO) << "Decoder implementation: " << implementation_name_;
|
||||
decoder_info_ = decoder_->GetDecoderInfo();
|
||||
RTC_LOG(LS_INFO) << "Decoder implementation: " << decoder_info_.ToString();
|
||||
if (_callback) {
|
||||
_callback->OnDecoderImplementationName(
|
||||
decoder_info_.implementation_name.c_str());
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -269,13 +273,16 @@ int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, Timestamp now) {
|
||||
_nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength;
|
||||
int32_t ret = decoder_->Decode(frame.EncodedImage(), frame.MissingFrame(),
|
||||
frame.RenderTimeMs());
|
||||
const char* new_implementation_name = decoder_->ImplementationName();
|
||||
if (new_implementation_name != implementation_name_) {
|
||||
implementation_name_ = new_implementation_name;
|
||||
VideoDecoder::DecoderInfo decoder_info = decoder_->GetDecoderInfo();
|
||||
if (decoder_info != decoder_info_) {
|
||||
RTC_LOG(LS_INFO) << "Changed decoder implementation to: "
|
||||
<< new_implementation_name;
|
||||
<< decoder_info.ToString();
|
||||
|
||||
_callback->OnDecoderImplementationName(
|
||||
decoder_info.implementation_name.empty()
|
||||
? "unknown"
|
||||
: decoder_info.implementation_name.c_str());
|
||||
}
|
||||
_callback->OnDecoderImplementationName(implementation_name_.c_str());
|
||||
if (ret < WEBRTC_VIDEO_CODEC_OK) {
|
||||
RTC_LOG(LS_WARNING) << "Failed to decode frame with timestamp "
|
||||
<< frame.Timestamp() << ", error code: " << ret;
|
||||
@ -291,7 +298,12 @@ int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, Timestamp now) {
|
||||
int32_t VCMGenericDecoder::RegisterDecodeCompleteCallback(
|
||||
VCMDecodedFrameCallback* callback) {
|
||||
_callback = callback;
|
||||
return decoder_->RegisterDecodeCompleteCallback(callback);
|
||||
int32_t ret = decoder_->RegisterDecodeCompleteCallback(callback);
|
||||
if (callback && !decoder_info_.implementation_name.empty()) {
|
||||
callback->OnDecoderImplementationName(
|
||||
decoder_info_.implementation_name.c_str());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user