Commit d47b7a9c authored by Frank Liberato's avatar Frank Liberato Committed by Chromium LUCI CQ

Don't elide all initial config changes in D3D11VideoDecoder

Previously, we would elide any config change that arrived before the
first frame was decoded, since the accelerated decoder sends one
even if it matches the container config.

Unfortunately, some streams actually do change config before the
first frame (e.g., some RTC streams).  Eliding it leaves the D3D11
decoder configured for the container config.

This CL causes D3D11VideoDecoder to elide the config change, and
prevent re-allocating the D3D11 decoder, only if the config matches
what the container told us.

Bug: 1109397
Change-Id: Ib9c5ec77897b24666118077935f91c541cbdabe2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2585666
Commit-Queue: Frank Liberato <liberato@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835833}
parent b93a7df2
...@@ -602,22 +602,31 @@ void D3D11VideoDecoder::DoDecode() { ...@@ -602,22 +602,31 @@ void D3D11VideoDecoder::DoDecode() {
return; return;
CreatePictureBuffers(); CreatePictureBuffers();
} else if (result == media::AcceleratedVideoDecoder::kConfigChange) { } else if (result == media::AcceleratedVideoDecoder::kConfigChange) {
if (profile_ != accelerated_video_decoder_->GetProfile()) {
profile_ = accelerated_video_decoder_->GetProfile();
config_.set_profile(profile_);
}
// Before the first frame, we get a config change that we should ignore. // Before the first frame, we get a config change that we should ignore.
// We only want to take action if this is a mid-stream config change. We // We only want to take action if this is a mid-stream config change. We
// could wait until now to allocate the first D3D11VideoDecoder, but we // could wait until now to allocate the first D3D11VideoDecoder, but we
// don't, so that init can fail rather than decoding if there's a problem // don't, so that init can fail rather than decoding if there's a problem
// creating it. If there's a config change at the start of the stream, // creating it. We could also unconditionally re-allocate the decoder,
// then this might not work. // but we keep it if it's ready to go.
if (!picture_buffers_.size()) const auto new_profile = accelerated_video_decoder_->GetProfile();
const auto new_coded_size = accelerated_video_decoder_->GetPicSize();
if (new_profile == config_.profile() &&
new_coded_size == config_.coded_size()) {
continue; continue;
}
// Update the config. // Update the config.
const auto new_coded_size = accelerated_video_decoder_->GetPicSize(); MEDIA_LOG(INFO, media_log_)
<< "D3D11VideoDecoder config change: profile: "
<< static_cast<int>(new_profile) << " coded_size: ("
<< new_coded_size.width() << ", " << new_coded_size.height() << ")";
profile_ = new_profile;
config_.set_profile(profile_);
config_.set_coded_size(new_coded_size); config_.set_coded_size(new_coded_size);
// Replace the decoder, and clear any picture buffers we have. It's okay
// if we don't have any picture buffer yet; this might be before the
// accelerated decoder asked for any.
auto video_decoder_or_error = CreateD3D11Decoder(); auto video_decoder_or_error = CreateD3D11Decoder();
if (video_decoder_or_error.has_error()) { if (video_decoder_or_error.has_error()) {
NotifyError(video_decoder_or_error.error()); NotifyError(video_decoder_or_error.error());
......
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