Commit 43857450 authored by Patrick Noland's avatar Patrick Noland Committed by Commit Bot

Revert "Wait for GPU initialization completion"

This reverts commit b2925a91.

Reason for revert:  The re-enabled test is failing on several android builders

Original change's description:
> Wait for GPU initialization completion
>
> In RTC video decoder factory, wait until initialization of GPU is
> finished before querying supported formats and creating a decoder.
> Timeout is configurable via RtcDecoderSupportTimeout field trial.
> The feature is enabled by default. The default timeout is 10 seconds.
>
> Bug: 1047994
> Change-Id: I9d827507664228f903e4ce46e2949785b13192ba
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2411935
> Reviewed-by: Guido Urdaneta <guidou@chromium.org>
> Reviewed-by: Dan Sanders <sandersd@chromium.org>
> Commit-Queue: Sergey Silkin <ssilkin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#811143}

TBR=fdoray@chromium.org,sandersd@chromium.org,guidou@chromium.org,chromium-reviews@chromium.org,etiennep@chromium.org,ssilkin@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1047994
Change-Id: I19aec959a1542425d747b58acafdcaab3721b6aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2438570Reviewed-by: default avatarPatrick Noland <pnoland@chromium.org>
Commit-Queue: Patrick Noland <pnoland@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811859}
parent 054a1b3b
......@@ -264,8 +264,10 @@ IN_PROC_BROWSER_TEST_F(
#if defined(OS_ANDROID) && BUILDFLAG(USE_PROPRIETARY_CODECS)
// This test is to make sure HW H264 work normally on supported devices, since
// there is no SW H264 fallback available on Android.
// TODO(crbug.com/1047994): Disabled due to flakiness caused by timing issue
// in blink HW codec factories.
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest,
CanSetupH264VideoCallOnSupportedDevice) {
DISABLED_CanSetupH264VideoCallOnSupportedDevice) {
MakeTypicalPeerConnectionCall("CanSetupH264VideoCallOnSupportedDevice();");
}
#endif
......
......@@ -12,7 +12,6 @@ include_rules = [
# Dependencies.
"+base/strings/string_number_conversions.h",
"+base/strings/string_split.h",
"+base/task/task_traits.h",
"+base/threading/thread_restrictions.h",
"+media/base",
"+media/capture/capture_switches.h",
......@@ -31,6 +30,7 @@ include_rules = [
specific_include_rules = {
".*_test\.cc": [
"+base/task/task_traits.h",
"+base/threading/thread.h",
"+gpu/command_buffer/common/mailbox.h",
"+media/video/mock_gpu_video_accelerator_factories.h",
......
......@@ -7,12 +7,8 @@
#include <array>
#include <memory>
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "build/build_config.h"
#include "media/base/media_util.h"
#include "media/base/video_codecs.h"
......@@ -31,11 +27,6 @@ const int kDefaultFps = 30;
// Any reasonable size, will be overridden by the decoder anyway.
const gfx::Size kDefaultSize(640, 480);
const base::Feature kRtcDecoderSupportTimeout{"RtcDecoderSupportTimeout",
base::FEATURE_ENABLED_BY_DEFAULT};
const uint32_t kDefaultRtcDecoderSupportTimeoutMs = 10000;
struct CodecConfig {
media::VideoCodec codec;
media::VideoCodecProfile profile;
......@@ -180,70 +171,16 @@ class ScopedVideoDecoder : public webrtc::VideoDecoder {
std::unique_ptr<webrtc::VideoDecoder> decoder_;
};
base::Optional<base::TimeDelta> GetRtcDecoderSupportTimeoutMs() {
if (!base::FeatureList::IsEnabled(kRtcDecoderSupportTimeout)) {
return base::nullopt;
}
int timeout_ms = base::GetFieldTrialParamByFeatureAsInt(
kRtcDecoderSupportTimeout, "timeout", kDefaultRtcDecoderSupportTimeoutMs);
return base::TimeDelta::FromMilliseconds(timeout_ms);
}
} // namespace
RTCVideoDecoderFactory::RTCVideoDecoderFactory(
media::GpuVideoAcceleratorFactories* gpu_factories)
: gpu_factories_(gpu_factories),
decoder_support_known_(base::WaitableEvent::ResetPolicy::MANUAL,
base::WaitableEvent::InitialState::NOT_SIGNALED),
decoder_support_timeout_ms_(GetRtcDecoderSupportTimeoutMs()) {
: gpu_factories_(gpu_factories) {
DVLOG(2) << __func__;
}
bool RTCVideoDecoderFactory::IsDecoderSupportKnown() const {
if (gpu_factories_->IsDecoderSupportKnown()) {
return true;
}
if (!decoder_support_timeout_ms_) {
return false;
}
// Callback passed to NotifyDecoderSupportKnown is called on caller's
// sequence. To not block the callback while waiting for it, call
// NotifyDecoderSupportKnown on a separate sequence.
scoped_refptr<base::SequencedTaskRunner> task_runner =
base::ThreadPool::CreateSequencedTaskRunner({});
bool is_decoder_support_notification_requested = task_runner->PostTask(
FROM_HERE, base::BindOnce(
[](media::GpuVideoAcceleratorFactories* gpu_factories,
base::WaitableEvent* decoder_support_known) {
gpu_factories->NotifyDecoderSupportKnown(base::BindOnce(
[](base::WaitableEvent* decoder_support_known) {
decoder_support_known->Signal();
},
decoder_support_known));
},
gpu_factories_, &decoder_support_known_));
if (!is_decoder_support_notification_requested) {
DLOG(WARNING) << "Failed to request decoder support notification.";
return false;
}
return decoder_support_known_.TimedWait(*decoder_support_timeout_ms_);
}
std::vector<webrtc::SdpVideoFormat>
RTCVideoDecoderFactory::GetSupportedFormats() const {
if (!IsDecoderSupportKnown()) {
DLOG(WARNING) << "Decoder support is unknown. Timeout "
<< decoder_support_timeout_ms_.value_or(base::TimeDelta())
.InMilliseconds()
<< "ms. Decoders might not be available.";
}
std::vector<webrtc::SdpVideoFormat> supported_formats;
for (auto& codec_config : kCodecConfigs) {
media::VideoDecoderConfig config(
......@@ -276,13 +213,6 @@ std::unique_ptr<webrtc::VideoDecoder>
RTCVideoDecoderFactory::CreateVideoDecoder(
const webrtc::SdpVideoFormat& format) {
DVLOG(2) << __func__;
if (!IsDecoderSupportKnown()) {
DLOG(WARNING) << "Decoder support is unknown. Timeout "
<< decoder_support_timeout_ms_.value_or(base::TimeDelta())
.InMilliseconds()
<< "ms. Decoders might not be available.";
}
std::unique_ptr<webrtc::VideoDecoder> decoder =
RTCVideoDecoderAdapter::Create(gpu_factories_, format);
// ScopedVideoDecoder uses the task runner to make sure the decoder is
......
......@@ -6,9 +6,6 @@
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_VIDEO_DECODER_FACTORY_H_
#include "base/macros.h"
#include "base/optional.h"
#include "base/synchronization/waitable_event.h"
#include "base/time/time.h"
#include "third_party/webrtc/api/video_codecs/video_decoder_factory.h"
#include "third_party/webrtc/modules/video_coding/include/video_codec_interface.h"
......@@ -37,13 +34,8 @@ class RTCVideoDecoderFactory : public webrtc::VideoDecoderFactory {
std::vector<webrtc::SdpVideoFormat> GetSupportedFormats() const override;
private:
bool IsDecoderSupportKnown() const;
media::GpuVideoAcceleratorFactories* gpu_factories_;
mutable base::WaitableEvent decoder_support_known_;
const base::Optional<base::TimeDelta> decoder_support_timeout_ms_;
DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoderFactory);
};
......
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