Skip to content

Commit

Permalink
Revert "[Fuchsia] Mark protected video frames"
Browse files Browse the repository at this point in the history
This reverts commit ac22761.

Reason for revert: Regressed video playback in some scenarios, see b/266011868 . OTOH we don't really need this in M110 as we have a workaround in the corresponding versions of Fuchsia

Original change's description:
> [Fuchsia] Mark protected video frames
>
> Previously FuchsiaVideoDecoder wasn't setting hw_protected flag in the
> video frames produced on the output. Without that flag the compositor
> may try to present them without overlays, which is not supported. As
> result the video content is not rendered correctly on the screen.
> Now the decoder sets hw_protected and protected_video flags when
> necessary.
> Also moved handling of the --force-protected-video-output-buffers
> command line argument to the renderer process.
>
> (cherry picked from commit f592db4)
>
> Bug: 1401245
> Change-Id: I2c34c0b5055bf2c19a50d18fb47a6c8673e3d987
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4116013
> Reviewed-by: Tom Sepez <tsepez@chromium.org>
> Reviewed-by: Peter McNeeley <petermcneeley@chromium.org>
> Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
> Cr-Original-Commit-Position: refs/heads/main@{#1090463}
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4158071
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
> Commit-Queue: Peter McNeeley <petermcneeley@chromium.org>
> Cr-Commit-Position: refs/branch-heads/5481@{#262}
> Cr-Branched-From: 130f3e4-refs/heads/main@{#1084008}

Bug: 1401245
Change-Id: I66aa73db0e8b44ccc460cca17749e515444aa793
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4204948
Reviewed-by: Peter McNeeley <petermcneeley@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/branch-heads/5481@{#870}
Cr-Branched-From: 130f3e4-refs/heads/main@{#1084008}
  • Loading branch information
SergeyUlanov authored and Chromium LUCI CQ committed Feb 1, 2023
1 parent c93bfb1 commit 1e007a3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 20 deletions.
Expand Up @@ -127,9 +127,12 @@ void FuchsiaMediaCodecProviderImpl::CreateVideoDecoder(
fuchsia::mediacodec::SecureMemoryMode::ON);
break;

case media::mojom::VideoDecoderSecureMemoryMode::SECURE_OUTPUT:
decoder_params.set_secure_output_mode(
fuchsia::mediacodec::SecureMemoryMode::ON);
case media::mojom::VideoDecoderSecureMemoryMode::CLEAR_INPUT:
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kForceProtectedVideoOutputBuffers)) {
decoder_params.set_secure_output_mode(
fuchsia::mediacodec::SecureMemoryMode::ON);
}
break;
}

Expand Down
5 changes: 3 additions & 2 deletions media/fuchsia/mojom/fuchsia_media.mojom
Expand Up @@ -25,8 +25,9 @@ enum VideoDecoderSecureMemoryMode {
// Input and output buffers must be allocated in protected memory.
SECURE,

// Input buffers are not protected. Output buffers are protected.
SECURE_OUTPUT,
// Input buffers are not protected. Output buffers may be allocated in
// protected memory.
CLEAR_INPUT,
};

// Interface used by the renderer to connect to CDM and mediacodec resources.
Expand Down
17 changes: 5 additions & 12 deletions media/fuchsia/video/fuchsia_video_decoder.cc
Expand Up @@ -302,7 +302,7 @@ void FuchsiaVideoDecoder::Initialize(const VideoDecoderConfig& config,
}

media::mojom::VideoDecoderSecureMemoryMode secure_mode =
media::mojom::VideoDecoderSecureMemoryMode::CLEAR;
media::mojom::VideoDecoderSecureMemoryMode::CLEAR_INPUT;
if (secure_input) {
if (!use_overlays_for_video_) {
DLOG(ERROR) << "Protected content can be rendered only using overlays.";
Expand All @@ -312,13 +312,11 @@ void FuchsiaVideoDecoder::Initialize(const VideoDecoderConfig& config,
return;
}
secure_mode = media::mojom::VideoDecoderSecureMemoryMode::SECURE;
} else if (use_overlays_for_video_ &&
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kForceProtectedVideoOutputBuffers)) {
secure_mode = media::mojom::VideoDecoderSecureMemoryMode::SECURE_OUTPUT;
} else if (!use_overlays_for_video_) {
// Protected output buffers can be rendered only using overlays. If overlays
// are not allowed then the output buffers cannot be protected.
secure_mode = media::mojom::VideoDecoderSecureMemoryMode::CLEAR;
}
protected_output_ =
secure_mode != media::mojom::VideoDecoderSecureMemoryMode::CLEAR;

// Reset output buffers since we won't be able to re-use them.
ReleaseOutputBuffers();
Expand Down Expand Up @@ -670,11 +668,6 @@ void FuchsiaVideoDecoder::OnStreamProcessorOutputPacket(
// registered with an ImagePipe.
frame->metadata().allow_overlay = use_overlays_for_video_;

if (protected_output_) {
frame->metadata().protected_video = true;
frame->metadata().hw_protected = true;
}

output_cb_.Run(std::move(frame));
}

Expand Down
3 changes: 0 additions & 3 deletions media/fuchsia/video/fuchsia_video_decoder.h
Expand Up @@ -152,9 +152,6 @@ class MEDIA_EXPORT FuchsiaVideoDecoder : public VideoDecoder,
zx::eventpair output_buffer_collection_handle_;
std::vector<OutputMailbox*> output_mailboxes_;

// Set to true when the output buffers are protected.
bool protected_output_ = false;

size_t num_used_output_buffers_ = 0;

SEQUENCE_CHECKER(sequence_checker_);
Expand Down

0 comments on commit 1e007a3

Please sign in to comment.