Rename {absl => std}::optional in //media/
#cleanup
Automated patch. This is a no-op. Please avoid, as much as possible,
assigning unrelated bugs to this.
Context:
https://groups.google.com/a/chromium.org/g/cxx/c/nBD_1LaanTc/m/ghh-ZZhWAwAJ?utm_medium=email
As of https://crrev.com/1204351, absl::optional is now a type alias
for std::optional. We should migrate toward it.
Script:
```
cd media/
function replace {
echo "Replacing $1 by $2"
git grep -l "$1" \
| cut -f1 -d: \
| grep \
-e "\.h" \
-e "\.cc" \
-e "\.mm" \
| sort \
| uniq \
| xargs sed -i "s/$1/$2/g"
}
replace "absl::make_optional" "std::make_optional"
replace "absl::optional" "std::optional"
replace "absl::nullopt" "std::nullopt"
replace "absl::in_place" "std::in_place"
replace "absl::in_place_t" "std::in_place_t"
replace "\"third_party\/abseil-cpp\/absl\/types\/optional.h\"" "<optional>"
cd ..
echo "Formatting:"
echo "IncludeBlocks: Regroup" >> ".clang-format"
echo "IncludeIsMainRegex: \"(_(android|apple|chromeos|freebsd|fuchsia|fuzzer|ios|linux|mac|nacl|openbsd|posix|stubs?|win))?(_(unit|browser|perf)?tests?)?$\"" >> ".clang-format"
git cl format
git restore ".clang-format"
git cl format
```
Bug: chromium:1500249
Change-Id: I4c9528856ab34eed75ab85cf8d98ad5e81a007d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5238442
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1253983}
diff --git a/media/audio/alsa/alsa_output.cc b/media/audio/alsa/alsa_output.cc
index 3eaef18..9f91e1ff 100644
--- a/media/audio/alsa/alsa_output.cc
+++ b/media/audio/alsa/alsa_output.cc
@@ -613,8 +613,8 @@
TRACE_EVENT_BEGIN(TRACE_DISABLED_BY_DEFAULT("audio"),
"AlsaPcmOutputStream::GetCurrentDelay");
// Intermediate values saved for tracing.
- absl::optional<snd_pcm_sframes_t> pcm_delay;
- absl::optional<snd_pcm_sframes_t> available_frames;
+ std::optional<snd_pcm_sframes_t> pcm_delay;
+ std::optional<snd_pcm_sframes_t> available_frames;
snd_pcm_sframes_t delay = -1;
// Don't query ALSA's delay if we have underrun since it'll be jammed at some
diff --git a/media/audio/audio_encoders_unittest.cc b/media/audio/audio_encoders_unittest.cc
index dbcdf3b..e5fd8fb 100644
--- a/media/audio/audio_encoders_unittest.cc
+++ b/media/audio/audio_encoders_unittest.cc
@@ -153,7 +153,7 @@
AudioEncodersTest& operator=(const AudioEncodersTest&) = delete;
~AudioEncodersTest() override = default;
- using MaybeDesc = absl::optional<AudioEncoder::CodecDescription>;
+ using MaybeDesc = std::optional<AudioEncoder::CodecDescription>;
AudioEncoder* encoder() const { return encoder_.get(); }
diff --git a/media/audio/audio_input_device.h b/media/audio/audio_input_device.h
index b298970..60cc2625 100644
--- a/media/audio/audio_input_device.h
+++ b/media/audio/audio_input_device.h
@@ -46,6 +46,7 @@
#define MEDIA_AUDIO_AUDIO_INPUT_DEVICE_H_
#include <memory>
+#include <optional>
#include <string>
#include "base/compiler_specific.h"
@@ -59,7 +60,6 @@
#include "media/base/audio_capturer_source.h"
#include "media/base/audio_parameters.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -165,7 +165,7 @@
// Cache the output device used for AEC in case it's called before the stream
// is created.
- absl::optional<std::string> output_device_id_for_aec_;
+ std::optional<std::string> output_device_id_for_aec_;
};
} // namespace media
diff --git a/media/audio/audio_manager_base.cc b/media/audio/audio_manager_base.cc
index 28fbca8..6507d4c0 100644
--- a/media/audio/audio_manager_base.cc
+++ b/media/audio/audio_manager_base.cc
@@ -5,10 +5,12 @@
#include "media/audio/audio_manager_base.h"
#include <memory>
+#include <optional>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
+#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
@@ -20,16 +22,13 @@
#include "build/build_config.h"
#include "build/buildflag.h"
#include "media/audio/audio_device_description.h"
+#include "media/audio/audio_input_stream_data_interceptor.h"
#include "media/audio/audio_output_dispatcher_impl.h"
#include "media/audio/audio_output_proxy.h"
#include "media/audio/audio_output_resampler.h"
#include "media/audio/fake_audio_input_stream.h"
#include "media/audio/fake_audio_output_stream.h"
#include "media/base/media_switches.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
-
-#include "base/logging.h"
-#include "media/audio/audio_input_stream_data_interceptor.h"
namespace media {
@@ -355,7 +354,7 @@
const std::string& device_id) {
CHECK(GetTaskRunner()->BelongsToCurrentThread());
DCHECK(params.IsValid());
- absl::optional<StreamFormat> uma_stream_format;
+ std::optional<StreamFormat> uma_stream_format;
// If the caller supplied an empty device id to select the default device,
// we fetch the actual device id of the default device so that the lookup
diff --git a/media/audio/audio_opus_encoder.cc b/media/audio/audio_opus_encoder.cc
index 559154bd..844aae33 100644
--- a/media/audio/audio_opus_encoder.cc
+++ b/media/audio/audio_opus_encoder.cc
@@ -41,7 +41,7 @@
}
base::TimeDelta GetFrameDuration(
- const absl::optional<AudioEncoder::OpusOptions> opus_options) {
+ const std::optional<AudioEncoder::OpusOptions> opus_options) {
return opus_options.has_value() ? opus_options.value().frame_duration
: kDefaultOpusBufferDuration;
}
@@ -288,7 +288,7 @@
// If |result| in {0,1}, do nothing; the documentation says that a return
// value of zero or one means the packet does not need to be transmitted.
if (encoded_data_size > 1) {
- absl::optional<CodecDescription> desc;
+ std::optional<CodecDescription> desc;
if (need_to_emit_extra_data_) {
desc = PrepareExtraData();
need_to_emit_extra_data_ = false;
@@ -320,7 +320,7 @@
// Creates and returns the libopus encoder instance. Returns nullptr if the
// encoder creation fails.
EncoderStatus::Or<OwnedOpusEncoder> AudioOpusEncoder::CreateOpusEncoder(
- const absl::optional<AudioEncoder::OpusOptions>& opus_options) {
+ const std::optional<AudioEncoder::OpusOptions>& opus_options) {
int opus_result;
OwnedOpusEncoder encoder(
opus_encoder_create(converted_params_.sample_rate(),
diff --git a/media/audio/audio_opus_encoder.h b/media/audio/audio_opus_encoder.h
index ccdf659..3d34cb5 100644
--- a/media/audio/audio_opus_encoder.h
+++ b/media/audio/audio_opus_encoder.h
@@ -56,7 +56,7 @@
CodecDescription PrepareExtraData();
EncoderStatus::Or<OwnedOpusEncoder> CreateOpusEncoder(
- const absl::optional<AudioEncoder::OpusOptions>& opus_options);
+ const std::optional<AudioEncoder::OpusOptions>& opus_options);
AudioParameters input_params_;
diff --git a/media/audio/audio_output_device_thread_callback.h b/media/audio/audio_output_device_thread_callback.h
index 615de29..904c1fa 100644
--- a/media/audio/audio_output_device_thread_callback.h
+++ b/media/audio/audio_output_device_thread_callback.h
@@ -63,7 +63,7 @@
const base::TimeTicks create_time_;
// If set, used to record the startup duration UMA stat.
- absl::optional<base::TimeTicks> first_play_start_time_;
+ std::optional<base::TimeTicks> first_play_start_time_;
AudioDeviceStatsReporter stats_reporter_;
};
diff --git a/media/audio/audio_output_ipc.h b/media/audio/audio_output_ipc.h
index 1b77a77..7a2be7d 100644
--- a/media/audio/audio_output_ipc.h
+++ b/media/audio/audio_output_ipc.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_
#define MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_
+#include <optional>
#include <string>
#include "base/memory/unsafe_shared_memory_region.h"
@@ -13,7 +14,6 @@
#include "media/base/audio_parameters.h"
#include "media/base/media_export.h"
#include "media/base/output_device_info.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/audio/audio_output_proxy_unittest.cc b/media/audio/audio_output_proxy_unittest.cc
index 76ffc17..774281d6 100644
--- a/media/audio/audio_output_proxy_unittest.cc
+++ b/media/audio/audio_output_proxy_unittest.cc
@@ -114,12 +114,12 @@
MOCK_METHOD0(Close, void());
MOCK_METHOD0(Flush, void());
- absl::optional<AudioOutputStream::AudioSourceCallback*> GetCallback() {
+ std::optional<AudioOutputStream::AudioSourceCallback*> GetCallback() {
return callback_;
}
private:
- absl::optional<AudioOutputStream::AudioSourceCallback*> callback_;
+ std::optional<AudioOutputStream::AudioSourceCallback*> callback_;
};
class MockAudioManager : public AudioManagerBase {
diff --git a/media/audio/audio_source_parameters.h b/media/audio/audio_source_parameters.h
index 2be9b2e..13b06c4cb 100644
--- a/media/audio/audio_source_parameters.h
+++ b/media/audio/audio_source_parameters.h
@@ -5,10 +5,11 @@
#ifndef MEDIA_AUDIO_AUDIO_SOURCE_PARAMETERS_H_
#define MEDIA_AUDIO_AUDIO_SOURCE_PARAMETERS_H_
+#include <optional>
+
#include "base/unguessable_token.h"
#include "media/base/audio_processing.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -23,7 +24,7 @@
~AudioSourceParameters();
base::UnguessableToken session_id;
- absl::optional<AudioProcessingSettings> processing;
+ std::optional<AudioProcessingSettings> processing;
};
} // namespace media
diff --git a/media/audio/audio_system.h b/media/audio/audio_system.h
index 5a58b03..e2a49a0 100644
--- a/media/audio/audio_system.h
+++ b/media/audio/audio_system.h
@@ -5,13 +5,13 @@
#ifndef MEDIA_AUDIO_AUDIO_SYSTEM_H_
#define MEDIA_AUDIO_AUDIO_SYSTEM_H_
+#include <optional>
#include <string>
#include "base/functional/callback.h"
#include "media/audio/audio_device_description.h"
#include "media/base/audio_parameters.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -33,12 +33,12 @@
// std::string. If optional matched output device id is empty, it means there
// is no associated output device.
using >
- base::OnceCallback<void(const absl::optional<AudioParameters>&)>;
+ base::OnceCallback<void(const std::optional<AudioParameters>&)>;
using >
- base::OnceCallback<void(const absl::optional<std::string>&)>;
+ base::OnceCallback<void(const std::optional<std::string>&)>;
using >
- base::OnceCallback<void(const absl::optional<AudioParameters>&,
- const absl::optional<std::string>&)>;
+ base::OnceCallback<void(const std::optional<AudioParameters>&,
+ const std::optional<std::string>&)>;
using >
using >
diff --git a/media/audio/audio_system_helper.cc b/media/audio/audio_system_helper.cc
index 4ea3254..fd611c3 100644
--- a/media/audio/audio_system_helper.cc
+++ b/media/audio/audio_system_helper.cc
@@ -12,8 +12,7 @@
namespace {
-absl::optional<AudioParameters> TryToFixChannels(
- const AudioParameters& params) {
+std::optional<AudioParameters> TryToFixChannels(const AudioParameters& params) {
DCHECK(!params.IsValid());
AudioParameters params_copy(params);
@@ -26,8 +25,7 @@
limits::kMaxChannels);
}
- return params_copy.IsValid() ? params_copy
- : absl::optional<AudioParameters>();
+ return params_copy.IsValid() ? params_copy : std::optional<AudioParameters>();
}
} // namespace
@@ -84,7 +82,7 @@
const std::string associated_output_device_id =
audio_manager_->GetAssociatedOutputDeviceID(input_device_id);
std::move(on_device_id_cb)
- .Run(associated_output_device_id.empty() ? absl::optional<std::string>()
+ .Run(associated_output_device_id.empty() ? std::optional<std::string>()
: associated_output_device_id);
}
@@ -96,11 +94,11 @@
audio_manager_->GetAssociatedOutputDeviceID(input_device_id);
std::move(on_input_device_info_cb)
.Run(ComputeInputParameters(input_device_id),
- associated_output_device_id.empty() ? absl::optional<std::string>()
+ associated_output_device_id.empty() ? std::optional<std::string>()
: associated_output_device_id);
}
-absl::optional<AudioParameters> AudioSystemHelper::ComputeInputParameters(
+std::optional<AudioParameters> AudioSystemHelper::ComputeInputParameters(
const std::string& device_id) {
DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread());
@@ -112,17 +110,17 @@
// AudioManager::GetInputStreamParameters will check |device_id| and
// query the correct device for audio parameters by itself.
if (!audio_manager_->HasAudioOutputDevices())
- return absl::optional<AudioParameters>();
+ return std::optional<AudioParameters>();
} else {
if (!audio_manager_->HasAudioInputDevices())
- return absl::optional<AudioParameters>();
+ return std::optional<AudioParameters>();
}
AudioParameters params = audio_manager_->GetInputStreamParameters(device_id);
return params.IsValid() ? params : TryToFixChannels(params);
}
-absl::optional<AudioParameters> AudioSystemHelper::ComputeOutputParameters(
+std::optional<AudioParameters> AudioSystemHelper::ComputeOutputParameters(
const std::string& device_id) {
DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread());
@@ -130,7 +128,7 @@
// AudioManager::Get[Default]OutputStreamParameters() returns invalid
// parameters if the device is not found.
if (!audio_manager_->HasAudioOutputDevices())
- return absl::optional<AudioParameters>();
+ return std::optional<AudioParameters>();
AudioParameters params =
AudioDeviceDescription::IsDefaultDevice(device_id)
diff --git a/media/audio/audio_system_helper.h b/media/audio/audio_system_helper.h
index 4ef7e26..0698769 100644
--- a/media/audio/audio_system_helper.h
+++ b/media/audio/audio_system_helper.h
@@ -5,10 +5,11 @@
#ifndef MEDIA_AUDIO_AUDIO_SYSTEM_HELPER_H_
#define MEDIA_AUDIO_AUDIO_SYSTEM_HELPER_H_
+#include <optional>
+
#include "base/memory/raw_ptr.h"
#include "media/audio/audio_system.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
class AudioManager;
@@ -50,9 +51,9 @@
AudioSystem::OnInputDeviceInfoCallback on_input_device_info_cb);
private:
- absl::optional<AudioParameters> ComputeInputParameters(
+ std::optional<AudioParameters> ComputeInputParameters(
const std::string& device_id);
- absl::optional<AudioParameters> ComputeOutputParameters(
+ std::optional<AudioParameters> ComputeOutputParameters(
const std::string& device_id);
const raw_ptr<AudioManager, DanglingUntriaged> audio_manager_;
diff --git a/media/audio/audio_system_test_util.cc b/media/audio/audio_system_test_util.cc
index afc0cb7..ee4f474 100644
--- a/media/audio/audio_system_test_util.cc
+++ b/media/audio/audio_system_test_util.cc
@@ -13,7 +13,7 @@
AudioSystemCallbackExpectations::GetAudioParamsCallback(
const base::Location& location,
base::OnceClosure on_cb_received,
- const absl::optional<AudioParameters>& expected_params) {
+ const std::optional<AudioParameters>& expected_params) {
return base::BindOnce(&AudioSystemCallbackExpectations::OnAudioParams,
base::Unretained(this), location.ToString(),
std::move(on_cb_received), expected_params);
@@ -42,8 +42,8 @@
AudioSystemCallbackExpectations::GetInputDeviceInfoCallback(
const base::Location& location,
base::OnceClosure on_cb_received,
- const absl::optional<AudioParameters>& expected_input,
- const absl::optional<std::string>& expected_associated_device_id) {
+ const std::optional<AudioParameters>& expected_input,
+ const std::optional<std::string>& expected_associated_device_id) {
return base::BindOnce(&AudioSystemCallbackExpectations::OnInputDeviceInfo,
base::Unretained(this), location.ToString(),
std::move(on_cb_received), expected_input,
@@ -54,7 +54,7 @@
AudioSystemCallbackExpectations::GetDeviceIdCallback(
const base::Location& location,
base::OnceClosure on_cb_received,
- const absl::optional<std::string>& expected_id) {
+ const std::optional<std::string>& expected_id) {
return base::BindOnce(&AudioSystemCallbackExpectations::OnDeviceId,
base::Unretained(this), location.ToString(),
std::move(on_cb_received), expected_id);
@@ -63,8 +63,8 @@
void AudioSystemCallbackExpectations::OnAudioParams(
const std::string& from_here,
base::OnceClosure on_cb_received,
- const absl::optional<AudioParameters>& expected,
- const absl::optional<AudioParameters>& received) {
+ const std::optional<AudioParameters>& expected,
+ const std::optional<AudioParameters>& received) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_, from_here);
if (expected) {
EXPECT_TRUE(received) << from_here;
@@ -99,10 +99,10 @@
void AudioSystemCallbackExpectations::OnInputDeviceInfo(
const std::string& from_here,
base::OnceClosure on_cb_received,
- const absl::optional<AudioParameters>& expected_input,
- const absl::optional<std::string>& expected_associated_device_id,
- const absl::optional<AudioParameters>& input,
- const absl::optional<std::string>& associated_device_id) {
+ const std::optional<AudioParameters>& expected_input,
+ const std::optional<std::string>& expected_associated_device_id,
+ const std::optional<AudioParameters>& input,
+ const std::optional<std::string>& associated_device_id) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_, from_here);
EXPECT_TRUE(!input || input->IsValid());
if (expected_input) {
@@ -126,8 +126,8 @@
void AudioSystemCallbackExpectations::OnDeviceId(
const std::string& from_here,
base::OnceClosure on_cb_received,
- const absl::optional<std::string>& expected_id,
- const absl::optional<std::string>& result_id) {
+ const std::optional<std::string>& expected_id,
+ const std::optional<std::string>& result_id) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_, from_here);
EXPECT_TRUE(!result_id || !result_id->empty());
if (expected_id) {
diff --git a/media/audio/audio_system_test_util.h b/media/audio/audio_system_test_util.h
index 1e30206..b8df0bf9 100644
--- a/media/audio/audio_system_test_util.h
+++ b/media/audio/audio_system_test_util.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_AUDIO_AUDIO_SYSTEM_TEST_UTIL_H_
#define MEDIA_AUDIO_AUDIO_SYSTEM_TEST_UTIL_H_
+#include <optional>
+
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/run_loop.h"
@@ -14,7 +16,6 @@
#include "media/audio/mock_audio_manager.h"
#include "media/base/audio_parameters.h"
#include "testing/gmock/include/gmock/gmock.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -36,7 +37,7 @@
AudioSystem::OnAudioParamsCallback GetAudioParamsCallback(
const base::Location& location,
base::OnceClosure on_cb_received,
- const absl::optional<AudioParameters>& expected_params);
+ const std::optional<AudioParameters>& expected_params);
AudioSystem::OnBoolCallback GetBoolCallback(const base::Location& location,
base::OnceClosure on_cb_received,
@@ -50,20 +51,20 @@
AudioSystem::OnInputDeviceInfoCallback GetInputDeviceInfoCallback(
const base::Location& location,
base::OnceClosure on_cb_received,
- const absl::optional<AudioParameters>& expected_input,
- const absl::optional<std::string>& expected_associated_device_id);
+ const std::optional<AudioParameters>& expected_input,
+ const std::optional<std::string>& expected_associated_device_id);
AudioSystem::OnDeviceIdCallback GetDeviceIdCallback(
const base::Location& location,
base::OnceClosure on_cb_received,
- const absl::optional<std::string>& expected_id);
+ const std::optional<std::string>& expected_id);
private:
// Methods to verify correctness of received data.
void OnAudioParams(const std::string& from_here,
base::OnceClosure on_cb_received,
- const absl::optional<AudioParameters>& expected,
- const absl::optional<AudioParameters>& received);
+ const std::optional<AudioParameters>& expected,
+ const std::optional<AudioParameters>& received);
void OnBool(const std::string& from_here,
base::OnceClosure on_cb_received,
@@ -79,15 +80,15 @@
void OnInputDeviceInfo(
const std::string& from_here,
base::OnceClosure on_cb_received,
- const absl::optional<AudioParameters>& expected_input,
- const absl::optional<std::string>& expected_associated_device_id,
- const absl::optional<AudioParameters>& input,
- const absl::optional<std::string>& associated_device_id);
+ const std::optional<AudioParameters>& expected_input,
+ const std::optional<std::string>& expected_associated_device_id,
+ const std::optional<AudioParameters>& input,
+ const std::optional<std::string>& associated_device_id);
void OnDeviceId(const std::string& from_here,
base::OnceClosure on_cb_received,
- const absl::optional<std::string>& expected_id,
- const absl::optional<std::string>& result_id);
+ const std::optional<std::string>& expected_id,
+ const std::optional<std::string>& result_id);
THREAD_CHECKER(thread_checker_);
};
@@ -165,7 +166,7 @@
AudioDeviceDescription::kDefaultDeviceId,
this->expectations_.GetAudioParamsCallback(
FROM_HERE, wait_loop.QuitClosure(),
- absl::optional<AudioParameters>()));
+ std::optional<AudioParameters>()));
wait_loop.Run();
}
@@ -195,7 +196,7 @@
AudioDeviceDescription::kDefaultDeviceId,
this->expectations_.GetAudioParamsCallback(
FROM_HERE, wait_loop.QuitClosure(),
- absl::optional<AudioParameters>()));
+ std::optional<AudioParameters>()));
wait_loop.Run();
}
@@ -206,7 +207,7 @@
this->audio_system()->GetOutputStreamParameters(
"non-default-device-id", this->expectations_.GetAudioParamsCallback(
FROM_HERE, wait_loop.QuitClosure(),
- absl::optional<AudioParameters>()));
+ std::optional<AudioParameters>()));
wait_loop.Run();
}
@@ -326,7 +327,7 @@
"non-default-device-id",
this->expectations_.GetInputDeviceInfoCallback(
FROM_HERE, wait_loop.QuitClosure(), this->input_params_,
- absl::optional<std::string>()));
+ std::optional<std::string>()));
wait_loop.Run();
}
diff --git a/media/audio/audio_thread_hang_monitor.cc b/media/audio/audio_thread_hang_monitor.cc
index 6a1ab23..6798b1d 100644
--- a/media/audio/audio_thread_hang_monitor.cc
+++ b/media/audio/audio_thread_hang_monitor.cc
@@ -43,7 +43,7 @@
// static
AudioThreadHangMonitor::Ptr AudioThreadHangMonitor::Create(
HangAction hang_action,
- absl::optional<base::TimeDelta> hang_deadline,
+ std::optional<base::TimeDelta> hang_deadline,
const base::TickClock* clock,
scoped_refptr<base::SingleThreadTaskRunner> audio_thread_task_runner,
scoped_refptr<base::SequencedTaskRunner> monitor_task_runner) {
@@ -72,7 +72,7 @@
AudioThreadHangMonitor::AudioThreadHangMonitor(
HangAction hang_action,
- absl::optional<base::TimeDelta> hang_deadline,
+ std::optional<base::TimeDelta> hang_deadline,
const base::TickClock* clock,
scoped_refptr<base::SingleThreadTaskRunner> audio_thread_task_runner)
: clock_(clock),
diff --git a/media/audio/audio_thread_hang_monitor.h b/media/audio/audio_thread_hang_monitor.h
index 68831f0..2498db0 100644
--- a/media/audio/audio_thread_hang_monitor.h
+++ b/media/audio/audio_thread_hang_monitor.h
@@ -5,22 +5,21 @@
#ifndef MEDIA_AUDIO_AUDIO_THREAD_HANG_MONITOR_H_
#define MEDIA_AUDIO_AUDIO_THREAD_HANG_MONITOR_H_
-#include "base/memory/raw_ptr.h"
-#include "media/audio/audio_manager.h"
-
#include <atomic>
#include <memory>
+#include <optional>
#include "base/functional/callback_forward.h"
#include "base/gtest_prod_util.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/sequence_checker.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
+#include "media/audio/audio_manager.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class TickClock;
@@ -68,7 +67,7 @@
// zero, a default value is used.
static Ptr Create(
HangAction hang_action,
- absl::optional<base::TimeDelta> hang_deadline,
+ std::optional<base::TimeDelta> hang_deadline,
const base::TickClock* clock,
scoped_refptr<base::SingleThreadTaskRunner> audio_thread_task_runner,
scoped_refptr<base::SequencedTaskRunner> monitor_task_runner = nullptr);
@@ -98,7 +97,7 @@
AudioThreadHangMonitor(
HangAction hang_action,
- absl::optional<base::TimeDelta> hang_deadline,
+ std::optional<base::TimeDelta> hang_deadline,
const base::TickClock* clock,
scoped_refptr<base::SingleThreadTaskRunner> audio_thread_task_runner);
diff --git a/media/audio/audio_thread_hang_monitor_unittest.cc b/media/audio/audio_thread_hang_monitor_unittest.cc
index 71594c41..0d6faefc 100644
--- a/media/audio/audio_thread_hang_monitor_unittest.cc
+++ b/media/audio/audio_thread_hang_monitor_unittest.cc
@@ -4,6 +4,8 @@
#include "media/audio/audio_thread_hang_monitor.h"
+#include <optional>
+
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/synchronization/waitable_event.h"
@@ -13,7 +15,6 @@
#include "base/time/time.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
using testing::ElementsAre;
using testing::Test;
@@ -47,7 +48,7 @@
// runner since TaskEnvironment::FastForwardBy only works for the main
// thread.
hang_monitor_ = AudioThreadHangMonitor::Create(
- HangAction::kDoNothing, absl::nullopt, task_env_.GetMockTickClock(),
+ HangAction::kDoNothing, std::nullopt, task_env_.GetMockTickClock(),
audio_thread_.task_runner(), task_env_.GetMainThreadTaskRunner());
}
@@ -251,7 +252,7 @@
TEST_F(AudioThreadHangMonitorTest, DumpsWhenAudioThreadIsBlocked) {
hang_monitor_ = AudioThreadHangMonitor::Create(
- HangAction::kDump, absl::nullopt, task_env_.GetMockTickClock(),
+ HangAction::kDump, std::nullopt, task_env_.GetMockTickClock(),
audio_thread_.task_runner(), task_env_.GetMainThreadTaskRunner());
SetHangActionCallbacksForTesting();
RunUntilIdle();
@@ -268,7 +269,7 @@
TEST_F(AudioThreadHangMonitorTest, TerminatesProcessWhenAudioThreadIsBlocked) {
hang_monitor_ = AudioThreadHangMonitor::Create(
- HangAction::kTerminateCurrentProcess, absl::nullopt,
+ HangAction::kTerminateCurrentProcess, std::nullopt,
task_env_.GetMockTickClock(), audio_thread_.task_runner(),
task_env_.GetMainThreadTaskRunner());
SetHangActionCallbacksForTesting();
@@ -287,7 +288,7 @@
TEST_F(AudioThreadHangMonitorTest,
DumpsAndTerminatesProcessWhenAudioThreadIsBlocked) {
hang_monitor_ = AudioThreadHangMonitor::Create(
- HangAction::kDumpAndTerminateCurrentProcess, absl::nullopt,
+ HangAction::kDumpAndTerminateCurrentProcess, std::nullopt,
task_env_.GetMockTickClock(), audio_thread_.task_runner(),
task_env_.GetMainThreadTaskRunner());
SetHangActionCallbacksForTesting();
diff --git a/media/audio/audio_thread_impl.cc b/media/audio/audio_thread_impl.cc
index 4bb4996..6ead700 100644
--- a/media/audio/audio_thread_impl.cc
+++ b/media/audio/audio_thread_impl.cc
@@ -4,12 +4,13 @@
#include "media/audio/audio_thread_impl.h"
+#include <optional>
+
#include "base/message_loop/message_pump_type.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/default_tick_clock.h"
#include "build/build_config.h"
#include "media/audio/audio_thread_hang_monitor.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -40,7 +41,7 @@
// https://crbug.com/946968: The hang monitor possibly causes crashes on
// Android
hang_monitor_ = AudioThreadHangMonitor::Create(
- AudioThreadHangMonitor::HangAction::kDoNothing, absl::nullopt,
+ AudioThreadHangMonitor::HangAction::kDoNothing, std::nullopt,
base::DefaultTickClock::GetInstance(), task_runner_);
#endif
}
diff --git a/media/audio/fuchsia/audio_output_stream_fuchsia.cc b/media/audio/fuchsia/audio_output_stream_fuchsia.cc
index 38deffb..4627ead 100644
--- a/media/audio/fuchsia/audio_output_stream_fuchsia.cc
+++ b/media/audio/fuchsia/audio_output_stream_fuchsia.cc
@@ -23,7 +23,7 @@
const uint32_t kBufferId = 0;
-absl::optional<fuchsia::media::AudioRenderUsage> GetStreamUsage(
+std::optional<fuchsia::media::AudioRenderUsage> GetStreamUsage(
const AudioParameters& parameters) {
int usage_flags = parameters.effects() &
(AudioParameters::FUCHSIA_RENDER_USAGE_BACKGROUND |
@@ -51,7 +51,7 @@
return fuchsia::media::AudioRenderUsage::MEDIA;
default:
DLOG(FATAL) << "More than one FUCHSIA_RENDER_USAGE flag is set";
- return absl::nullopt;
+ return std::nullopt;
}
}
diff --git a/media/audio/fuchsia/audio_output_stream_fuchsia.h b/media/audio/fuchsia/audio_output_stream_fuchsia.h
index 775675ab..ff9c23cc 100644
--- a/media/audio/fuchsia/audio_output_stream_fuchsia.h
+++ b/media/audio/fuchsia/audio_output_stream_fuchsia.h
@@ -7,12 +7,13 @@
#include <fuchsia/media/cpp/fidl.h>
+#include <optional>
+
#include "base/memory/shared_memory_mapping.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "media/audio/audio_io.h"
#include "media/base/audio_parameters.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -96,7 +97,7 @@
// Current min lead time for the stream. This value is not set until the first
// AudioRenderer::OnMinLeadTimeChanged event.
- absl::optional<base::TimeDelta> min_lead_time_;
+ std::optional<base::TimeDelta> min_lead_time_;
// Timer that's scheduled to call PumpSamples().
base::DeadlineTimer timer_;
diff --git a/media/audio/mac/audio_device_listener_mac.cc b/media/audio/mac/audio_device_listener_mac.cc
index 047c284..82b2e3a6 100644
--- a/media/audio/mac/audio_device_listener_mac.cc
+++ b/media/audio/mac/audio_device_listener_mac.cc
@@ -4,6 +4,7 @@
#include "media/audio/mac/audio_device_listener_mac.h"
+#include <optional>
#include <vector>
#include "base/apple/osstatus_logging.h"
@@ -16,7 +17,6 @@
#include "base/thread_annotations.h"
#include "media/audio/audio_manager.h"
#include "media/audio/mac/core_audio_util_mac.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -391,7 +391,7 @@
return core_audio_mac::IsOutputDevice(id);
}
-absl::optional<uint32_t> AudioDeviceListenerMac::GetDeviceSource(
+std::optional<uint32_t> AudioDeviceListenerMac::GetDeviceSource(
AudioObjectID device_id,
bool is_input) {
return core_audio_mac::GetDeviceSource(device_id, is_input);
diff --git a/media/audio/mac/audio_device_listener_mac.h b/media/audio/mac/audio_device_listener_mac.h
index 67dfd8a..09ce96e7 100644
--- a/media/audio/mac/audio_device_listener_mac.h
+++ b/media/audio/mac/audio_device_listener_mac.h
@@ -9,13 +9,13 @@
#include <map>
#include <memory>
+#include <optional>
#include <utility>
#include "base/containers/flat_map.h"
#include "base/functional/callback.h"
#include "base/threading/thread_checker.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -84,8 +84,8 @@
// Virtual for testing.
virtual std::vector<AudioObjectID> GetAllAudioDeviceIDs();
virtual bool IsOutputDevice(AudioObjectID id);
- virtual absl::optional<uint32_t> GetDeviceSource(AudioObjectID device_id,
- bool is_input);
+ virtual std::optional<uint32_t> GetDeviceSource(AudioObjectID device_id,
+ bool is_input);
virtual OSStatus AddPropertyListener(
AudioObjectID inObjectID,
const AudioObjectPropertyAddress* inAddress,
diff --git a/media/audio/mac/audio_device_listener_mac_unittest.cc b/media/audio/mac/audio_device_listener_mac_unittest.cc
index 913f086..8816800 100644
--- a/media/audio/mac/audio_device_listener_mac_unittest.cc
+++ b/media/audio/mac/audio_device_listener_mac_unittest.cc
@@ -7,6 +7,7 @@
#include <CoreAudio/AudioHardware.h>
#include <memory>
+#include <optional>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
@@ -15,7 +16,6 @@
#include "base/test/task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
using testing::Return;
@@ -38,7 +38,7 @@
MOCK_METHOD0(GetAllAudioDeviceIDs, std::vector<AudioObjectID>());
MOCK_METHOD1(IsOutputDevice, bool(AudioObjectID));
- MOCK_METHOD2(GetDeviceSource, absl::optional<uint32_t>(AudioObjectID, bool));
+ MOCK_METHOD2(GetDeviceSource, std::optional<uint32_t>(AudioObjectID, bool));
OSStatus AddPropertyListener(AudioObjectID inObjectID,
const AudioObjectPropertyAddress* inAddress,
@@ -404,7 +404,7 @@
// Device 1 is an input device.
EXPECT_CALL(system_audio_mock, GetDeviceSource(1, false))
.Times(3)
- .WillRepeatedly(Return(absl::optional<uint32_t>()));
+ .WillRepeatedly(Return(std::optional<uint32_t>()));
EXPECT_CALL(system_audio_mock, GetDeviceSource(1, true))
.Times(3)
.WillRepeatedly(Return(123));
@@ -413,7 +413,7 @@
EXPECT_CALL(system_audio_mock, GetDeviceSource(2, false))
.WillOnce(Return(123));
EXPECT_CALL(system_audio_mock, GetDeviceSource(2, true))
- .WillOnce(Return(absl::optional<uint32_t>()));
+ .WillOnce(Return(std::optional<uint32_t>()));
// Device 3 is both an input and output device.
EXPECT_CALL(system_audio_mock, GetDeviceSource(3, false))
@@ -470,7 +470,7 @@
// Device 1 is an input device.
EXPECT_CALL(system_audio_mock, GetDeviceSource(1, false))
.Times(3)
- .WillRepeatedly(Return(absl::optional<uint32_t>()));
+ .WillRepeatedly(Return(std::optional<uint32_t>()));
EXPECT_CALL(system_audio_mock, GetDeviceSource(1, true))
.Times(3)
.WillRepeatedly(Return(123));
@@ -479,7 +479,7 @@
EXPECT_CALL(system_audio_mock, GetDeviceSource(2, false))
.WillOnce(Return(123));
EXPECT_CALL(system_audio_mock, GetDeviceSource(2, true))
- .WillOnce(Return(absl::optional<uint32_t>()));
+ .WillOnce(Return(std::optional<uint32_t>()));
// Device 3 is both an input and output device.
EXPECT_CALL(system_audio_mock, GetDeviceSource(3, false))
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc
index 402efe6d..675f49b 100644
--- a/media/audio/mac/audio_manager_mac.cc
+++ b/media/audio/mac/audio_manager_mac.cc
@@ -6,6 +6,7 @@
#include <limits>
#include <memory>
+#include <optional>
#include <utility>
#include <vector>
@@ -41,7 +42,6 @@
#include "media/base/limits.h"
#include "media/base/mac/audio_latency_mac.h"
#include "media/base/media_switches.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -149,13 +149,13 @@
continue;
}
- absl::optional<std::string> unique_id =
+ std::optional<std::string> unique_id =
core_audio_mac::GetDeviceUniqueID(device_id);
if (!unique_id) {
continue;
}
- absl::optional<std::string> label =
+ std::optional<std::string> label =
core_audio_mac::GetDeviceLabel(device_id, is_input);
if (!label) {
continue;
@@ -581,7 +581,7 @@
// Get unique ID of input device which would be used to match with unique IDs
// of all other devices.
- absl::optional<std::string> input_unique_id = GetDeviceUniqueID(device_id);
+ std::optional<std::string> input_unique_id = GetDeviceUniqueID(device_id);
if (!input_unique_id) {
return result_ids;
}
@@ -601,7 +601,7 @@
// Iterate through all device IDs and match the unique IDs base to find the
// related devices.
for (const auto& id : GetAllAudioDeviceIDs()) {
- absl::optional<std::string> unique_id = GetDeviceUniqueID(id);
+ std::optional<std::string> unique_id = GetDeviceUniqueID(id);
if (!unique_id) {
continue;
}
@@ -624,20 +624,20 @@
std::vector<AudioObjectID> AudioManagerMac::GetRelatedDeviceIDs(
AudioObjectID device_id) {
DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread());
- absl::optional<uint32_t> transport_type = GetDeviceTransportType(device_id);
+ std::optional<uint32_t> transport_type = GetDeviceTransportType(device_id);
if (transport_type && *transport_type == kAudioDeviceTransportTypeBluetooth) {
return GetRelatedBluetoothDeviceIDs(device_id);
}
return GetRelatedNonBluetoothDeviceIDs(device_id);
}
-absl::optional<std::string> AudioManagerMac::GetDeviceUniqueID(
+std::optional<std::string> AudioManagerMac::GetDeviceUniqueID(
AudioObjectID device_id) {
DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread());
return core_audio_mac::GetDeviceUniqueID(device_id);
}
-absl::optional<uint32_t> AudioManagerMac::GetDeviceTransportType(
+std::optional<uint32_t> AudioManagerMac::GetDeviceTransportType(
AudioObjectID device_id) {
DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread());
return core_audio_mac::GetDeviceTransportType(device_id);
@@ -752,7 +752,7 @@
// to detect if a device (e.g. a digital output device) is actually connected
// to an endpoint, so we cannot randomly pick a device.
if (related_output_device_ids.size() == 1) {
- absl::optional<std::string> related_unique_id =
+ std::optional<std::string> related_unique_id =
GetDeviceUniqueID(*related_output_device_ids.begin());
if (related_unique_id) {
return std::move(*related_unique_id);
diff --git a/media/audio/mac/audio_manager_mac.h b/media/audio/mac/audio_manager_mac.h
index 7a46c37..367c4b4 100644
--- a/media/audio/mac/audio_manager_mac.h
+++ b/media/audio/mac/audio_manager_mac.h
@@ -207,12 +207,11 @@
// Returns a string with a unique device ID for the given |device_id|, or no
// value if there is an error.
- virtual absl::optional<std::string> GetDeviceUniqueID(
- AudioObjectID device_id);
+ virtual std::optional<std::string> GetDeviceUniqueID(AudioObjectID device_id);
// Returns the transport type of the given |device_id|, or no value if
// |device_id| has no source or if there is an error.
- virtual absl::optional<uint32_t> GetDeviceTransportType(
+ virtual std::optional<uint32_t> GetDeviceTransportType(
AudioObjectID device_id);
void ShutdownOnAudioThread() override;
diff --git a/media/audio/mac/audio_manager_mac_unittest.cc b/media/audio/mac/audio_manager_mac_unittest.cc
index 935d566..14c4d7c 100644
--- a/media/audio/mac/audio_manager_mac_unittest.cc
+++ b/media/audio/mac/audio_manager_mac_unittest.cc
@@ -24,8 +24,8 @@
: AudioManagerMac(std::move(audio_thread), audio_log_factory) {}
MOCK_METHOD0(GetAllAudioDeviceIDs, std::vector<AudioObjectID>());
- MOCK_METHOD1(GetDeviceTransportType, absl::optional<uint32_t>(AudioObjectID));
- MOCK_METHOD1(GetDeviceUniqueID, absl::optional<std::string>(AudioObjectID));
+ MOCK_METHOD1(GetDeviceTransportType, std::optional<uint32_t>(AudioObjectID));
+ MOCK_METHOD1(GetDeviceUniqueID, std::optional<std::string>(AudioObjectID));
MOCK_METHOD1(GetRelatedNonBluetoothDeviceIDs,
std::vector<AudioObjectID>(AudioObjectID));
};
@@ -133,7 +133,7 @@
.WillRepeatedly(Return(std::vector<AudioObjectID>{2}));
// DeviceID: 3
EXPECT_CALL(audio_manager_mock, GetDeviceTransportType(/*device_id=*/3))
- .WillRepeatedly(Return(absl::nullopt));
+ .WillRepeatedly(Return(std::nullopt));
EXPECT_CALL(audio_manager_mock, GetDeviceUniqueID(/*device_id=*/3))
.WillRepeatedly(Return("inbuilt_output_device"));
EXPECT_CALL(audio_manager_mock,
diff --git a/media/audio/mac/core_audio_util_mac.cc b/media/audio/mac/core_audio_util_mac.cc
index ac33592..a9d8631 100644
--- a/media/audio/mac/core_audio_util_mac.cc
+++ b/media/audio/mac/core_audio_util_mac.cc
@@ -32,7 +32,7 @@
"Media.Audio.Mac.AggregateDeviceCompositionPropertyIsNull", is_null);
}
-absl::optional<std::string> GetDeviceStringProperty(
+std::optional<std::string> GetDeviceStringProperty(
AudioObjectID device_id,
AudioObjectPropertySelector property_selector) {
CFStringRef property_value = nullptr;
@@ -48,11 +48,11 @@
OSSTATUS_DLOG(WARNING, result)
<< "Failed to read string property " << property_selector
<< " for device " << device_id;
- return absl::nullopt;
+ return std::nullopt;
}
if (!property_value)
- return absl::nullopt;
+ return std::nullopt;
std::string device_property = base::SysCFStringRefToUTF8(property_value);
CFRelease(property_value);
@@ -60,7 +60,7 @@
return device_property;
}
-absl::optional<uint32_t> GetDeviceUint32Property(
+std::optional<uint32_t> GetDeviceUint32Property(
AudioObjectID device_id,
AudioObjectPropertySelector property_selector,
AudioObjectPropertyScope property_scope) {
@@ -72,7 +72,7 @@
device_id, &property_address, 0 /* inQualifierDataSize */,
nullptr /* inQualifierData */, &size, &property_value);
if (result != noErr)
- return absl::nullopt;
+ return std::nullopt;
return property_value;
}
@@ -132,11 +132,11 @@
return device_ids;
}
-absl::optional<std::string> GetDeviceName(AudioObjectID device_id) {
+std::optional<std::string> GetDeviceName(AudioObjectID device_id) {
return GetDeviceStringProperty(device_id, kAudioObjectPropertyName);
}
-absl::optional<std::string> GetDeviceModel(AudioObjectID device_id) {
+std::optional<std::string> GetDeviceModel(AudioObjectID device_id) {
return GetDeviceStringProperty(device_id, kAudioDevicePropertyModelUID);
}
@@ -187,9 +187,9 @@
}
}
-absl::optional<std::string> TranslateDeviceSource(AudioObjectID device_id,
- UInt32 source_id,
- bool is_input) {
+std::optional<std::string> TranslateDeviceSource(AudioObjectID device_id,
+ UInt32 source_id,
+ bool is_input) {
CFStringRef source_name = nullptr;
AudioValueTranslation translation;
translation.mInputData = &source_id;
@@ -206,7 +206,7 @@
device_id, &property_address, 0 /* inQualifierDataSize */,
nullptr /* inQualifierData */, &translation_size, &translation);
if (result)
- return absl::nullopt;
+ return std::nullopt;
std::string ret = base::SysCFStringRefToUTF8(source_name);
CFRelease(source_name);
@@ -225,14 +225,14 @@
return GetAudioObjectIDs(device_id, kAudioDevicePropertyRelatedDevices);
}
-absl::optional<std::string> GetDeviceUniqueID(AudioObjectID device_id) {
+std::optional<std::string> GetDeviceUniqueID(AudioObjectID device_id) {
return GetDeviceStringProperty(device_id, kAudioDevicePropertyDeviceUID);
}
-absl::optional<std::string> GetDeviceLabel(AudioObjectID device_id,
- bool is_input) {
- absl::optional<std::string> device_label;
- absl::optional<uint32_t> source = GetDeviceSource(device_id, is_input);
+std::optional<std::string> GetDeviceLabel(AudioObjectID device_id,
+ bool is_input) {
+ std::optional<std::string> device_label;
+ std::optional<uint32_t> source = GetDeviceSource(device_id, is_input);
if (source) {
device_label = TranslateDeviceSource(device_id, *source, is_input);
}
@@ -240,14 +240,14 @@
if (!device_label) {
device_label = GetDeviceName(device_id);
if (!device_label)
- return absl::nullopt;
+ return std::nullopt;
}
std::string suffix;
- absl::optional<uint32_t> transport_type = GetDeviceTransportType(device_id);
+ std::optional<uint32_t> transport_type = GetDeviceTransportType(device_id);
if (transport_type) {
if (*transport_type == kAudioDeviceTransportTypeUSB) {
- absl::optional<std::string> model = GetDeviceModel(device_id);
+ std::optional<std::string> model = GetDeviceModel(device_id);
if (model) {
suffix = UsbVidPidFromModel(*model);
}
@@ -268,13 +268,13 @@
InputOutputScope(is_input));
}
-absl::optional<uint32_t> GetDeviceSource(AudioObjectID device_id,
- bool is_input) {
+std::optional<uint32_t> GetDeviceSource(AudioObjectID device_id,
+ bool is_input) {
return GetDeviceUint32Property(device_id, kAudioDevicePropertyDataSource,
InputOutputScope(is_input));
}
-absl::optional<uint32_t> GetDeviceTransportType(AudioObjectID device_id) {
+std::optional<uint32_t> GetDeviceTransportType(AudioObjectID device_id) {
return GetDeviceUint32Property(device_id, kAudioDevicePropertyTransportType,
kAudioObjectPropertyScopeGlobal);
}
diff --git a/media/audio/mac/core_audio_util_mac.h b/media/audio/mac/core_audio_util_mac.h
index f5396c3..c7417b0 100644
--- a/media/audio/mac/core_audio_util_mac.h
+++ b/media/audio/mac/core_audio_util_mac.h
@@ -6,15 +6,14 @@
#define MEDIA_AUDIO_MAC_CORE_AUDIO_UTIL_MAC_H_
#include <AudioUnit/AudioUnit.h>
+#include <CoreAudio/CoreAudio.h>
+#include <optional>
#include <string>
#include <vector>
#include "base/time/time.h"
#include "build/build_config.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
-
-#include <CoreAudio/CoreAudio.h>
namespace media {
namespace core_audio_mac {
@@ -30,13 +29,13 @@
// Returns a string with a unique device ID for the given |device_id|, or no
// value if there is an error.
-absl::optional<std::string> GetDeviceUniqueID(AudioObjectID device_id);
+std::optional<std::string> GetDeviceUniqueID(AudioObjectID device_id);
// Returns a string with a descriptive label for the given |device_id|, or no
// value if there is an error. The returned label is based on several
// characteristics of the device.
-absl::optional<std::string> GetDeviceLabel(AudioObjectID device_id,
- bool is_input);
+std::optional<std::string> GetDeviceLabel(AudioObjectID device_id,
+ bool is_input);
// Returns the number of input or output streams associated with the given
// |device_id|. Returns zero if there are no streams or if there is an error.
@@ -44,12 +43,11 @@
// Returns the source associated with the given |device_id|, or no value if
// |device_id| has no source or if there is an error.
-absl::optional<uint32_t> GetDeviceSource(AudioObjectID device_id,
- bool is_input);
+std::optional<uint32_t> GetDeviceSource(AudioObjectID device_id, bool is_input);
// Returns the transport type of the given |device_id|, or no value if
// |device_id| has no source or if there is an error.
-absl::optional<uint32_t> GetDeviceTransportType(AudioObjectID device_id);
+std::optional<uint32_t> GetDeviceTransportType(AudioObjectID device_id);
// Returns whether or not the |device_id| corresponds to a private, aggregate
// device. Such a device gets created by instantiating a VoiceProcessingIO
diff --git a/media/audio/win/audio_low_latency_input_win.h b/media/audio/win/audio_low_latency_input_win.h
index f3f692d..aacc028 100644
--- a/media/audio/win/audio_low_latency_input_win.h
+++ b/media/audio/win/audio_low_latency_input_win.h
@@ -361,7 +361,7 @@
// into a TimeTick value and a default base::TimeTicks::Now() is larger than
// 500 msec. A true return value should trigger usage of "fake" audio
// timestamps instead of default which are QPC based.
- absl::optional<bool> use_fake_audio_capture_timestamps_;
+ std::optional<bool> use_fake_audio_capture_timestamps_;
SEQUENCE_CHECKER(sequence_checker_);
};
diff --git a/media/base/android/media_codec_bridge.h b/media/base/android/media_codec_bridge.h
index 34c65d4..c68f408 100644
--- a/media/base/android/media_codec_bridge.h
+++ b/media/base/android/media_codec_bridge.h
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <optional>
#include <string>
#include <vector>
@@ -18,7 +19,6 @@
#include "media/base/encryption_scheme.h"
#include "media/base/media_export.h"
#include "media/base/status.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/size.h"
@@ -148,7 +148,7 @@
const std::string& iv,
const std::vector<SubsampleEntry>& subsamples,
EncryptionScheme encryption_scheme,
- absl::optional<EncryptionPattern> encryption_pattern,
+ std::optional<EncryptionPattern> encryption_pattern,
base::TimeDelta presentation_time) = 0;
// Submits an empty buffer with the END_OF_STREAM flag set.
diff --git a/media/base/android/media_codec_bridge_impl.cc b/media/base/android/media_codec_bridge_impl.cc
index 0bb5c86..5b580a0 100644
--- a/media/base/android/media_codec_bridge_impl.cc
+++ b/media/base/android/media_codec_bridge_impl.cc
@@ -608,7 +608,7 @@
const std::string& iv,
const std::vector<SubsampleEntry>& subsamples,
EncryptionScheme encryption_scheme,
- absl::optional<EncryptionPattern> encryption_pattern,
+ std::optional<EncryptionPattern> encryption_pattern,
base::TimeDelta presentation_time) {
DVLOG(3) << __func__ << " " << index << ": " << data_size;
if (data_size >
diff --git a/media/base/android/media_codec_bridge_impl.h b/media/base/android/media_codec_bridge_impl.h
index a5cca64..f8c6bb9 100644
--- a/media/base/android/media_codec_bridge_impl.h
+++ b/media/base/android/media_codec_bridge_impl.h
@@ -57,7 +57,7 @@
// VP9 HDR metadata is only embedded in the container. HDR10 metadata is
// embedded in the video stream.
- absl::optional<gfx::HDRMetadata> hdr_metadata;
+ std::optional<gfx::HDRMetadata> hdr_metadata;
// Enables the async MediaCodec.Callback API. |on_buffers_available_cb|
// will be called when input or output buffers are available. This will be
@@ -132,7 +132,7 @@
const std::string& iv,
const std::vector<SubsampleEntry>& subsamples,
EncryptionScheme encryption_scheme,
- absl::optional<EncryptionPattern> encryption_pattern,
+ std::optional<EncryptionPattern> encryption_pattern,
base::TimeDelta presentation_time) override;
void QueueEOS(int input_buffer_index) override;
MediaCodecResult DequeueInputBuffer(base::TimeDelta timeout,
diff --git a/media/base/android/media_codec_loop.h b/media/base/android/media_codec_loop.h
index fca4f20..49e37b13 100644
--- a/media/base/android/media_codec_loop.h
+++ b/media/base/android/media_codec_loop.h
@@ -6,6 +6,7 @@
#define MEDIA_BASE_ANDROID_MEDIA_CODEC_LOOP_H_
#include <memory>
+#include <optional>
#include <utility>
#include <vector>
@@ -22,7 +23,6 @@
#include "media/base/media_export.h"
#include "media/base/subsample_entry.h"
#include "media/base/waiting.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
// MediaCodecLoop is based on Android's MediaCodec API.
// The MediaCodec API is required to play encrypted (as in EME) content on
@@ -125,7 +125,7 @@
bool is_eos = false;
EncryptionScheme encryption_scheme = EncryptionScheme::kUnencrypted;
- absl::optional<EncryptionPattern> encryption_pattern;
+ std::optional<EncryptionPattern> encryption_pattern;
};
// Handy enum for "no buffer".
diff --git a/media/base/android/media_codec_util.cc b/media/base/android/media_codec_util.cc
index 0ec0e02..093e5116 100644
--- a/media/base/android/media_codec_util.cc
+++ b/media/base/android/media_codec_util.cc
@@ -286,9 +286,9 @@
}
// static
-absl::optional<gfx::Size> MediaCodecUtil::LookupCodedSizeAlignment(
+std::optional<gfx::Size> MediaCodecUtil::LookupCodedSizeAlignment(
std::string_view name,
- absl::optional<int> host_sdk_int) {
+ std::optional<int> host_sdk_int) {
// Below we build a map of codec names to coded size alignments. We do this on
// a best effort basis to avoid glitches during a coded size change.
//
@@ -359,7 +359,7 @@
}
}
- return absl::nullopt;
+ return std::nullopt;
}
// static
diff --git a/media/base/android/media_codec_util.h b/media/base/android/media_codec_util.h
index 2dbf7ee..aba77c0 100644
--- a/media/base/android/media_codec_util.h
+++ b/media/base/android/media_codec_util.h
@@ -7,6 +7,7 @@
#include <jni.h>
+#include <optional>
#include <set>
#include <string>
#include <string_view>
@@ -18,7 +19,6 @@
#include "media/base/media_export.h"
#include "media/base/sample_format.h"
#include "media/base/video_codecs.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
@@ -73,11 +73,11 @@
// (64, 1) would mean visible width should be rounded up to the nearest
// multiple of 64 and height should be left untouched.
//
- // Returns absl::nullopt if the decoder isn't recognized. `host_sdk_int` may
+ // Returns std::nullopt if the decoder isn't recognized. `host_sdk_int` may
// be set for testing purposes.
- static absl::optional<gfx::Size> LookupCodedSizeAlignment(
+ static std::optional<gfx::Size> LookupCodedSizeAlignment(
std::string_view name,
- absl::optional<int> host_sdk_int = absl::nullopt);
+ std::optional<int> host_sdk_int = std::nullopt);
//
// ***************************************************************
diff --git a/media/base/android/media_codec_util_unittest.cc b/media/base/android/media_codec_util_unittest.cc
index bde5fc7..3a61e51 100644
--- a/media/base/android/media_codec_util_unittest.cc
+++ b/media/base/android/media_codec_util_unittest.cc
@@ -25,7 +25,7 @@
};
TEST_F(MediaCodecUtilTest, GuessCodedSizeAlignment) {
- EXPECT_EQ(absl::nullopt,
+ EXPECT_EQ(std::nullopt,
MediaCodecUtil::LookupCodedSizeAlignment("c2.fake.h264.decoder"));
// Software AVC and HEVC decoders have a weird width-only alignment. This also
diff --git a/media/base/android/media_player_bridge.h b/media/base/android/media_player_bridge.h
index f9ebba0..baee0892 100644
--- a/media/base/android/media_player_bridge.h
+++ b/media/base/android/media_player_bridge.h
@@ -293,7 +293,7 @@
std::unique_ptr<MediaPlayerListener> listener_;
// Pending playback rate while player is preparing.
- absl::optional<double> pending_playback_rate_;
+ std::optional<double> pending_playback_rate_;
// Weak pointer passed to `listener_` for callbacks.
// NOTE: Weak pointers must be invalidated before all other member variables.
diff --git a/media/base/android/mock_media_codec_bridge.h b/media/base/android/mock_media_codec_bridge.h
index 5fdfbba0..5352cb7 100644
--- a/media/base/android/mock_media_codec_bridge.h
+++ b/media/base/android/mock_media_codec_bridge.h
@@ -54,7 +54,7 @@
const std::string& iv,
const std::vector<SubsampleEntry>& subsamples,
EncryptionScheme encryption_scheme,
- absl::optional<EncryptionPattern> encryption_pattern,
+ std::optional<EncryptionPattern> encryption_pattern,
base::TimeDelta presentation_time));
MOCK_METHOD1(QueueEOS, void(int input_buffer_index));
MOCK_METHOD2(DequeueInputBuffer,
diff --git a/media/base/android/test_destruction_observable.h b/media/base/android/test_destruction_observable.h
index 4e43417..56bc45f 100644
--- a/media/base/android/test_destruction_observable.h
+++ b/media/base/android/test_destruction_observable.h
@@ -5,9 +5,10 @@
#ifndef MEDIA_BASE_ANDROID_TEST_DESTRUCTION_OBSERVABLE_H_
#define MEDIA_BASE_ANDROID_TEST_DESTRUCTION_OBSERVABLE_H_
+#include <optional>
+
#include "base/functional/callback_helpers.h"
#include "base/memory/weak_ptr.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -62,7 +63,7 @@
bool destructed_;
// Whether to expect destruction. Unset if there is no expectation.
- absl::optional<bool> expect_destruction_;
+ std::optional<bool> expect_destruction_;
base::WeakPtrFactory<DestructionObserver> weak_factory_{this};
};
diff --git a/media/base/audio_encoder.h b/media/base/audio_encoder.h
index 909be2d..8b39640 100644
--- a/media/base/audio_encoder.h
+++ b/media/base/audio_encoder.h
@@ -6,6 +6,7 @@
#define MEDIA_BASE_AUDIO_ENCODER_H_
#include <memory>
+#include <optional>
#include <vector>
#include "base/functional/callback.h"
@@ -17,7 +18,6 @@
#include "media/base/encoder_status.h"
#include "media/base/media_export.h"
#include "media/base/timestamp_constants.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -83,16 +83,16 @@
AudioCodec codec;
- absl::optional<int> bitrate;
+ std::optional<int> bitrate;
int channels;
int sample_rate;
- absl::optional<BitrateMode> bitrate_mode;
+ std::optional<BitrateMode> bitrate_mode;
- absl::optional<OpusOptions> opus;
- absl::optional<AacOptions> aac;
+ std::optional<OpusOptions> opus;
+ std::optional<AacOptions> aac;
};
// A sequence of codec specific bytes, commonly known as extradata.
@@ -102,7 +102,7 @@
// invoked on the same sequence on which EncodeAudio() is called.
using OutputCB =
base::RepeatingCallback<void(EncodedAudioBuffer output,
- absl::optional<CodecDescription>)>;
+ std::optional<CodecDescription>)>;
// Signature of the callback to report errors.
using EncoderStatusCB = base::OnceCallback<void(EncoderStatus error)>;
diff --git a/media/base/audio_parameters.h b/media/base/audio_parameters.h
index 30b47cc..1827755 100644
--- a/media/base/audio_parameters.h
+++ b/media/base/audio_parameters.h
@@ -6,6 +6,8 @@
#define MEDIA_BASE_AUDIO_PARAMETERS_H_
#include <stdint.h>
+
+#include <optional>
#include <string>
#include <vector>
@@ -18,7 +20,6 @@
#include "media/base/channel_layout.h"
#include "media/base/media_shmem_export.h"
#include "media/base/sample_format.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -334,12 +335,12 @@
}
int frames_per_buffer() const { return frames_per_buffer_; }
- absl::optional<HardwareCapabilities> hardware_capabilities() const {
+ std::optional<HardwareCapabilities> hardware_capabilities() const {
return hardware_capabilities_;
}
void set_hardware_capabilities(
- const absl::optional<HardwareCapabilities>& hwc) {
+ const std::optional<HardwareCapabilities>& hwc) {
hardware_capabilities_ = hwc;
}
@@ -389,7 +390,7 @@
// Audio hardware specific parameters, these are treated as read-only and
// changing them has no effect.
- absl::optional<HardwareCapabilities> hardware_capabilities_;
+ std::optional<HardwareCapabilities> hardware_capabilities_;
};
// Comparison is useful when AudioParameters is used with std structures.
diff --git a/media/base/audio_processor_controls.h b/media/base/audio_processor_controls.h
index 305bb70..45b83dc 100644
--- a/media/base/audio_processor_controls.h
+++ b/media/base/audio_processor_controls.h
@@ -5,16 +5,17 @@
#ifndef MEDIA_BASE_AUDIO_PROCESSOR_CONTROLS_H_
#define MEDIA_BASE_AUDIO_PROCESSOR_CONTROLS_H_
+#include <optional>
+
#include "base/functional/callback.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
// Audio processing metrics that are reported by the audio service.
struct MEDIA_EXPORT AudioProcessingStats {
- absl::optional<double> echo_return_loss;
- absl::optional<double> echo_return_loss_enhancement;
+ std::optional<double> echo_return_loss;
+ std::optional<double> echo_return_loss_enhancement;
};
// Interactions with the audio service.
diff --git a/media/base/audio_renderer.h b/media/base/audio_renderer.h
index 7a1123e..49f212ee 100644
--- a/media/base/audio_renderer.h
+++ b/media/base/audio_renderer.h
@@ -5,12 +5,13 @@
#ifndef MEDIA_BASE_AUDIO_RENDERER_H_
#define MEDIA_BASE_AUDIO_RENDERER_H_
+#include <optional>
+
#include "base/functional/callback.h"
#include "base/time/time.h"
#include "media/base/buffering_state.h"
#include "media/base/media_export.h"
#include "media/base/pipeline_status.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -65,7 +66,7 @@
// Set a hint indicating target latency. See comment in renderer.h.
// |latency_hint| may be nullopt to indicate the hint has been cleared
// (restore UA default).
- virtual void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) = 0;
+ virtual void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) = 0;
// Sets a flag indicating that the AudioRenderer should use or avoid pitch
// preservation when playing back at speeds other than 1.0.
diff --git a/media/base/audio_renderer_mixer_input.h b/media/base/audio_renderer_mixer_input.h
index 81264b1d..548e86b 100644
--- a/media/base/audio_renderer_mixer_input.h
+++ b/media/base/audio_renderer_mixer_input.h
@@ -86,7 +86,7 @@
double volume_ GUARDED_BY(volume_lock_) = 1.0;
scoped_refptr<AudioRendererSink> sink_;
- absl::optional<OutputDeviceInfo> device_info_;
+ std::optional<OutputDeviceInfo> device_info_;
// AudioConverter::InputCallback implementation.
double ProvideInput(AudioBus* audio_bus,
diff --git a/media/base/cdm_context.cc b/media/base/cdm_context.cc
index 50d95a7..2a2d737 100644
--- a/media/base/cdm_context.cc
+++ b/media/base/cdm_context.cc
@@ -22,8 +22,8 @@
return nullptr;
}
-absl::optional<base::UnguessableToken> CdmContext::GetCdmId() const {
- return absl::nullopt;
+std::optional<base::UnguessableToken> CdmContext::GetCdmId() const {
+ return std::nullopt;
}
std::string CdmContext::CdmIdToString(const base::UnguessableToken* cdm_id) {
diff --git a/media/base/cdm_context.h b/media/base/cdm_context.h
index 260251b..0837309a 100644
--- a/media/base/cdm_context.h
+++ b/media/base/cdm_context.h
@@ -5,13 +5,14 @@
#ifndef MEDIA_BASE_CDM_CONTEXT_H_
#define MEDIA_BASE_CDM_CONTEXT_H_
+#include <optional>
+
#include "base/functional/callback.h"
#include "base/memory/scoped_refptr.h"
#include "base/unguessable_token.h"
#include "build/build_config.h"
#include "media/base/media_export.h"
#include "media/media_buildflags.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_WIN)
#include "media/base/win/media_foundation_cdm_proxy.h"
@@ -89,9 +90,9 @@
virtual Decryptor* GetDecryptor();
// Returns an ID that can be used to find a remote CDM, in which case this CDM
- // serves as a proxy to the remote one. Returns absl::nullopt when remote CDM
+ // serves as a proxy to the remote one. Returns std::nullopt when remote CDM
// is not supported (e.g. this CDM is a local CDM).
- virtual absl::optional<base::UnguessableToken> GetCdmId() const;
+ virtual std::optional<base::UnguessableToken> GetCdmId() const;
static std::string CdmIdToString(const base::UnguessableToken* cdm_id);
diff --git a/media/base/decoder_buffer.h b/media/base/decoder_buffer.h
index 9d3f963..1990bba 100644
--- a/media/base/decoder_buffer.h
+++ b/media/base/decoder_buffer.h
@@ -9,6 +9,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include <ostream>
#include <string>
#include <utility>
@@ -25,7 +26,6 @@
#include "media/base/decrypt_config.h"
#include "media/base/media_export.h"
#include "media/base/timestamp_constants.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -228,11 +228,11 @@
}
bool has_side_data() const { return side_data_.has_value(); }
- const absl::optional<DecoderBufferSideData>& side_data() const {
+ const std::optional<DecoderBufferSideData>& side_data() const {
return side_data_;
}
DecoderBufferSideData& WritableSideData();
- void set_side_data(const absl::optional<DecoderBufferSideData>& side_data) {
+ void set_side_data(const std::optional<DecoderBufferSideData>& side_data) {
side_data_ = side_data;
}
@@ -277,7 +277,7 @@
size_t size_;
// Structured side data.
- absl::optional<DecoderBufferSideData> side_data_;
+ std::optional<DecoderBufferSideData> side_data_;
// Encoded data, if it is stored in a read-only shared memory mapping.
base::ReadOnlySharedMemoryMapping read_only_mapping_;
diff --git a/media/base/decoder_buffer_side_data.h b/media/base/decoder_buffer_side_data.h
index 17f7e0f..950a5f5 100644
--- a/media/base/decoder_buffer_side_data.h
+++ b/media/base/decoder_buffer_side_data.h
@@ -7,10 +7,10 @@
#include <stdint.h>
+#include <optional>
#include <vector>
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/base/decoder_buffer_unittest.cc b/media/base/decoder_buffer_unittest.cc
index bda0906..2cf5ea3 100644
--- a/media/base/decoder_buffer_unittest.cc
+++ b/media/base/decoder_buffer_unittest.cc
@@ -243,7 +243,7 @@
EXPECT_EQ(buffer->side_data()->spatial_layers, kSpatialLayers);
EXPECT_EQ(buffer->side_data()->alpha_data, kAlphaData);
- buffer->set_side_data(absl::nullopt);
+ buffer->set_side_data(std::nullopt);
EXPECT_FALSE(buffer->has_side_data());
}
diff --git a/media/base/decrypt_config.cc b/media/base/decrypt_config.cc
index 7c348c6..9f45e30 100644
--- a/media/base/decrypt_config.cc
+++ b/media/base/decrypt_config.cc
@@ -21,7 +21,7 @@
const std::string& iv,
const std::vector<SubsampleEntry>& subsamples) {
return std::make_unique<DecryptConfig>(EncryptionScheme::kCenc, key_id, iv,
- subsamples, absl::nullopt);
+ subsamples, std::nullopt);
}
// static
@@ -29,7 +29,7 @@
const std::string& key_id,
const std::string& iv,
const std::vector<SubsampleEntry>& subsamples,
- absl::optional<EncryptionPattern> encryption_pattern) {
+ std::optional<EncryptionPattern> encryption_pattern) {
return std::make_unique<DecryptConfig>(EncryptionScheme::kCbcs, key_id, iv,
subsamples,
std::move(encryption_pattern));
@@ -40,7 +40,7 @@
const std::string& key_id,
const std::string& iv,
const std::vector<SubsampleEntry>& subsamples,
- absl::optional<EncryptionPattern> encryption_pattern)
+ std::optional<EncryptionPattern> encryption_pattern)
: encryption_scheme_(encryption_scheme),
key_id_(key_id),
iv_(iv),
diff --git a/media/base/decrypt_config.h b/media/base/decrypt_config.h
index 109f31c..3ab59a0 100644
--- a/media/base/decrypt_config.h
+++ b/media/base/decrypt_config.h
@@ -9,6 +9,7 @@
#include <iosfwd>
#include <memory>
+#include <optional>
#include <string>
#include <vector>
@@ -16,7 +17,6 @@
#include "media/base/encryption_scheme.h"
#include "media/base/media_export.h"
#include "media/base/subsample_entry.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -46,13 +46,13 @@
const std::string& key_id,
const std::string& iv,
const std::vector<SubsampleEntry>& subsamples,
- absl::optional<EncryptionPattern> encryption_pattern);
+ std::optional<EncryptionPattern> encryption_pattern);
DecryptConfig(EncryptionScheme encryption_scheme,
const std::string& key_id,
const std::string& iv,
const std::vector<SubsampleEntry>& subsamples,
- absl::optional<EncryptionPattern> encryption_pattern);
+ std::optional<EncryptionPattern> encryption_pattern);
DecryptConfig& operator=(const DecryptConfig&) = delete;
@@ -62,7 +62,7 @@
const std::string& iv() const { return iv_; }
const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; }
EncryptionScheme encryption_scheme() const { return encryption_scheme_; }
- const absl::optional<EncryptionPattern>& encryption_pattern() const {
+ const std::optional<EncryptionPattern>& encryption_pattern() const {
return encryption_pattern_;
}
@@ -97,7 +97,7 @@
const std::vector<SubsampleEntry> subsamples_;
// Only specified if |encryption_mode_| requires a pattern.
- absl::optional<EncryptionPattern> encryption_pattern_;
+ std::optional<EncryptionPattern> encryption_pattern_;
};
inline std::ostream& operator<<(std::ostream& os,
diff --git a/media/base/decrypt_config_unittest.cc b/media/base/decrypt_config_unittest.cc
index b6eb25fe..4df6ee1 100644
--- a/media/base/decrypt_config_unittest.cc
+++ b/media/base/decrypt_config_unittest.cc
@@ -78,7 +78,7 @@
// Now without pattern.
config = DecryptConfig::CreateCbcsConfig(kAlternateKeyId, kDefaultIV,
- {{1, 2}}, absl::nullopt);
+ {{1, 2}}, std::nullopt);
EXPECT_EQ(config->key_id(), kAlternateKeyId);
EXPECT_EQ(config->iv(), kDefaultIV);
EXPECT_EQ(config->subsamples().size(), 1u);
@@ -173,7 +173,7 @@
// Without pattern.
auto config6 = DecryptConfig::CreateCbcsConfig(kDefaultKeyId, kDefaultIV, {},
- absl::nullopt);
+ std::nullopt);
EXPECT_FALSE(config1->Matches(*config6));
EXPECT_FALSE(config5->Matches(*config6));
EXPECT_FALSE(config6->Matches(*config1));
@@ -192,7 +192,7 @@
// Simple 'cbcs' config.
stream << *DecryptConfig::CreateCbcsConfig(kDefaultKeyId, kDefaultIV, {},
- absl::nullopt);
+ std::nullopt);
// 'cbcs' config with subsamples and pattern.
stream << *DecryptConfig::CreateCbcsConfig(kAlternateKeyId, kAlternateIV,
diff --git a/media/base/demuxer.h b/media/base/demuxer.h
index 50acd92..c88200d 100644
--- a/media/base/demuxer.h
+++ b/media/base/demuxer.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include <vector>
#include "base/time/time.h"
@@ -20,7 +21,6 @@
#include "media/base/media_track.h"
#include "media/base/pipeline_status.h"
#include "media/base/ranges.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -170,7 +170,7 @@
// Implementations where this is not meaningful will return an empty value.
// Implementations that do provide values should always provide a value,
// returning CONTAINER_UNKNOWN in cases where the container is not known.
- virtual absl::optional<container_names::MediaContainerName>
+ virtual std::optional<container_names::MediaContainerName>
GetContainerForMetrics() const = 0;
// The |track_ids| vector has either 1 track, or is empty, indicating that
diff --git a/media/base/demuxer_memory_limit_cast_unittest.cc b/media/base/demuxer_memory_limit_cast_unittest.cc
index 2e92b28..7647281 100644
--- a/media/base/demuxer_memory_limit_cast_unittest.cc
+++ b/media/base/demuxer_memory_limit_cast_unittest.cc
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <optional>
+
#include "media/base/audio_decoder_config.h"
#include "media/base/demuxer.h"
#include "media/base/demuxer_memory_limit.h"
#include "media/base/media_util.h"
#include "media/base/video_decoder_config.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/base/eme_constants.h b/media/base/eme_constants.h
index 9ba7995..a4d9fde5 100644
--- a/media/base/eme_constants.h
+++ b/media/base/eme_constants.h
@@ -7,9 +7,10 @@
#include <stdint.h>
+#include <optional>
+
#include "media/base/media_export.h"
#include "media/media_buildflags.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -189,7 +190,7 @@
};
struct MEDIA_EXPORT EmeConfig {
- using Rule = absl::optional<EmeConfig>;
+ using Rule = std::optional<EmeConfig>;
// Refer to the EME spec for definitions on what identifier, persistence, and
// hw_secure_codecs represent.
@@ -203,8 +204,8 @@
static EmeConfig::Rule SupportedRule() { return EmeConfig(); }
// To represent an EmeConfig::Rule where the feature is not supported.
- // Internally, we represent Unsupported as absl::nullopt.
- static EmeConfig::Rule UnsupportedRule() { return absl::nullopt; }
+ // Internally, we represent Unsupported as std::nullopt.
+ static EmeConfig::Rule UnsupportedRule() { return std::nullopt; }
};
inline bool operator==(EmeConfig const& lhs, EmeConfig const& rhs) {
diff --git a/media/base/encryption_pattern.h b/media/base/encryption_pattern.h
index bd5d117e..b18e4af 100644
--- a/media/base/encryption_pattern.h
+++ b/media/base/encryption_pattern.h
@@ -21,7 +21,7 @@
// encrypted, and the next nine are skipped. This pattern is applied
// repeatedly until the end of the last 16-byte block in the subsample.
// Any remaining bytes are left clear.
-// TODO(jrummell): Use absl::optional<EncryptionPattern> everywhere.
+// TODO(jrummell): Use std::optional<EncryptionPattern> everywhere.
class MEDIA_EXPORT EncryptionPattern {
public:
EncryptionPattern();
diff --git a/media/base/format_utils.cc b/media/base/format_utils.cc
index 1b2283d..1237cd3a 100644
--- a/media/base/format_utils.cc
+++ b/media/base/format_utils.cc
@@ -8,7 +8,7 @@
namespace media {
-absl::optional<VideoPixelFormat> GfxBufferFormatToVideoPixelFormat(
+std::optional<VideoPixelFormat> GfxBufferFormatToVideoPixelFormat(
gfx::BufferFormat format) {
switch (format) {
case gfx::BufferFormat::BGRX_8888:
@@ -43,11 +43,11 @@
default:
DLOG(WARNING) << "Unsupported BufferFormat: "
<< gfx::BufferFormatToString(format);
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<gfx::BufferFormat> VideoPixelFormatToGfxBufferFormat(
+std::optional<gfx::BufferFormat> VideoPixelFormatToGfxBufferFormat(
VideoPixelFormat pixel_format) {
switch (pixel_format) {
case PIXEL_FORMAT_ARGB:
@@ -76,7 +76,7 @@
default:
DLOG(WARNING) << "Unsupported VideoPixelFormat: " << pixel_format;
- return absl::nullopt;
+ return std::nullopt;
}
}
diff --git a/media/base/format_utils.h b/media/base/format_utils.h
index 137e527..5ec56bc1 100644
--- a/media/base/format_utils.h
+++ b/media/base/format_utils.h
@@ -5,18 +5,19 @@
#ifndef MEDIA_BASE_FORMAT_UTILS_H_
#define MEDIA_BASE_FORMAT_UTILS_H_
+#include <optional>
+
#include "media/base/media_export.h"
#include "media/base/video_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/buffer_types.h"
namespace media {
-MEDIA_EXPORT absl::optional<VideoPixelFormat> GfxBufferFormatToVideoPixelFormat(
+MEDIA_EXPORT std::optional<VideoPixelFormat> GfxBufferFormatToVideoPixelFormat(
gfx::BufferFormat format);
-MEDIA_EXPORT absl::optional<gfx::BufferFormat>
-VideoPixelFormatToGfxBufferFormat(VideoPixelFormat pixel_format);
+MEDIA_EXPORT std::optional<gfx::BufferFormat> VideoPixelFormatToGfxBufferFormat(
+ VideoPixelFormat pixel_format);
} // namespace media
diff --git a/media/base/frame_rate_estimator.cc b/media/base/frame_rate_estimator.cc
index c77f98c8..76761a5 100644
--- a/media/base/frame_rate_estimator.cc
+++ b/media/base/frame_rate_estimator.cc
@@ -62,7 +62,7 @@
most_recent_bucket_ = bucketed_fps_min;
}
-absl::optional<int> FrameRateEstimator::ComputeFPS() {
+std::optional<int> FrameRateEstimator::ComputeFPS() {
return most_recent_bucket_;
}
diff --git a/media/base/frame_rate_estimator.h b/media/base/frame_rate_estimator.h
index 72e1b8d..be037dd6 100644
--- a/media/base/frame_rate_estimator.h
+++ b/media/base/frame_rate_estimator.h
@@ -5,10 +5,11 @@
#ifndef MEDIA_BASE_FRAME_RATE_ESTIMATOR_H_
#define MEDIA_BASE_FRAME_RATE_ESTIMATOR_H_
+#include <optional>
+
#include "base/moving_window.h"
#include "base/time/time.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -25,7 +26,7 @@
// Return the current (bucketed) frame rate (not duration), or nullopt if one
// isn't available with suitable certainty.
- absl::optional<int> ComputeFPS();
+ std::optional<int> ComputeFPS();
// Reset everything.
void Reset();
@@ -43,7 +44,7 @@
uint64_t required_samples_;
// Most recently computed bucketed FPS (not duration), if any.
- absl::optional<int> most_recent_bucket_;
+ std::optional<int> most_recent_bucket_;
};
} // namespace media
diff --git a/media/base/ipc/media_param_traits.cc b/media/base/ipc/media_param_traits.cc
index 7222fb27..be108b7 100644
--- a/media/base/ipc/media_param_traits.cc
+++ b/media/base/ipc/media_param_traits.cc
@@ -41,7 +41,7 @@
int sample_rate, frames_per_buffer, channels, effects;
std::vector<media::Point> mic_positions;
AudioLatency::Type latency_tag;
- absl::optional<media::AudioParameters::HardwareCapabilities>
+ std::optional<media::AudioParameters::HardwareCapabilities>
hardware_capabilities;
if (!ReadParam(m, iter, &format) || !ReadParam(m, iter, &channel_layout) ||
diff --git a/media/base/key_system_info.h b/media/base/key_system_info.h
index 529ece2..f81d844 100644
--- a/media/base/key_system_info.h
+++ b/media/base/key_system_info.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_BASE_KEY_SYSTEM_INFO_H_
#define MEDIA_BASE_KEY_SYSTEM_INFO_H_
+#include <optional>
#include <string>
#include "base/functional/callback.h"
@@ -12,7 +13,6 @@
#include "media/base/decrypt_config.h"
#include "media/base/eme_constants.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/base/key_systems.h b/media/base/key_systems.h
index 942daf6b..fa267ce 100644
--- a/media/base/key_systems.h
+++ b/media/base/key_systems.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include <optional>
#include <string>
#include <vector>
@@ -14,7 +15,6 @@
#include "media/base/decrypt_config.h"
#include "media/base/eme_constants.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -108,7 +108,7 @@
// supported key systems.
MEDIA_EXPORT std::string GetKeySystemNameForUMA(
const std::string& key_system,
- absl::optional<bool> use_hw_secure_codecs = absl::nullopt);
+ std::optional<bool> use_hw_secure_codecs = std::nullopt);
// Returns an int mapping to `key_system` suitable for UKM reporting. CdmConfig
// is not needed here because we can report CdmConfig fields in UKM directly.
diff --git a/media/base/key_systems_impl.cc b/media/base/key_systems_impl.cc
index c423dbe..2cfc399 100644
--- a/media/base/key_systems_impl.cc
+++ b/media/base/key_systems_impl.cc
@@ -730,7 +730,7 @@
}
std::string GetKeySystemNameForUMA(const std::string& key_system,
- absl::optional<bool> use_hw_secure_codecs) {
+ std::optional<bool> use_hw_secure_codecs) {
// Here we maintain a short list of known key systems to facilitate UMA
// reporting. Mentioned key systems are not necessarily supported by
// the current platform.
diff --git a/media/base/key_systems_impl.h b/media/base/key_systems_impl.h
index bc8ec94..52a979d 100644
--- a/media/base/key_systems_impl.h
+++ b/media/base/key_systems_impl.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include <optional>
#include <string>
#include <unordered_map>
#include <vector>
@@ -20,7 +21,6 @@
#include "media/base/key_system_info.h"
#include "media/base/key_systems.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/base/key_systems_unittest.cc b/media/base/key_systems_unittest.cc
index b91b40c..04f8688 100644
--- a/media/base/key_systems_unittest.cc
+++ b/media/base/key_systems_unittest.cc
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "media/base/key_systems.h"
+
+#include <optional>
#include <string>
#include <vector>
@@ -12,13 +15,11 @@
#include "media/base/audio_parameters.h"
#include "media/base/decrypt_config.h"
#include "media/base/eme_constants.h"
-#include "media/base/key_systems.h"
#include "media/base/media.h"
#include "media/base/media_client.h"
#include "media/cdm/clear_key_cdm_common.h"
#include "media/media_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/widevine/cdm/widevine_cdm_common.h"
namespace media {
@@ -242,7 +243,7 @@
// test the key system update case.
void DisableExternalKeySystemSupport();
- absl::optional<AudioRendererAlgorithmParameters>
+ std::optional<AudioRendererAlgorithmParameters>
GetAudioRendererAlgorithmParameters(AudioParameters audio_parameters) final;
private:
@@ -279,10 +280,10 @@
get_supported_key_systems_cb_.Run(GetSupportedKeySystemsInternal());
}
-absl::optional<AudioRendererAlgorithmParameters>
+std::optional<AudioRendererAlgorithmParameters>
TestMediaClient::GetAudioRendererAlgorithmParameters(
AudioParameters audio_parameters) {
- return absl::nullopt;
+ return std::nullopt;
}
KeySystemInfos TestMediaClient::GetSupportedKeySystemsInternal() {
diff --git a/media/base/media_client.h b/media/base/media_client.h
index fd22d95..5edceab 100644
--- a/media/base/media_client.h
+++ b/media/base/media_client.h
@@ -6,6 +6,7 @@
#define MEDIA_BASE_MEDIA_CLIENT_H_
#include <memory>
+#include <optional>
#include <vector>
#include "media/base/audio_codecs.h"
@@ -15,7 +16,6 @@
#include "media/base/media_types.h"
#include "media/base/video_codecs.h"
#include "media/base/video_color_space.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_space.h"
#include "url/gurl.h"
@@ -54,7 +54,7 @@
virtual bool IsSupportedBitstreamAudioCodec(AudioCodec codec) = 0;
// Optionally returns audio renderer algorithm parameters.
- virtual absl::optional<::media::AudioRendererAlgorithmParameters>
+ virtual std::optional<::media::AudioRendererAlgorithmParameters>
GetAudioRendererAlgorithmParameters(AudioParameters audio_parameters) = 0;
};
diff --git a/media/base/media_drm_storage.h b/media/base/media_drm_storage.h
index 7d1f5de..83c3fe6 100644
--- a/media/base/media_drm_storage.h
+++ b/media/base/media_drm_storage.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include <string>
#include <vector>
@@ -15,7 +16,6 @@
#include "base/memory/weak_ptr.h"
#include "media/base/media_drm_key_type.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
namespace base {
@@ -31,7 +31,7 @@
public:
// When using per-origin provisioning, this is the ID for the origin.
// If not specified, the device specific origin ID is to be used.
- using MediaDrmOriginId = absl::optional<base::UnguessableToken>;
+ using MediaDrmOriginId = std::optional<base::UnguessableToken>;
struct MEDIA_EXPORT SessionData {
SessionData(std::vector<uint8_t> key_set_id,
diff --git a/media/base/media_serializers.h b/media/base/media_serializers.h
index 595a926..985e449 100644
--- a/media/base/media_serializers.h
+++ b/media/base/media_serializers.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_BASE_MEDIA_SERIALIZERS_H_
#define MEDIA_BASE_MEDIA_SERIALIZERS_H_
+#include <optional>
#include <sstream>
#include <vector>
@@ -18,7 +19,6 @@
#include "media/base/renderer.h"
#include "media/base/status.h"
#include "media/base/video_decoder_config.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/hdr_metadata.h"
@@ -78,8 +78,8 @@
// serialize optional types
template <typename OptType>
-struct MediaSerializer<absl::optional<OptType>> {
- static base::Value Serialize(const absl::optional<OptType>& opt) {
+struct MediaSerializer<std::optional<OptType>> {
+ static base::Value Serialize(const std::optional<OptType>& opt) {
return opt ? MediaSerializer<OptType>::Serialize(opt.value())
: base::Value("unset"); // TODO(tmathmeyer) maybe empty string?
}
diff --git a/media/base/media_serializers_unittest.cc b/media/base/media_serializers_unittest.cc
index 91545a7a..00198be0 100644
--- a/media/base/media_serializers_unittest.cc
+++ b/media/base/media_serializers_unittest.cc
@@ -41,7 +41,7 @@
}
TEST(MediaSerializersTest, Optional) {
- absl::optional<int> foo;
+ std::optional<int> foo;
ASSERT_EQ(ToString(MediaSerialize(foo)), "unset");
foo = 1;
diff --git a/media/base/media_types.h b/media/base/media_types.h
index 505944b..b6aa0cb7 100644
--- a/media/base/media_types.h
+++ b/media/base/media_types.h
@@ -5,13 +5,14 @@
#ifndef MEDIA_BASE_MEDIA_TYPES_H_
#define MEDIA_BASE_MEDIA_TYPES_H_
+#include <optional>
+
#include "media/base/audio_codecs.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/media_export.h"
#include "media/base/video_codecs.h"
#include "media/base/video_color_space.h"
#include "media/base/video_decoder_config.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -35,8 +36,8 @@
VideoCodecLevel level = kNoVideoCodecLevel;
VideoColorSpace color_space;
gfx::HdrMetadataType hdr_metadata_type = gfx::HdrMetadataType::kNone;
- absl::optional<VideoChromaSampling> subsampling;
- absl::optional<uint8_t> bit_depth;
+ std::optional<VideoChromaSampling> subsampling;
+ std::optional<uint8_t> bit_depth;
};
MEDIA_EXPORT bool operator==(const AudioType& x, const AudioType& y);
diff --git a/media/base/media_url_demuxer.cc b/media/base/media_url_demuxer.cc
index ac1c65e..d107182 100644
--- a/media/base/media_url_demuxer.cc
+++ b/media/base/media_url_demuxer.cc
@@ -101,9 +101,9 @@
return 0;
}
-absl::optional<container_names::MediaContainerName>
+std::optional<container_names::MediaContainerName>
MediaUrlDemuxer::GetContainerForMetrics() const {
- return absl::nullopt;
+ return std::nullopt;
}
void MediaUrlDemuxer::OnEnabledAudioTracksChanged(
diff --git a/media/base/media_url_demuxer.h b/media/base/media_url_demuxer.h
index 80a1394..da830b4 100644
--- a/media/base/media_url_demuxer.h
+++ b/media/base/media_url_demuxer.h
@@ -68,7 +68,7 @@
base::TimeDelta GetStartTime() const override;
base::Time GetTimelineOffset() const override;
int64_t GetMemoryUsage() const override;
- absl::optional<container_names::MediaContainerName> GetContainerForMetrics()
+ std::optional<container_names::MediaContainerName> GetContainerForMetrics()
const override;
void OnEnabledAudioTracksChanged(const std::vector<MediaTrack::Id>& track_ids,
base::TimeDelta curr_time,
diff --git a/media/base/mime_util.cc b/media/base/mime_util.cc
index 9f948ba..c67ff54 100644
--- a/media/base/mime_util.cc
+++ b/media/base/mime_util.cc
@@ -40,9 +40,9 @@
GetMimeUtil()->StripCodecs(codecs);
}
-absl::optional<VideoType> ParseVideoCodecString(std::string_view mime_type,
- std::string_view codec_id,
- bool allow_ambiguous_matches) {
+std::optional<VideoType> ParseVideoCodecString(std::string_view mime_type,
+ std::string_view codec_id,
+ bool allow_ambiguous_matches) {
return GetMimeUtil()->ParseVideoCodecString(mime_type, codec_id,
allow_ambiguous_matches);
}
diff --git a/media/base/mime_util.h b/media/base/mime_util.h
index 5d0ff73a..7cf60fe 100644
--- a/media/base/mime_util.h
+++ b/media/base/mime_util.h
@@ -37,9 +37,9 @@
// |codec_id|. If |allow_ambiguous_matches| is true, matches against
// non-standard codec strings (e.g., vp9 vs vp9.0) will be allowed.
//
-// Returns absl::nullopt if parsing fails (invalid string, or unrecognized video
+// Returns std::nullopt if parsing fails (invalid string, or unrecognized video
// codec).
-MEDIA_EXPORT absl::optional<VideoType> ParseVideoCodecString(
+MEDIA_EXPORT std::optional<VideoType> ParseVideoCodecString(
std::string_view mime_type,
std::string_view codec_id,
bool allow_ambiguous_matches = false);
diff --git a/media/base/mime_util_internal.cc b/media/base/mime_util_internal.cc
index 22da62a..8be5dc6 100644
--- a/media/base/mime_util_internal.cc
+++ b/media/base/mime_util_internal.cc
@@ -111,7 +111,7 @@
return *kStringToCodecMap;
}
-static absl::optional<VideoType> ParseVp9CodecID(
+static std::optional<VideoType> ParseVp9CodecID(
std::string_view mime_type_lower_case,
std::string_view codec_id) {
if (auto result = ParseNewStyleVp9CodecID(codec_id)) {
@@ -126,7 +126,7 @@
return ParseLegacyVp9CodecID(codec_id);
}
- return absl::nullopt;
+ return std::nullopt;
}
static bool IsValidH264Level(uint8_t level_idc) {
@@ -464,7 +464,7 @@
}
}
-absl::optional<VideoType> MimeUtil::ParseVideoCodecString(
+std::optional<VideoType> MimeUtil::ParseVideoCodecString(
std::string_view mime_type,
std::string_view codec_id,
bool allow_ambiguous_matches) const {
@@ -479,7 +479,7 @@
DVLOG(3) << __func__ << " Failed to parse mime/codec pair: "
<< (mime_type.empty() ? "<empty mime>" : mime_type) << "; "
<< codec_id;
- return absl::nullopt;
+ return std::nullopt;
}
CHECK_EQ(1U, parsed_results.size());
@@ -487,12 +487,12 @@
if (!parsed_results[0].video) {
DVLOG(3) << __func__ << " Codec string " << codec_id
<< " is not a VIDEO codec.";
- return absl::nullopt;
+ return std::nullopt;
}
if (!allow_ambiguous_matches && parsed_results[0].is_ambiguous) {
DVLOG(3) << __func__ << " Refusing to return ambiguous codec string match.";
- return absl::nullopt;
+ return std::nullopt;
}
return parsed_results[0].video;
diff --git a/media/base/mime_util_internal.h b/media/base/mime_util_internal.h
index 02fd12d..07617dd 100644
--- a/media/base/mime_util_internal.h
+++ b/media/base/mime_util_internal.h
@@ -75,7 +75,7 @@
struct ParsedCodecResult {
Codec codec;
bool is_ambiguous;
- absl::optional<VideoType> video;
+ std::optional<VideoType> video;
};
// See mime_util.h for more information on these methods.
@@ -83,7 +83,7 @@
void SplitCodecs(base::StringPiece codecs,
std::vector<std::string>* codecs_out) const;
void StripCodecs(std::vector<std::string>* codecs) const;
- absl::optional<VideoType> ParseVideoCodecString(
+ std::optional<VideoType> ParseVideoCodecString(
std::string_view mime_type,
std::string_view codec_id,
bool allow_ambiguous_matches) const;
diff --git a/media/base/mock_filters.cc b/media/base/mock_filters.cc
index 70ef2c5..4915e49 100644
--- a/media/base/mock_filters.cc
+++ b/media/base/mock_filters.cc
@@ -168,12 +168,12 @@
MockCdmContext::~MockCdmContext() = default;
-absl::optional<base::UnguessableToken> MockCdmContext::GetCdmId() const {
+std::optional<base::UnguessableToken> MockCdmContext::GetCdmId() const {
return cdm_id_;
}
void MockCdmContext::set_cdm_id(const base::UnguessableToken& cdm_id) {
- cdm_id_ = absl::make_optional(cdm_id);
+ cdm_id_ = std::make_optional(cdm_id);
}
MockCdmPromise::MockCdmPromise(bool expect_success) {
diff --git a/media/base/mock_filters.h b/media/base/mock_filters.h
index 9a783fe..b38a0a5 100644
--- a/media/base/mock_filters.h
+++ b/media/base/mock_filters.h
@@ -71,7 +71,7 @@
MOCK_METHOD1(OnVideoConfigChange, void(const VideoDecoderConfig&));
MOCK_METHOD1(OnVideoNaturalSizeChange, void(const gfx::Size&));
MOCK_METHOD1(OnVideoOpacityChange, void(bool));
- MOCK_METHOD1(OnVideoFrameRateChange, void(absl::optional<int>));
+ MOCK_METHOD1(OnVideoFrameRateChange, void(std::optional<int>));
MOCK_METHOD0(OnVideoAverageKeyframeDistanceUpdate, void());
MOCK_METHOD1(OnAudioPipelineInfoChange, void(const AudioPipelineInfo&));
MOCK_METHOD1(OnVideoPipelineInfoChange, void(const VideoPipelineInfo&));
@@ -109,7 +109,7 @@
MOCK_METHOD2(OnEnabledAudioTracksChanged,
void(const std::vector<MediaTrack::Id>&, base::OnceClosure));
MOCK_METHOD2(OnSelectedVideoTrackChanged,
- void(absl::optional<MediaTrack::Id>, base::OnceClosure));
+ void(std::optional<MediaTrack::Id>, base::OnceClosure));
MOCK_METHOD0(OnExternalVideoFrameRequest, void());
// TODO(sandersd): This should automatically return true between Start() and
@@ -123,7 +123,7 @@
MOCK_METHOD1(SetPlaybackRate, void(double));
MOCK_CONST_METHOD0(GetVolume, float());
MOCK_METHOD1(SetVolume, void(float));
- MOCK_METHOD1(SetLatencyHint, void(absl::optional<base::TimeDelta>));
+ MOCK_METHOD1(SetLatencyHint, void(std::optional<base::TimeDelta>));
MOCK_METHOD1(SetPreservesPitch, void(bool));
MOCK_METHOD1(SetWasPlayedWithUserActivation, void(bool));
@@ -194,7 +194,7 @@
MOCK_METHOD(base::TimeDelta, GetStartTime, (), (const, override));
MOCK_METHOD(base::Time, GetTimelineOffset, (), (const, override));
MOCK_METHOD(int64_t, GetMemoryUsage, (), (const, override));
- MOCK_METHOD(absl::optional<container_names::MediaContainerName>,
+ MOCK_METHOD(std::optional<container_names::MediaContainerName>,
GetContainerForMetrics,
(),
(const, override));
@@ -439,7 +439,7 @@
MOCK_METHOD1(OnVideoConfigChange, void(const VideoDecoderConfig&));
MOCK_METHOD1(OnVideoNaturalSizeChange, void(const gfx::Size&));
MOCK_METHOD1(OnVideoOpacityChange, void(bool));
- MOCK_METHOD1(OnVideoFrameRateChange, void(absl::optional<int>));
+ MOCK_METHOD1(OnVideoFrameRateChange, void(std::optional<int>));
MOCK_METHOD1(OnDurationChange, void(base::TimeDelta));
MOCK_METHOD1(OnRemotePlayStateChange, void(MediaStatus::State state));
MOCK_METHOD0(IsVideoStreamAvailable, bool());
@@ -473,7 +473,7 @@
MOCK_METHOD0(OnTimeProgressing, void());
MOCK_METHOD0(OnTimeStopped, void());
MOCK_METHOD1(SetLatencyHint,
- void(absl::optional<base::TimeDelta> latency_hint));
+ void(std::optional<base::TimeDelta> latency_hint));
};
class MockAudioRenderer : public AudioRenderer {
@@ -502,7 +502,7 @@
MOCK_METHOD0(StartPlaying, void());
MOCK_METHOD1(SetVolume, void(float volume));
MOCK_METHOD1(SetLatencyHint,
- void(absl::optional<base::TimeDelta> latency_hint));
+ void(std::optional<base::TimeDelta> latency_hint));
MOCK_METHOD1(SetPreservesPitch, void(bool));
MOCK_METHOD1(SetWasPlayedWithUserActivation, void(bool));
};
@@ -527,7 +527,7 @@
void(MediaResource* media_resource,
RendererClient* client,
PipelineStatusCallback& init_cb));
- MOCK_METHOD1(SetLatencyHint, void(absl::optional<base::TimeDelta>));
+ MOCK_METHOD1(SetLatencyHint, void(std::optional<base::TimeDelta>));
MOCK_METHOD1(SetPreservesPitch, void(bool));
MOCK_METHOD1(SetWasPlayedWithUserActivation, void(bool));
void Flush(base::OnceClosure flush_cb) override { OnFlush(flush_cb); }
@@ -676,12 +676,12 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
MOCK_METHOD0(GetChromeOsCdmContext, chromeos::ChromeOsCdmContext*());
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
- absl::optional<base::UnguessableToken> GetCdmId() const override;
+ std::optional<base::UnguessableToken> GetCdmId() const override;
void set_cdm_id(const base::UnguessableToken& cdm_id);
private:
- absl::optional<base::UnguessableToken> cdm_id_;
+ std::optional<base::UnguessableToken> cdm_id_;
};
class MockCdmPromise : public SimpleCdmPromise {
@@ -876,7 +876,7 @@
MOCK_METHOD1(IsSupportedVideoType, bool(const media::VideoType& type));
MOCK_METHOD1(IsSupportedBitstreamAudioCodec, bool(media::AudioCodec codec));
MOCK_METHOD1(GetAudioRendererAlgorithmParameters,
- absl::optional<::media::AudioRendererAlgorithmParameters>(
+ std::optional<::media::AudioRendererAlgorithmParameters>(
media::AudioParameters audio_parameters));
};
diff --git a/media/base/offloading_audio_encoder_unittest.cc b/media/base/offloading_audio_encoder_unittest.cc
index d50cd850..1f1c672 100644
--- a/media/base/offloading_audio_encoder_unittest.cc
+++ b/media/base/offloading_audio_encoder_unittest.cc
@@ -58,7 +58,7 @@
bool called_output = false;
AudioEncoder::Options options;
AudioEncoder::OutputCB output_cb = base::BindLambdaForTesting(
- [&](EncodedAudioBuffer, absl::optional<AudioEncoder::CodecDescription>) {
+ [&](EncodedAudioBuffer, std::optional<AudioEncoder::CodecDescription>) {
EXPECT_TRUE(callback_runner_->RunsTasksInCurrentSequence());
called_output = true;
});
diff --git a/media/base/overlay_info.h b/media/base/overlay_info.h
index 00f4e345..7908091 100644
--- a/media/base/overlay_info.h
+++ b/media/base/overlay_info.h
@@ -5,17 +5,18 @@
#ifndef MEDIA_BASE_OVERLAY_INFO_H_
#define MEDIA_BASE_OVERLAY_INFO_H_
+#include <optional>
+
#include "base/functional/callback_forward.h"
#include "base/unguessable_token.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
struct MEDIA_EXPORT OverlayInfo {
// An unset routing token indicates "do not use any routing token". A null
// routing token isn't serializable, else we'd probably use that instead.
- using RoutingToken = absl::optional<base::UnguessableToken>;
+ using RoutingToken = std::optional<base::UnguessableToken>;
OverlayInfo();
OverlayInfo(const OverlayInfo&);
diff --git a/media/base/pipeline.h b/media/base/pipeline.h
index 7cdd2e0c..d7940421 100644
--- a/media/base/pipeline.h
+++ b/media/base/pipeline.h
@@ -6,6 +6,7 @@
#define MEDIA_BASE_PIPELINE_H_
#include <memory>
+#include <optional>
#include "base/time/time.h"
#include "media/base/audio_decoder_config.h"
@@ -19,7 +20,6 @@
#include "media/base/video_decoder_config.h"
#include "media/base/video_transformation.h"
#include "media/base/waiting.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
@@ -83,7 +83,7 @@
// Executed whenever the video frame rate changes. |fps| will be unset if
// the frame rate is unstable. The duration used for the frame rate is
// based on wall clock time, not media time.
- virtual void OnVideoFrameRateChange(absl::optional<int> fps) = 0;
+ virtual void OnVideoFrameRateChange(std::optional<int> fps) = 0;
};
virtual ~Pipeline() {}
@@ -146,7 +146,7 @@
// |selected_track_id| is either empty, which means no video track is
// selected, or contains the selected video track id.
virtual void OnSelectedVideoTrackChanged(
- absl::optional<MediaTrack::Id> selected_track_id,
+ std::optional<MediaTrack::Id> selected_track_id,
base::OnceClosure change_completed_cb) = 0;
// Signal to the pipeline that there has been a client request to access
@@ -225,7 +225,7 @@
// post-decode buffering required to start playback or resume from
// seek/underflow. A null option indicates the hint is unset and the pipeline
// can choose its own default.
- virtual void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) = 0;
+ virtual void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) = 0;
// Sets whether pitch adjustment should be applied when the playback rate is
// different than 1.0.
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index 66d9451..1897665 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -90,7 +90,7 @@
void Resume(std::unique_ptr<Renderer> default_renderer, base::TimeDelta time);
void SetPlaybackRate(double playback_rate);
void SetVolume(float volume);
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint);
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint);
void SetPreservesPitch(bool preserves_pitch);
void SetWasPlayedWithUserActivation(bool was_played_with_user_activation);
base::TimeDelta GetMediaTime() const;
@@ -107,7 +107,7 @@
// |selected_track_id| is either empty, which means no video track is
// selected, or contains the selected video track id.
void OnSelectedVideoTrackChanged(
- absl::optional<MediaTrack::Id> selected_track_id,
+ std::optional<MediaTrack::Id> selected_track_id,
base::OnceClosure change_completed_cb);
void OnExternalVideoFrameRequest();
@@ -172,7 +172,7 @@
void OnVideoConfigChange(const VideoDecoderConfig& config) final;
void OnVideoNaturalSizeChange(const gfx::Size& size) final;
void OnVideoOpacityChange(bool opaque) final;
- void OnVideoFrameRateChange(absl::optional<int> fps) final;
+ void OnVideoFrameRateChange(std::optional<int> fps) final;
// Common handlers for notifications from renderers and demuxer.
void OnPipelineError(PipelineStatus error);
@@ -216,7 +216,7 @@
double playback_rate_;
float volume_;
- absl::optional<base::TimeDelta> latency_hint_;
+ std::optional<base::TimeDelta> latency_hint_;
raw_ptr<CdmContext> cdm_context_;
// By default, apply pitch adjustments.
@@ -507,7 +507,7 @@
}
void PipelineImpl::RendererWrapper::SetLatencyHint(
- absl::optional<base::TimeDelta> latency_hint) {
+ std::optional<base::TimeDelta> latency_hint) {
DCHECK(media_task_runner_->RunsTasksInCurrentSequence());
if (latency_hint_ == latency_hint)
@@ -606,7 +606,7 @@
DCHECK(cdm_context_ || !HasEncryptedStream())
<< "CDM should be available now if has encrypted stream";
- absl::optional<RendererType> renderer_type;
+ std::optional<RendererType> renderer_type;
#if BUILDFLAG(IS_WIN)
if (cdm_context_) {
@@ -744,7 +744,7 @@
}
void PipelineImpl::OnSelectedVideoTrackChanged(
- absl::optional<MediaTrack::Id> selected_track_id,
+ std::optional<MediaTrack::Id> selected_track_id,
base::OnceClosure change_completed_cb) {
DCHECK(thread_checker_.CalledOnValidThread());
media_task_runner_->PostTask(
@@ -756,7 +756,7 @@
}
void PipelineImpl::RendererWrapper::OnSelectedVideoTrackChanged(
- absl::optional<MediaTrack::Id> selected_track_id,
+ std::optional<MediaTrack::Id> selected_track_id,
base::OnceClosure change_completed_cb) {
DCHECK(media_task_runner_->RunsTasksInCurrentSequence());
@@ -920,7 +920,7 @@
}
void PipelineImpl::RendererWrapper::OnVideoFrameRateChange(
- absl::optional<int> fps) {
+ std::optional<int> fps) {
DCHECK(media_task_runner_->RunsTasksInCurrentSequence());
main_task_runner_->PostTask(
@@ -1306,7 +1306,7 @@
// play. In this case, not creating a default renderer to reduce memory usage.
std::unique_ptr<Renderer> default_renderer;
if (start_type != StartType::kSuspendAfterMetadata)
- default_renderer = create_renderer_cb_.Run(absl::nullopt);
+ default_renderer = create_renderer_cb_.Run(std::nullopt);
media_task_runner_->PostTask(
FROM_HERE,
@@ -1396,7 +1396,7 @@
// Always create a default renderer for Resume(). Creation error is handled in
// `RendererWrapper::Resume()`.
- auto default_renderer = create_renderer_cb_.Run(absl::nullopt);
+ auto default_renderer = create_renderer_cb_.Run(std::nullopt);
media_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&RendererWrapper::Resume,
@@ -1461,8 +1461,7 @@
base::Unretained(renderer_wrapper_.get()), volume_));
}
-void PipelineImpl::SetLatencyHint(
- absl::optional<base::TimeDelta> latency_hint) {
+void PipelineImpl::SetLatencyHint(std::optional<base::TimeDelta> latency_hint) {
DVLOG(1) << __func__ << "("
<< (latency_hint
? base::NumberToString(latency_hint->InMilliseconds()) + "ms"
@@ -1588,7 +1587,7 @@
#undef RETURN_STRING
void PipelineImpl::AsyncCreateRenderer(
- absl::optional<RendererType> renderer_type,
+ std::optional<RendererType> renderer_type,
RendererCreatedCB renderer_created_cb) {
DVLOG(2) << __func__;
DCHECK(thread_checker_.CalledOnValidThread());
@@ -1688,7 +1687,7 @@
client_->OnVideoOpacityChange(opaque);
}
-void PipelineImpl::OnVideoFrameRateChange(absl::optional<int> fps) {
+void PipelineImpl::OnVideoFrameRateChange(std::optional<int> fps) {
DVLOG(2) << __func__;
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(IsRunning());
diff --git a/media/base/pipeline_impl.h b/media/base/pipeline_impl.h
index 418ff17..b6ce11c 100644
--- a/media/base/pipeline_impl.h
+++ b/media/base/pipeline_impl.h
@@ -6,6 +6,7 @@
#define MEDIA_BASE_PIPELINE_IMPL_H_
#include <memory>
+#include <optional>
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
@@ -17,7 +18,6 @@
#include "media/base/pipeline.h"
#include "media/base/renderer.h"
#include "media/base/renderer_factory_selector.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class SingleThreadTaskRunner;
@@ -30,10 +30,10 @@
// Callbacks used for Renderer creation. When the RendererType is nullopt, the
// current base one will be created.
using CreateRendererCB = base::RepeatingCallback<std::unique_ptr<Renderer>(
- absl::optional<RendererType>)>;
+ std::optional<RendererType>)>;
using RendererCreatedCB = base::OnceCallback<void(std::unique_ptr<Renderer>)>;
using AsyncCreateRendererCB =
- base::RepeatingCallback<void(absl::optional<RendererType>,
+ base::RepeatingCallback<void(std::optional<RendererType>,
RendererCreatedCB)>;
// Pipeline runs the media pipeline. Filters are created and called on the
@@ -109,7 +109,7 @@
void SetPlaybackRate(double playback_rate) override;
float GetVolume() const override;
void SetVolume(float volume) override;
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) override;
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) override;
void SetPreservesPitch(bool preserves_pitch) override;
void SetWasPlayedWithUserActivation(
bool was_played_with_user_activation) override;
@@ -128,7 +128,7 @@
// |selected_track_id| is either empty, which means no video track is
// selected, or contains the selected video track id.
void OnSelectedVideoTrackChanged(
- absl::optional<MediaTrack::Id> selected_track_id,
+ std::optional<MediaTrack::Id> selected_track_id,
base::OnceClosure change_completed_cb) override;
void OnExternalVideoFrameRequest() override;
@@ -155,7 +155,7 @@
// Create a Renderer asynchronously. Must be called on the main task runner
// and the callback will be called on the main task runner as well.
- void AsyncCreateRenderer(absl::optional<RendererType> renderer_type,
+ void AsyncCreateRenderer(std::optional<RendererType> renderer_type,
RendererCreatedCB renderer_created_cb);
// Notifications from RendererWrapper.
@@ -175,7 +175,7 @@
void OnAudioPipelineInfoChange(const AudioPipelineInfo& info);
void OnVideoPipelineInfoChange(const VideoPipelineInfo& info);
void OnRemotePlayStateChange(MediaStatus::State state);
- void OnVideoFrameRateChange(absl::optional<int> fps);
+ void OnVideoFrameRateChange(std::optional<int> fps);
// Task completion callbacks from RendererWrapper.
void OnSeekDone(bool is_suspended);
diff --git a/media/base/pipeline_impl_unittest.cc b/media/base/pipeline_impl_unittest.cc
index 1ba17679..41949c08 100644
--- a/media/base/pipeline_impl_unittest.cc
+++ b/media/base/pipeline_impl_unittest.cc
@@ -295,7 +295,7 @@
}
std::unique_ptr<Renderer> TakeRenderer(
- absl::optional<RendererType> /* renderer_type */) {
+ std::optional<RendererType> /* renderer_type */) {
return std::move(scoped_renderer_);
}
diff --git a/media/base/pipeline_status.h b/media/base/pipeline_status.h
index cd3097f..d873ba9 100644
--- a/media/base/pipeline_status.h
+++ b/media/base/pipeline_status.h
@@ -6,7 +6,9 @@
#define MEDIA_BASE_PIPELINE_STATUS_H_
#include <stdint.h>
+
#include <iosfwd>
+#include <optional>
#include <string>
#include "base/functional/callback.h"
@@ -15,7 +17,6 @@
#include "media/base/media_export.h"
#include "media/base/status.h"
#include "media/base/timestamp_constants.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/base/renderer.h b/media/base/renderer.h
index 65d3036f..c90c760 100644
--- a/media/base/renderer.h
+++ b/media/base/renderer.h
@@ -5,13 +5,14 @@
#ifndef MEDIA_BASE_RENDERER_H_
#define MEDIA_BASE_RENDERER_H_
+#include <optional>
+
#include "base/functional/callback.h"
#include "base/time/time.h"
#include "media/base/buffering_state.h"
#include "media/base/demuxer_stream.h"
#include "media/base/media_export.h"
#include "media/base/pipeline_status.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -74,7 +75,7 @@
// of decoded data is buffered. A nullopt hint indicates the user is clearing
// their preference and the renderer should restore its default buffering
// thresholds.
- virtual void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) = 0;
+ virtual void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) = 0;
// Sets whether pitch adjustment should be applied when the playback rate is
// different than 1.0.
diff --git a/media/base/renderer_client.h b/media/base/renderer_client.h
index 515a173..38cf1ac 100644
--- a/media/base/renderer_client.h
+++ b/media/base/renderer_client.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_BASE_RENDERER_CLIENT_H_
#define MEDIA_BASE_RENDERER_CLIENT_H_
+#include <optional>
+
#include "media/base/audio_decoder_config.h"
#include "media/base/buffering_state.h"
#include "media/base/media_export.h"
@@ -12,7 +14,6 @@
#include "media/base/pipeline_status.h"
#include "media/base/video_decoder_config.h"
#include "media/base/waiting.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
@@ -64,7 +65,7 @@
// Called when the bucketed frames per second has changed. |fps| will be
// unset if the frame rate is unstable. The duration used for the frame rate
// is based on the wall clock time, not the media time.
- virtual void OnVideoFrameRateChange(absl::optional<int> fps) = 0;
+ virtual void OnVideoFrameRateChange(std::optional<int> fps) = 0;
};
} // namespace media
diff --git a/media/base/renderer_factory_selector.h b/media/base/renderer_factory_selector.h
index 5ab0db1..f700c37 100644
--- a/media/base/renderer_factory_selector.h
+++ b/media/base/renderer_factory_selector.h
@@ -6,6 +6,7 @@
#define MEDIA_BASE_RENDERER_FACTORY_SELECTOR_H_
#include <map>
+#include <optional>
#include "base/functional/callback.h"
#include "build/build_config.h"
@@ -13,7 +14,6 @@
#include "media/base/media_status.h"
#include "media/base/renderer.h"
#include "media/base/renderer_factory.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -80,7 +80,7 @@
#endif
private:
- absl::optional<RendererType> base_renderer_type_;
+ std::optional<RendererType> base_renderer_type_;
// Use a map to avoid duplicate entries for the same RendererType.
std::map<RendererType, ConditionalFactoryCB> conditional_factories_;
diff --git a/media/base/status.h b/media/base/status.h
index 2cb9a86..a8cb328 100644
--- a/media/base/status.h
+++ b/media/base/status.h
@@ -146,14 +146,14 @@
static constexpr bool has_pack = HasPackExtraData<T>::as_method;
// If T defines OkEnumValue(), then return it. Otherwise, return an
- // T::Codes::kOk if that's defined, or absl::nullopt if its not.
- static constexpr absl::optional<typename T::Codes> OkEnumValue() {
+ // T::Codes::kOk if that's defined, or std::nullopt if its not.
+ static constexpr std::optional<typename T::Codes> OkEnumValue() {
if constexpr (has_default) {
return T::OkEnumValue();
} else if constexpr (has_ok) {
return T::Codes::kOk;
} else {
- return absl::nullopt;
+ return std::nullopt;
}
}
@@ -577,12 +577,12 @@
}
private:
- absl::optional<TypedStatus<T>> error_;
+ std::optional<TypedStatus<T>> error_;
// We wrap |OtherType| in a container so that windows COM wrappers work.
// They override operator& and similar, and won't compile in a
- // absl::optional.
- absl::optional<std::tuple<OtherType>> value_;
+ // std::optional.
+ std::optional<std::tuple<OtherType>> value_;
};
static Callback BindOkContinuation(Callback err,
diff --git a/media/base/test_helpers.cc b/media/base/test_helpers.cc
index 6b0224b..ee68ac8 100644
--- a/media/base/test_helpers.cc
+++ b/media/base/test_helpers.cc
@@ -7,6 +7,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include "base/check_op.h"
#include "base/functional/bind.h"
@@ -21,7 +22,6 @@
#include "media/base/decoder_buffer.h"
#include "media/base/media_util.h"
#include "media/base/mock_filters.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/libyuv/include/libyuv.h"
#include "ui/gfx/geometry/rect.h"
@@ -34,7 +34,7 @@
std::tuple<uint32_t, uint32_t, uint32_t, uint32_t> FourColors(
bool opaque,
- absl::optional<uint32_t> xor_mask) {
+ std::optional<uint32_t> xor_mask) {
DCHECK_EQ(xor_mask.value_or(0) >> 24, 0u)
<< "Alpha byte must be zero when using `xor_mask`";
const uint32_t mask = xor_mask.value_or(0);
@@ -109,7 +109,7 @@
}
void FillFourColorsFrameYUV(VideoFrame& dest_frame,
- absl::optional<uint32_t> xor_mask) {
+ std::optional<uint32_t> xor_mask) {
DCHECK(dest_frame.format() == PIXEL_FORMAT_NV12 ||
dest_frame.format() == PIXEL_FORMAT_NV12A ||
dest_frame.format() == PIXEL_FORMAT_I420 ||
@@ -189,7 +189,7 @@
}
void FillFourColorsFrameARGB(VideoFrame& dest_frame,
- absl::optional<uint32_t> xor_mask) {
+ std::optional<uint32_t> xor_mask) {
DCHECK(dest_frame.format() == PIXEL_FORMAT_ARGB ||
dest_frame.format() == PIXEL_FORMAT_XRGB ||
dest_frame.format() == PIXEL_FORMAT_ABGR ||
@@ -451,7 +451,7 @@
config.set_color_space_info(
VideoColorSpace::FromGfxColorSpace(gfx::ColorSpace::CreateHDR10()));
config.set_hdr_metadata(
- gfx::HDRMetadata::PopulateUnspecifiedWithDefaults(absl::nullopt));
+ gfx::HDRMetadata::PopulateUnspecifiedWithDefaults(std::nullopt));
return config;
}
@@ -460,7 +460,7 @@
config.set_color_space_info(
VideoColorSpace::FromGfxColorSpace(gfx::ColorSpace::CreateHDR10()));
config.set_hdr_metadata(
- gfx::HDRMetadata::PopulateUnspecifiedWithDefaults(absl::nullopt));
+ gfx::HDRMetadata::PopulateUnspecifiedWithDefaults(std::nullopt));
return config;
}
@@ -787,7 +787,7 @@
return stream;
}
-void FillFourColors(VideoFrame& dest_frame, absl::optional<uint32_t> xor_mask) {
+void FillFourColors(VideoFrame& dest_frame, std::optional<uint32_t> xor_mask) {
if (IsRGB(dest_frame.format())) {
FillFourColorsFrameARGB(dest_frame, xor_mask);
} else {
diff --git a/media/base/test_helpers.h b/media/base/test_helpers.h
index 368873e9..d540383a9 100644
--- a/media/base/test_helpers.h
+++ b/media/base/test_helpers.h
@@ -260,7 +260,7 @@
// provided the standard four colors will be XOR'd with the provided 00RRGGBB
// value (alpha value must be zero).
void FillFourColors(VideoFrame& dest_frame,
- absl::optional<uint32_t> xor_mask = absl::nullopt);
+ std::optional<uint32_t> xor_mask = std::nullopt);
// Compares two media::Status by StatusCode only. Also allows the ok helper to
// match kOk. It's a special case because we don't know the TypedStatus traits
diff --git a/media/base/video_codec_string_parsers.cc b/media/base/video_codec_string_parsers.cc
index 0565243e..4ad5bb6 100644
--- a/media/base/video_codec_string_parsers.cc
+++ b/media/base/video_codec_string_parsers.cc
@@ -28,7 +28,7 @@
namespace media {
-absl::optional<VideoType> ParseNewStyleVp9CodecID(std::string_view codec_id) {
+std::optional<VideoType> ParseNewStyleVp9CodecID(std::string_view codec_id) {
// Initialize optional fields to their defaults.
VideoType result = {
.codec = VideoCodec::kVP9,
@@ -43,12 +43,12 @@
if (fields.size() < 4 || fields.size() > 9) {
DVLOG(3) << __func__ << " Invalid number of fields (" << fields.size()
<< ")";
- return absl::nullopt;
+ return std::nullopt;
}
if (fields[0] != "vp09") {
DVLOG(3) << __func__ << " Invalid 4CC (" << fields[0] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
std::vector<int> values;
@@ -56,12 +56,12 @@
// Missing value is not allowed.
if (fields[i] == "") {
DVLOG(3) << __func__ << " Invalid missing field (position:" << i << ")";
- return absl::nullopt;
+ return std::nullopt;
}
int value;
if (!base::StringToInt(fields[i], &value) || value < 0) {
DVLOG(3) << __func__ << " Invalid field value (" << value << ")";
- return absl::nullopt;
+ return std::nullopt;
}
values.push_back(value);
}
@@ -82,7 +82,7 @@
break;
default:
DVLOG(3) << __func__ << " Invalid profile (" << profile_idc << ")";
- return absl::nullopt;
+ return std::nullopt;
}
result.level = values[1];
@@ -104,14 +104,14 @@
break;
default:
DVLOG(3) << __func__ << " Invalid level (" << result.level << ")";
- return absl::nullopt;
+ return std::nullopt;
}
result.bit_depth = values[2];
if (result.bit_depth != 8 && result.bit_depth != 10 &&
result.bit_depth != 12) {
DVLOG(3) << __func__ << " Invalid bit-depth (" << *result.bit_depth << ")";
- return absl::nullopt;
+ return std::nullopt;
}
// 4:2:0 isn't supported in profiles 1, 3.
@@ -137,7 +137,7 @@
default:
DVLOG(3) << __func__ << " Invalid chroma subsampling ("
<< chroma_subsampling << ")";
- return absl::nullopt;
+ return std::nullopt;
}
if (result.subsampling != VideoChromaSampling::k420 && profile_idc != 1 &&
@@ -155,7 +155,7 @@
result.color_space.primaries = VideoColorSpace::GetPrimaryID(values[4]);
if (result.color_space.primaries == VideoColorSpace::PrimaryID::INVALID) {
DVLOG(3) << __func__ << " Invalid color primaries (" << values[4] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
if (values.size() < 6) {
@@ -164,7 +164,7 @@
result.color_space.transfer = VideoColorSpace::GetTransferID(values[5]);
if (result.color_space.transfer == VideoColorSpace::TransferID::INVALID) {
DVLOG(3) << __func__ << " Invalid transfer function (" << values[5] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
if (values.size() < 7) {
@@ -174,7 +174,7 @@
if (result.color_space.matrix == VideoColorSpace::MatrixID::INVALID) {
DVLOG(3) << __func__ << " Invalid matrix coefficients (" << values[6]
<< ")";
- return absl::nullopt;
+ return std::nullopt;
}
if (result.color_space.matrix == VideoColorSpace::MatrixID::RGB &&
chroma_subsampling != 3) {
@@ -189,7 +189,7 @@
if (video_full_range_flag > 1) {
DVLOG(3) << __func__ << " Invalid full range flag ("
<< video_full_range_flag << ")";
- return absl::nullopt;
+ return std::nullopt;
}
result.color_space.range = video_full_range_flag == 1
? gfx::ColorSpace::RangeID::FULL
@@ -198,7 +198,7 @@
return result;
}
-absl::optional<VideoType> ParseLegacyVp9CodecID(std::string_view codec_id) {
+std::optional<VideoType> ParseLegacyVp9CodecID(std::string_view codec_id) {
if (codec_id == "vp9" || codec_id == "vp9.0") {
// Profile is not included in the codec string. Consumers of parsed codec
// should handle by rejecting ambiguous string or resolving to a default
@@ -209,10 +209,10 @@
return result;
}
- return absl::nullopt;
+ return std::nullopt;
}
-absl::optional<VideoType> ParseAv1CodecId(std::string_view codec_id) {
+std::optional<VideoType> ParseAv1CodecId(std::string_view codec_id) {
// The codecs parameter string for the AOM AV1 codec is as follows:
// See https://aomediacodec.github.io/av1-isobmff/#codecsparam.
//
@@ -229,7 +229,7 @@
if (fields.size() < 4 || fields.size() > 10) {
DVLOG(3) << __func__ << " Invalid number of fields (" << fields.size()
<< ")";
- return absl::nullopt;
+ return std::nullopt;
}
// All the other fields (including their leading '.') are optional, mutually
@@ -251,7 +251,7 @@
if (fields[0] != "av01") {
DVLOG(3) << __func__ << " Invalid AV1 4CC (" << fields[0] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
// The level parameter value SHALL equal the first level value indicated by
@@ -260,7 +260,7 @@
// 0, and H when it is equal to 1.
if (fields[2].size() != 3 || (fields[2][2] != 'M' && fields[2][2] != 'H')) {
DVLOG(3) << __func__ << " Invalid level+tier (" << fields[2] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
// Since tier has been validated, strip the trailing tier indicator to allow
@@ -272,12 +272,12 @@
for (size_t i = 1; i < fields.size(); ++i) {
if (fields[i].empty()) {
DVLOG(3) << __func__ << " Invalid empty field (position:" << i << ")";
- return absl::nullopt;
+ return std::nullopt;
}
if (!base::StringToInt(fields[i], &values[i]) || values[i] < 0) {
DVLOG(3) << __func__ << " Invalid field value (" << values[i] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
}
@@ -297,7 +297,7 @@
break;
default:
DVLOG(3) << __func__ << " Invalid profile (" << fields[1] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
// The level parameter value SHALL equal the first level value indicated by
@@ -306,7 +306,7 @@
result.level = values[2];
if (result.level > 31) {
DVLOG(3) << __func__ << " Invalid level (" << result.level << ")";
- return absl::nullopt;
+ return std::nullopt;
}
// The bitDepth parameter value SHALL equal the value of BitDepth variable as
@@ -316,7 +316,7 @@
(result.bit_depth != 8 && result.bit_depth != 10 &&
result.bit_depth != 12)) {
DVLOG(3) << __func__ << " Invalid bit-depth (" << fields[3] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
if (values.size() <= 4) {
@@ -328,11 +328,11 @@
const int monochrome = values[4];
if (fields[4].size() != 1 || monochrome > 1) {
DVLOG(3) << __func__ << " Invalid monochrome (" << fields[4] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
if (monochrome == 1 && result.profile == AV1PROFILE_PROFILE_HIGH) {
DVLOG(3) << "Monochrome isn't supported in high profile.";
- return absl::nullopt;
+ return std::nullopt;
}
if (values.size() <= 5) {
@@ -349,7 +349,7 @@
// otherwise it SHALL be set to 0.
if (fields[5].size() != 3) {
DVLOG(3) << __func__ << " Invalid chroma subsampling (" << fields[5] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
const char subsampling_x = fields[5][0];
@@ -359,13 +359,13 @@
(subsampling_y < '0' || subsampling_y > '1') ||
(chroma_sample_position < '0' || chroma_sample_position > '3')) {
DVLOG(3) << __func__ << " Invalid chroma subsampling (" << fields[5] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
if (((subsampling_x == '0' || subsampling_y == '0') &&
chroma_sample_position != '0')) {
DVLOG(3) << __func__ << " Invalid chroma subsampling (" << fields[5] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
if (subsampling_x == '0' && subsampling_y == '0' && monochrome == 0) {
@@ -399,7 +399,7 @@
if (fields[6].size() != 2 ||
result.color_space.primaries == VideoColorSpace::PrimaryID::INVALID) {
DVLOG(3) << __func__ << " Invalid color primaries (" << fields[6] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
if (values.size() <= 7) {
@@ -410,7 +410,7 @@
if (fields[7].size() != 2 ||
result.color_space.transfer == VideoColorSpace::TransferID::INVALID) {
DVLOG(3) << __func__ << " Invalid transfer function (" << fields[7] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
if (values.size() <= 8) {
@@ -429,7 +429,7 @@
DVLOG(3) << __func__ << " Invalid matrix coefficients (" << fields[8]
<< ")";
}
- return absl::nullopt;
+ return std::nullopt;
}
if (values.size() <= 9) {
@@ -439,7 +439,7 @@
const int video_full_range_flag = values[9];
if (fields[9].size() != 1 || video_full_range_flag > 1) {
DVLOG(3) << __func__ << " Invalid full range flag (" << fields[9] << ")";
- return absl::nullopt;
+ return std::nullopt;
}
result.color_space.range = video_full_range_flag == 1
? gfx::ColorSpace::RangeID::FULL
@@ -448,17 +448,17 @@
return result;
}
-absl::optional<VideoType> ParseAVCCodecId(std::string_view codec_id) {
+std::optional<VideoType> ParseAVCCodecId(std::string_view codec_id) {
// Make sure we have avc1.xxxxxx or avc3.xxxxxx , where xxxxxx are hex digits
if (!base::StartsWith(codec_id, "avc1.", base::CompareCase::SENSITIVE) &&
!base::StartsWith(codec_id, "avc3.", base::CompareCase::SENSITIVE)) {
- return absl::nullopt;
+ return std::nullopt;
}
uint32_t elem = 0;
if (codec_id.size() != 11 ||
!base::HexStringToUInt(base::StringPiece(codec_id).substr(5), &elem)) {
DVLOG(4) << __func__ << ": invalid avc codec id (" << codec_id << ")";
- return absl::nullopt;
+ return std::nullopt;
}
uint8_t level_byte = elem & 0xFF;
@@ -469,7 +469,7 @@
// reserved and must be zero according to ISO IEC 14496-10).
if (constraints_byte & 3) {
DVLOG(4) << __func__ << ": non-zero reserved bits in codec id " << codec_id;
- return absl::nullopt;
+ return std::nullopt;
}
VideoCodecProfile out_profile = VIDEO_CODEC_PROFILE_UNKNOWN;
@@ -511,7 +511,7 @@
break;
default:
DVLOG(1) << "Warning: unrecognized AVC/H.264 profile " << profile_idc;
- return absl::nullopt;
+ return std::nullopt;
}
// TODO(servolk): Take into account also constraint set flags 3 through 5.
@@ -538,10 +538,10 @@
// The specification for HEVC codec id strings can be found in ISO IEC 14496-15
// dated 2012 or newer in the Annex E.3
-absl::optional<VideoType> ParseHEVCCodecId(std::string_view codec_id) {
+std::optional<VideoType> ParseHEVCCodecId(std::string_view codec_id) {
if (!base::StartsWith(codec_id, "hev1.", base::CompareCase::SENSITIVE) &&
!base::StartsWith(codec_id, "hvc1.", base::CompareCase::SENSITIVE)) {
- return absl::nullopt;
+ return std::nullopt;
}
// HEVC codec id consists of:
@@ -554,7 +554,7 @@
if (codec_id.size() > kMaxHevcCodecIdLength) {
DVLOG(4) << __func__ << ": Codec id is too long (" << codec_id << ")";
- return absl::nullopt;
+ return std::nullopt;
}
std::vector<std::string> elem = base::SplitString(
@@ -563,7 +563,7 @@
if (elem.size() < 4) {
DVLOG(4) << __func__ << ": invalid HEVC codec id " << codec_id;
- return absl::nullopt;
+ return std::nullopt;
}
uint8_t general_profile_space = 0;
@@ -578,14 +578,14 @@
if (!base::StringToUint(elem[1], &general_profile_idc) ||
general_profile_idc > 0x1f) {
DVLOG(4) << __func__ << ": invalid general_profile_idc=" << elem[1];
- return absl::nullopt;
+ return std::nullopt;
}
uint32_t general_profile_compatibility_flags = 0;
if (!base::HexStringToUInt(elem[2], &general_profile_compatibility_flags)) {
DVLOG(4) << __func__
<< ": invalid general_profile_compatibility_flags=" << elem[2];
- return absl::nullopt;
+ return std::nullopt;
}
VideoCodecProfile out_profile = VIDEO_CODEC_PROFILE_UNKNOWN;
@@ -646,7 +646,7 @@
DVLOG(1) << "Warning: unrecognized HEVC/H.265 general_profile_idc: "
<< general_profile_idc << ", general_profile_compatibility_flags: "
<< general_profile_compatibility_flags;
- return absl::nullopt;
+ return std::nullopt;
}
uint8_t general_tier_flag;
@@ -655,7 +655,7 @@
elem[3].erase(0, 1);
} else {
DVLOG(4) << __func__ << ": invalid general_tier_flag=" << elem[3];
- return absl::nullopt;
+ return std::nullopt;
}
DCHECK(general_tier_flag == 0 || general_tier_flag == 1);
@@ -663,7 +663,7 @@
if (!base::StringToUint(elem[3], &general_level_idc) ||
general_level_idc > 0xff) {
DVLOG(4) << __func__ << ": invalid general_level_idc=" << elem[3];
- return absl::nullopt;
+ return std::nullopt;
}
uint8_t constraint_flags[6];
@@ -672,13 +672,13 @@
if (elem.size() > 10) {
DVLOG(4) << __func__ << ": unexpected number of trailing bytes in HEVC "
<< "codec id " << codec_id;
- return absl::nullopt;
+ return std::nullopt;
}
for (size_t i = 4; i < elem.size(); ++i) {
unsigned constr_byte = 0;
if (!base::HexStringToUInt(elem[i], &constr_byte) || constr_byte > 0xFF) {
DVLOG(4) << __func__ << ": invalid constraint byte=" << elem[i];
- return absl::nullopt;
+ return std::nullopt;
}
constraint_flags[i - 4] = constr_byte;
}
@@ -702,10 +702,10 @@
// .S<general_sub_profile_idc1> (Optional, base32 with "=" might be omitted.)
// <+general_sub_profile_
// .O<ols_idx>+<max_tid> (Optional, base10 OlsIdx & MaxTid)
-absl::optional<VideoType> ParseVVCCodecId(std::string_view codec_id) {
+std::optional<VideoType> ParseVVCCodecId(std::string_view codec_id) {
if (!base::StartsWith(codec_id, "vvc1.", base::CompareCase::SENSITIVE) &&
!base::StartsWith(codec_id, "vvi1.", base::CompareCase::SENSITIVE)) {
- return absl::nullopt;
+ return std::nullopt;
}
std::vector<std::string> elem = base::SplitString(
@@ -714,7 +714,7 @@
if (elem.size() < 3 || elem.size() > 6) {
DVLOG(4) << __func__ << ": invalid VVC codec id " << codec_id;
- return absl::nullopt;
+ return std::nullopt;
}
for (auto& item : elem) {
@@ -722,11 +722,11 @@
((item[0] == 'C' || item[0] == 'S' || item[0] == 'O') &&
item.size() < 2)) {
DVLOG(4) << __func__ << ": subelement of VVC codec id invalid.";
- return absl::nullopt;
+ return std::nullopt;
}
if (item[0] == 'O' && item.back() == '+') {
DVLOG(4) << __func__ << ": invalid OlxIdx and MaxTid string.";
- return absl::nullopt;
+ return std::nullopt;
}
}
@@ -734,7 +734,7 @@
if (!base::StringToUint(elem[1], &general_profile_idc) ||
general_profile_idc > 0x63) {
DVLOG(4) << __func__ << ": invalid general_profile_idc=" << elem[1];
- return absl::nullopt;
+ return std::nullopt;
}
VideoCodecProfile out_profile = VIDEO_CODEC_PROFILE_UNKNOWN;
@@ -791,7 +791,7 @@
if (out_profile == VIDEO_CODEC_PROFILE_UNKNOWN) {
DVLOG(1) << "Warning: unrecognized VVC/H.266 general_profile_idc: "
<< general_profile_idc;
- return absl::nullopt;
+ return std::nullopt;
}
uint8_t general_tier_flag;
@@ -800,7 +800,7 @@
elem[2].erase(0, 1);
} else {
DVLOG(4) << __func__ << ": invalid general_tier_flag=" << elem[2];
- return absl::nullopt;
+ return std::nullopt;
}
DCHECK(general_tier_flag == 0 || general_tier_flag == 1);
@@ -808,7 +808,7 @@
if (!base::StringToUint(elem[2], &general_level_idc) ||
general_level_idc > 0xff) {
DVLOG(4) << __func__ << ": invalid general_level_idc=" << elem[2];
- return absl::nullopt;
+ return std::nullopt;
}
// C-string, if existing, should proceed S-string and O-string.
@@ -832,7 +832,7 @@
if (!trailing_valid) {
DVLOG(4) << __func__ << ": invalid traing codec string.";
- return absl::nullopt;
+ return std::nullopt;
}
// TODO(crbug.com/1417910): Add VideoCodec::kVVC here when its ready.
@@ -847,10 +847,10 @@
// The specification for Dolby Vision codec id strings can be found in Dolby
// Vision streams within the MPEG-DASH format:
// https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolbyvisioninmpegdashspecification_v2_0_public_20190107.pdf
-absl::optional<VideoType> ParseDolbyVisionCodecId(std::string_view codec_id) {
+std::optional<VideoType> ParseDolbyVisionCodecId(std::string_view codec_id) {
if (!IsDolbyVisionAVCCodecId(codec_id) &&
!IsDolbyVisionHEVCCodecId(codec_id)) {
- return absl::nullopt;
+ return std::nullopt;
}
const int kMaxDvCodecIdLength = 5 // FOURCC string
@@ -861,7 +861,7 @@
if (codec_id.size() > kMaxDvCodecIdLength) {
DVLOG(4) << __func__ << ": Codec id is too long (" << codec_id << ")";
- return absl::nullopt;
+ return std::nullopt;
}
std::vector<std::string> elem = base::SplitString(
@@ -871,7 +871,7 @@
if (elem.size() != 3) {
DVLOG(4) << __func__ << ": invalid dolby vision codec id " << codec_id;
- return absl::nullopt;
+ return std::nullopt;
}
// Profile string should be two digits.
@@ -879,7 +879,7 @@
if (elem[1].size() != 2 || !base::StringToUint(elem[1], &profile_id) ||
profile_id > 9) {
DVLOG(4) << __func__ << ": invalid format or profile_id=" << elem[1];
- return absl::nullopt;
+ return std::nullopt;
}
VideoType result = {
@@ -894,7 +894,7 @@
if (!IsDolbyVisionAVCCodecId(codec_id)) {
DVLOG(4) << __func__
<< ": codec id is mismatched with profile_id=" << profile_id;
- return absl::nullopt;
+ return std::nullopt;
}
if (profile_id == 0) {
result.profile = DOLBYVISION_PROFILE0;
@@ -908,7 +908,7 @@
if (!IsDolbyVisionHEVCCodecId(codec_id)) {
DVLOG(4) << __func__
<< ": codec id is mismatched with profile_id=" << profile_id;
- return absl::nullopt;
+ return std::nullopt;
}
if (profile_id == 5) {
result.profile = DOLBYVISION_PROFILE5;
@@ -921,7 +921,7 @@
default:
DVLOG(4) << __func__
<< ": depecrated and not supported profile_id=" << profile_id;
- return absl::nullopt;
+ return std::nullopt;
}
// Level string should be two digits.
@@ -929,18 +929,18 @@
if (elem[2].size() != 2 || !base::StringToUint(elem[2], &level_id) ||
level_id > 13 || level_id < 1) {
DVLOG(4) << __func__ << ": invalid format level_id=" << elem[2];
- return absl::nullopt;
+ return std::nullopt;
}
result.level = level_id;
return result;
}
-absl::optional<VideoType> ParseCodec(std::string_view codec_id) {
+std::optional<VideoType> ParseCodec(std::string_view codec_id) {
std::vector<std::string> elem = base::SplitString(
codec_id, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (elem.empty()) {
- return absl::nullopt;
+ return std::nullopt;
}
if (codec_id == "vp8" || codec_id == "vp8.0") {
@@ -985,7 +985,7 @@
return result;
}
- return absl::nullopt;
+ return std::nullopt;
}
VideoCodec StringToVideoCodec(std::string_view codec_id) {
diff --git a/media/base/video_codec_string_parsers.h b/media/base/video_codec_string_parsers.h
index 50ee40f..e144eb3 100644
--- a/media/base/video_codec_string_parsers.h
+++ b/media/base/video_codec_string_parsers.h
@@ -7,12 +7,12 @@
#include <stdint.h>
+#include <optional>
#include <string>
#include <string_view>
#include "media/base/media_export.h"
#include "media/base/media_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -21,29 +21,29 @@
// https://storage.googleapis.com/downloads.webmproject.org/docs/vp9/vp-codec-iso-media-file-format-binding-20160516-draft.pdf
// ParseLegacyVp9CodecID handles parsing of legacy VP9 codec strings defined
// for WebM.
-MEDIA_EXPORT absl::optional<VideoType> ParseNewStyleVp9CodecID(
+MEDIA_EXPORT std::optional<VideoType> ParseNewStyleVp9CodecID(
std::string_view codec_id);
-MEDIA_EXPORT absl::optional<VideoType> ParseLegacyVp9CodecID(
+MEDIA_EXPORT std::optional<VideoType> ParseLegacyVp9CodecID(
std::string_view codec_id);
-MEDIA_EXPORT absl::optional<VideoType> ParseAv1CodecId(
+MEDIA_EXPORT std::optional<VideoType> ParseAv1CodecId(
std::string_view codec_id);
// Handle parsing AVC/H.264 codec ids as outlined in RFC 6381 and ISO-14496-10.
-MEDIA_EXPORT absl::optional<VideoType> ParseAVCCodecId(
+MEDIA_EXPORT std::optional<VideoType> ParseAVCCodecId(
std::string_view codec_id);
-MEDIA_EXPORT absl::optional<VideoType> ParseHEVCCodecId(
+MEDIA_EXPORT std::optional<VideoType> ParseHEVCCodecId(
std::string_view codec_id);
-MEDIA_EXPORT absl::optional<VideoType> ParseVVCCodecId(
+MEDIA_EXPORT std::optional<VideoType> ParseVVCCodecId(
std::string_view codec_id);
-MEDIA_EXPORT absl::optional<VideoType> ParseDolbyVisionCodecId(
+MEDIA_EXPORT std::optional<VideoType> ParseDolbyVisionCodecId(
std::string_view codec_id);
-MEDIA_EXPORT absl::optional<VideoType> ParseCodec(std::string_view codec_id);
+MEDIA_EXPORT std::optional<VideoType> ParseCodec(std::string_view codec_id);
MEDIA_EXPORT VideoCodec StringToVideoCodec(std::string_view codec_id);
diff --git a/media/base/video_decoder_config.h b/media/base/video_decoder_config.h
index 2cdcc8a..6b08854 100644
--- a/media/base/video_decoder_config.h
+++ b/media/base/video_decoder_config.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include <optional>
#include <string>
#include <vector>
@@ -17,7 +18,6 @@
#include "media/base/video_color_space.h"
#include "media/base/video_transformation.h"
#include "media/base/video_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/hdr_metadata.h"
@@ -148,7 +148,7 @@
void set_hdr_metadata(const gfx::HDRMetadata& hdr_metadata) {
hdr_metadata_ = hdr_metadata;
}
- const absl::optional<gfx::HDRMetadata>& hdr_metadata() const {
+ const std::optional<gfx::HDRMetadata>& hdr_metadata() const {
return hdr_metadata_;
}
@@ -188,7 +188,7 @@
EncryptionScheme encryption_scheme_ = EncryptionScheme::kUnencrypted;
VideoColorSpace color_space_info_;
- absl::optional<gfx::HDRMetadata> hdr_metadata_;
+ std::optional<gfx::HDRMetadata> hdr_metadata_;
bool is_rtc_ = false;
// Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
diff --git a/media/base/video_encoder.h b/media/base/video_encoder.h
index a77225a0..edf7a00 100644
--- a/media/base/video_encoder.h
+++ b/media/base/video_encoder.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_BASE_VIDEO_ENCODER_H_
#define MEDIA_BASE_VIDEO_ENCODER_H_
+#include <optional>
+
#include "base/functional/callback.h"
#include "base/task/bind_post_task.h"
#include "base/time/time.h"
@@ -14,7 +16,6 @@
#include "media/base/svc_scalability_mode.h"
#include "media/base/video_codecs.h"
#include "media/base/video_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/size.h"
@@ -49,7 +50,7 @@
// Some platforms may adjust the encoding size to meet hardware requirements.
// If not set, the encoded size is the same as configured.
- absl::optional<gfx::Size> encoded_size;
+ std::optional<gfx::Size> encoded_size;
};
class MEDIA_EXPORT VideoEncoder {
@@ -70,24 +71,24 @@
Options();
Options(const Options&);
~Options();
- absl::optional<Bitrate> bitrate;
- absl::optional<double> framerate;
+ std::optional<Bitrate> bitrate;
+ std::optional<double> framerate;
gfx::Size frame_size;
- absl::optional<int> keyframe_interval = 10000;
+ std::optional<int> keyframe_interval = 10000;
LatencyMode latency_mode = LatencyMode::Realtime;
- absl::optional<SVCScalabilityMode> scalability_mode;
+ std::optional<SVCScalabilityMode> scalability_mode;
- absl::optional<ContentHint> content_hint;
+ std::optional<ContentHint> content_hint;
// Controls encoded pixel format.
- absl::optional<VideoChromaSampling> subsampling;
+ std::optional<VideoChromaSampling> subsampling;
// Controls encoded bit depth.
- absl::optional<uint8_t> bit_depth;
+ std::optional<uint8_t> bit_depth;
// Only used for H264 encoding.
AvcOptions avc;
@@ -104,7 +105,7 @@
bool key_frame = false;
// Per-frame codec-specific quantizer value.
// Should only be used when encoder configured with kExternal bitrate mode.
- absl::optional<int> quantizer;
+ std::optional<int> quantizer;
};
// A sequence of codec specific bytes, commonly known as extradata.
@@ -121,7 +122,7 @@
// becomes available.
using OutputCB =
base::RepeatingCallback<void(VideoEncoderOutput output,
- absl::optional<CodecDescription>)>;
+ std::optional<CodecDescription>)>;
// Callback to report success and errors in encoder calls.
using EncoderStatusCB = base::OnceCallback<void(EncoderStatus error)>;
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index ab73424f..2c40b03 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -240,7 +240,7 @@
}
// Creates VideoFrameLayout for tightly packed frame.
-static absl::optional<VideoFrameLayout> GetDefaultLayout(
+static std::optional<VideoFrameLayout> GetDefaultLayout(
VideoPixelFormat format,
const gfx::Size& coded_size) {
std::vector<ColorPlaneLayout> planes;
@@ -300,7 +300,7 @@
default:
DLOG(ERROR) << "Unsupported pixel format"
<< VideoPixelFormatToString(format);
- return absl::nullopt;
+ return std::nullopt;
}
return VideoFrameLayout::CreateWithPlanes(format, coded_size, planes);
@@ -616,7 +616,7 @@
const gpu::MailboxHolder (&mailbox_holders)[kMaxPlanes],
ReleaseMailboxAndGpuMemoryBufferCB mailbox_holder_and_gmb_release_cb,
base::TimeDelta timestamp) {
- const absl::optional<VideoPixelFormat> format =
+ const std::optional<VideoPixelFormat> format =
GfxBufferFormatToVideoPixelFormat(gpu_memory_buffer->GetFormat());
if (!format)
return nullptr;
@@ -755,7 +755,7 @@
std::vector<int32_t> strides;
for (size_t i = 0; i < num_planes; ++i)
strides.push_back(IOSurfaceGetBytesPerRowOfPlane(io_surface.get(), i));
- absl::optional<VideoFrameLayout> layout =
+ std::optional<VideoFrameLayout> layout =
media::VideoFrameLayout::CreateWithStrides(pixel_format, size, strides);
if (!layout) {
DLOG(ERROR) << "Invalid layout.";
@@ -865,7 +865,7 @@
}
size_t new_plane_count = NumPlanes(format);
- absl::optional<VideoFrameLayout> new_layout;
+ std::optional<VideoFrameLayout> new_layout;
if (format == frame->format()) {
new_layout = frame->layout();
} else {
@@ -1539,7 +1539,7 @@
}
// static
-absl::optional<VideoFrameLayout>
+std::optional<VideoFrameLayout>
VideoFrame::CreateFullySpecifiedLayoutWithStrides(VideoPixelFormat format,
const gfx::Size& coded_size) {
const gfx::Size new_coded_size = DetermineAlignedSize(format, coded_size);
diff --git a/media/base/video_frame.h b/media/base/video_frame.h
index 81366ff..b56a9b6c 100644
--- a/media/base/video_frame.h
+++ b/media/base/video_frame.h
@@ -9,6 +9,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include <string>
#include <utility>
#include <vector>
@@ -33,7 +34,6 @@
#include "media/base/video_frame_layout.h"
#include "media/base/video_frame_metadata.h"
#include "media/base/video_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -169,7 +169,7 @@
// specified layout including offsets and plane sizes. Except that VideoFrame
// knows how to compute plane sizes, this method should be in
// `VideoFrameLayout`, probably just folded into `CreateWithStrides()`.
- static absl::optional<VideoFrameLayout> CreateFullySpecifiedLayoutWithStrides(
+ static std::optional<VideoFrameLayout> CreateFullySpecifiedLayoutWithStrides(
VideoPixelFormat format,
const gfx::Size& coded_size);
@@ -502,11 +502,11 @@
color_space_ = color_space;
}
- const absl::optional<gfx::HDRMetadata>& hdr_metadata() const {
+ const std::optional<gfx::HDRMetadata>& hdr_metadata() const {
return hdr_metadata_;
}
- void set_hdr_metadata(const absl::optional<gfx::HDRMetadata>& hdr_metadata) {
+ void set_hdr_metadata(const std::optional<gfx::HDRMetadata>& hdr_metadata) {
hdr_metadata_ = hdr_metadata;
}
@@ -577,7 +577,7 @@
return const_cast<uint8_t*>(data_[plane]);
}
- const absl::optional<gpu::VulkanYCbCrInfo>& ycbcr_info() const {
+ const std::optional<gpu::VulkanYCbCrInfo>& ycbcr_info() const {
return wrapped_frame_ ? wrapped_frame_->ycbcr_info() : ycbcr_info_;
}
@@ -686,7 +686,7 @@
size_t BitDepth() const;
// Provide the sampler conversion information for the frame.
- void set_ycbcr_info(const absl::optional<gpu::VulkanYCbCrInfo>& ycbcr_info) {
+ void set_ycbcr_info(const std::optional<gpu::VulkanYCbCrInfo>& ycbcr_info) {
ycbcr_info_ = ycbcr_info;
}
@@ -849,7 +849,7 @@
const ID unique_id_;
gfx::ColorSpace color_space_;
- absl::optional<gfx::HDRMetadata> hdr_metadata_;
+ std::optional<gfx::HDRMetadata> hdr_metadata_;
// The format type used to create shared images. When set to Legacy creates
// shared images with current path; when set to SharedImageFormat with/without
@@ -859,7 +859,7 @@
SharedImageFormatType::kLegacy;
// Sampler conversion information which is used in vulkan context for android.
- absl::optional<gpu::VulkanYCbCrInfo> ycbcr_info_;
+ std::optional<gpu::VulkanYCbCrInfo> ycbcr_info_;
// Allocation which makes up |data_| planes for self-allocated frames.
std::unique_ptr<uint8_t, base::UncheckedFreeDeleter> private_data_;
diff --git a/media/base/video_frame_converter.cc b/media/base/video_frame_converter.cc
index b9bd76c..b75b435 100644
--- a/media/base/video_frame_converter.cc
+++ b/media/base/video_frame_converter.cc
@@ -14,7 +14,7 @@
constexpr auto kDefaultFiltering = libyuv::kFilterBox;
-absl::optional<VideoPixelFormat> GetSourceFormatOverrideForABGRToARGB(
+std::optional<VideoPixelFormat> GetSourceFormatOverrideForABGRToARGB(
VideoPixelFormat src_format,
VideoPixelFormat dest_format) {
if ((src_format == PIXEL_FORMAT_XBGR || src_format == PIXEL_FORMAT_ABGR) &&
@@ -22,7 +22,7 @@
return src_format == PIXEL_FORMAT_XBGR ? PIXEL_FORMAT_XRGB
: PIXEL_FORMAT_ARGB;
}
- return absl::nullopt;
+ return std::nullopt;
}
// Wraps `tmp_frame` in a new VideoFrame with pixel format `override_format`. No
diff --git a/media/base/video_frame_layout.cc b/media/base/video_frame_layout.cc
index 7e5dfe6..85c547e 100644
--- a/media/base/video_frame_layout.cc
+++ b/media/base/video_frame_layout.cc
@@ -94,7 +94,7 @@
}
// static
-absl::optional<VideoFrameLayout> VideoFrameLayout::Create(
+std::optional<VideoFrameLayout> VideoFrameLayout::Create(
VideoPixelFormat format,
const gfx::Size& coded_size) {
return CreateWithStrides(format, coded_size,
@@ -102,7 +102,7 @@
}
// static
-absl::optional<VideoFrameLayout> VideoFrameLayout::CreateWithStrides(
+std::optional<VideoFrameLayout> VideoFrameLayout::CreateWithStrides(
VideoPixelFormat format,
const gfx::Size& coded_size,
std::vector<int32_t> strides,
@@ -113,32 +113,32 @@
}
// static
-absl::optional<VideoFrameLayout> VideoFrameLayout::CreateWithPlanes(
+std::optional<VideoFrameLayout> VideoFrameLayout::CreateWithPlanes(
VideoPixelFormat format,
const gfx::Size& coded_size,
std::vector<ColorPlaneLayout> planes,
size_t buffer_addr_align,
uint64_t modifier) {
// NOTE: Even if format is UNKNOWN, it is valid if coded_sizes is not Empty().
- // TODO(crbug.com/896135): Return absl::nullopt,
+ // TODO(crbug.com/896135): Return std::nullopt,
// if (format != PIXEL_FORMAT_UNKNOWN || !coded_sizes.IsEmpty())
- // TODO(crbug.com/896135): Return absl::nullopt,
+ // TODO(crbug.com/896135): Return std::nullopt,
// if (planes.size() != NumPlanes(format))
return VideoFrameLayout(format, coded_size, std::move(planes),
false /*is_multi_planar */, buffer_addr_align,
modifier);
}
-absl::optional<VideoFrameLayout> VideoFrameLayout::CreateMultiPlanar(
+std::optional<VideoFrameLayout> VideoFrameLayout::CreateMultiPlanar(
VideoPixelFormat format,
const gfx::Size& coded_size,
std::vector<ColorPlaneLayout> planes,
size_t buffer_addr_align,
uint64_t modifier) {
// NOTE: Even if format is UNKNOWN, it is valid if coded_sizes is not Empty().
- // TODO(crbug.com/896135): Return absl::nullopt,
+ // TODO(crbug.com/896135): Return std::nullopt,
// if (format != PIXEL_FORMAT_UNKNOWN || !coded_sizes.IsEmpty())
- // TODO(crbug.com/896135): Return absl::nullopt,
+ // TODO(crbug.com/896135): Return std::nullopt,
// if (planes.size() != NumPlanes(format))
return VideoFrameLayout(format, coded_size, std::move(planes),
true /*is_multi_planar */, buffer_addr_align,
diff --git a/media/base/video_frame_layout.h b/media/base/video_frame_layout.h
index ae68bcfe5..a32d391 100644
--- a/media/base/video_frame_layout.h
+++ b/media/base/video_frame_layout.h
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <optional>
#include <ostream>
#include <utility>
#include <vector>
@@ -15,7 +16,6 @@
#include "media/base/color_plane_layout.h"
#include "media/base/media_export.h"
#include "media/base/video_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/native_pixmap_handle.h"
@@ -46,19 +46,19 @@
// |modifier| is the additional information of |format|. It will become some
// value else than gfx::NativePixmapHandle::kNoModifier when the underlying
// buffer format is different from a standard |format| due to tiling.
- // The returned absl::optional will be absl::nullopt if the configured values
+ // The returned std::optional will be std::nullopt if the configured values
// are invalid.
// Create a layout suitable for |format| at |coded_size|. The stride, offsets
// and size of all planes are set to 0, since that information cannot reliably
// be infered from the arguments.
- static absl::optional<VideoFrameLayout> Create(VideoPixelFormat format,
- const gfx::Size& coded_size);
+ static std::optional<VideoFrameLayout> Create(VideoPixelFormat format,
+ const gfx::Size& coded_size);
// Create a layout suitable for |format| at |coded_size|, with the |strides|
// for each plane specified. The offsets and size of all planes are set to 0.
// The size of |strides| must be equal to NumPlanes(|format|).
- static absl::optional<VideoFrameLayout> CreateWithStrides(
+ static std::optional<VideoFrameLayout> CreateWithStrides(
VideoPixelFormat format,
const gfx::Size& coded_size,
std::vector<int32_t> strides,
@@ -68,7 +68,7 @@
// Create a layout suitable for |format| at |coded_size|, with the |planes|
// fully provided.
// The size of |planes| must be equal to NumPlanes(|format|).
- static absl::optional<VideoFrameLayout> CreateWithPlanes(
+ static std::optional<VideoFrameLayout> CreateWithPlanes(
VideoPixelFormat format,
const gfx::Size& coded_size,
std::vector<ColorPlaneLayout> planes,
@@ -78,7 +78,7 @@
// This constructor should be called for situations where the frames using
// this format are backed by multiple physical buffers, instead of having each
// plane at different offsets of the same buffer. Currently only used by V4L2.
- static absl::optional<VideoFrameLayout> CreateMultiPlanar(
+ static std::optional<VideoFrameLayout> CreateMultiPlanar(
VideoPixelFormat format,
const gfx::Size& coded_size,
std::vector<ColorPlaneLayout> planes,
diff --git a/media/base/video_frame_metadata.h b/media/base/video_frame_metadata.h
index ca03a4f7..601075b 100644
--- a/media/base/video_frame_metadata.h
+++ b/media/base/video_frame_metadata.h
@@ -5,13 +5,14 @@
#ifndef MEDIA_BASE_VIDEO_FRAME_METADATA_H_
#define MEDIA_BASE_VIDEO_FRAME_METADATA_H_
+#include <optional>
+
#include "base/time/time.h"
#include "base/unguessable_token.h"
#include "build/build_config.h"
#include "media/base/media_export.h"
#include "media/base/video_transformation.h"
#include "media/gpu/buildflags.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
namespace media {
@@ -37,8 +38,8 @@
// Video capture begin/end timestamps. Consumers can use these values for
// dynamic optimizations, logging stats, etc.
- absl::optional<base::TimeTicks> capture_begin_time;
- absl::optional<base::TimeTicks> capture_end_time;
+ std::optional<base::TimeTicks> capture_begin_time;
+ std::optional<base::TimeTicks> capture_end_time;
// A counter that is increased by the producer of video frames each time
// it pushes out a new frame. By looking for gaps in this counter, clients
@@ -46,7 +47,7 @@
// the producer between two consecutively received frames. Note that the
// counter may start at arbitrary values, so the absolute value of it has no
// meaning.
- absl::optional<int> capture_counter;
+ std::optional<int> capture_counter;
// The rectangular region of the frame that has changed since the frame
// with the directly preceding CAPTURE_COUNTER. If that frame was not
@@ -55,13 +56,13 @@
// The rectangle is relative to the full frame data, i.e. [0, 0,
// coded_size().width(), coded_size().height()]. It does not have to be
// fully contained within visible_rect().
- absl::optional<gfx::Rect> capture_update_rect;
+ std::optional<gfx::Rect> capture_update_rect;
// For encoded frames, this is the original source size which may be different
// from the encoded size. It's used for the HiDPI tab capture heuristic.
// The size corresponds to the active region if region capture is active,
// or otherwise the full size of the captured source.
- absl::optional<gfx::Size> source_size;
+ std::optional<gfx::Size> source_size;
// If cropping was applied due to Region Capture to produce this frame,
// then this reflects where the frame's contents originate from in the
@@ -70,7 +71,7 @@
// NOTE: May also be nullopt if region capture is enabled but the capture rect
// is in a different coordinate space. For more info, see
// https://crbug.com/1327560.
- absl::optional<gfx::Rect> region_capture_rect;
+ std::optional<gfx::Rect> region_capture_rect;
// Whenever cropTo() or restrictTo() are called, Blink increments the
// sub_capture_target_version and records a Promise as associated with that
@@ -96,12 +97,12 @@
// vary unpredictably for every frame. Consumers can use this to optimize
// playback scheduling, make encoding quality decisions, and/or compute
// frame-level resource utilization stats.
- absl::optional<base::TimeDelta> frame_duration;
+ std::optional<base::TimeDelta> frame_duration;
// Represents either the fixed frame rate, or the maximum frame rate to
// expect from a variable-rate source. This value generally remains the
// same for all frames in the same session.
- absl::optional<double> frame_rate;
+ std::optional<double> frame_rate;
// This is a boolean that signals that the video capture engine detects
// interactive content. One possible optimization that this signal can help
@@ -115,7 +116,7 @@
// a high-resolution timestamp, and so it should not be used as a
// presentation time; but, instead, it should be used for buffering playback
// and for A/V synchronization purposes.
- absl::optional<base::TimeTicks> reference_time;
+ std::optional<base::TimeTicks> reference_time;
// Sources of VideoFrames use this marker to indicate that an instance of
// VideoFrameExternalResources produced from the associated video frame
@@ -123,7 +124,7 @@
bool read_lock_fences_enabled = false;
// Indicates that the frame has a rotation and/or flip.
- absl::optional<VideoTransformation> transformation;
+ std::optional<VideoTransformation> transformation;
// Android only: if set, then this frame is not suitable for overlay, even
// if ALLOW_OVERLAY is set. However, it allows us to process the overlay
@@ -162,12 +163,12 @@
//
// Notes on IPC: this field should not be copied to the Mojo version of
// VideoFrameMetadata because it should not cross process boundaries.
- absl::optional<unsigned int> hw_va_protected_session_id;
+ std::optional<unsigned int> hw_va_protected_session_id;
#endif
// An UnguessableToken that identifies VideoOverlayFactory that created
// this VideoFrame. It's used by Cast to help with video hole punch.
- absl::optional<base::UnguessableToken> overlay_plane_id;
+ std::optional<base::UnguessableToken> overlay_plane_id;
// Whether this frame was decoded in a power efficient way.
bool power_efficient = false;
@@ -180,52 +181,52 @@
// remote debugging.
// TODO(crbug.com/832220): Use a customized dictionary value instead of
// using these keys directly.
- absl::optional<double> device_scale_factor;
- absl::optional<double> page_scale_factor;
- absl::optional<double> root_scroll_offset_x;
- absl::optional<double> root_scroll_offset_y;
- absl::optional<double> top_controls_visible_height;
+ std::optional<double> device_scale_factor;
+ std::optional<double> page_scale_factor;
+ std::optional<double> root_scroll_offset_x;
+ std::optional<double> root_scroll_offset_y;
+ std::optional<double> top_controls_visible_height;
// If present, this field represents the local time at which the VideoFrame
// was decoded from whichever format it was encoded in. Sometimes only
// DECODE_END_TIME will be present.
- absl::optional<base::TimeTicks> decode_begin_time;
- absl::optional<base::TimeTicks> decode_end_time;
+ std::optional<base::TimeTicks> decode_begin_time;
+ std::optional<base::TimeTicks> decode_end_time;
// If present, this field represents the elapsed time from the submission of
// the encoded packet with the same PTS as this frame to the decoder until
// the decoded frame was ready for presentation.
- absl::optional<base::TimeDelta> processing_time;
+ std::optional<base::TimeDelta> processing_time;
// The RTP timestamp associated with this video frame. Stored as a double
// since base::Value::Dict doesn't have a uint32_t type.
//
// https://w3c.github.io/webrtc-pc/#dom-rtcrtpcontributingsource-rtptimestamp
- absl::optional<double> rtp_timestamp;
+ std::optional<double> rtp_timestamp;
// For video frames coming from a remote source, this is the time the
// encoded frame was received by the platform, i.e., the time at
// which the last packet belonging to this frame was received over the
// network.
- absl::optional<base::TimeTicks> receive_time;
+ std::optional<base::TimeTicks> receive_time;
// If present, this field represents the duration this frame is ideally
// expected to spend on the screen during playback. Unlike FRAME_DURATION
// this field takes into account current playback rate.
- absl::optional<base::TimeDelta> wallclock_frame_duration;
+ std::optional<base::TimeDelta> wallclock_frame_duration;
// WebRTC streams only: if present, this field represents the maximum
// composition delay that is allowed for this frame. This is respected
// in a best effort manner.
// This is an experimental feature, see crbug.com/1138888 for more
// information.
- absl::optional<int> maximum_composition_delay_in_frames;
+ std::optional<int> maximum_composition_delay_in_frames;
// Identifies a BeginFrameArgs (along with the source_id).
// See comments in components/viz/common/frame_sinks/begin_frame_args.h.
//
// Only set for video frames produced by the frame sink video capturer.
- absl::optional<uint64_t> frame_sequence;
+ std::optional<uint64_t> frame_sequence;
};
} // namespace media
diff --git a/media/base/video_renderer.h b/media/base/video_renderer.h
index d4a84a4..15b74cb 100644
--- a/media/base/video_renderer.h
+++ b/media/base/video_renderer.h
@@ -5,11 +5,12 @@
#ifndef MEDIA_BASE_VIDEO_RENDERER_H_
#define MEDIA_BASE_VIDEO_RENDERER_H_
+#include <optional>
+
#include "base/functional/callback_forward.h"
#include "media/base/media_export.h"
#include "media/base/pipeline_status.h"
#include "media/base/time_source.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -69,7 +70,7 @@
// media::Renderer::SetLatencyHint().
// |latency_hint| may be nullopt to indicate the hint has been cleared
// (restore UA default).
- virtual void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) = 0;
+ virtual void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) = 0;
};
} // namespace media
diff --git a/media/capabilities/webrtc_video_stats_db.cc b/media/capabilities/webrtc_video_stats_db.cc
index 9b46948c..22611bb 100644
--- a/media/capabilities/webrtc_video_stats_db.cc
+++ b/media/capabilities/webrtc_video_stats_db.cc
@@ -93,7 +93,7 @@
}
// static
-absl::optional<int> WebrtcVideoStatsDB::VideoDescKey::ParsePixelsFromKey(
+std::optional<int> WebrtcVideoStatsDB::VideoDescKey::ParsePixelsFromKey(
std::string key) {
constexpr size_t kMinimumIndexOfLastSeparator = 5;
size_t last_separator_index = key.rfind("|");
@@ -105,7 +105,7 @@
&parsed_pixels))
return parsed_pixels;
}
- return absl::nullopt;
+ return std::nullopt;
}
WebrtcVideoStatsDB::VideoStats::VideoStats(double timestamp,
diff --git a/media/capabilities/webrtc_video_stats_db.h b/media/capabilities/webrtc_video_stats_db.h
index 3305521..de243d5 100644
--- a/media/capabilities/webrtc_video_stats_db.h
+++ b/media/capabilities/webrtc_video_stats_db.h
@@ -6,6 +6,7 @@
#define MEDIA_CAPABILITIES_WEBRTC_VIDEO_STATS_DB_H_
#include <memory>
+#include <optional>
#include <string>
#include <vector>
@@ -15,7 +16,6 @@
#include "base/time/time.h"
#include "media/base/media_export.h"
#include "media/base/video_codecs.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
@@ -42,7 +42,7 @@
// For debug logging. NOT interchangeable with Serialize().
std::string ToLogStringForDebug() const;
- static absl::optional<int> ParsePixelsFromKey(std::string key);
+ static std::optional<int> ParsePixelsFromKey(std::string key);
// Note: operator == and != are defined outside this class.
const bool is_decode_stats;
@@ -146,7 +146,7 @@
// the stats in addition to a boolean signaling if the call was successful.
// VideoStatsEntry can be nullopt if there was no data associated with `key`.
using GetVideoStatsCB =
- base::OnceCallback<void(bool, absl::optional<VideoStatsEntry>)>;
+ base::OnceCallback<void(bool, std::optional<VideoStatsEntry>)>;
virtual void GetVideoStats(const VideoDescKey& key,
GetVideoStatsCB get_stats_cb) = 0;
@@ -155,7 +155,7 @@
// signaling if the call was successful. VideoStatsEntry can be nullopt if
// there was no data associated with `key`.
using GetVideoStatsCollectionCB =
- base::OnceCallback<void(bool, absl::optional<VideoStatsCollection>)>;
+ base::OnceCallback<void(bool, std::optional<VideoStatsCollection>)>;
virtual void GetVideoStatsCollection(
const VideoDescKey& key,
GetVideoStatsCollectionCB get_stats_cb) = 0;
diff --git a/media/capabilities/webrtc_video_stats_db_impl.cc b/media/capabilities/webrtc_video_stats_db_impl.cc
index ff6c441e..927f68d 100644
--- a/media/capabilities/webrtc_video_stats_db_impl.cc
+++ b/media/capabilities/webrtc_video_stats_db_impl.cc
@@ -291,7 +291,7 @@
UMA_HISTOGRAM_BOOLEAN("Media.WebrtcVideoStatsDB.OpSuccess.Read", success);
// Convert from WebrtcVideoStatsEntryProto to VideoStatsEntry.
- absl::optional<VideoStatsEntry> entry;
+ std::optional<VideoStatsEntry> entry;
if (stats_proto && AreStatsValid(stats_proto.get())) {
DCHECK(success);
const base::TimeDelta max_time_to_keep_stats = GetMaxTimeToKeepStats();
@@ -326,7 +326,7 @@
pending_operations_.Complete(op_id);
UMA_HISTOGRAM_BOOLEAN("Media.WebrtcVideoStatsDB.OpSuccess.Read", success);
// Convert from map of WebrtcVideoStatsEntryProto to VideoStatsCollection.
- absl::optional<VideoStatsCollection> collection;
+ std::optional<VideoStatsCollection> collection;
if (stats_proto_collection) {
DCHECK(success);
collection.emplace();
@@ -346,7 +346,7 @@
}
if (!entry.empty()) {
- absl::optional<int> pixels =
+ std::optional<int> pixels =
VideoDescKey::ParsePixelsFromKey(pixel_key);
if (pixels) {
collection->insert({*pixels, std::move(entry)});
diff --git a/media/capabilities/webrtc_video_stats_db_impl_unittest.cc b/media/capabilities/webrtc_video_stats_db_impl_unittest.cc
index 4e69ee1..4a8676ae 100644
--- a/media/capabilities/webrtc_video_stats_db_impl_unittest.cc
+++ b/media/capabilities/webrtc_video_stats_db_impl_unittest.cc
@@ -143,8 +143,7 @@
void VerifyReadStats(const VideoDescKey& key,
const VideoStatsEntry& expected) {
- EXPECT_CALL(*this,
- MockGetVideoStatsCb(true, absl::make_optional(expected)));
+ EXPECT_CALL(*this, MockGetVideoStatsCb(true, std::make_optional(expected)));
stats_db_->GetVideoStats(
key, base::BindOnce(&WebrtcVideoStatsDBImplTest::MockGetVideoStatsCb,
base::Unretained(this)));
@@ -157,7 +156,7 @@
const VideoDescKey& key,
const WebrtcVideoStatsDB::VideoStatsCollection& expected) {
EXPECT_CALL(*this, MockGetVideoStatsCollectionCb(
- true, absl::make_optional(expected)));
+ true, std::make_optional(expected)));
stats_db_->GetVideoStatsCollection(
key, base::BindOnce(
&WebrtcVideoStatsDBImplTest::MockGetVideoStatsCollectionCb,
@@ -169,7 +168,7 @@
void VerifyEmptyStats(const VideoDescKey& key) {
EXPECT_CALL(*this,
- MockGetVideoStatsCb(true, absl::optional<VideoStatsEntry>()));
+ MockGetVideoStatsCb(true, std::optional<VideoStatsEntry>()));
stats_db_->GetVideoStats(
key, base::BindOnce(&WebrtcVideoStatsDBImplTest::MockGetVideoStatsCb,
base::Unretained(this)));
@@ -204,12 +203,12 @@
MOCK_METHOD1(OnInitialize, void(bool success));
MOCK_METHOD2(MockGetVideoStatsCb,
- void(bool success, absl::optional<VideoStatsEntry> entry));
+ void(bool success, std::optional<VideoStatsEntry> entry));
- MOCK_METHOD2(MockGetVideoStatsCollectionCb,
- void(bool success,
- absl::optional<WebrtcVideoStatsDB::VideoStatsCollection>
- collection));
+ MOCK_METHOD2(
+ MockGetVideoStatsCollectionCb,
+ void(bool success,
+ std::optional<WebrtcVideoStatsDB::VideoStatsCollection> collection));
MOCK_METHOD1(MockAppendVideoStatsCb, void(bool success));
diff --git a/media/capture/content/video_capture_oracle_unittest.cc b/media/capture/content/video_capture_oracle_unittest.cc
index 94d2e1f7..d9df399 100644
--- a/media/capture/content/video_capture_oracle_unittest.cc
+++ b/media/capture/content/video_capture_oracle_unittest.cc
@@ -4,9 +4,10 @@
#include "media/capture/content/video_capture_oracle.h"
+#include <optional>
+
#include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -878,7 +879,7 @@
int frame_number;
// As if previous frame was captured at 30 fps.
- absl::optional<base::TimeTicks> last_capture_time;
+ std::optional<base::TimeTicks> last_capture_time;
for (int i = 0; i < 100; ++i) {
t += vsync_interval;
if (oracle.ObserveEventAndDecideCapture(
@@ -902,7 +903,7 @@
frame_number, media::VideoCaptureFeedback(kNoResourceUtilization, k5Fps));
// Don't measure frame-rate across different target frame-rates.
- last_capture_time = absl::nullopt;
+ last_capture_time = std::nullopt;
// Continue capturing frames, observe that frame-rate limit is respected.
for (int i = 0; i < 100; ++i) {
t += vsync_interval;
@@ -928,7 +929,7 @@
media::VideoCaptureFeedback(kNoResourceUtilization, kNoFpsLimit));
// Don't measure frame-rate across different target frame-rates.
- last_capture_time = absl::nullopt;
+ last_capture_time = std::nullopt;
// Continue capturing frames, observe that original min capture period is
// respected.
for (int i = 0; i < 100; ++i) {
diff --git a/media/capture/mojom/video_capture_types_mojom_traits.cc b/media/capture/mojom/video_capture_types_mojom_traits.cc
index a976434..e5aa2d9ee 100644
--- a/media/capture/mojom/video_capture_types_mojom_traits.cc
+++ b/media/capture/mojom/video_capture_types_mojom_traits.cc
@@ -4,7 +4,8 @@
#include "media/capture/mojom/video_capture_types_mojom_traits.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
+#include <optional>
+
#include "ui/gfx/geometry/mojom/geometry.mojom.h"
#include "ui/gfx/geometry/mojom/geometry_mojom_traits.h"
diff --git a/media/capture/mojom/video_capture_types_mojom_traits.h b/media/capture/mojom/video_capture_types_mojom_traits.h
index ae9af758..4cef83bd 100644
--- a/media/capture/mojom/video_capture_types_mojom_traits.h
+++ b/media/capture/mojom/video_capture_types_mojom_traits.h
@@ -213,7 +213,7 @@
return input.facing;
}
- static absl::optional<media::CameraAvailability> availability(
+ static std::optional<media::CameraAvailability> availability(
const media::VideoCaptureDeviceDescriptor& input) {
return input.availability;
}
diff --git a/media/capture/video/apple/pixel_buffer_pool.cc b/media/capture/video/apple/pixel_buffer_pool.cc
index e6b19fcc..b4268e3 100644
--- a/media/capture/video/apple/pixel_buffer_pool.cc
+++ b/media/capture/video/apple/pixel_buffer_pool.cc
@@ -42,7 +42,7 @@
OSType format,
int width,
int height,
- absl::optional<size_t> max_buffers) {
+ std::optional<size_t> max_buffers) {
// Pixel buffer attributes: The attributes of buffers created by the pool.
CFStringRef pixel_buffer_attribute_keys[] = {
kCVPixelBufferIOSurfacePropertiesKey, // We want IOSurfaces.
@@ -91,7 +91,7 @@
PixelBufferPool::PixelBufferPool(
base::apple::ScopedCFTypeRef<CVPixelBufferPoolRef> buffer_pool,
- absl::optional<size_t> max_buffers)
+ std::optional<size_t> max_buffers)
: buffer_pool_(std::move(buffer_pool)),
max_buffers_(std::move(max_buffers)),
num_consecutive_errors_(0) {
diff --git a/media/capture/video/apple/pixel_buffer_pool.h b/media/capture/video/apple/pixel_buffer_pool.h
index dd470b5b..270f633 100644
--- a/media/capture/video/apple/pixel_buffer_pool.h
+++ b/media/capture/video/apple/pixel_buffer_pool.h
@@ -6,11 +6,12 @@
#define MEDIA_CAPTURE_VIDEO_APPLE_PIXEL_BUFFER_POOL_H_
#import <VideoToolbox/VideoToolbox.h>
+
#include <memory>
+#include <optional>
#include "base/apple/scoped_cftyperef.h"
#include "media/capture/capture_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -26,7 +27,7 @@
OSType format,
int width,
int height,
- absl::optional<size_t> max_buffers);
+ std::optional<size_t> max_buffers);
~PixelBufferPool();
// Creates a new buffer from the pool, if possible. The underlying buffers are
@@ -55,14 +56,14 @@
private:
friend std::unique_ptr<PixelBufferPool> std::make_unique<PixelBufferPool>(
base::apple::ScopedCFTypeRef<CVPixelBufferPoolRef>&& buffer_pool,
- absl::optional<size_t>&& max_buffers);
+ std::optional<size_t>&& max_buffers);
PixelBufferPool(
base::apple::ScopedCFTypeRef<CVPixelBufferPoolRef> buffer_pool,
- absl::optional<size_t> max_buffers);
+ std::optional<size_t> max_buffers);
base::apple::ScopedCFTypeRef<CVPixelBufferPoolRef> buffer_pool_;
- const absl::optional<size_t> max_buffers_;
+ const std::optional<size_t> max_buffers_;
size_t num_consecutive_errors_;
};
diff --git a/media/capture/video/apple/pixel_buffer_pool_unittest.mm b/media/capture/video/apple/pixel_buffer_pool_unittest.mm
index 7f11f0b..5baa9a51 100644
--- a/media/capture/video/apple/pixel_buffer_pool_unittest.mm
+++ b/media/capture/video/apple/pixel_buffer_pool_unittest.mm
@@ -83,7 +83,7 @@
TEST(PixelBufferPoolTest, CanCreateBuffersIfMaxIsNull) {
std::unique_ptr<PixelBufferPool> pool = PixelBufferPool::Create(
- kPixelFormatNv12, kVgaWidth, kVgaHeight, absl::nullopt);
+ kPixelFormatNv12, kVgaWidth, kVgaHeight, std::nullopt);
base::apple::ScopedCFTypeRef<CVPixelBufferRef> first_buffer =
pool->CreateBuffer();
EXPECT_TRUE(first_buffer);
@@ -201,7 +201,7 @@
TEST(PixelBufferPoolTest, CanFlushWhileBufferIsInUse) {
std::unique_ptr<PixelBufferPool> pool = PixelBufferPool::Create(
- kPixelFormatNv12, kVgaWidth, kVgaHeight, absl::nullopt);
+ kPixelFormatNv12, kVgaWidth, kVgaHeight, std::nullopt);
base::apple::ScopedCFTypeRef<CVPixelBufferRef> retained_buffer =
pool->CreateBuffer();
base::apple::ScopedCFTypeRef<CVPixelBufferRef> released_buffer =
diff --git a/media/capture/video/apple/sample_buffer_transformer.cc b/media/capture/video/apple/sample_buffer_transformer.cc
index 2c858708..94e080fb 100644
--- a/media/capture/video/apple/sample_buffer_transformer.cc
+++ b/media/capture/video/apple/sample_buffer_transformer.cc
@@ -480,7 +480,7 @@
OSType destination_pixel_format,
const gfx::Size& destination_size,
int rotation_angle,
- absl::optional<size_t> buffer_pool_size) {
+ std::optional<size_t> buffer_pool_size) {
DCHECK(transformer != Transformer::kLibyuv ||
destination_pixel_format == kPixelFormatI420 ||
destination_pixel_format == kPixelFormatNv12)
diff --git a/media/capture/video/apple/sample_buffer_transformer.h b/media/capture/video/apple/sample_buffer_transformer.h
index 12f325f..4f0cc5d 100644
--- a/media/capture/video/apple/sample_buffer_transformer.h
+++ b/media/capture/video/apple/sample_buffer_transformer.h
@@ -60,7 +60,7 @@
OSType destination_pixel_format,
const gfx::Size& destination_size,
int rotation_angle,
- absl::optional<size_t> buffer_pool_size = absl::nullopt);
+ std::optional<size_t> buffer_pool_size = std::nullopt);
// Converts the input buffer to an IOSurface-backed pixel buffer according to
// current configurations. If no transformation is needed (input format is the
diff --git a/media/capture/video/apple/video_capture_device_avfoundation.mm b/media/capture/video/apple/video_capture_device_avfoundation.mm
index b3e652f..4a65766 100644
--- a/media/capture/video/apple/video_capture_device_avfoundation.mm
+++ b/media/capture/video/apple/video_capture_device_avfoundation.mm
@@ -233,8 +233,8 @@
// For testing.
base::RepeatingCallback<void()> _onPhotoOutputStopped;
- absl::optional<bool> _isPortraitEffectSupportedForTesting;
- absl::optional<bool> _isPortraitEffectActiveForTesting;
+ std::optional<bool> _isPortraitEffectSupportedForTesting;
+ std::optional<bool> _isPortraitEffectActiveForTesting;
scoped_refptr<base::SingleThreadTaskRunner> _mainThreadTaskRunner;
}
diff --git a/media/capture/video/apple/video_capture_device_avfoundation_utils.h b/media/capture/video/apple/video_capture_device_avfoundation_utils.h
index 619fae1..eadcf35 100644
--- a/media/capture/video/apple/video_capture_device_avfoundation_utils.h
+++ b/media/capture/video/apple/video_capture_device_avfoundation_utils.h
@@ -35,7 +35,7 @@
gfx::Size CAPTURE_EXPORT GetSampleBufferSize(CMSampleBufferRef sample_buffer);
#if BUILDFLAG(IS_IOS)
-absl::optional<int> MaybeGetVideoRotation(
+std::optional<int> MaybeGetVideoRotation(
UIDeviceOrientation orientation,
AVCaptureDevicePosition camera_position);
#endif
diff --git a/media/capture/video/apple/video_capture_device_avfoundation_utils.mm b/media/capture/video/apple/video_capture_device_avfoundation_utils.mm
index 4fe66d9..f9e7afb 100644
--- a/media/capture/video/apple/video_capture_device_avfoundation_utils.mm
+++ b/media/capture/video/apple/video_capture_device_avfoundation_utils.mm
@@ -62,7 +62,7 @@
}
#if BUILDFLAG(IS_IOS)
-absl::optional<int> MaybeGetVideoRotation(
+std::optional<int> MaybeGetVideoRotation(
UIDeviceOrientation orientation,
AVCaptureDevicePosition camera_position) {
bool is_front_camera = NO;
@@ -72,7 +72,7 @@
is_front_camera = NO;
}
- absl::optional<int> rotation;
+ std::optional<int> rotation;
switch (orientation) {
case UIDeviceOrientationPortrait:
rotation = 90;
diff --git a/media/capture/video/chromeos/camera_app_device_impl.cc b/media/capture/video/chromeos/camera_app_device_impl.cc
index 2a69004..ac34a892 100644
--- a/media/capture/video/chromeos/camera_app_device_impl.cc
+++ b/media/capture/video/chromeos/camera_app_device_impl.cc
@@ -74,7 +74,7 @@
std::move(callback).Run();
}
-absl::optional<gfx::Range> CameraAppDeviceImpl::GetFpsRange() {
+std::optional<gfx::Range> CameraAppDeviceImpl::GetFpsRange() {
base::AutoLock lock(fps_ranges_lock_);
return specified_fps_range_;
@@ -474,10 +474,10 @@
}
}
-absl::optional<PortraitModeCallbacks>
+std::optional<PortraitModeCallbacks>
CameraAppDeviceImpl::ConsumePortraitModeCallbacks() {
base::AutoLock lock(portrait_mode_callbacks_lock_);
- absl::optional<PortraitModeCallbacks> callbacks;
+ std::optional<PortraitModeCallbacks> callbacks;
if (take_portrait_photo_callbacks_.has_value()) {
callbacks = std::move(take_portrait_photo_callbacks_);
take_portrait_photo_callbacks_.reset();
diff --git a/media/capture/video/chromeos/camera_app_device_impl.h b/media/capture/video/chromeos/camera_app_device_impl.h
index 0877383..4d345f8b 100644
--- a/media/capture/video/chromeos/camera_app_device_impl.h
+++ b/media/capture/video/chromeos/camera_app_device_impl.h
@@ -80,7 +80,7 @@
bool should_disable_new_ptrs);
// Retrieves the fps range if it is specified by the app.
- absl::optional<gfx::Range> GetFpsRange();
+ std::optional<gfx::Range> GetFpsRange();
// Retrieves the corresponding capture resolution which is specified by the
// app.
@@ -142,7 +142,7 @@
void RegisterCameraInfoObserver(
mojo::PendingRemote<cros::mojom::CameraInfoObserver> observer,
RegisterCameraInfoObserverCallback callback) override;
- absl::optional<PortraitModeCallbacks> ConsumePortraitModeCallbacks();
+ std::optional<PortraitModeCallbacks> ConsumePortraitModeCallbacks();
void SetCropRegion(const gfx::Rect& crop_region,
SetCropRegionCallback callback) override;
void ResetCropRegion(ResetCropRegionCallback callback) override;
@@ -188,12 +188,12 @@
mojo::Remote<cros::mojom::StillCaptureResultObserver>
portrait_mode_observers_;
base::Lock portrait_mode_callbacks_lock_;
- absl::optional<PortraitModeCallbacks> take_portrait_photo_callbacks_
+ std::optional<PortraitModeCallbacks> take_portrait_photo_callbacks_
GUARDED_BY(portrait_mode_callbacks_lock_);
// It will be inserted and read from different threads.
base::Lock fps_ranges_lock_;
- absl::optional<gfx::Range> specified_fps_range_ GUARDED_BY(fps_ranges_lock_);
+ std::optional<gfx::Range> specified_fps_range_ GUARDED_BY(fps_ranges_lock_);
// It will be inserted and read from different threads.
base::Lock still_capture_resolution_lock_;
diff --git a/media/capture/video/chromeos/camera_app_device_provider_impl.cc b/media/capture/video/chromeos/camera_app_device_provider_impl.cc
index 4ce91e7..8fac8ae 100644
--- a/media/capture/video/chromeos/camera_app_device_provider_impl.cc
+++ b/media/capture/video/chromeos/camera_app_device_provider_impl.cc
@@ -39,7 +39,7 @@
void CameraAppDeviceProviderImpl::GetCameraAppDeviceWithDeviceId(
GetCameraAppDeviceCallback callback,
- const absl::optional<std::string>& device_id) {
+ const std::optional<std::string>& device_id) {
if (!device_id.has_value()) {
std::move(callback).Run(
cros::mojom::GetCameraAppDeviceStatus::kErrorInvalidId,
@@ -68,7 +68,7 @@
void CameraAppDeviceProviderImpl::SetVirtualDeviceEnabledWithDeviceId(
bool enabled,
SetVirtualDeviceEnabledCallback callback,
- const absl::optional<std::string>& device_id) {
+ const std::optional<std::string>& device_id) {
if (!device_id.has_value()) {
std::move(callback).Run(false);
return;
@@ -88,7 +88,7 @@
void CameraAppDeviceProviderImpl::IsDeviceInUseWithDeviceId(
IsDeviceInUseCallback callback,
- const absl::optional<std::string>& device_id) {
+ const std::optional<std::string>& device_id) {
if (!device_id.has_value()) {
std::move(callback).Run(false);
return;
diff --git a/media/capture/video/chromeos/camera_app_device_provider_impl.h b/media/capture/video/chromeos/camera_app_device_provider_impl.h
index 004a3cb..0c50c2fb 100644
--- a/media/capture/video/chromeos/camera_app_device_provider_impl.h
+++ b/media/capture/video/chromeos/camera_app_device_provider_impl.h
@@ -18,7 +18,7 @@
: public cros::mojom::CameraAppDeviceProvider {
public:
using WithRealIdCallback =
- base::OnceCallback<void(const absl::optional<std::string>&)>;
+ base::OnceCallback<void(const std::optional<std::string>&)>;
using DeviceIdMappingCallback =
base::RepeatingCallback<void(const std::string&, WithRealIdCallback)>;
@@ -48,14 +48,14 @@
private:
void GetCameraAppDeviceWithDeviceId(
GetCameraAppDeviceCallback callback,
- const absl::optional<std::string>& device_id);
+ const std::optional<std::string>& device_id);
void SetVirtualDeviceEnabledWithDeviceId(
bool enable,
SetVirtualDeviceEnabledCallback callback,
- const absl::optional<std::string>& device_id);
+ const std::optional<std::string>& device_id);
void IsDeviceInUseWithDeviceId(IsDeviceInUseCallback callback,
- const absl::optional<std::string>& device_id);
+ const std::optional<std::string>& device_id);
mojo::Remote<cros::mojom::CameraAppDeviceBridge> bridge_;
diff --git a/media/capture/video/chromeos/camera_device_delegate.cc b/media/capture/video/chromeos/camera_device_delegate.cc
index e78f941..1d506f2 100644
--- a/media/capture/video/chromeos/camera_device_delegate.cc
+++ b/media/capture/video/chromeos/camera_device_delegate.cc
@@ -666,7 +666,7 @@
if (request_manager_) {
request_manager_->StopPreview(
base::BindOnce(&CameraDeviceDelegate::OnFlushed, GetWeakPtr(),
- ShouldUseBlobVideoSnapshot(), absl::nullopt));
+ ShouldUseBlobVideoSnapshot(), std::nullopt));
}
}
@@ -701,7 +701,7 @@
std::move(new_blob_resolution)));
} else {
request_manager_->StopPreview(base::BindOnce(
- &CameraDeviceDelegate::OnFlushed, GetWeakPtr(), true, absl::nullopt));
+ &CameraDeviceDelegate::OnFlushed, GetWeakPtr(), true, std::nullopt));
}
return true;
}
@@ -740,7 +740,7 @@
if (current_blob_resolution_.IsEmpty() &&
on_reconfigured_callbacks_.empty()) {
request_manager_->StopPreview(base::BindOnce(
- &CameraDeviceDelegate::OnFlushed, GetWeakPtr(), true, absl::nullopt));
+ &CameraDeviceDelegate::OnFlushed, GetWeakPtr(), true, std::nullopt));
}
auto on_reconfigured_callback = base::BindOnce(
[](base::WeakPtr<Camera3AController> controller,
@@ -777,7 +777,7 @@
void CameraDeviceDelegate::OnFlushed(
bool require_photo,
- absl::optional<gfx::Size> new_blob_resolution,
+ std::optional<gfx::Size> new_blob_resolution,
int32_t result) {
DCHECK(ipc_task_runner_->BelongsToCurrentThread());
if (result) {
@@ -956,12 +956,12 @@
return false;
}
}();
- ConfigureStreams(require_photo, absl::nullopt);
+ ConfigureStreams(require_photo, std::nullopt);
}
void CameraDeviceDelegate::ConfigureStreams(
bool require_photo,
- absl::optional<gfx::Size> new_blob_resolution) {
+ std::optional<gfx::Size> new_blob_resolution) {
DCHECK(ipc_task_runner_->BelongsToCurrentThread());
DCHECK_EQ(device_context_->GetState(),
CameraDeviceContext::State::kInitialized);
@@ -1268,7 +1268,7 @@
}
gfx::Size CameraDeviceDelegate::GetBlobResolution(
- absl::optional<gfx::Size> new_blob_resolution) {
+ std::optional<gfx::Size> new_blob_resolution) {
DCHECK(ipc_task_runner_->BelongsToCurrentThread());
std::vector<gfx::Size> blob_resolutions;
@@ -1331,7 +1331,7 @@
device_descriptor_.device_id);
auto take_portrait_photo_callbacks =
camera_app_device ? camera_app_device->ConsumePortraitModeCallbacks()
- : absl::nullopt;
+ : std::nullopt;
if (take_portrait_photo_callbacks.has_value()) {
take_portrait_photo_callbacks_ = std::move(take_portrait_photo_callbacks);
TakePhotoImpl(cros::mojom::Effect::kPortraitMode);
@@ -1400,7 +1400,7 @@
mojom::RangePtr CameraDeviceDelegate::GetControlRangeByVendorTagName(
const std::string& range_name,
- const absl::optional<int32_t>& current) {
+ const std::optional<int32_t>& current) {
const VendorTagInfo* info =
camera_hal_delegate_->GetVendorTagInfoByName(range_name);
if (info == nullptr) {
@@ -1444,7 +1444,7 @@
auto get_vendor_int =
[&](const std::string& name,
const cros::mojom::CameraMetadataPtr& result_metadata,
- absl::optional<int32_t>* returned_value) {
+ std::optional<int32_t>* returned_value) {
returned_value->reset();
const VendorTagInfo* info =
camera_hal_delegate_->GetVendorTagInfoByName(name);
@@ -1842,7 +1842,7 @@
CameraAppDeviceBridgeImpl::GetInstance()->GetWeakCameraAppDevice(
device_descriptor_.device_id);
auto specified_fps_range =
- camera_app_device ? camera_app_device->GetFpsRange() : absl::nullopt;
+ camera_app_device ? camera_app_device->GetFpsRange() : std::nullopt;
if (specified_fps_range) {
return std::make_pair(specified_fps_range->GetMin(),
specified_fps_range->GetMax());
diff --git a/media/capture/video/chromeos/camera_device_delegate.h b/media/capture/video/chromeos/camera_device_delegate.h
index 9b193c0..6b9025cb 100644
--- a/media/capture/video/chromeos/camera_device_delegate.h
+++ b/media/capture/video/chromeos/camera_device_delegate.h
@@ -6,6 +6,7 @@
#define MEDIA_CAPTURE_VIDEO_CHROMEOS_CAMERA_DEVICE_DELEGATE_H_
#include <memory>
+#include <optional>
#include <queue>
#include "base/containers/flat_map.h"
@@ -22,7 +23,6 @@
#include "media/capture/video/video_capture_device.h"
#include "media/capture/video_capture_types.h"
#include "mojo/public/cpp/bindings/remote.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/range/range.h"
@@ -71,21 +71,21 @@
ResultMetadata();
~ResultMetadata();
- absl::optional<uint8_t> ae_mode;
- absl::optional<int32_t> ae_compensation;
- absl::optional<uint8_t> af_mode;
- absl::optional<uint8_t> awb_mode;
- absl::optional<int32_t> brightness;
- absl::optional<int32_t> contrast;
- absl::optional<int64_t> exposure_time;
- absl::optional<float> focus_distance;
- absl::optional<int32_t> pan;
- absl::optional<int32_t> saturation;
- absl::optional<int32_t> sensitivity;
- absl::optional<int32_t> sharpness;
- absl::optional<int32_t> tilt;
- absl::optional<int32_t> zoom;
- absl::optional<gfx::Rect> scaler_crop_region;
+ std::optional<uint8_t> ae_mode;
+ std::optional<int32_t> ae_compensation;
+ std::optional<uint8_t> af_mode;
+ std::optional<uint8_t> awb_mode;
+ std::optional<int32_t> brightness;
+ std::optional<int32_t> contrast;
+ std::optional<int64_t> exposure_time;
+ std::optional<float> focus_distance;
+ std::optional<int32_t> pan;
+ std::optional<int32_t> saturation;
+ std::optional<int32_t> sensitivity;
+ std::optional<int32_t> sharpness;
+ std::optional<int32_t> tilt;
+ std::optional<int32_t> zoom;
+ std::optional<gfx::Rect> scaler_crop_region;
};
StreamType StreamIdToStreamType(uint64_t stream_id);
@@ -180,7 +180,7 @@
// Reconfigure streams for picture taking and recording.
void OnFlushed(bool require_photo,
- absl::optional<gfx::Size> new_blob_resolution,
+ std::optional<gfx::Size> new_blob_resolution,
int32_t result);
// Callback method for the Close Mojo IPC call. This method resets the Mojo
@@ -206,7 +206,7 @@
// |client_| the capture has started by calling OnStarted, and proceeds to
// ConstructDefaultRequestSettings.
void ConfigureStreams(bool require_photo,
- absl::optional<gfx::Size> new_blob_resolution);
+ std::optional<gfx::Size> new_blob_resolution);
void OnConfiguredStreams(
gfx::Size blob_resolution,
int32_t result,
@@ -228,7 +228,7 @@
void OnConstructedDefaultPortraitModeRequestSettings(
cros::mojom::CameraMetadataPtr settings);
- gfx::Size GetBlobResolution(absl::optional<gfx::Size> new_blob_resolution);
+ gfx::Size GetBlobResolution(std::optional<gfx::Size> new_blob_resolution);
// StreamCaptureInterface implementations. These methods are called by
// |stream_buffer_manager_| on |ipc_task_runner_|.
@@ -243,7 +243,7 @@
// metadata by |range_name| and current value of |current|.
mojom::RangePtr GetControlRangeByVendorTagName(
const std::string& range_name,
- const absl::optional<int32_t>& current);
+ const std::optional<int32_t>& current);
bool ShouldUseBlobVideoSnapshot();
@@ -286,7 +286,7 @@
std::queue<VideoCaptureDevice::TakePhotoCallback> take_photo_callbacks_;
- absl::optional<PortraitModeCallbacks> take_portrait_photo_callbacks_;
+ std::optional<PortraitModeCallbacks> take_portrait_photo_callbacks_;
std::unique_ptr<RequestManager> request_manager_;
diff --git a/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc b/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc
index abc4fc0..89e343f 100644
--- a/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc
+++ b/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc
@@ -239,7 +239,7 @@
mojo::PendingRemote<cros::mojom::CrosCameraService> camera_service;
ash::mojo_service_manager::GetServiceManagerProxy()->Request(
- chromeos::mojo_services::kCrosCameraService, absl::nullopt,
+ chromeos::mojo_services::kCrosCameraService, std::nullopt,
camera_service.InitWithNewPipeAndPassReceiver().PassPipe());
proxy_task_runner_->PostTask(
FROM_HERE,
diff --git a/media/capture/video/chromeos/display_rotation_observer.h b/media/capture/video/chromeos/display_rotation_observer.h
index ee1dfac..17babe66 100644
--- a/media/capture/video/chromeos/display_rotation_observer.h
+++ b/media/capture/video/chromeos/display_rotation_observer.h
@@ -60,7 +60,7 @@
base::WeakPtr<DisplayRotationObserver> observer_;
- absl::optional<display::ScopedDisplayObserver> display_observer_;
+ std::optional<display::ScopedDisplayObserver> display_observer_;
// The task runner where the calls to display::Display must be serialized on.
const scoped_refptr<base::SingleThreadTaskRunner> display_task_runner_;
diff --git a/media/capture/video/chromeos/gpu_memory_buffer_tracker_cros.cc b/media/capture/video/chromeos/gpu_memory_buffer_tracker_cros.cc
index 8ac10ac5..aca6b7a 100644
--- a/media/capture/video/chromeos/gpu_memory_buffer_tracker_cros.cc
+++ b/media/capture/video/chromeos/gpu_memory_buffer_tracker_cros.cc
@@ -19,7 +19,7 @@
bool GpuMemoryBufferTrackerCros::Init(const gfx::Size& dimensions,
VideoPixelFormat format,
const mojom::PlaneStridesPtr& strides) {
- absl::optional<gfx::BufferFormat> gfx_format = PixFormatVideoToGfx(format);
+ std::optional<gfx::BufferFormat> gfx_format = PixFormatVideoToGfx(format);
if (!gfx_format) {
NOTREACHED() << "Unsupported VideoPixelFormat "
<< VideoPixelFormatToString(format);
@@ -46,7 +46,7 @@
const gfx::Size& dimensions,
VideoPixelFormat format,
const mojom::PlaneStridesPtr& strides) {
- absl::optional<gfx::BufferFormat> gfx_format = PixFormatVideoToGfx(format);
+ std::optional<gfx::BufferFormat> gfx_format = PixFormatVideoToGfx(format);
if (!gfx_format) {
return false;
}
diff --git a/media/capture/video/chromeos/mock_vendor_tag_ops.h b/media/capture/video/chromeos/mock_vendor_tag_ops.h
index 0daaff7..d27e21b2 100644
--- a/media/capture/video/chromeos/mock_vendor_tag_ops.h
+++ b/media/capture/video/chromeos/mock_vendor_tag_ops.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_CAPTURE_VIDEO_CHROMEOS_MOCK_VENDOR_TAG_OPS_H_
#define MEDIA_CAPTURE_VIDEO_CHROMEOS_MOCK_VENDOR_TAG_OPS_H_
+#include <optional>
#include <string>
#include <utility>
#include <vector>
@@ -14,7 +15,6 @@
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "testing/gmock/include/gmock/gmock.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace unittest_internal {
@@ -32,10 +32,10 @@
MOCK_METHOD0(DoGetAllTags, std::vector<uint32_t>());
void GetAllTags(GetAllTagsCallback callback) override;
- MOCK_METHOD1(DoGetSectionName, absl::optional<std::string>(uint32_t tag));
+ MOCK_METHOD1(DoGetSectionName, std::optional<std::string>(uint32_t tag));
void GetSectionName(uint32_t tag, GetSectionNameCallback callback) override;
- MOCK_METHOD1(DoGetTagName, absl::optional<std::string>(uint32_t tag));
+ MOCK_METHOD1(DoGetTagName, std::optional<std::string>(uint32_t tag));
void GetTagName(uint32_t tag, GetTagNameCallback callback) override;
MOCK_METHOD1(DoGetTagType, int32_t(uint32_t tag));
diff --git a/media/capture/video/chromeos/pixel_format_utils.cc b/media/capture/video/chromeos/pixel_format_utils.cc
index 6f9d481..a273cd0c 100644
--- a/media/capture/video/chromeos/pixel_format_utils.cc
+++ b/media/capture/video/chromeos/pixel_format_utils.cc
@@ -62,7 +62,7 @@
}
}
-absl::optional<gfx::BufferFormat> PixFormatVideoToGfx(
+std::optional<gfx::BufferFormat> PixFormatVideoToGfx(
VideoPixelFormat pixel_format) {
switch (pixel_format) {
case PIXEL_FORMAT_MJPEG:
@@ -70,7 +70,7 @@
case PIXEL_FORMAT_NV12:
return gfx::BufferFormat::YUV_420_BIPLANAR;
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
diff --git a/media/capture/video/chromeos/pixel_format_utils.h b/media/capture/video/chromeos/pixel_format_utils.h
index afed38a..2d4e079 100644
--- a/media/capture/video/chromeos/pixel_format_utils.h
+++ b/media/capture/video/chromeos/pixel_format_utils.h
@@ -5,11 +5,11 @@
#ifndef MEDIA_CAPTURE_VIDEO_CHROMEOS_PIXEL_FORMAT_UTILS_H_
#define MEDIA_CAPTURE_VIDEO_CHROMEOS_PIXEL_FORMAT_UTILS_H_
+#include <optional>
#include <vector>
#include "media/capture/video/chromeos/mojom/camera3.mojom.h"
#include "media/capture/video_capture_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/buffer_types.h"
namespace media {
@@ -32,7 +32,7 @@
uint32_t PixFormatVideoToDrm(VideoPixelFormat from);
// Converts the video pixel format |pixel_format| to gfx::BufferFormat.
-absl::optional<gfx::BufferFormat> PixFormatVideoToGfx(
+std::optional<gfx::BufferFormat> PixFormatVideoToGfx(
VideoPixelFormat pixel_format);
} // namespace media
diff --git a/media/capture/video/chromeos/request_builder.cc b/media/capture/video/chromeos/request_builder.cc
index 6fa512e2..6812f93 100644
--- a/media/capture/video/chromeos/request_builder.cc
+++ b/media/capture/video/chromeos/request_builder.cc
@@ -31,11 +31,11 @@
// contain buffer handles.
if (use_buffer_management_apis_) {
capture_request->output_buffers.push_back(
- CreateStreamBuffer(stream_type, absl::nullopt));
+ CreateStreamBuffer(stream_type, std::nullopt));
continue;
}
- absl::optional<BufferInfo> buffer_info =
+ std::optional<BufferInfo> buffer_info =
request_buffer_callback_.Run(stream_type);
if (!buffer_info) {
return capture_request;
@@ -51,7 +51,7 @@
cros::mojom::Camera3StreamBufferPtr RequestBuilder::CreateStreamBuffer(
StreamType stream_type,
- absl::optional<BufferInfo> buffer_info) {
+ std::optional<BufferInfo> buffer_info) {
cros::mojom::Camera3StreamBufferPtr buffer =
cros::mojom::Camera3StreamBuffer::New();
buffer->stream_id = static_cast<uint64_t>(stream_type);
diff --git a/media/capture/video/chromeos/request_builder.h b/media/capture/video/chromeos/request_builder.h
index d7a5d0dc..52a2229 100644
--- a/media/capture/video/chromeos/request_builder.h
+++ b/media/capture/video/chromeos/request_builder.h
@@ -6,6 +6,7 @@
#define MEDIA_CAPTURE_VIDEO_CHROMEOS_REQUEST_BUILDER_H_
#include <memory>
+#include <optional>
#include <set>
#include <vector>
@@ -13,7 +14,6 @@
#include "media/capture/video/chromeos/camera_device_delegate.h"
#include "media/capture/video/chromeos/mojom/camera3.mojom.h"
#include "media/capture/video_capture_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -35,7 +35,7 @@
class CAPTURE_EXPORT RequestBuilder {
public:
using RequestBufferCallback =
- base::RepeatingCallback<absl::optional<BufferInfo>(StreamType)>;
+ base::RepeatingCallback<std::optional<BufferInfo>(StreamType)>;
RequestBuilder(CameraDeviceContext* device_context,
// Callback to request buffer from StreamBufferManager. Having
@@ -54,7 +54,7 @@
// Camera3StreamBufferRet.
cros::mojom::Camera3StreamBufferPtr CreateStreamBuffer(
StreamType stream_type,
- absl::optional<BufferInfo> buffer_info);
+ std::optional<BufferInfo> buffer_info);
private:
cros::mojom::CameraBufferHandlePtr CreateCameraBufferHandle(
diff --git a/media/capture/video/chromeos/request_manager.cc b/media/capture/video/chromeos/request_manager.cc
index d22a03d4..e3f40fb 100644
--- a/media/capture/video/chromeos/request_manager.cc
+++ b/media/capture/video/chromeos/request_manager.cc
@@ -915,7 +915,7 @@
cros::mojom::Camera3StreamBufferReqStatus::CAMERA3_PS_BUF_REQ_OK;
ret->output_buffers = std::vector<cros::mojom::Camera3StreamBufferPtr>();
for (size_t i = 0; i < req->num_buffers_requested; ++i) {
- absl::optional<BufferInfo> buffer_info =
+ std::optional<BufferInfo> buffer_info =
stream_buffer_manager_->RequestBufferForCaptureRequest(stream_type);
if (!buffer_info.has_value()) {
// Return buffers to |stream_buffer_manager_|.
@@ -1046,7 +1046,7 @@
if (video_capture_use_gmb_) {
VideoCaptureFormat format;
- absl::optional<VideoCaptureDevice::Client::Buffer> buffer =
+ std::optional<VideoCaptureDevice::Client::Buffer> buffer =
stream_buffer_manager_->AcquireBufferForClientById(
stream_type, buffer_ipc_id, &format);
CHECK(buffer);
diff --git a/media/capture/video/chromeos/request_manager.h b/media/capture/video/chromeos/request_manager.h
index 50c8773..796830d 100644
--- a/media/capture/video/chromeos/request_manager.h
+++ b/media/capture/video/chromeos/request_manager.h
@@ -8,6 +8,7 @@
#include <cstring>
#include <map>
#include <memory>
+#include <optional>
#include <queue>
#include <set>
#include <vector>
@@ -29,7 +30,6 @@
#include "media/capture/video_capture_types.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/capture/video/chromeos/stream_buffer_manager.cc b/media/capture/video/chromeos/stream_buffer_manager.cc
index e5ece64..8907f9a 100644
--- a/media/capture/video/chromeos/stream_buffer_manager.cc
+++ b/media/capture/video/chromeos/stream_buffer_manager.cc
@@ -61,7 +61,7 @@
return it->second.gmb.get();
}
-absl::optional<StreamBufferManager::Buffer>
+std::optional<StreamBufferManager::Buffer>
StreamBufferManager::AcquireBufferForClientById(StreamType stream_type,
uint64_t buffer_ipc_id,
VideoCaptureFormat* format) {
@@ -71,7 +71,7 @@
if (it == stream_context->buffers.end()) {
LOG(ERROR) << "Invalid buffer: " << buffer_ipc_id
<< " for stream: " << stream_type;
- return absl::nullopt;
+ return std::nullopt;
}
auto buffer_pair = std::move(it->second);
stream_context->buffers.erase(it);
@@ -90,7 +90,7 @@
gfx::Size(format->frame_size.height(), format->frame_size.width());
}
- const absl::optional<gfx::BufferFormat> gfx_format =
+ const std::optional<gfx::BufferFormat> gfx_format =
PixFormatVideoToGfx(format->pixel_format);
DCHECK(gfx_format);
const auto& original_gmb = buffer_pair.gmb;
@@ -307,7 +307,7 @@
return stream_context_[stream_type]->stream.Clone();
}
-absl::optional<BufferInfo> StreamBufferManager::RequestBufferForCaptureRequest(
+std::optional<BufferInfo> StreamBufferManager::RequestBufferForCaptureRequest(
StreamType stream_type) {
VideoPixelFormat buffer_format =
stream_context_[stream_type]->capture_format.pixel_format;
@@ -364,7 +364,7 @@
StreamBufferManager::CreateGpuMemoryBuffer(gfx::GpuMemoryBufferHandle handle,
const VideoCaptureFormat& format,
gfx::BufferUsage buffer_usage) {
- absl::optional<gfx::BufferFormat> gfx_format =
+ std::optional<gfx::BufferFormat> gfx_format =
PixFormatVideoToGfx(format.pixel_format);
DCHECK(gfx_format);
return gmb_support_->CreateGpuMemoryBufferImplFromHandle(
@@ -392,7 +392,7 @@
void StreamBufferManager::ReserveBufferFromFactory(StreamType stream_type) {
auto& stream_context = stream_context_[stream_type];
- absl::optional<gfx::BufferFormat> gfx_format =
+ std::optional<gfx::BufferFormat> gfx_format =
PixFormatVideoToGfx(stream_context->capture_format.pixel_format);
if (!gfx_format) {
device_context_->SetErrorState(
@@ -417,12 +417,12 @@
int key = stream_context->buffers.size() + 1;
stream_context->free_buffers.push(key);
stream_context->buffers.insert(
- std::make_pair(key, BufferPair(std::move(gmb), absl::nullopt)));
+ std::make_pair(key, BufferPair(std::move(gmb), std::nullopt)));
}
void StreamBufferManager::ReserveBufferFromPool(StreamType stream_type) {
auto& stream_context = stream_context_[stream_type];
- absl::optional<gfx::BufferFormat> gfx_format =
+ std::optional<gfx::BufferFormat> gfx_format =
PixFormatVideoToGfx(stream_context->capture_format.pixel_format);
if (!gfx_format) {
device_context_->SetErrorState(
@@ -455,7 +455,7 @@
StreamBufferManager::BufferPair::BufferPair(
std::unique_ptr<gfx::GpuMemoryBuffer> input_gmb,
- absl::optional<Buffer> input_vcd_buffer)
+ std::optional<Buffer> input_vcd_buffer)
: gmb(std::move(input_gmb)), vcd_buffer(std::move(input_vcd_buffer)) {}
StreamBufferManager::BufferPair::BufferPair(
diff --git a/media/capture/video/chromeos/stream_buffer_manager.h b/media/capture/video/chromeos/stream_buffer_manager.h
index 7e7fe1b..8535537 100644
--- a/media/capture/video/chromeos/stream_buffer_manager.h
+++ b/media/capture/video/chromeos/stream_buffer_manager.h
@@ -9,6 +9,7 @@
#include <initializer_list>
#include <map>
#include <memory>
+#include <optional>
#include <queue>
#include <set>
#include <unordered_map>
@@ -23,7 +24,6 @@
#include "media/capture/video/chromeos/camera_device_delegate.h"
#include "media/capture/video/chromeos/mojom/camera3.mojom.h"
#include "media/capture/video_capture_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace gfx {
@@ -76,9 +76,9 @@
//
// TODO(crbug.com/990682): Remove the |rotation| arg when we disable the
// camera frame rotation for good.
- absl::optional<Buffer> AcquireBufferForClientById(StreamType stream_type,
- uint64_t buffer_ipc_id,
- VideoCaptureFormat* format);
+ std::optional<Buffer> AcquireBufferForClientById(StreamType stream_type,
+ uint64_t buffer_ipc_id,
+ VideoCaptureFormat* format);
VideoCaptureFormat GetStreamCaptureFormat(StreamType stream_type);
@@ -102,7 +102,7 @@
cros::mojom::Camera3StreamPtr GetStreamConfiguration(StreamType stream_type);
// Requests buffer for specific stream type.
- absl::optional<BufferInfo> RequestBufferForCaptureRequest(
+ std::optional<BufferInfo> RequestBufferForCaptureRequest(
StreamType stream_type);
// Releases buffer by marking it as free buffer.
@@ -126,7 +126,7 @@
// BufferPair holding up to two types of handles of a stream buffer.
struct BufferPair {
BufferPair(std::unique_ptr<gfx::GpuMemoryBuffer> gmb,
- absl::optional<Buffer> vcd_buffer);
+ std::optional<Buffer> vcd_buffer);
BufferPair(BufferPair&& other);
~BufferPair();
// The GpuMemoryBuffer interface of the stream buffer.
@@ -137,7 +137,7 @@
std::unique_ptr<gfx::GpuMemoryBuffer> gmb;
// The VCD buffer reserved from the VCD buffer pool. This is only set when
// the VCD runs GpuMemoryBuffer-based VideoCapture buffer.
- absl::optional<Buffer> vcd_buffer;
+ std::optional<Buffer> vcd_buffer;
};
struct StreamContext {
diff --git a/media/capture/video/chromeos/token_manager.cc b/media/capture/video/chromeos/token_manager.cc
index 694be54f..91dd612 100644
--- a/media/capture/video/chromeos/token_manager.cc
+++ b/media/capture/video/chromeos/token_manager.cc
@@ -123,7 +123,7 @@
return server_token_ == token;
}
-absl::optional<cros::mojom::CameraClientType> TokenManager::AuthenticateClient(
+std::optional<cros::mojom::CameraClientType> TokenManager::AuthenticateClient(
cros::mojom::CameraClientType type,
const base::UnguessableToken& token) {
base::AutoLock l(client_token_map_lock_);
@@ -133,11 +133,11 @@
return client_type;
}
}
- return absl::nullopt;
+ return std::nullopt;
}
auto& token_set = client_token_map_[type];
if (token_set.find(token) == token_set.end()) {
- return absl::nullopt;
+ return std::nullopt;
}
return type;
}
diff --git a/media/capture/video/chromeos/token_manager.h b/media/capture/video/chromeos/token_manager.h
index 041faf0..f11bbd9 100644
--- a/media/capture/video/chromeos/token_manager.h
+++ b/media/capture/video/chromeos/token_manager.h
@@ -6,6 +6,7 @@
#define MEDIA_CAPTURE_VIDEO_CHROMEOS_TOKEN_MANAGER_H_
#include <array>
+#include <optional>
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
@@ -13,7 +14,6 @@
#include "base/unguessable_token.h"
#include "media/capture/capture_export.h"
#include "media/capture/video/chromeos/mojom/cros_camera_service.mojom.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -46,8 +46,8 @@
// cros::mojom::CameraClientType::UNKNOWN, it tries to figure out the actual
// client type by the supplied |token|. If authentication succeeds, it returns
// the authenticated type of the client. If authentication fails,
- // absl::nullopt is returned.
- absl::optional<cros::mojom::CameraClientType> AuthenticateClient(
+ // std::nullopt is returned.
+ std::optional<cros::mojom::CameraClientType> AuthenticateClient(
cros::mojom::CameraClientType type,
const base::UnguessableToken& token);
diff --git a/media/capture/video/chromeos/vendor_tag_ops_delegate.cc b/media/capture/video/chromeos/vendor_tag_ops_delegate.cc
index 3bcb91f..2946081 100644
--- a/media/capture/video/chromeos/vendor_tag_ops_delegate.cc
+++ b/media/capture/video/chromeos/vendor_tag_ops_delegate.cc
@@ -97,7 +97,7 @@
void VendorTagOpsDelegate::OnGotSectionName(
uint32_t tag,
- const absl::optional<std::string>& section_name) {
+ const std::optional<std::string>& section_name) {
DCHECK(ipc_task_runner_->RunsTasksInCurrentSequence());
if (!section_name.has_value()) {
LOG(ERROR) << "Failed to get section name of tag " << std::hex
@@ -114,7 +114,7 @@
void VendorTagOpsDelegate::OnGotTagName(
uint32_t tag,
- const absl::optional<std::string>& tag_name) {
+ const std::optional<std::string>& tag_name) {
DCHECK(ipc_task_runner_->RunsTasksInCurrentSequence());
if (!tag_name.has_value()) {
LOG(ERROR) << "Failed to get tag name of tag " << std::hex << std::showbase
diff --git a/media/capture/video/chromeos/vendor_tag_ops_delegate.h b/media/capture/video/chromeos/vendor_tag_ops_delegate.h
index ced8f8cd..3edba58d 100644
--- a/media/capture/video/chromeos/vendor_tag_ops_delegate.h
+++ b/media/capture/video/chromeos/vendor_tag_ops_delegate.h
@@ -6,6 +6,7 @@
#define MEDIA_CAPTURE_VIDEO_CHROMEOS_VENDOR_TAG_OPS_DELEGATE_H_
#include <map>
+#include <optional>
#include <string>
#include <vector>
@@ -16,7 +17,6 @@
#include "media/capture/video/chromeos/mojom/camera_common.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -52,8 +52,8 @@
void OnGotTagCount(int32_t tag_count);
void OnGotAllTags(size_t tag_count, const std::vector<uint32_t>& tags);
void OnGotSectionName(uint32_t tag,
- const absl::optional<std::string>& section_name);
- void OnGotTagName(uint32_t tag, const absl::optional<std::string>& tag_name);
+ const std::optional<std::string>& section_name);
+ void OnGotTagName(uint32_t tag, const std::optional<std::string>& tag_name);
void OnGotTagType(uint32_t tag, int32_t type);
scoped_refptr<base::SequencedTaskRunner> ipc_task_runner_;
diff --git a/media/capture/video/chromeos/video_capture_device_chromeos_delegate.cc b/media/capture/video/chromeos/video_capture_device_chromeos_delegate.cc
index 33d6082..1421c17 100644
--- a/media/capture/video/chromeos/video_capture_device_chromeos_delegate.cc
+++ b/media/capture/video/chromeos/video_capture_device_chromeos_delegate.cc
@@ -59,7 +59,7 @@
friend class base::RefCountedThreadSafe<PowerManagerClientProxy>;
using PendingTask = std::pair<base::OnceCallback<void()>,
- absl::optional<base::UnguessableToken>>;
+ std::optional<base::UnguessableToken>>;
~PowerManagerClientProxy() override = default;
@@ -81,7 +81,7 @@
// chromeos::PowerManagerClient::Observer:
void SuspendImminent(power_manager::SuspendImminent::Reason reason) final {
- absl::optional<base::UnguessableToken> token =
+ std::optional<base::UnguessableToken> token =
base::UnguessableToken::Create();
chromeos::PowerManagerClient::Get()->BlockSuspend(
*token, "VideoCaptureDeviceChromeOSDelegate");
@@ -105,7 +105,7 @@
task_queue_.push(
{base::BindOnce(&VideoCaptureDeviceChromeOSDelegate::OpenDevice,
device_),
- absl::nullopt});
+ std::nullopt});
}
device_task_runner_->PostTask(
FROM_HERE,
diff --git a/media/capture/video/fake_video_capture_device_factory.h b/media/capture/video/fake_video_capture_device_factory.h
index 060089b..564e0c8 100644
--- a/media/capture/video/fake_video_capture_device_factory.h
+++ b/media/capture/video/fake_video_capture_device_factory.h
@@ -38,7 +38,7 @@
VideoCaptureFormats supported_formats;
FakePhotoDeviceConfig photo_device_config;
FakeVideoCaptureDevice::DisplayMediaType display_media_type;
- absl::optional<media::CameraAvailability> availability;
+ std::optional<media::CameraAvailability> availability;
};
// Implementation of VideoCaptureDeviceFactory that creates fake devices
diff --git a/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.cc b/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.cc
index 4133f51..9ef4869 100644
--- a/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.cc
+++ b/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.cc
@@ -99,8 +99,8 @@
uint64_t device_id_;
fuchsia::camera3::DevicePtr device_;
- absl::optional<std::string> description_;
- absl::optional<VideoCaptureFormats> formats_;
+ std::optional<std::string> description_;
+ std::optional<VideoCaptureFormats> formats_;
base::OnceClosure on_fetched_callback_;
};
@@ -180,7 +180,7 @@
// Clear the list of devices, so we don't report any camera devices while
// DeviceWatcher is disconnected. We will try connecting DeviceWatcher again
// when GetDevicesInfo() is called.
- devices_ = absl::nullopt;
+ devices_ = std::nullopt;
num_pending_device_info_requests_ = 0;
MaybeResolvePendingDeviceInfoCallbacks();
diff --git a/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h b/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h
index 06f515b..6f53ef31 100644
--- a/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h
+++ b/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h
@@ -8,10 +8,10 @@
#include <fuchsia/camera3/cpp/fidl.h>
#include <map>
+#include <optional>
#include "base/containers/small_map.h"
#include "media/capture/video/video_capture_device_factory.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -54,7 +54,7 @@
// Current list of devices. Set to nullopt if the list hasn't been received
// yet.
- absl::optional<
+ std::optional<
base::small_map<std::map<uint64_t, std::unique_ptr<DeviceConfigFetcher>>>>
devices_;
diff --git a/media/capture/video/fuchsia/video_capture_device_fuchsia.cc b/media/capture/video/fuchsia/video_capture_device_fuchsia.cc
index 6232a7f2..949aa56 100644
--- a/media/capture/video/fuchsia/video_capture_device_fuchsia.cc
+++ b/media/capture/video/fuchsia/video_capture_device_fuchsia.cc
@@ -262,7 +262,7 @@
// need to be specified explicitly.
fuchsia::sysmem::BufferCollectionConstraints constraints =
VmoBuffer::GetRecommendedConstraints(kMaxUsedOutputFrames,
- /*min_buffer_size=*/absl::nullopt,
+ /*min_buffer_size=*/std::nullopt,
/*writable=*/false);
buffer_collection_ = sysmem_allocator_.BindSharedCollection(std::move(token));
buffer_collection_->Initialize(std::move(constraints), "CrVideoCaptureDevice",
diff --git a/media/capture/video/fuchsia/video_capture_device_fuchsia.h b/media/capture/video/fuchsia/video_capture_device_fuchsia.h
index 85cf96d..edb6cb6 100644
--- a/media/capture/video/fuchsia/video_capture_device_fuchsia.h
+++ b/media/capture/video/fuchsia/video_capture_device_fuchsia.h
@@ -8,13 +8,13 @@
#include <fuchsia/camera3/cpp/fidl.h>
#include <memory>
+#include <optional>
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "media/capture/video/video_capture_device.h"
#include "media/fuchsia/common/sysmem_client.h"
#include "media/fuchsia/common/vmo_buffer.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -100,7 +100,7 @@
std::vector<VmoBuffer> buffers_;
fuchsia::sysmem::ImageFormatConstraints buffers_format_;
- absl::optional<gfx::Size> frame_size_;
+ std::optional<gfx::Size> frame_size_;
fuchsia::camera3::Orientation orientation_ =
fuchsia::camera3::Orientation::UP;
diff --git a/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc b/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc
index e12d0d4..163857b 100644
--- a/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc
+++ b/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc
@@ -185,7 +185,7 @@
bool started_ = false;
std::vector<ReceivedFrame> received_frames_;
- absl::optional<base::RunLoop> wait_frame_run_loop_;
+ std::optional<base::RunLoop> wait_frame_run_loop_;
};
} // namespace
diff --git a/media/capture/video/linux/v4l2_gpu_memory_buffer_tracker.cc b/media/capture/video/linux/v4l2_gpu_memory_buffer_tracker.cc
index dcc5ac3..252a3b11 100644
--- a/media/capture/video/linux/v4l2_gpu_memory_buffer_tracker.cc
+++ b/media/capture/video/linux/v4l2_gpu_memory_buffer_tracker.cc
@@ -3,22 +3,23 @@
// found in the LICENSE file.
#include "media/capture/video/linux/v4l2_gpu_memory_buffer_tracker.h"
+
+#include <optional>
+
#include "media/capture/video/video_capture_buffer_handle.h"
#include "media/capture/video_capture_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
namespace {
// Converts the video pixel format |pixel_format| to gfx::BufferFormat.
-absl::optional<gfx::BufferFormat> ToBufferFormat(
- VideoPixelFormat pixel_format) {
+std::optional<gfx::BufferFormat> ToBufferFormat(VideoPixelFormat pixel_format) {
switch (pixel_format) {
case PIXEL_FORMAT_NV12:
return gfx::BufferFormat::YUV_420_BIPLANAR;
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
@@ -43,7 +44,7 @@
bool V4L2GpuMemoryBufferTracker::Init(const gfx::Size& dimensions,
VideoPixelFormat format,
const mojom::PlaneStridesPtr& strides) {
- absl::optional<gfx::BufferFormat> gfx_format = ToBufferFormat(format);
+ std::optional<gfx::BufferFormat> gfx_format = ToBufferFormat(format);
if (!gfx_format) {
DLOG(ERROR) << "Unsupported VideoPixelFormat "
<< VideoPixelFormatToString(format);
@@ -77,7 +78,7 @@
return false;
}
- absl::optional<gfx::BufferFormat> gfx_format = ToBufferFormat(format);
+ std::optional<gfx::BufferFormat> gfx_format = ToBufferFormat(format);
if (!gfx_format) {
return false;
}
diff --git a/media/capture/video/mac/uvc_control_mac.mm b/media/capture/video/mac/uvc_control_mac.mm
index c8b79f3..3598ef3b 100644
--- a/media/capture/video/mac/uvc_control_mac.mm
+++ b/media/capture/video/mac/uvc_control_mac.mm
@@ -63,8 +63,8 @@
// Set pan and tilt values for a USB camera device.
static void SetPanTiltCurrent(UvcControl& uvc,
- absl::optional<int> pan,
- absl::optional<int> tilt) {
+ std::optional<int> pan,
+ std::optional<int> tilt) {
DCHECK(pan.has_value() || tilt.has_value());
PanTilt pan_tilt_current;
@@ -547,11 +547,11 @@
}
if (UvcControl uvc(device_model, uvc::kVcInputTerminal); uvc.Good()) {
if (settings->has_pan || settings->has_tilt) {
- SetPanTiltCurrent(uvc,
- settings->has_pan ? absl::make_optional(settings->pan)
- : absl::nullopt,
- settings->has_tilt ? absl::make_optional(settings->tilt)
- : absl::nullopt);
+ SetPanTiltCurrent(
+ uvc,
+ settings->has_pan ? std::make_optional(settings->pan) : std::nullopt,
+ settings->has_tilt ? std::make_optional(settings->tilt)
+ : std::nullopt);
}
if (settings->has_zoom) {
uvc.SetControlCurrent<uint16_t>(uvc::kCtZoomAbsoluteControl,
diff --git a/media/capture/video/video_capture_device_descriptor.cc b/media/capture/video/video_capture_device_descriptor.cc
index 87b966c5..451a4e7 100644
--- a/media/capture/video/video_capture_device_descriptor.cc
+++ b/media/capture/video/video_capture_device_descriptor.cc
@@ -42,7 +42,7 @@
const VideoCaptureControlSupport& control_support,
VideoCaptureTransportType transport_type,
VideoFacingMode facing,
- absl::optional<CameraAvailability> availability)
+ std::optional<CameraAvailability> availability)
: device_id(device_id),
model_id(model_id),
facing(facing),
diff --git a/media/capture/video/video_capture_device_descriptor.h b/media/capture/video/video_capture_device_descriptor.h
index 682fa7c8..982a41d 100644
--- a/media/capture/video/video_capture_device_descriptor.h
+++ b/media/capture/video/video_capture_device_descriptor.h
@@ -5,12 +5,12 @@
#ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_
#define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_
+#include <optional>
#include <string>
#include <vector>
#include "media/base/video_facing.h"
#include "media/capture/capture_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -85,7 +85,7 @@
VideoCaptureTransportType transport_type =
VideoCaptureTransportType::OTHER_TRANSPORT,
VideoFacingMode facing = VideoFacingMode::MEDIA_VIDEO_FACING_NONE,
- absl::optional<CameraAvailability> availability = absl::nullopt);
+ std::optional<CameraAvailability> availability = std::nullopt);
VideoCaptureDeviceDescriptor(const VideoCaptureDeviceDescriptor& other);
~VideoCaptureDeviceDescriptor();
@@ -119,7 +119,7 @@
std::string model_id;
VideoFacingMode facing;
- absl::optional<CameraAvailability> availability;
+ std::optional<CameraAvailability> availability;
VideoCaptureApi capture_api;
VideoCaptureTransportType transport_type;
diff --git a/media/capture/video/video_capture_device_unittest.cc b/media/capture/video/video_capture_device_unittest.cc
index 4d02b1a..60c5ed2 100644
--- a/media/capture/video/video_capture_device_unittest.cc
+++ b/media/capture/video/video_capture_device_unittest.cc
@@ -381,7 +381,7 @@
run_loop_->Run();
}
- absl::optional<VideoCaptureDeviceInfo> FindUsableDevice() {
+ std::optional<VideoCaptureDeviceInfo> FindUsableDevice() {
base::RunLoop run_loop;
video_capture_device_factory_->GetDevicesInfo(base::BindLambdaForTesting(
[this, &run_loop](std::vector<VideoCaptureDeviceInfo> devices_info) {
@@ -392,7 +392,7 @@
if (devices_info_.empty()) {
DLOG(WARNING) << "No camera found";
- return absl::nullopt;
+ return std::nullopt;
}
#if BUILDFLAG(IS_ANDROID)
for (const auto& device : devices_info_) {
@@ -407,7 +407,7 @@
}
}
DLOG(WARNING) << "No usable camera found";
- return absl::nullopt;
+ return std::nullopt;
#else
auto device = devices_info_.front();
DLOG(INFO) << "Using camera " << device.descriptor.GetNameAndModel();
@@ -417,10 +417,10 @@
const VideoCaptureFormat& last_format() const { return last_format_; }
- absl::optional<VideoCaptureDeviceInfo> GetFirstDeviceSupportingPixelFormat(
+ std::optional<VideoCaptureDeviceInfo> GetFirstDeviceSupportingPixelFormat(
const VideoPixelFormat& pixel_format) {
if (!FindUsableDevice())
- return absl::nullopt;
+ return std::nullopt;
for (const auto& device : devices_info_) {
for (const auto& format : device.supported_formats) {
@@ -431,7 +431,7 @@
}
DVLOG_IF(1, pixel_format != PIXEL_FORMAT_MAX)
<< VideoPixelFormatToString(pixel_format);
- return absl::nullopt;
+ return std::nullopt;
}
bool IsCaptureSizeSupported(const VideoCaptureDeviceInfo& device_info,
diff --git a/media/capture/video/video_capture_feedback.h b/media/capture/video/video_capture_feedback.h
index b31ddb8..402f54b 100644
--- a/media/capture/video/video_capture_feedback.h
+++ b/media/capture/video/video_capture_feedback.h
@@ -6,11 +6,11 @@
#define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_FEEDBACK_H_
#include <limits>
+#include <optional>
#include <vector>
#include "base/functional/callback.h"
#include "media/capture/capture_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
@@ -96,7 +96,7 @@
// The frame id that this particular feedback is associated with, not all
// callers may set or require this.
- absl::optional<int> frame_id = absl::nullopt;
+ std::optional<int> frame_id = std::nullopt;
};
} // namespace media
diff --git a/media/capture/video/win/video_capture_device_mf_win.h b/media/capture/video/win/video_capture_device_mf_win.h
index f5d1d2ba..5beedf46 100644
--- a/media/capture/video/win/video_capture_device_mf_win.h
+++ b/media/capture/video/win/video_capture_device_mf_win.h
@@ -19,6 +19,7 @@
#include <strmif.h>
#include <wrl/client.h>
+#include <optional>
#include <utility>
#include <vector>
@@ -33,7 +34,6 @@
#include "media/capture/video/video_capture_device.h"
#include "media/capture/video/win/capability_list_win.h"
#include "media/capture/video/win/metrics.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
interface IMFSourceReader;
@@ -123,7 +123,7 @@
dxgi_device_manager_ = std::move(dxgi_device_manager);
}
- absl::optional<int> camera_rotation() const { return camera_rotation_; }
+ std::optional<int> camera_rotation() const { return camera_rotation_; }
private:
class MFVideoCallback;
@@ -218,7 +218,7 @@
base::WaitableEvent capture_started_;
HRESULT last_error_hr_ = S_OK;
scoped_refptr<DXGIDeviceManager> dxgi_device_manager_;
- absl::optional<int> camera_rotation_;
+ std::optional<int> camera_rotation_;
VideoCaptureParams params_;
int num_restarts_ = 0;
diff --git a/media/capture/video/win/video_capture_device_win.h b/media/capture/video/win/video_capture_device_win.h
index 696e3fc..0f17eb6f 100644
--- a/media/capture/video/win/video_capture_device_win.h
+++ b/media/capture/video/win/video_capture_device_win.h
@@ -16,6 +16,7 @@
#include <wrl/client.h>
#include <map>
+#include <optional>
#include <string>
#include "base/containers/queue.h"
@@ -27,7 +28,6 @@
#include "media/capture/video/win/sink_filter_win.h"
#include "media/capture/video/win/sink_input_pin_win.h"
#include "media/capture/video_capture_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class Location;
@@ -171,7 +171,7 @@
bool enable_get_photo_state_;
- absl::optional<int> camera_rotation_;
+ std::optional<int> camera_rotation_;
};
} // namespace media
diff --git a/media/cast/common/openscreen_conversion_helpers.cc b/media/cast/common/openscreen_conversion_helpers.cc
index 7823749..76f612d3 100644
--- a/media/cast/common/openscreen_conversion_helpers.cc
+++ b/media/cast/common/openscreen_conversion_helpers.cc
@@ -14,7 +14,7 @@
namespace media::cast {
openscreen::Clock::time_point ToOpenscreenTimePoint(
- absl::optional<base::TimeTicks> ticks) {
+ std::optional<base::TimeTicks> ticks) {
if (!ticks) {
return openscreen::Clock::time_point::min();
}
diff --git a/media/cast/common/sender_encoded_frame.h b/media/cast/common/sender_encoded_frame.h
index 98d8789..0a6a9c3 100644
--- a/media/cast/common/sender_encoded_frame.h
+++ b/media/cast/common/sender_encoded_frame.h
@@ -5,9 +5,10 @@
#ifndef MEDIA_CAST_COMMON_SENDER_ENCODED_FRAME_H_
#define MEDIA_CAST_COMMON_SENDER_ENCODED_FRAME_H_
+#include <optional>
+
#include "base/time/time.h"
#include "media/cast/common/encoded_frame.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace cast {
@@ -48,10 +49,10 @@
base::TimeTicks encode_completion_time;
// The time at which capture of the frame started.
- absl::optional<base::TimeTicks> capture_begin_time;
+ std::optional<base::TimeTicks> capture_begin_time;
// The time at which capture of the frame ended.
- absl::optional<base::TimeTicks> capture_end_time;
+ std::optional<base::TimeTicks> capture_end_time;
};
} // namespace cast
diff --git a/media/cast/encoding/external_video_encoder.cc b/media/cast/encoding/external_video_encoder.cc
index f4aa4b7..2981512 100644
--- a/media/cast/encoding/external_video_encoder.cc
+++ b/media/cast/encoding/external_video_encoder.cc
@@ -181,7 +181,7 @@
// uint32_t bitrates
video_encode_accelerator_->RequestEncodingParametersChange(
Bitrate::ConstantBitrate(base::saturated_cast<uint32_t>(bit_rate)),
- static_cast<uint32_t>(max_frame_rate_ + 0.5), absl::nullopt);
+ static_cast<uint32_t>(max_frame_rate_ + 0.5), std::nullopt);
}
}
diff --git a/media/cast/logging/stats_event_subscriber_unittest.cc b/media/cast/logging/stats_event_subscriber_unittest.cc
index b5e450af..a82ae37 100644
--- a/media/cast/logging/stats_event_subscriber_unittest.cc
+++ b/media/cast/logging/stats_event_subscriber_unittest.cc
@@ -535,7 +535,7 @@
if (!dict.contains(bucket)) {
continue;
}
- absl::optional<int> bucket_count = dict.FindInt(bucket);
+ std::optional<int> bucket_count = dict.FindInt(bucket);
if (!bucket_count.has_value()) {
return false;
}
diff --git a/media/cast/openscreen/remoting_proto_enum_utils.cc b/media/cast/openscreen/remoting_proto_enum_utils.cc
index 0f5565e..c868a720 100644
--- a/media/cast/openscreen/remoting_proto_enum_utils.cc
+++ b/media/cast/openscreen/remoting_proto_enum_utils.cc
@@ -14,7 +14,7 @@
case OriginType::x: \
return OtherType::y
-absl::optional<media::AudioCodec> ToMediaAudioCodec(
+std::optional<media::AudioCodec> ToMediaAudioCodec(
openscreen::cast::AudioDecoderConfig::Codec value) {
using OriginType = openscreen::cast::AudioDecoderConfig;
using OtherType = media::AudioCodec;
@@ -38,11 +38,11 @@
CASE_RETURN_ORIGIN_TO_OTHER(kCodecAC3, kAC3);
CASE_RETURN_ORIGIN_TO_OTHER(kCodecMpegHAudio, kMpegHAudio);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<openscreen::cast::AudioDecoderConfig::Codec>
+std::optional<openscreen::cast::AudioDecoderConfig::Codec>
ToProtoAudioDecoderConfigCodec(media::AudioCodec value) {
using OriginType = media::AudioCodec;
using OtherType = openscreen::cast::AudioDecoderConfig;
@@ -66,11 +66,11 @@
CASE_RETURN_ORIGIN_TO_OTHER(kAC3, kCodecAC3);
CASE_RETURN_ORIGIN_TO_OTHER(kMpegHAudio, kCodecMpegHAudio);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<media::SampleFormat> ToMediaSampleFormat(
+std::optional<media::SampleFormat> ToMediaSampleFormat(
openscreen::cast::AudioDecoderConfig::SampleFormat value) {
using OriginType = openscreen::cast::AudioDecoderConfig;
using OtherType = media::SampleFormat;
@@ -89,11 +89,11 @@
CASE_RETURN_OTHER(kSampleFormatEac3);
CASE_RETURN_OTHER(kSampleFormatMpegHAudio);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<openscreen::cast::AudioDecoderConfig::SampleFormat>
+std::optional<openscreen::cast::AudioDecoderConfig::SampleFormat>
ToProtoAudioDecoderConfigSampleFormat(media::SampleFormat value) {
using OriginType = media::SampleFormat;
using OtherType = openscreen::cast::AudioDecoderConfig;
@@ -112,11 +112,11 @@
CASE_RETURN_OTHER(kSampleFormatEac3);
CASE_RETURN_OTHER(kSampleFormatMpegHAudio);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<media::ChannelLayout> ToMediaChannelLayout(
+std::optional<media::ChannelLayout> ToMediaChannelLayout(
openscreen::cast::AudioDecoderConfig::ChannelLayout value) {
using OriginType = openscreen::cast::AudioDecoderConfig;
using OtherType = media::ChannelLayout;
@@ -155,11 +155,11 @@
CASE_RETURN_OTHER(CHANNEL_LAYOUT_4_1_QUAD_SIDE);
CASE_RETURN_OTHER(CHANNEL_LAYOUT_BITSTREAM);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<openscreen::cast::AudioDecoderConfig::ChannelLayout>
+std::optional<openscreen::cast::AudioDecoderConfig::ChannelLayout>
ToProtoAudioDecoderConfigChannelLayout(media::ChannelLayout value) {
using OriginType = media::ChannelLayout;
using OtherType = openscreen::cast::AudioDecoderConfig;
@@ -198,11 +198,11 @@
CASE_RETURN_OTHER(CHANNEL_LAYOUT_4_1_QUAD_SIDE);
CASE_RETURN_OTHER(CHANNEL_LAYOUT_BITSTREAM);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<media::VideoCodec> ToMediaVideoCodec(
+std::optional<media::VideoCodec> ToMediaVideoCodec(
openscreen::cast::VideoDecoderConfig::Codec value) {
using OriginType = openscreen::cast::VideoDecoderConfig;
using OtherType = media::VideoCodec;
@@ -219,11 +219,11 @@
CASE_RETURN_ORIGIN_TO_OTHER(kCodecDolbyVision, kDolbyVision);
CASE_RETURN_ORIGIN_TO_OTHER(kCodecAV1, kAV1);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<openscreen::cast::VideoDecoderConfig::Codec>
+std::optional<openscreen::cast::VideoDecoderConfig::Codec>
ToProtoVideoDecoderConfigCodec(media::VideoCodec value) {
using OriginType = media::VideoCodec;
using OtherType = openscreen::cast::VideoDecoderConfig;
@@ -240,11 +240,11 @@
CASE_RETURN_ORIGIN_TO_OTHER(kDolbyVision, kCodecDolbyVision);
CASE_RETURN_ORIGIN_TO_OTHER(kAV1, kCodecAV1);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<media::VideoCodecProfile> ToMediaVideoCodecProfile(
+std::optional<media::VideoCodecProfile> ToMediaVideoCodecProfile(
openscreen::cast::VideoDecoderConfig::Profile value) {
using OriginType = openscreen::cast::VideoDecoderConfig;
using OtherType = media::VideoCodecProfile;
@@ -287,11 +287,11 @@
CASE_RETURN_OTHER(AV1PROFILE_PROFILE_HIGH);
CASE_RETURN_OTHER(AV1PROFILE_PROFILE_PRO);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<openscreen::cast::VideoDecoderConfig::Profile>
+std::optional<openscreen::cast::VideoDecoderConfig::Profile>
ToProtoVideoDecoderConfigProfile(media::VideoCodecProfile value) {
using OriginType = media::VideoCodecProfile;
using OtherType = openscreen::cast::VideoDecoderConfig;
@@ -334,11 +334,11 @@
CASE_RETURN_OTHER(AV1PROFILE_PROFILE_HIGH);
CASE_RETURN_OTHER(AV1PROFILE_PROFILE_PRO);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<media::VideoPixelFormat> ToMediaVideoPixelFormat(
+std::optional<media::VideoPixelFormat> ToMediaVideoPixelFormat(
openscreen::cast::VideoDecoderConfig::Format value) {
using OriginType = openscreen::cast::VideoDecoderConfig;
using OtherType = media::VideoPixelFormat;
@@ -373,13 +373,13 @@
CASE_RETURN_OTHER(PIXEL_FORMAT_XB30);
// PIXEL_FORMAT_UYVY, PIXEL_FORMAT_RGB32 and PIXEL_FORMAT_Y8 are deprecated.
case openscreen::cast::VideoDecoderConfig_Format_PIXEL_FORMAT_RGB32:
- return absl::nullopt;
+ return std::nullopt;
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<media::BufferingState> ToMediaBufferingState(
+std::optional<media::BufferingState> ToMediaBufferingState(
openscreen::cast::RendererClientOnBufferingStateChange::State value) {
using OriginType = openscreen::cast::RendererClientOnBufferingStateChange;
using OtherType = media::BufferingState;
@@ -387,11 +387,11 @@
CASE_RETURN_OTHER(BUFFERING_HAVE_NOTHING);
CASE_RETURN_OTHER(BUFFERING_HAVE_ENOUGH);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<openscreen::cast::RendererClientOnBufferingStateChange::State>
+std::optional<openscreen::cast::RendererClientOnBufferingStateChange::State>
ToProtoMediaBufferingState(media::BufferingState value) {
using OriginType = media::BufferingState;
using OtherType = openscreen::cast::RendererClientOnBufferingStateChange;
@@ -399,11 +399,11 @@
CASE_RETURN_OTHER(BUFFERING_HAVE_NOTHING);
CASE_RETURN_OTHER(BUFFERING_HAVE_ENOUGH);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<media::DemuxerStream::Status> ToDemuxerStreamStatus(
+std::optional<media::DemuxerStream::Status> ToDemuxerStreamStatus(
openscreen::cast::DemuxerStreamReadUntilCallback::Status value) {
using OriginType = openscreen::cast::DemuxerStreamReadUntilCallback;
using OtherType = media::DemuxerStream;
@@ -413,11 +413,11 @@
CASE_RETURN_OTHER(kConfigChanged);
CASE_RETURN_OTHER(kError);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
-absl::optional<openscreen::cast::DemuxerStreamReadUntilCallback::Status>
+std::optional<openscreen::cast::DemuxerStreamReadUntilCallback::Status>
ToProtoDemuxerStreamStatus(media::DemuxerStream::Status value) {
using OriginType = media::DemuxerStream;
using OtherType = openscreen::cast::DemuxerStreamReadUntilCallback;
@@ -427,7 +427,7 @@
CASE_RETURN_OTHER(kConfigChanged);
CASE_RETURN_OTHER(kError);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
diff --git a/media/cast/openscreen/remoting_proto_enum_utils.h b/media/cast/openscreen/remoting_proto_enum_utils.h
index ae778fe..8f0029ba 100644
--- a/media/cast/openscreen/remoting_proto_enum_utils.h
+++ b/media/cast/openscreen/remoting_proto_enum_utils.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_CAST_OPENSCREEN_REMOTING_PROTO_ENUM_UTILS_H_
#define MEDIA_CAST_OPENSCREEN_REMOTING_PROTO_ENUM_UTILS_H_
+#include <optional>
+
#include "media/base/audio_codecs.h"
#include "media/base/buffering_state.h"
#include "media/base/channel_layout.h"
@@ -12,7 +14,6 @@
#include "media/base/sample_format.h"
#include "media/base/video_codecs.h"
#include "media/base/video_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/openscreen/src/cast/streaming/remoting.pb.h"
namespace media::cast {
@@ -23,45 +24,45 @@
// modules while maintaining compile-time checks to ensure that there are always
// valid, backwards-compatible mappings between the two.
//
-// Each returns a absl::optional value. If it is not set, that indicates the
+// Each returns a std::optional value. If it is not set, that indicates the
// conversion failed.
-absl::optional<media::AudioCodec> ToMediaAudioCodec(
+std::optional<media::AudioCodec> ToMediaAudioCodec(
openscreen::cast::AudioDecoderConfig::Codec value);
-absl::optional<openscreen::cast::AudioDecoderConfig::Codec>
+std::optional<openscreen::cast::AudioDecoderConfig::Codec>
ToProtoAudioDecoderConfigCodec(media::AudioCodec value);
-absl::optional<media::SampleFormat> ToMediaSampleFormat(
+std::optional<media::SampleFormat> ToMediaSampleFormat(
openscreen::cast::AudioDecoderConfig::SampleFormat value);
-absl::optional<openscreen::cast::AudioDecoderConfig::SampleFormat>
+std::optional<openscreen::cast::AudioDecoderConfig::SampleFormat>
ToProtoAudioDecoderConfigSampleFormat(media::SampleFormat value);
-absl::optional<media::ChannelLayout> ToMediaChannelLayout(
+std::optional<media::ChannelLayout> ToMediaChannelLayout(
openscreen::cast::AudioDecoderConfig::ChannelLayout value);
-absl::optional<openscreen::cast::AudioDecoderConfig::ChannelLayout>
+std::optional<openscreen::cast::AudioDecoderConfig::ChannelLayout>
ToProtoAudioDecoderConfigChannelLayout(media::ChannelLayout value);
-absl::optional<media::VideoCodec> ToMediaVideoCodec(
+std::optional<media::VideoCodec> ToMediaVideoCodec(
openscreen::cast::VideoDecoderConfig::Codec value);
-absl::optional<openscreen::cast::VideoDecoderConfig::Codec>
+std::optional<openscreen::cast::VideoDecoderConfig::Codec>
ToProtoVideoDecoderConfigCodec(media::VideoCodec value);
-absl::optional<media::VideoCodecProfile> ToMediaVideoCodecProfile(
+std::optional<media::VideoCodecProfile> ToMediaVideoCodecProfile(
openscreen::cast::VideoDecoderConfig::Profile value);
-absl::optional<openscreen::cast::VideoDecoderConfig::Profile>
+std::optional<openscreen::cast::VideoDecoderConfig::Profile>
ToProtoVideoDecoderConfigProfile(media::VideoCodecProfile value);
-absl::optional<media::VideoPixelFormat> ToMediaVideoPixelFormat(
+std::optional<media::VideoPixelFormat> ToMediaVideoPixelFormat(
openscreen::cast::VideoDecoderConfig::Format value);
-absl::optional<media::BufferingState> ToMediaBufferingState(
+std::optional<media::BufferingState> ToMediaBufferingState(
openscreen::cast::RendererClientOnBufferingStateChange::State value);
-absl::optional<openscreen::cast::RendererClientOnBufferingStateChange::State>
+std::optional<openscreen::cast::RendererClientOnBufferingStateChange::State>
ToProtoMediaBufferingState(media::BufferingState value);
-absl::optional<media::DemuxerStream::Status> ToDemuxerStreamStatus(
+std::optional<media::DemuxerStream::Status> ToDemuxerStreamStatus(
openscreen::cast::DemuxerStreamReadUntilCallback::Status value);
-absl::optional<openscreen::cast::DemuxerStreamReadUntilCallback::Status>
+std::optional<openscreen::cast::DemuxerStreamReadUntilCallback::Status>
ToProtoDemuxerStreamStatus(media::DemuxerStream::Status value);
} // namespace media::cast
diff --git a/media/cast/openscreen/rpc_call_message_handler.cc b/media/cast/openscreen/rpc_call_message_handler.cc
index b745797..3f56a2bd 100644
--- a/media/cast/openscreen/rpc_call_message_handler.cc
+++ b/media/cast/openscreen/rpc_call_message_handler.cc
@@ -15,34 +15,34 @@
namespace {
template <typename T>
-absl::optional<media::AudioDecoderConfig> ExtractAudioConfig(
+std::optional<media::AudioDecoderConfig> ExtractAudioConfig(
const T& config_container) {
if (!config_container.has_audio_decoder_config()) {
- return absl::nullopt;
+ return std::nullopt;
}
const auto& audio_message = config_container.audio_decoder_config();
media::AudioDecoderConfig config;
ConvertProtoToAudioDecoderConfig(audio_message, &config);
if (!config.IsValidConfig()) {
- return absl::nullopt;
+ return std::nullopt;
}
return config;
}
template <typename T>
-absl::optional<media::VideoDecoderConfig> ExtractVideoConfig(
+std::optional<media::VideoDecoderConfig> ExtractVideoConfig(
const T& config_container) {
if (!config_container.has_video_decoder_config()) {
- return absl::nullopt;
+ return std::nullopt;
}
const auto& video_message = config_container.video_decoder_config();
media::VideoDecoderConfig config;
ConvertProtoToVideoDecoderConfig(video_message, &config);
if (!config.IsValidConfig()) {
- return absl::nullopt;
+ return std::nullopt;
}
return config;
diff --git a/media/cast/openscreen/rpc_call_message_handler.h b/media/cast/openscreen/rpc_call_message_handler.h
index 0e79954..dd8ad8ca 100644
--- a/media/cast/openscreen/rpc_call_message_handler.h
+++ b/media/cast/openscreen/rpc_call_message_handler.h
@@ -5,10 +5,11 @@
#ifndef MEDIA_CAST_OPENSCREEN_RPC_CALL_MESSAGE_HANDLER_H_
#define MEDIA_CAST_OPENSCREEN_RPC_CALL_MESSAGE_HANDLER_H_
+#include <optional>
+
#include "base/time/time.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/video_decoder_config.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/openscreen/src/cast/streaming/rpc_messenger.h"
namespace openscreen::cast {
@@ -48,12 +49,12 @@
virtual void OnRpcInitializeCallback(
openscreen::cast::RpcMessenger::Handle handle,
- absl::optional<media::AudioDecoderConfig> audio_config,
- absl::optional<media::VideoDecoderConfig> video_config) = 0;
+ std::optional<media::AudioDecoderConfig> audio_config,
+ std::optional<media::VideoDecoderConfig> video_config) = 0;
virtual void OnRpcReadUntilCallback(
openscreen::cast::RpcMessenger::Handle handle,
- absl::optional<media::AudioDecoderConfig> audio_config,
- absl::optional<media::VideoDecoderConfig> video_config,
+ std::optional<media::AudioDecoderConfig> audio_config,
+ std::optional<media::VideoDecoderConfig> video_config,
uint32_t total_frames_received) = 0;
virtual void OnRpcEnableBitstreamConverterCallback(
openscreen::cast::RpcMessenger::Handle handle,
diff --git a/media/cast/openscreen/rpc_call_message_handler_unittest.cc b/media/cast/openscreen/rpc_call_message_handler_unittest.cc
index 88a4fab..3273765 100644
--- a/media/cast/openscreen/rpc_call_message_handler_unittest.cc
+++ b/media/cast/openscreen/rpc_call_message_handler_unittest.cc
@@ -50,12 +50,12 @@
MOCK_METHOD3(OnRpcInitializeCallback,
void(int,
- absl::optional<media::AudioDecoderConfig>,
- absl::optional<media::VideoDecoderConfig>));
+ std::optional<media::AudioDecoderConfig>,
+ std::optional<media::VideoDecoderConfig>));
MOCK_METHOD4(OnRpcReadUntilCallback,
void(int,
- absl::optional<media::AudioDecoderConfig>,
- absl::optional<media::VideoDecoderConfig>,
+ std::optional<media::AudioDecoderConfig>,
+ std::optional<media::VideoDecoderConfig>,
uint32_t));
MOCK_METHOD2(OnRpcEnableBitstreamConverterCallback, void(int, bool));
};
@@ -173,8 +173,8 @@
ConvertVideoDecoderConfigToProto(test_video_config_, video_config);
EXPECT_CALL(demuxer_stream_client_, OnRpcInitializeCallback(kHandle, _, _))
.WillOnce([this](openscreen::cast::RpcMessenger::Handle handle,
- absl::optional<media::AudioDecoderConfig> audio_config,
- absl::optional<media::VideoDecoderConfig> video_config) {
+ std::optional<media::AudioDecoderConfig> audio_config,
+ std::optional<media::VideoDecoderConfig> video_config) {
EXPECT_TRUE(audio_config.has_value());
EXPECT_TRUE(test_audio_config_.Matches(audio_config.value()));
EXPECT_TRUE(video_config.has_value());
@@ -194,8 +194,8 @@
ConvertVideoDecoderConfigToProto(test_video_config_, video_config);
EXPECT_CALL(demuxer_stream_client_, OnRpcInitializeCallback(kHandle, _, _))
.WillOnce([this](openscreen::cast::RpcMessenger::Handle handle,
- absl::optional<media::AudioDecoderConfig> audio_config,
- absl::optional<media::VideoDecoderConfig> video_config) {
+ std::optional<media::AudioDecoderConfig> audio_config,
+ std::optional<media::VideoDecoderConfig> video_config) {
EXPECT_FALSE(audio_config.has_value());
EXPECT_TRUE(video_config.has_value());
EXPECT_TRUE(test_video_config_.Matches(video_config.value()));
@@ -230,8 +230,8 @@
EXPECT_CALL(demuxer_stream_client_,
OnRpcReadUntilCallback(kHandle, _, _, kCount))
.WillOnce([this](openscreen::cast::RpcMessenger::Handle handle,
- absl::optional<media::AudioDecoderConfig> audio_config,
- absl::optional<media::VideoDecoderConfig> video_config,
+ std::optional<media::AudioDecoderConfig> audio_config,
+ std::optional<media::VideoDecoderConfig> video_config,
uint32_t count) {
EXPECT_TRUE(audio_config.has_value());
EXPECT_TRUE(test_audio_config_.Matches(audio_config.value()));
@@ -257,8 +257,8 @@
EXPECT_CALL(demuxer_stream_client_,
OnRpcReadUntilCallback(kHandle, _, _, kCount))
.WillOnce([this](openscreen::cast::RpcMessenger::Handle handle,
- absl::optional<media::AudioDecoderConfig> audio_config,
- absl::optional<media::VideoDecoderConfig> video_config,
+ std::optional<media::AudioDecoderConfig> audio_config,
+ std::optional<media::VideoDecoderConfig> video_config,
uint32_t count) {
EXPECT_FALSE(audio_config.has_value());
EXPECT_TRUE(video_config.has_value());
@@ -293,8 +293,8 @@
EXPECT_CALL(demuxer_stream_client_,
OnRpcReadUntilCallback(kHandle, _, _, kCount))
.WillOnce([](openscreen::cast::RpcMessenger::Handle handle,
- absl::optional<media::AudioDecoderConfig> audio_config,
- absl::optional<media::VideoDecoderConfig> video_config,
+ std::optional<media::AudioDecoderConfig> audio_config,
+ std::optional<media::VideoDecoderConfig> video_config,
uint32_t count) {
EXPECT_FALSE(audio_config.has_value());
EXPECT_FALSE(video_config.has_value());
diff --git a/media/cast/sender/openscreen_frame_sender.h b/media/cast/sender/openscreen_frame_sender.h
index 91b5a58..affce8b5 100644
--- a/media/cast/sender/openscreen_frame_sender.h
+++ b/media/cast/sender/openscreen_frame_sender.h
@@ -7,6 +7,8 @@
#include <stdint.h>
+#include <optional>
+
#include "base/containers/flat_map.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ref.h"
@@ -19,7 +21,6 @@
#include "media/cast/net/rtcp/rtcp_defines.h"
#include "media/cast/sender/frame_sender.h"
#include "media/cast/sender/video_bitrate_suggester.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/openscreen/src/cast/streaming/sender.h"
namespace media::cast {
@@ -135,7 +136,7 @@
// The ID of the frame that was the first one to have a different identifier
// used inside of Open Screen. This only occurs if a frame is dropped.
- absl::optional<FrameId> diverged_frame_id_;
+ std::optional<FrameId> diverged_frame_id_;
// Since the encoder emits frames that depend on each other, and the Open
// Screen sender demands that we use its FrameIDs for enqueued frames, we
diff --git a/media/cast/test/receiver/video_decoder.cc b/media/cast/test/receiver/video_decoder.cc
index e55c800..9d9f4082 100644
--- a/media/cast/test/receiver/video_decoder.cc
+++ b/media/cast/test/receiver/video_decoder.cc
@@ -196,7 +196,7 @@
// Make sure this is a JSON string.
if (!len || data[0] != '{')
return nullptr;
- absl::optional<base::Value> values = base::JSONReader::Read(
+ std::optional<base::Value> values = base::JSONReader::Read(
base::StringPiece(reinterpret_cast<char*>(data), len));
if (!values || !values->is_dict())
return nullptr;
diff --git a/media/cdm/aes_cbc_crypto_unittest.cc b/media/cdm/aes_cbc_crypto_unittest.cc
index cd91497..28aa75f 100644
--- a/media/cdm/aes_cbc_crypto_unittest.cc
+++ b/media/cdm/aes_cbc_crypto_unittest.cc
@@ -5,6 +5,7 @@
#include "media/cdm/aes_cbc_crypto.h"
#include <memory>
+#include <optional>
#include "base/containers/span.h"
#include "crypto/encryptor.h"
@@ -12,7 +13,6 @@
#include "media/base/decoder_buffer.h"
#include "media/base/decrypt_config.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/boringssl/src/include/openssl/aes.h"
#include "third_party/boringssl/src/include/openssl/crypto.h"
#include "third_party/boringssl/src/include/openssl/err.h"
diff --git a/media/cdm/aes_decryptor_unittest.cc b/media/cdm/aes_decryptor_unittest.cc
index fbd2e66..657ebeb0 100644
--- a/media/cdm/aes_decryptor_unittest.cc
+++ b/media/cdm/aes_decryptor_unittest.cc
@@ -61,7 +61,7 @@
}
MATCHER(IsJSONDictionary, "") {
std::string result(arg.begin(), arg.end());
- absl::optional<base::Value> root = base::JSONReader::Read(result);
+ std::optional<base::Value> root = base::JSONReader::Read(result);
return (root && root->type() == base::Value::Type::DICT);
}
MATCHER(IsNullTime, "") {
diff --git a/media/cdm/cbcs_decryptor_unittest.cc b/media/cdm/cbcs_decryptor_unittest.cc
index 7fc69cd..66b3c1c 100644
--- a/media/cdm/cbcs_decryptor_unittest.cc
+++ b/media/cdm/cbcs_decryptor_unittest.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include <array>
#include <memory>
+#include <optional>
#include "base/containers/span.h"
#include "base/time/time.h"
@@ -15,7 +16,6 @@
#include "media/base/decoder_buffer.h"
#include "media/base/decrypt_config.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -107,7 +107,7 @@
const std::vector<uint8_t>& data,
const std::string& iv,
const std::vector<SubsampleEntry>& subsample_entries,
- absl::optional<EncryptionPattern> encryption_pattern) {
+ std::optional<EncryptionPattern> encryption_pattern) {
EXPECT_FALSE(data.empty());
EXPECT_FALSE(iv.empty());
diff --git a/media/cdm/cdm_adapter.cc b/media/cdm/cdm_adapter.cc
index b602c63..befa0de9 100644
--- a/media/cdm/cdm_adapter.cc
+++ b/media/cdm/cdm_adapter.cc
@@ -416,9 +416,9 @@
return this;
}
-absl::optional<base::UnguessableToken> CdmAdapter::GetCdmId() const {
+std::optional<base::UnguessableToken> CdmAdapter::GetCdmId() const {
DCHECK(task_runner_->BelongsToCurrentThread());
- return absl::nullopt;
+ return std::nullopt;
}
void CdmAdapter::Decrypt(StreamType stream_type,
diff --git a/media/cdm/cdm_adapter.h b/media/cdm/cdm_adapter.h
index cd816a3..7df3a0d 100644
--- a/media/cdm/cdm_adapter.h
+++ b/media/cdm/cdm_adapter.h
@@ -97,7 +97,7 @@
// CdmContext implementation.
std::unique_ptr<CallbackRegistration> RegisterEventCB(EventCB event_cb) final;
Decryptor* GetDecryptor() final;
- absl::optional<base::UnguessableToken> GetCdmId() const final;
+ std::optional<base::UnguessableToken> GetCdmId() const final;
// Decryptor implementation.
void Decrypt(StreamType stream_type,
diff --git a/media/cdm/cdm_auxiliary_helper.cc b/media/cdm/cdm_auxiliary_helper.cc
index 8440bc8..3627a4b 100644
--- a/media/cdm/cdm_auxiliary_helper.cc
+++ b/media/cdm/cdm_auxiliary_helper.cc
@@ -9,8 +9,9 @@
#include "media/cdm/cdm_helpers.h"
#if BUILDFLAG(IS_WIN)
+#include <optional>
+
#include "media/cdm/media_foundation_cdm_data.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#endif // BUILDFLAG(IS_WIN)
namespace media {
@@ -59,7 +60,7 @@
void CdmAuxiliaryHelper::GetMediaFoundationCdmData(
GetMediaFoundationCdmDataCB callback) {
std::move(callback).Run(std::make_unique<MediaFoundationCdmData>(
- base::UnguessableToken::Null(), absl::nullopt, base::FilePath()));
+ base::UnguessableToken::Null(), std::nullopt, base::FilePath()));
}
void CdmAuxiliaryHelper::SetCdmClientToken(
diff --git a/media/cdm/cdm_capability.h b/media/cdm/cdm_capability.h
index 67e52ca..90e20ff 100644
--- a/media/cdm/cdm_capability.h
+++ b/media/cdm/cdm_capability.h
@@ -6,6 +6,7 @@
#define MEDIA_CDM_CDM_CAPABILITY_H_
#include <map>
+#include <optional>
#include "base/containers/flat_set.h"
#include "base/functional/callback.h"
@@ -14,7 +15,6 @@
#include "media/base/encryption_scheme.h"
#include "media/base/media_export.h"
#include "media/base/video_codecs.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -74,7 +74,7 @@
// Callback for when a capability is initialized if lazy initialization
// required.
-using CdmCapabilityCB = base::OnceCallback<void(absl::optional<CdmCapability>)>;
+using CdmCapabilityCB = base::OnceCallback<void(std::optional<CdmCapability>)>;
} // namespace media
diff --git a/media/cdm/fuchsia/fuchsia_cdm.cc b/media/cdm/fuchsia/fuchsia_cdm.cc
index 66c3103..bd805c5 100644
--- a/media/cdm/fuchsia/fuchsia_cdm.cc
+++ b/media/cdm/fuchsia/fuchsia_cdm.cc
@@ -4,12 +4,13 @@
#include "media/cdm/fuchsia/fuchsia_cdm.h"
+#include <optional>
+
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/mem_buffer_util.h"
#include "base/logging.h"
#include "media/base/callback_registry.h"
#include "media/base/cdm_promise.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#define REJECT_PROMISE_AND_RETURN_IF_BAD_CDM(promise, cdm) \
if (!cdm) { \
@@ -121,7 +122,7 @@
class FuchsiaCdm::CdmSession {
public:
using ResultCB =
- base::OnceCallback<void(absl::optional<CdmPromise::Exception>)>;
+ base::OnceCallback<void(std::optional<CdmPromise::Exception>)>;
using SessionReadyCB = base::OnceCallback<void(bool success)>;
CdmSession(const FuchsiaCdm::SessionCallbacks* callbacks,
@@ -206,7 +207,7 @@
void OnLicenseMessageGenerated(fuchsia::media::drm::LicenseMessage message) {
DCHECK(!session_id_.empty());
- absl::optional<std::string> session_msg =
+ std::optional<std::string> session_msg =
base::StringFromMemBuffer(message.message);
if (!session_msg) {
@@ -258,8 +259,8 @@
DCHECK(result_cb_);
std::move(result_cb_)
.Run(result.is_err()
- ? absl::make_optional(ToCdmPromiseException(result.err()))
- : absl::nullopt);
+ ? std::make_optional(ToCdmPromiseException(result.err()))
+ : std::nullopt);
}
const SessionCallbacks* const session_callbacks_;
@@ -427,7 +428,7 @@
void FuchsiaCdm::OnGenerateLicenseRequestStatus(
CdmSession* session,
uint32_t promise_id,
- absl::optional<CdmPromise::Exception> exception) {
+ std::optional<CdmPromise::Exception> exception) {
DCHECK(session);
std::string session_id = session->session_id();
@@ -515,7 +516,7 @@
void FuchsiaCdm::OnProcessLicenseServerMessageStatus(
const std::string& session_id,
uint32_t promise_id,
- absl::optional<CdmPromise::Exception> exception) {
+ std::optional<CdmPromise::Exception> exception) {
if (exception.has_value()) {
promises_.RejectPromise(promise_id, exception.value(), 0,
"fail to process license.");
@@ -576,7 +577,7 @@
void FuchsiaCdm::OnGenerateLicenseReleaseStatus(
const std::string& session_id,
uint32_t promise_id,
- absl::optional<CdmPromise::Exception> exception) {
+ std::optional<CdmPromise::Exception> exception) {
if (exception.has_value()) {
promises_.RejectPromise(promise_id, exception.value(), 0,
"Failed to release license.");
diff --git a/media/cdm/fuchsia/fuchsia_cdm.h b/media/cdm/fuchsia/fuchsia_cdm.h
index d2bb33f..b5e1038 100644
--- a/media/cdm/fuchsia/fuchsia_cdm.h
+++ b/media/cdm/fuchsia/fuchsia_cdm.h
@@ -7,6 +7,8 @@
#include <fuchsia/media/drm/cpp/fidl.h>
+#include <optional>
+
#include "base/containers/flat_map.h"
#include "base/functional/callback_forward.h"
#include "media/base/callback_registry.h"
@@ -15,7 +17,6 @@
#include "media/base/content_decryption_module.h"
#include "media/cdm/fuchsia/fuchsia_cdm_context.h"
#include "media/cdm/fuchsia/fuchsia_decryptor.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -93,11 +94,11 @@
void OnGenerateLicenseRequestStatus(
CdmSession* session,
uint32_t promise_id,
- absl::optional<CdmPromise::Exception> exception);
+ std::optional<CdmPromise::Exception> exception);
void OnProcessLicenseServerMessageStatus(
const std::string& session_id,
uint32_t promise_id,
- absl::optional<CdmPromise::Exception> exception);
+ std::optional<CdmPromise::Exception> exception);
void OnSessionLoaded(std::unique_ptr<CdmSession> session,
uint32_t promise_id,
bool loaded);
@@ -105,7 +106,7 @@
void OnGenerateLicenseReleaseStatus(
const std::string& session_id,
uint32_t promise_id,
- absl::optional<CdmPromise::Exception> exception);
+ std::optional<CdmPromise::Exception> exception);
void OnNewKey();
diff --git a/media/cdm/json_web_key.cc b/media/cdm/json_web_key.cc
index 50fad26..837dd998 100644
--- a/media/cdm/json_web_key.cc
+++ b/media/cdm/json_web_key.cc
@@ -167,7 +167,7 @@
return false;
}
- absl::optional<base::Value> root = base::JSONReader::Read(jwk_set);
+ std::optional<base::Value> root = base::JSONReader::Read(jwk_set);
if (!root || root->type() != base::Value::Type::DICT) {
DVLOG(1) << "Not valid JSON: " << jwk_set;
return false;
@@ -236,7 +236,7 @@
return false;
}
- absl::optional<base::Value> root = base::JSONReader::Read(input);
+ std::optional<base::Value> root = base::JSONReader::Read(input);
if (!root || root->type() != base::Value::Type::DICT) {
error_message->assign("Not valid JSON: ");
error_message->append(ShortenTo64Characters(input));
@@ -385,7 +385,7 @@
return false;
}
- absl::optional<base::Value> root = base::JSONReader::Read(license_as_str);
+ std::optional<base::Value> root = base::JSONReader::Read(license_as_str);
if (!root || root->type() != base::Value::Type::DICT) {
DVLOG(1) << "Not valid JSON: " << license_as_str;
return false;
diff --git a/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc b/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc
index b6db1b9..4d08882 100644
--- a/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc
+++ b/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc
@@ -5,6 +5,7 @@
#include "media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.h"
#include <memory>
+#include <optional>
#include <utility>
#include "base/command_line.h"
@@ -17,7 +18,6 @@
#include "base/no_destructor.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
// Necessary to convert async media::VideoDecoder to sync CdmVideoDecoder.
// Typically not recommended for production code, but is ok here since
// ClearKeyCdm is only for testing.
@@ -290,8 +290,8 @@
// Results of |video_decoder_| operations. Set iff the callback of the
// operation has been called.
- absl::optional<DecoderStatus> last_init_result_;
- absl::optional<DecoderStatus> last_decode_status_;
+ std::optional<DecoderStatus> last_init_result_;
+ std::optional<DecoderStatus> last_decode_status_;
// Queue of decoded video frames.
using VideoFrameQueue = base::queue<scoped_refptr<VideoFrame>>;
diff --git a/media/cdm/media_foundation_cdm_data.cc b/media/cdm/media_foundation_cdm_data.cc
index 926126f..aeadff6 100644
--- a/media/cdm/media_foundation_cdm_data.cc
+++ b/media/cdm/media_foundation_cdm_data.cc
@@ -10,7 +10,7 @@
MediaFoundationCdmData::MediaFoundationCdmData(
const base::UnguessableToken& origin_id,
- const absl::optional<std::vector<uint8_t>>& client_token,
+ const std::optional<std::vector<uint8_t>>& client_token,
const base::FilePath& cdm_store_path_root)
: origin_id(origin_id),
client_token(client_token),
diff --git a/media/cdm/media_foundation_cdm_data.h b/media/cdm/media_foundation_cdm_data.h
index 36b0efa..25bfd08 100644
--- a/media/cdm/media_foundation_cdm_data.h
+++ b/media/cdm/media_foundation_cdm_data.h
@@ -5,19 +5,19 @@
#ifndef MEDIA_CDM_MEDIA_FOUNDATION_CDM_DATA_H_
#define MEDIA_CDM_MEDIA_FOUNDATION_CDM_DATA_H_
+#include <optional>
#include <vector>
#include "base/files/file_path.h"
#include "base/unguessable_token.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
struct MEDIA_EXPORT MediaFoundationCdmData {
MediaFoundationCdmData();
MediaFoundationCdmData(
const base::UnguessableToken& origin_id,
- const absl::optional<std::vector<uint8_t>>& client_token,
+ const std::optional<std::vector<uint8_t>>& client_token,
const base::FilePath& cdm_store_path_root);
MediaFoundationCdmData(const MediaFoundationCdmData& other) = delete;
@@ -27,7 +27,7 @@
~MediaFoundationCdmData();
base::UnguessableToken origin_id;
- absl::optional<std::vector<uint8_t>> client_token;
+ std::optional<std::vector<uint8_t>> client_token;
base::FilePath cdm_store_path_root;
};
} // namespace media
diff --git a/media/cdm/supported_cdm_versions.cc b/media/cdm/supported_cdm_versions.cc
index 88286e72..cf2b229 100644
--- a/media/cdm/supported_cdm_versions.cc
+++ b/media/cdm/supported_cdm_versions.cc
@@ -4,10 +4,11 @@
#include "media/cdm/supported_cdm_versions.h"
+#include <optional>
+
#include "base/command_line.h"
#include "base/strings/string_number_conversions.h"
#include "media/base/media_switches.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -15,17 +16,17 @@
// Returns the overridden supported CDM interface version specified on command
// line, which can be null if not specified.
-absl::optional<int> GetSupportedCdmInterfaceVersionOverrideFromCommandLine() {
+std::optional<int> GetSupportedCdmInterfaceVersionOverrideFromCommandLine() {
auto* command_line = base::CommandLine::ForCurrentProcess();
if (!command_line)
- return absl::nullopt;
+ return std::nullopt;
auto version_string = command_line->GetSwitchValueASCII(
switches::kOverrideEnabledCdmInterfaceVersion);
int version = 0;
if (!base::StringToInt(version_string, &version))
- return absl::nullopt;
+ return std::nullopt;
else
return version;
}
diff --git a/media/cdm/win/media_foundation_cdm_factory.cc b/media/cdm/win/media_foundation_cdm_factory.cc
index 51751b40..407c2c0 100644
--- a/media/cdm/win/media_foundation_cdm_factory.cc
+++ b/media/cdm/win/media_foundation_cdm_factory.cc
@@ -195,7 +195,7 @@
void MediaFoundationCdmFactory::CreateMfCdm(
const CdmConfig& cdm_config,
const base::UnguessableToken& cdm_origin_id,
- const absl::optional<std::vector<uint8_t>>& cdm_client_token,
+ const std::optional<std::vector<uint8_t>>& cdm_client_token,
const base::FilePath& cdm_store_path_root,
HRESULT& hresult,
Microsoft::WRL::ComPtr<IMFContentDecryptionModule>& mf_cdm) {
diff --git a/media/cdm/win/media_foundation_cdm_factory.h b/media/cdm/win/media_foundation_cdm_factory.h
index 3e72c81..c1e2c8a0 100644
--- a/media/cdm/win/media_foundation_cdm_factory.h
+++ b/media/cdm/win/media_foundation_cdm_factory.h
@@ -77,7 +77,7 @@
// can bind it to a repeating callback using weak pointer.
void CreateMfCdm(const CdmConfig& cdm_config,
const base::UnguessableToken& cdm_origin_id,
- const absl::optional<std::vector<uint8_t>>& cdm_client_token,
+ const std::optional<std::vector<uint8_t>>& cdm_client_token,
const base::FilePath& cdm_store_path_root,
HRESULT& hresult,
Microsoft::WRL::ComPtr<IMFContentDecryptionModule>& mf_cdm);
diff --git a/media/cdm/win/media_foundation_cdm_factory_unittest.cc b/media/cdm/win/media_foundation_cdm_factory_unittest.cc
index 4c779de..95b850a 100644
--- a/media/cdm/win/media_foundation_cdm_factory_unittest.cc
+++ b/media/cdm/win/media_foundation_cdm_factory_unittest.cc
@@ -5,6 +5,7 @@
#include "media/cdm/win/media_foundation_cdm_factory.h"
#include <memory>
+#include <optional>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
@@ -19,7 +20,6 @@
#include "media/cdm/mock_helpers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
using base::test::RunOnceCallback;
using ::testing::_;
@@ -107,7 +107,7 @@
.WillOnce(DoAll(SetComPointee<3>(mf_cdm_access_.Get()), Return(S_OK)));
EXPECT_CALL(*cdm_helper_, GetMediaFoundationCdmData(_))
.WillOnce(RunOnceCallback<0>(std::make_unique<MediaFoundationCdmData>(
- base::UnguessableToken::Create(), absl::nullopt, base::FilePath())));
+ base::UnguessableToken::Create(), std::nullopt, base::FilePath())));
COM_EXPECT_CALL(mf_cdm_access_, CreateContentDecryptionModule(NotNull(), _))
.WillOnce(DoAll(SetComPointee<1>(mf_cdm_.Get()), Return(S_OK)));
@@ -120,7 +120,7 @@
EXPECT_CALL(*cdm_helper_, GetMediaFoundationCdmData(_))
.WillOnce(RunOnceCallback<0>(std::make_unique<MediaFoundationCdmData>(
- base::UnguessableToken::Create(), absl::nullopt, base::FilePath())));
+ base::UnguessableToken::Create(), std::nullopt, base::FilePath())));
EXPECT_CALL(cdm_created_cb_, Run(IsNull(), _));
Create();
@@ -133,7 +133,7 @@
.WillOnce(Return(FALSE));
EXPECT_CALL(*cdm_helper_, GetMediaFoundationCdmData(_))
.WillOnce(RunOnceCallback<0>(std::make_unique<MediaFoundationCdmData>(
- base::UnguessableToken::Create(), absl::nullopt, base::FilePath())));
+ base::UnguessableToken::Create(), std::nullopt, base::FilePath())));
EXPECT_CALL(cdm_created_cb_, Run(IsNull(), _));
Create();
@@ -149,7 +149,7 @@
.WillOnce(Return(E_FAIL));
EXPECT_CALL(*cdm_helper_, GetMediaFoundationCdmData(_))
.WillOnce(RunOnceCallback<0>(std::make_unique<MediaFoundationCdmData>(
- base::UnguessableToken::Create(), absl::nullopt, base::FilePath())));
+ base::UnguessableToken::Create(), std::nullopt, base::FilePath())));
EXPECT_CALL(cdm_created_cb_, Run(IsNull(), _));
Create();
@@ -160,7 +160,7 @@
EXPECT_CALL(*cdm_helper_, GetMediaFoundationCdmData(_))
.WillOnce(RunOnceCallback<0>(std::make_unique<MediaFoundationCdmData>(
- base::UnguessableToken::Null(), absl::nullopt, base::FilePath())));
+ base::UnguessableToken::Null(), std::nullopt, base::FilePath())));
EXPECT_CALL(cdm_created_cb_, Run(IsNull(), _));
Create();
@@ -176,7 +176,7 @@
.WillOnce(DoAll(SetComPointee<3>(mf_cdm_access_.Get()), Return(S_OK)));
EXPECT_CALL(*cdm_helper_, GetMediaFoundationCdmData(_))
.WillOnce(RunOnceCallback<0>(std::make_unique<MediaFoundationCdmData>(
- base::UnguessableToken::Create(), absl::nullopt, base::FilePath())));
+ base::UnguessableToken::Create(), std::nullopt, base::FilePath())));
COM_EXPECT_CALL(mf_cdm_access_, CreateContentDecryptionModule(NotNull(), _))
.WillOnce(DoAll(SetComPointee<1>(mf_cdm_.Get()), Return(E_FAIL)));
diff --git a/media/cdm/win/media_foundation_cdm_util.cc b/media/cdm/win/media_foundation_cdm_util.cc
index 351db43..8d7e7a4 100644
--- a/media/cdm/win/media_foundation_cdm_util.cc
+++ b/media/cdm/win/media_foundation_cdm_util.cc
@@ -121,7 +121,7 @@
HRESULT BuildCdmProperties(
const base::UnguessableToken& origin_id,
- const absl::optional<std::vector<uint8_t>>& client_token,
+ const std::optional<std::vector<uint8_t>>& client_token,
const base::FilePath& store_path,
ComPtr<IPropertyStore>& properties) {
DCHECK(!origin_id.is_empty());
@@ -165,7 +165,7 @@
ComPtr<IMFContentDecryptionModuleFactory> cdm_factory,
const CdmConfig& cdm_config,
const base::UnguessableToken& cdm_origin_id,
- const absl::optional<std::vector<uint8_t>>& cdm_client_token,
+ const std::optional<std::vector<uint8_t>>& cdm_client_token,
const base::FilePath& cdm_store_path_root,
ComPtr<IMFContentDecryptionModule>& mf_cdm) {
DVLOG(1) << __func__ << ": cdm_config=" << cdm_config
diff --git a/media/cdm/win/media_foundation_cdm_util.h b/media/cdm/win/media_foundation_cdm_util.h
index ceb02c2..779a8b7 100644
--- a/media/cdm/win/media_foundation_cdm_util.h
+++ b/media/cdm/win/media_foundation_cdm_util.h
@@ -5,18 +5,17 @@
#ifndef MEDIA_CDM_WIN_MEDIA_FOUNDATION_CDM_UTIL_H_
#define MEDIA_CDM_WIN_MEDIA_FOUNDATION_CDM_UTIL_H_
-#include <stdint.h>
-
-#include <vector>
-
#include <mfcontentdecryptionmodule.h>
+#include <stdint.h>
#include <wrl/client.h>
+#include <optional>
+#include <vector>
+
#include "base/files/file_path.h"
#include "base/unguessable_token.h"
#include "media/base/cdm_config.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -24,7 +23,7 @@
Microsoft::WRL::ComPtr<IMFContentDecryptionModuleFactory> cdm_factory,
const CdmConfig& cdm_config,
const base::UnguessableToken& cdm_origin_id,
- const absl::optional<std::vector<uint8_t>>& cdm_client_token,
+ const std::optional<std::vector<uint8_t>>& cdm_client_token,
const base::FilePath& cdm_store_path_root,
Microsoft::WRL::ComPtr<IMFContentDecryptionModule>& mf_cdm);
diff --git a/media/filters/audio_renderer_algorithm.cc b/media/filters/audio_renderer_algorithm.cc
index 06bfaae..b548878 100644
--- a/media/filters/audio_renderer_algorithm.cc
+++ b/media/filters/audio_renderer_algorithm.cc
@@ -359,7 +359,7 @@
}
void AudioRendererAlgorithm::SetLatencyHint(
- absl::optional<base::TimeDelta> latency_hint) {
+ std::optional<base::TimeDelta> latency_hint) {
DCHECK_GE(playback_threshold_, min_playback_threshold_);
DCHECK_LE(playback_threshold_, capacity_);
DCHECK_LE(capacity_, max_capacity_);
diff --git a/media/filters/audio_renderer_algorithm.h b/media/filters/audio_renderer_algorithm.h
index 6d2fc83..8457697 100644
--- a/media/filters/audio_renderer_algorithm.h
+++ b/media/filters/audio_renderer_algorithm.h
@@ -24,6 +24,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include <vector>
#include "base/memory/raw_ptr.h"
@@ -34,7 +35,6 @@
#include "media/base/audio_parameters.h"
#include "media/base/media_log.h"
#include "media/base/multi_channel_resampler.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -89,7 +89,7 @@
// Sets a target queue latency. This target will be clamped and stored in
// |playback_threshold_|. It may also cause an increase in |capacity_|. A
// value of nullopt indicates the algorithm should restore the default value.
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint);
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint);
// Sets a flag indicating whether apply pitch adjustments when playing back
// at rates other than 1.0. Concretely, we use WSOLA when this is true, and
@@ -223,7 +223,7 @@
// Hint to adjust |playback_threshold_| as a means of controlling playback
// start latency. See SetLatencyHint();
- absl::optional<base::TimeDelta> latency_hint_;
+ std::optional<base::TimeDelta> latency_hint_;
// Whether to apply pitch adjusments or not when playing back at rates other
// than 1.0. In other words, we use WSOLA to preserve pitch when this is on,
diff --git a/media/filters/audio_renderer_algorithm_unittest.cc b/media/filters/audio_renderer_algorithm_unittest.cc
index 650a655..96480b4 100644
--- a/media/filters/audio_renderer_algorithm_unittest.cc
+++ b/media/filters/audio_renderer_algorithm_unittest.cc
@@ -987,7 +987,7 @@
// Clearing the hint should restore the higher default playback threshold,
// such that we no longer have enough buffer to be "adequate for playback".
- algorithm_.SetLatencyHint(absl::nullopt);
+ algorithm_.SetLatencyHint(std::nullopt);
EXPECT_FALSE(algorithm_.IsQueueAdequateForPlayback());
// Fill until "full". Verify that "adequate" now matches "full".
@@ -1038,7 +1038,7 @@
// Clearing the hint should restore the lower default playback threshold and
// capacity.
- algorithm_.SetLatencyHint(absl::nullopt);
+ algorithm_.SetLatencyHint(std::nullopt);
EXPECT_EQ(algorithm_.QueueCapacity(), default_capacity);
// The queue is over-full from our last fill when the hint was set. Flush and
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
index 79569fe..a78202e 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -599,9 +599,9 @@
return mem;
}
-absl::optional<container_names::MediaContainerName>
+std::optional<container_names::MediaContainerName>
ChunkDemuxer::GetContainerForMetrics() const {
- return absl::nullopt;
+ return std::nullopt;
}
void ChunkDemuxer::AbortPendingReads() {
diff --git a/media/filters/chunk_demuxer.h b/media/filters/chunk_demuxer.h
index 1dd3a92d..7aaeae6 100644
--- a/media/filters/chunk_demuxer.h
+++ b/media/filters/chunk_demuxer.h
@@ -239,7 +239,7 @@
override;
base::TimeDelta GetStartTime() const override;
int64_t GetMemoryUsage() const override;
- absl::optional<container_names::MediaContainerName> GetContainerForMetrics()
+ std::optional<container_names::MediaContainerName> GetContainerForMetrics()
const override;
void AbortPendingReads() override;
diff --git a/media/filters/decoder_selector.cc b/media/filters/decoder_selector.cc
index fb5ef05..0317575b 100644
--- a/media/filters/decoder_selector.cc
+++ b/media/filters/decoder_selector.cc
@@ -197,7 +197,7 @@
}
if (needs_new_decoders) {
- decode_failure_reinit_cause_ = absl::nullopt;
+ decode_failure_reinit_cause_ = std::nullopt;
CreateDecoders();
}
diff --git a/media/filters/decoder_selector.h b/media/filters/decoder_selector.h
index 0ec0bf8..ca73f78 100644
--- a/media/filters/decoder_selector.h
+++ b/media/filters/decoder_selector.h
@@ -174,7 +174,7 @@
// Used to keep track of the original failure-to-decode reason so that if
// playback fails entirely, we have a root cause to point to, rather than
// failing due to running out of more acceptable decoders.
- absl::optional<DecoderStatus> decode_failure_reinit_cause_ = absl::nullopt;
+ std::optional<DecoderStatus> decode_failure_reinit_cause_ = std::nullopt;
base::WeakPtrFactory<DecoderSelector> weak_this_factory_{this};
};
diff --git a/media/filters/decrypting_demuxer_stream.h b/media/filters/decrypting_demuxer_stream.h
index 07969de..9a18fe15 100644
--- a/media/filters/decrypting_demuxer_stream.h
+++ b/media/filters/decrypting_demuxer_stream.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_
#define MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_
+#include <optional>
+
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
@@ -18,7 +20,6 @@
#include "media/base/pipeline_status.h"
#include "media/base/video_decoder_config.h"
#include "media/base/waiting.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class SequencedTaskRunner;
@@ -175,7 +176,7 @@
raw_ptr<Decryptor> decryptor_ = nullptr;
- absl::optional<bool> has_clear_lead_;
+ std::optional<bool> has_clear_lead_;
bool switched_clear_to_encrypted_ = false;
diff --git a/media/filters/decrypting_video_decoder.h b/media/filters/decrypting_video_decoder.h
index 7107a0a3..a28732bb 100644
--- a/media/filters/decrypting_video_decoder.h
+++ b/media/filters/decrypting_video_decoder.h
@@ -123,7 +123,7 @@
// clear content, we want to ensure this decoder remains used.
bool support_clear_content_ = false;
- absl::optional<bool> has_clear_lead_;
+ std::optional<bool> has_clear_lead_;
bool switched_clear_to_encrypted_ = false;
diff --git a/media/filters/demuxer_manager.cc b/media/filters/demuxer_manager.cc
index f3400fe..bc76e8c 100644
--- a/media/filters/demuxer_manager.cc
+++ b/media/filters/demuxer_manager.cc
@@ -300,12 +300,12 @@
#endif // BUILDFLAG(ENABLE_HLS_DEMUXER) || BUILDFLAG(IS_ANDROID)
-absl::optional<double> DemuxerManager::GetDemuxerDuration() {
+std::optional<double> DemuxerManager::GetDemuxerDuration() {
if (!demuxer_) {
- return absl::nullopt;
+ return std::nullopt;
}
if (demuxer_->GetDemuxerType() != DemuxerType::kChunkDemuxer) {
- return absl::nullopt;
+ return std::nullopt;
}
// Use duration from ChunkDemuxer when present. MSE allows users to specify
@@ -317,17 +317,17 @@
return static_cast<ChunkDemuxer*>(demuxer_.get())->GetDuration();
}
-absl::optional<DemuxerType> DemuxerManager::GetDemuxerType() const {
+std::optional<DemuxerType> DemuxerManager::GetDemuxerType() const {
if (!demuxer_) {
- return absl::nullopt;
+ return std::nullopt;
}
return demuxer_->GetDemuxerType();
}
-absl::optional<container_names::MediaContainerName>
+std::optional<container_names::MediaContainerName>
DemuxerManager::GetContainerForMetrics() {
if (!demuxer_) {
- return absl::nullopt;
+ return std::nullopt;
}
return demuxer_->GetContainerForMetrics();
}
@@ -516,11 +516,11 @@
return !!demuxer_override_;
}
-absl::optional<GURL> DemuxerManager::GetDataSourceUrlAfterRedirects() const {
+std::optional<GURL> DemuxerManager::GetDataSourceUrlAfterRedirects() const {
if (data_source_) {
return data_source_->GetUrlAfterRedirects();
}
- return absl::nullopt;
+ return std::nullopt;
}
bool DemuxerManager::DataSourceFullyBuffered() const {
diff --git a/media/filters/demuxer_manager.h b/media/filters/demuxer_manager.h
index 66d1541..988be31a 100644
--- a/media/filters/demuxer_manager.h
+++ b/media/filters/demuxer_manager.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_FILTERS_DEMUXER_MANAGER_H_
#define MEDIA_FILTERS_DEMUXER_MANAGER_H_
+#include <optional>
#include <vector>
#include "base/functional/callback.h"
@@ -20,7 +21,6 @@
#include "media/base/pipeline.h"
#include "media/base/pipeline_status.h"
#include "media/filters/chunk_demuxer.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
#if BUILDFLAG(ENABLE_HLS_DEMUXER)
@@ -136,9 +136,9 @@
void DisallowFallback();
// Methods that help manage demuxers
- absl::optional<double> GetDemuxerDuration();
- absl::optional<DemuxerType> GetDemuxerType() const;
- absl::optional<container_names::MediaContainerName> GetContainerForMetrics();
+ std::optional<double> GetDemuxerDuration();
+ std::optional<DemuxerType> GetDemuxerType() const;
+ std::optional<container_names::MediaContainerName> GetContainerForMetrics();
void RespondToDemuxerMemoryUsageReport(base::OnceCallback<void(int64_t)> cb);
void DisableDemuxerCanChangeType();
@@ -169,7 +169,7 @@
bool HasDataSource() const;
bool HasDemuxer() const;
bool HasDemuxerOverride() const;
- absl::optional<GURL> GetDataSourceUrlAfterRedirects() const;
+ std::optional<GURL> GetDataSourceUrlAfterRedirects() const;
bool DataSourceFullyBuffered() const;
bool IsStreaming() const;
bool PassedDataSourceTimingAllowOriginCheck() const;
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 719b0cc..ce04915 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -1177,7 +1177,7 @@
return allocation_size;
}
-absl::optional<container_names::MediaContainerName>
+std::optional<container_names::MediaContainerName>
FFmpegDemuxer::GetContainerForMetrics() const {
return container();
}
diff --git a/media/filters/ffmpeg_demuxer.h b/media/filters/ffmpeg_demuxer.h
index 1d0baae..d7f9dac 100644
--- a/media/filters/ffmpeg_demuxer.h
+++ b/media/filters/ffmpeg_demuxer.h
@@ -233,7 +233,7 @@
override;
base::TimeDelta GetStartTime() const override;
int64_t GetMemoryUsage() const override;
- absl::optional<container_names::MediaContainerName> GetContainerForMetrics()
+ std::optional<container_names::MediaContainerName> GetContainerForMetrics()
const override;
// Calls |encrypted_media_init_data_cb_| with the initialization data
diff --git a/media/filters/hls_data_source_provider.cc b/media/filters/hls_data_source_provider.cc
index a428798..ad2b7fc 100644
--- a/media/filters/hls_data_source_provider.cc
+++ b/media/filters/hls_data_source_provider.cc
@@ -49,7 +49,7 @@
max_read_position_ = first.range->GetEnd();
} else {
read_position_ = 0;
- max_read_position_ = absl::nullopt;
+ max_read_position_ = std::nullopt;
}
GURL new_url = std::move(first.uri);
segments_.pop();
diff --git a/media/filters/hls_data_source_provider.h b/media/filters/hls_data_source_provider.h
index 7f6a8ce..d3fabe6 100644
--- a/media/filters/hls_data_source_provider.h
+++ b/media/filters/hls_data_source_provider.h
@@ -7,6 +7,7 @@
#include <cstdint>
#include <memory>
+#include <optional>
#include "base/containers/queue.h"
#include "base/functional/callback.h"
@@ -15,7 +16,6 @@
#include "media/base/media_export.h"
#include "media/base/status.h"
#include "media/formats/hls/types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace media {
@@ -49,7 +49,7 @@
// multiple URIs or from multiple disjoing ranges on the same URI.
struct UrlDataSegment {
const GURL uri;
- const absl::optional<hls::types::ByteRange> range;
+ const std::optional<hls::types::ByteRange> range;
};
using SegmentQueue = base::queue<UrlDataSegment>;
@@ -100,9 +100,7 @@
size_t buffer_size() const { return buffer_.size(); }
- absl::optional<size_t> max_read_position() const {
- return max_read_position_;
- }
+ std::optional<size_t> max_read_position() const { return max_read_position_; }
const uint8_t* raw_data() const { return buffer_.data(); }
@@ -152,7 +150,7 @@
// If this optional value is set, then data can't be read past this maximum
// value.
- absl::optional<size_t> max_read_position_;
+ std::optional<size_t> max_read_position_;
// The data source read response indicated that the stream has ended.
bool reached_end_of_stream_ = false;
diff --git a/media/filters/hls_data_source_provider_impl_unittest.cc b/media/filters/hls_data_source_provider_impl_unittest.cc
index b977b336..8f0cbb3 100644
--- a/media/filters/hls_data_source_provider_impl_unittest.cc
+++ b/media/filters/hls_data_source_provider_impl_unittest.cc
@@ -138,13 +138,13 @@
// The entire read is satisfied, so there is more to read.
factory_->AddReadExpectation(0, 16384, 16384);
impl_->ReadFromUrl(
- {GURL("example.com"), absl::nullopt},
+ {GURL("example.com"), std::nullopt},
base::BindOnce([](HlsDataSourceProvider::ReadResult result) {
ASSERT_TRUE(result.has_value());
auto stream = std::move(result).value();
ASSERT_EQ(stream->read_position(), 16384lu);
ASSERT_EQ(stream->buffer_size(), 16384lu);
- ASSERT_EQ(stream->max_read_position(), absl::nullopt);
+ ASSERT_EQ(stream->max_read_position(), std::nullopt);
ASSERT_TRUE(stream->CanReadMore());
}));
task_environment_.RunUntilIdle();
@@ -153,14 +153,14 @@
// we'd have to read again (and get a 0) to be sure.
factory_->AddReadExpectation(0, 16384, 400);
impl_->ReadFromUrl(
- {GURL("example.com"), absl::nullopt},
+ {GURL("example.com"), std::nullopt},
base::BindOnce([](HlsDataSourceProvider::ReadResult result) {
ASSERT_TRUE(result.has_value());
auto stream = std::move(result).value();
ASSERT_TRUE(stream->CanReadMore());
ASSERT_EQ(stream->read_position(), 400lu);
ASSERT_EQ(stream->buffer_size(), 16384lu);
- ASSERT_EQ(stream->max_read_position(), absl::nullopt);
+ ASSERT_EQ(stream->max_read_position(), std::nullopt);
}));
task_environment_.RunUntilIdle();
@@ -186,7 +186,7 @@
factory_->AddReadExpectation(32768, 16384, 3);
factory_->AddReadExpectation(32771, 16384, 0);
impl_->ReadFromUrl(
- {GURL("example.com"), absl::nullopt},
+ {GURL("example.com"), std::nullopt},
base::BindOnce(
[](HlsDataSourceProviderImpl* impl_ptr,
HlsDataSourceProvider::ReadResult result) {
@@ -259,7 +259,7 @@
// The Read CB is captured, and so will not execute right away.
bool has_been_read = false;
impl_->ReadFromUrl(
- {GURL("example.com"), absl::nullopt},
+ {GURL("example.com"), std::nullopt},
base::BindOnce(
[](bool* read_canary, HlsDataSourceProvider::ReadResult result) {
*read_canary = true;
@@ -292,7 +292,7 @@
bool has_been_read = false;
impl_->ReadFromUrl(
- {GURL("example.com"), absl::nullopt},
+ {GURL("example.com"), std::nullopt},
base::BindOnce(
[](bool* read_canary, HlsDataSourceProvider::ReadResult result) {
*read_canary = true;
@@ -309,8 +309,8 @@
TEST_F(HlsDataSourceProviderImplUnittest, ReadMultipleSegments) {
HlsDataSourceProvider::SegmentQueue segments;
- segments.emplace(GURL("example.com"), absl::nullopt);
- segments.emplace(GURL("foo.com"), absl::nullopt);
+ segments.emplace(GURL("example.com"), std::nullopt);
+ segments.emplace(GURL("foo.com"), std::nullopt);
// Request 16k, but only 4k is read. Another read then happens and the 0 byte
// EOS read happens.
diff --git a/media/filters/hls_data_source_provider_unittest.cc b/media/filters/hls_data_source_provider_unittest.cc
index 11769b4c..e5be5c5 100644
--- a/media/filters/hls_data_source_provider_unittest.cc
+++ b/media/filters/hls_data_source_provider_unittest.cc
@@ -18,7 +18,7 @@
protected:
std::unique_ptr<HlsDataSourceStream> CreateStream(
- absl::optional<hls::types::ByteRange> range) {
+ std::optional<hls::types::ByteRange> range) {
HlsDataSourceProvider::SegmentQueue segments;
segments.emplace(GURL("https://example.com"), range);
return CreateStream(std::move(segments));
@@ -38,11 +38,11 @@
};
TEST_F(HlsDataSourceStreamUnittest, TestNewStreamHasProperties) {
- auto stream = CreateStream(absl::nullopt);
+ auto stream = CreateStream(std::nullopt);
ASSERT_EQ(stream->read_position(), static_cast<size_t>(0));
ASSERT_EQ(stream->buffer_size(), static_cast<size_t>(0));
- ASSERT_EQ(stream->max_read_position(), absl::nullopt);
+ ASSERT_EQ(stream->max_read_position(), std::nullopt);
ASSERT_TRUE(stream->CanReadMore());
ASSERT_TRUE(stream->RequiresNextDataSource());
ASSERT_EQ(stream->GetNextSegmentURI(), GURL("https://example.com"));
@@ -51,19 +51,19 @@
auto capped = CreateStream(hls::types::ByteRange::Validate(10, 20));
ASSERT_EQ(capped->read_position(), static_cast<size_t>(0));
ASSERT_EQ(capped->buffer_size(), static_cast<size_t>(0));
- ASSERT_EQ(capped->max_read_position(), absl::nullopt);
+ ASSERT_EQ(capped->max_read_position(), std::nullopt);
ASSERT_TRUE(capped->CanReadMore());
ASSERT_TRUE(capped->RequiresNextDataSource());
ASSERT_EQ(capped->GetNextSegmentURI(), GURL("https://example.com"));
ASSERT_FALSE(capped->RequiresNextDataSource());
HlsDataSourceProvider::SegmentQueue segments;
- segments.emplace(GURL("https://example.com"), absl::nullopt);
- segments.emplace(GURL("https://foo.com"), absl::nullopt);
+ segments.emplace(GURL("https://example.com"), std::nullopt);
+ segments.emplace(GURL("https://foo.com"), std::nullopt);
auto double_url = CreateStream(std::move(segments));
ASSERT_EQ(double_url->read_position(), static_cast<size_t>(0));
ASSERT_EQ(double_url->buffer_size(), static_cast<size_t>(0));
- ASSERT_EQ(double_url->max_read_position(), absl::nullopt);
+ ASSERT_EQ(double_url->max_read_position(), std::nullopt);
ASSERT_TRUE(double_url->CanReadMore());
ASSERT_TRUE(double_url->RequiresNextDataSource());
ASSERT_EQ(double_url->GetNextSegmentURI(), GURL("https://example.com"));
@@ -76,12 +76,12 @@
}
TEST_F(HlsDataSourceStreamUnittest, TestWritesAndClears) {
- auto stream = CreateStream(absl::nullopt);
+ auto stream = CreateStream(std::nullopt);
stream->LockStreamForWriting(10);
ASSERT_EQ(stream->read_position(), static_cast<size_t>(0));
ASSERT_EQ(stream->buffer_size(), static_cast<size_t>(10));
- ASSERT_EQ(stream->max_read_position(), absl::nullopt);
+ ASSERT_EQ(stream->max_read_position(), std::nullopt);
ASSERT_EQ(stream->CanReadMore(), true);
// No changes, because no write.
@@ -89,25 +89,25 @@
stream->LockStreamForWriting(10);
ASSERT_EQ(stream->read_position(), static_cast<size_t>(0));
ASSERT_EQ(stream->buffer_size(), static_cast<size_t>(10));
- ASSERT_EQ(stream->max_read_position(), absl::nullopt);
+ ASSERT_EQ(stream->max_read_position(), std::nullopt);
ASSERT_EQ(stream->CanReadMore(), true);
stream->UnlockStreamPostWrite(10, false);
ASSERT_EQ(stream->read_position(), static_cast<size_t>(10));
ASSERT_EQ(stream->buffer_size(), static_cast<size_t>(10));
- ASSERT_EQ(stream->max_read_position(), absl::nullopt);
+ ASSERT_EQ(stream->max_read_position(), std::nullopt);
ASSERT_EQ(stream->CanReadMore(), true);
stream->LockStreamForWriting(10);
ASSERT_EQ(stream->read_position(), static_cast<size_t>(10));
ASSERT_EQ(stream->buffer_size(), static_cast<size_t>(20));
- ASSERT_EQ(stream->max_read_position(), absl::nullopt);
+ ASSERT_EQ(stream->max_read_position(), std::nullopt);
ASSERT_EQ(stream->CanReadMore(), true);
stream->UnlockStreamPostWrite(10, false);
stream->Clear();
ASSERT_EQ(stream->read_position(), static_cast<size_t>(20));
ASSERT_EQ(stream->buffer_size(), static_cast<size_t>(0));
- ASSERT_EQ(stream->max_read_position(), absl::nullopt);
+ ASSERT_EQ(stream->max_read_position(), std::nullopt);
ASSERT_EQ(stream->CanReadMore(), true);
}
diff --git a/media/filters/hls_manifest_demuxer_engine.cc b/media/filters/hls_manifest_demuxer_engine.cc
index 5f34dc1..dd81b3d 100644
--- a/media/filters/hls_manifest_demuxer_engine.cc
+++ b/media/filters/hls_manifest_demuxer_engine.cc
@@ -4,6 +4,7 @@
#include "media/filters/hls_manifest_demuxer_engine.h"
+#include <optional>
#include <vector>
#include "base/logging.h"
@@ -26,7 +27,6 @@
#include "media/formats/hls/parse_status.h"
#include "media/formats/hls/types.h"
#include "media/formats/hls/variant_stream.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -598,7 +598,7 @@
this);
renditions_[role]->UpdatePlaylist(std::move(maybe_playlist).value(),
- absl::nullopt);
+ std::nullopt);
std::move(cb).Run();
}
diff --git a/media/filters/hls_manifest_demuxer_engine.h b/media/filters/hls_manifest_demuxer_engine.h
index 1ff64575..e220b73 100644
--- a/media/filters/hls_manifest_demuxer_engine.h
+++ b/media/filters/hls_manifest_demuxer_engine.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_FILTERS_HLS_MANIFEST_DEMUXER_ENGINE_H_
#define MEDIA_FILTERS_HLS_MANIFEST_DEMUXER_ENGINE_H_
+#include <optional>
#include <vector>
#include "base/memory/scoped_refptr.h"
@@ -23,7 +24,6 @@
#include "media/formats/hls/media_playlist.h"
#include "media/formats/hls/parse_status.h"
#include "media/formats/hls/rendition_manager.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -243,7 +243,7 @@
// When renditions are added, this ensures that they are all of the same
// liveness, and allows access to the liveness check later.
- absl::optional<bool> is_seekable_ = absl::nullopt;
+ std::optional<bool> is_seekable_ = std::nullopt;
// Ensure that safe member fields are only accessed on the media sequence.
SEQUENCE_CHECKER(media_sequence_checker_);
diff --git a/media/filters/hls_manifest_demuxer_engine_unittest.cc b/media/filters/hls_manifest_demuxer_engine_unittest.cc
index 180e151..f38243b 100644
--- a/media/filters/hls_manifest_demuxer_engine_unittest.cc
+++ b/media/filters/hls_manifest_demuxer_engine_unittest.cc
@@ -177,7 +177,7 @@
template <typename T>
void BindUrlToDataSource(std::string url, std::string value) {
EXPECT_CALL(*mock_dsp_, ReadFromCombinedUrlQueue(
- SingleSegmentQueue(url, absl::nullopt), _))
+ SingleSegmentQueue(url, std::nullopt), _))
.Times(1)
.WillOnce(RunOnceCallback<1>(T::CreateStream(value)));
}
@@ -356,8 +356,8 @@
TEST_F(HlsManifestDemuxerEngineTest, TestMultiRenditionCheckState) {
auto rendition1 = std::make_unique<MockHlsRendition>();
auto rendition2 = std::make_unique<MockHlsRendition>();
- EXPECT_CALL(*rendition1, GetDuration()).WillOnce(Return(absl::nullopt));
- EXPECT_CALL(*rendition2, GetDuration()).WillOnce(Return(absl::nullopt));
+ EXPECT_CALL(*rendition1, GetDuration()).WillOnce(Return(std::nullopt));
+ EXPECT_CALL(*rendition2, GetDuration()).WillOnce(Return(std::nullopt));
auto* rend1 = rendition1.get();
auto* rend2 = rendition2.get();
@@ -457,15 +457,15 @@
EXPECT_CALL(*mock_dsp_,
ReadFromCombinedUrlQueue(
SingleSegmentQueue("http://media.example.com/manifest.m3u8",
- absl::nullopt),
+ std::nullopt),
_))
.WillOnce(RunOnceCallback<1>(
StringHlsDataSourceStreamFactory::CreateStream(kShortMediaPlaylist)));
- EXPECT_CALL(*mock_dsp_,
- ReadFromCombinedUrlQueue(
- SingleSegmentQueue("http://media.example.com/first.ts",
- absl::nullopt),
- _))
+ EXPECT_CALL(
+ *mock_dsp_,
+ ReadFromCombinedUrlQueue(
+ SingleSegmentQueue("http://media.example.com/first.ts", std::nullopt),
+ _))
.WillOnce(
RunOnceCallback<1>(StringHlsDataSourceStreamFactory::CreateStream(
"hey, this isn't a bitstream!")))
diff --git a/media/filters/hls_rendition.cc b/media/filters/hls_rendition.cc
index 9ea054d..d094f87f 100644
--- a/media/filters/hls_rendition.cc
+++ b/media/filters/hls_rendition.cc
@@ -11,7 +11,7 @@
namespace {
-absl::optional<base::TimeDelta> GetPlaylistDuration(
+std::optional<base::TimeDelta> GetPlaylistDuration(
hls::MediaPlaylist* playlist) {
if (!playlist->HasMediaSequenceTag()) {
// Live playbacks have a media sequence tag, so if that's missing, then this
@@ -30,7 +30,7 @@
}
// Live content doesn't have a defined duration.
- return absl::nullopt;
+ return std::nullopt;
}
} // namespace
diff --git a/media/filters/hls_rendition.h b/media/filters/hls_rendition.h
index 972aedc1..1980da6 100644
--- a/media/filters/hls_rendition.h
+++ b/media/filters/hls_rendition.h
@@ -78,7 +78,7 @@
virtual void StartWaitingForSeek() = 0;
// Live renditions should return a nullopt for duration.
- virtual absl::optional<base::TimeDelta> GetDuration() = 0;
+ virtual std::optional<base::TimeDelta> GetDuration() = 0;
// Stop the rendition, including canceling pending seeks. After stopping,
// `CheckState` and `Seek` should be no-ops.
diff --git a/media/filters/hls_rendition_impl.cc b/media/filters/hls_rendition_impl.cc
index 2367428..c4b28a5 100644
--- a/media/filters/hls_rendition_impl.cc
+++ b/media/filters/hls_rendition_impl.cc
@@ -32,7 +32,7 @@
media_playlist_uri_(std::move(media_playlist_uri)),
last_download_time_(base::TimeTicks::Now()) {}
-absl::optional<base::TimeDelta> HlsRenditionImpl::GetDuration() {
+std::optional<base::TimeDelta> HlsRenditionImpl::GetDuration() {
return duration_;
}
@@ -76,7 +76,7 @@
auto remaining_manifest_time =
segments_->QueueSize() * segments_->GetMaxDuration();
auto pause_duration = base::TimeTicks::Now() - *livestream_pause_time_;
- livestream_pause_time_ = absl::nullopt;
+ livestream_pause_time_ = std::nullopt;
if (pause_duration < remaining_manifest_time) {
// our pause was so short that we are still within the segments currently
diff --git a/media/filters/hls_rendition_impl.h b/media/filters/hls_rendition_impl.h
index e18e48d..674884aa 100644
--- a/media/filters/hls_rendition_impl.h
+++ b/media/filters/hls_rendition_impl.h
@@ -27,7 +27,7 @@
GURL media_playlist_uri);
// `HlsRendition` implementation
- absl::optional<base::TimeDelta> GetDuration() override;
+ std::optional<base::TimeDelta> GetDuration() override;
void CheckState(base::TimeDelta media_time,
double playback_rate,
ManifestDemuxer::DelayCallback time_remaining_cb) override;
diff --git a/media/filters/hls_rendition_impl_unittest.cc b/media/filters/hls_rendition_impl_unittest.cc
index 4d58953..908905de 100644
--- a/media/filters/hls_rendition_impl_unittest.cc
+++ b/media/filters/hls_rendition_impl_unittest.cc
@@ -107,7 +107,7 @@
}
return std::make_unique<HlsRenditionImpl>(mock_mdeh_.get(), mock_hrh_.get(),
"test", std::move(parsed).value(),
- absl::nullopt, uri);
+ std::nullopt, uri);
}
MOCK_METHOD(void, CheckStateComplete, (base::TimeDelta delay), ());
@@ -255,7 +255,7 @@
auto rendition =
MakeLiveRendition(GURL("http://example.com"), kInitialFetchPlaylist);
ASSERT_NE(rendition, nullptr);
- ASSERT_EQ(rendition->GetDuration(), absl::nullopt);
+ ASSERT_EQ(rendition->GetDuration(), std::nullopt);
// Any rate not 0.0 or 1.0 should error.
EXPECT_CALL(*mock_mdeh_, OnError(_));
@@ -267,7 +267,7 @@
auto rendition =
MakeLiveRendition(GURL("http://example.com"), kInitialFetchPlaylist);
ASSERT_NE(rendition, nullptr);
- ASSERT_EQ(rendition->GetDuration(), absl::nullopt);
+ ASSERT_EQ(rendition->GetDuration(), std::nullopt);
// CheckState causes the rentidion to:
// Check buffered ranges first
@@ -288,7 +288,7 @@
auto rendition =
MakeLiveRendition(GURL("http://example.com"), kInitialFetchPlaylist);
ASSERT_NE(rendition, nullptr);
- ASSERT_EQ(rendition->GetDuration(), absl::nullopt);
+ ASSERT_EQ(rendition->GetDuration(), std::nullopt);
// CheckState causes the rentidion to:
// Check buffered ranges first. In this case, we've loaded a bunch of content
@@ -311,7 +311,7 @@
auto rendition =
MakeLiveRendition(GURL("http://example.com"), kInitialFetchPlaylist);
ASSERT_NE(rendition, nullptr);
- ASSERT_EQ(rendition->GetDuration(), absl::nullopt);
+ ASSERT_EQ(rendition->GetDuration(), std::nullopt);
// CheckState causes the rentidion to:
// Check buffered ranges first. In this case, we've loaded a bunch of content
@@ -333,7 +333,7 @@
auto rendition =
MakeLiveRendition(GURL("http://example.com"), kInitialFetchPlaylist);
ASSERT_NE(rendition, nullptr);
- ASSERT_EQ(rendition->GetDuration(), absl::nullopt);
+ ASSERT_EQ(rendition->GetDuration(), std::nullopt);
// CheckState causes the rentidion to:
// Check buffered ranges first. In this case, we've loaded a bunch of content
@@ -362,7 +362,7 @@
auto rendition =
MakeLiveRendition(GURL("http://example.com"), kInitialFetchPlaylist);
ASSERT_NE(rendition, nullptr);
- ASSERT_EQ(rendition->GetDuration(), absl::nullopt);
+ ASSERT_EQ(rendition->GetDuration(), std::nullopt);
// CheckState causes the rentidion to:
// Check buffered ranges first. In this case, we've loaded a bunch of content
@@ -399,7 +399,7 @@
auto rendition =
MakeLiveRendition(GURL("http://example.com"), kInitialFetchPlaylist);
ASSERT_NE(rendition, nullptr);
- ASSERT_EQ(rendition->GetDuration(), absl::nullopt);
+ ASSERT_EQ(rendition->GetDuration(), std::nullopt);
ON_CALL(*mock_mdeh_, OnError(_)).WillByDefault([](PipelineStatus st) {
LOG(ERROR) << MediaSerialize(st);
diff --git a/media/filters/hls_test_helpers.h b/media/filters/hls_test_helpers.h
index a796179..bef4172 100644
--- a/media/filters/hls_test_helpers.h
+++ b/media/filters/hls_test_helpers.h
@@ -152,7 +152,7 @@
(base::TimeDelta time),
(override));
MOCK_METHOD(void, StartWaitingForSeek, (), (override));
- MOCK_METHOD(absl::optional<base::TimeDelta>, GetDuration, (), (override));
+ MOCK_METHOD(std::optional<base::TimeDelta>, GetDuration, (), (override));
MOCK_METHOD(void, Stop, (), (override));
MOCK_METHOD(void,
UpdatePlaylist,
diff --git a/media/filters/mac/audio_toolbox_audio_decoder.cc b/media/filters/mac/audio_toolbox_audio_decoder.cc
index 4e6de69..5427bc5 100644
--- a/media/filters/mac/audio_toolbox_audio_decoder.cc
+++ b/media/filters/mac/audio_toolbox_audio_decoder.cc
@@ -4,6 +4,8 @@
#include "media/filters/mac/audio_toolbox_audio_decoder.h"
+#include <optional>
+
#include "base/apple/osstatus_logging.h"
#include "base/auto_reset.h"
#include "base/functional/bind.h"
@@ -23,7 +25,6 @@
#include "media/base/timestamp_constants.h"
#include "media/formats/mp4/es_descriptor.h"
#include "media/media_buildflags.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/filters/mac/audio_toolbox_audio_encoder.cc b/media/filters/mac/audio_toolbox_audio_encoder.cc
index 0cb7636..08ec850 100644
--- a/media/filters/mac/audio_toolbox_audio_encoder.cc
+++ b/media/filters/mac/audio_toolbox_audio_encoder.cc
@@ -365,7 +365,7 @@
bool adts_conversion_ok = true;
auto format = options_.aac.value_or(AacOptions()).format;
- absl::optional<CodecDescription> desc;
+ std::optional<CodecDescription> desc;
if (timestamp_helper_->frame_count() == 0) {
if (format == AudioEncoder::AacOutputFormat::AAC) {
desc = codec_desc_;
diff --git a/media/filters/manifest_demuxer.cc b/media/filters/manifest_demuxer.cc
index 205e055..a8db37b 100644
--- a/media/filters/manifest_demuxer.cc
+++ b/media/filters/manifest_demuxer.cc
@@ -4,6 +4,7 @@
#include "media/filters/manifest_demuxer.h"
+#include <optional>
#include <vector>
#include "base/logging.h"
@@ -22,7 +23,6 @@
#include "media/formats/hls/multivariant_playlist.h"
#include "media/formats/hls/types.h"
#include "media/formats/hls/variant_stream.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -256,11 +256,11 @@
return demuxer_usage + impl_usage;
}
-absl::optional<container_names::MediaContainerName>
+std::optional<container_names::MediaContainerName>
ManifestDemuxer::GetContainerForMetrics() const {
// TODO(crbug/1266991): Consider how this is used. HLS can involve multiple
// stream types (mp2t, mp4, etc). Refactor to report something useful.
- return absl::nullopt;
+ return std::nullopt;
}
void ManifestDemuxer::OnEnabledAudioTracksChanged(
diff --git a/media/filters/manifest_demuxer.h b/media/filters/manifest_demuxer.h
index c024b5e..994d659b 100644
--- a/media/filters/manifest_demuxer.h
+++ b/media/filters/manifest_demuxer.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_FILTERS_MANIFEST_DEMUXER_H_
#define MEDIA_FILTERS_MANIFEST_DEMUXER_H_
+#include <optional>
#include <vector>
#include "base/cancelable_callback.h"
@@ -23,7 +24,6 @@
#include "media/base/pipeline_status.h"
#include "media/filters/chunk_demuxer.h"
#include "media/filters/hls_data_source_provider.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -189,7 +189,7 @@
base::Time GetTimelineOffset() const override;
int64_t GetMemoryUsage() const override;
void SetPlaybackRate(double rate) override;
- absl::optional<container_names::MediaContainerName> GetContainerForMetrics()
+ std::optional<container_names::MediaContainerName> GetContainerForMetrics()
const override;
void OnEnabledAudioTracksChanged(const std::vector<MediaTrack::Id>& track_ids,
diff --git a/media/filters/pipeline_controller.cc b/media/filters/pipeline_controller.cc
index dc67a0b..b92038b 100644
--- a/media/filters/pipeline_controller.cc
+++ b/media/filters/pipeline_controller.cc
@@ -390,7 +390,7 @@
}
void PipelineController::SetLatencyHint(
- absl::optional<base::TimeDelta> latency_hint) {
+ std::optional<base::TimeDelta> latency_hint) {
DCHECK(!latency_hint || (*latency_hint >= base::TimeDelta()));
pipeline_->SetLatencyHint(latency_hint);
}
@@ -440,7 +440,7 @@
}
void PipelineController::OnSelectedVideoTrackChanged(
- absl::optional<MediaTrack::Id> selected_track_id) {
+ std::optional<MediaTrack::Id> selected_track_id) {
DCHECK(thread_checker_.CalledOnValidThread());
pending_video_track_change_ = true;
diff --git a/media/filters/pipeline_controller.h b/media/filters/pipeline_controller.h
index 1c37538..35e03a79 100644
--- a/media/filters/pipeline_controller.h
+++ b/media/filters/pipeline_controller.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_FILTERS_PIPELINE_CONTROLLER_H_
#define MEDIA_FILTERS_PIPELINE_CONTROLLER_H_
+#include <optional>
+
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
@@ -12,7 +14,6 @@
#include "base/time/time.h"
#include "media/base/media_export.h"
#include "media/base/pipeline.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -136,7 +137,7 @@
void SetPlaybackRate(double playback_rate);
float GetVolume() const;
void SetVolume(float volume);
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint);
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint);
void SetPreservesPitch(bool preserves_pitch);
void SetWasPlayedWithUserActivation(bool was_played_with_user_activation);
base::TimeDelta GetMediaTime() const;
@@ -148,7 +149,7 @@
void OnEnabledAudioTracksChanged(
const std::vector<MediaTrack::Id>& enabled_track_ids);
void OnSelectedVideoTrackChanged(
- absl::optional<MediaTrack::Id> selected_track_id);
+ std::optional<MediaTrack::Id> selected_track_id);
void OnExternalVideoFrameRequest();
// Used to fire the OnTrackChangeComplete function which is captured in a
@@ -236,7 +237,7 @@
// |pending_video_track_change_|.
base::TimeDelta pending_seek_time_;
std::vector<MediaTrack::Id> pending_audio_track_change_ids_;
- absl::optional<MediaTrack::Id> pending_video_track_change_id_;
+ std::optional<MediaTrack::Id> pending_video_track_change_id_;
// Set to true during Start(). Indicates that |seeked_cb_| must be fired once
// we've completed startup.
diff --git a/media/filters/pipeline_controller_unittest.cc b/media/filters/pipeline_controller_unittest.cc
index 170d729..76f8541 100644
--- a/media/filters/pipeline_controller_unittest.cc
+++ b/media/filters/pipeline_controller_unittest.cc
@@ -156,7 +156,7 @@
void OnAudioConfigChange(const AudioDecoderConfig& config) override {}
void OnVideoConfigChange(const VideoDecoderConfig& config) override {}
void OnVideoOpacityChange(bool opaque) override {}
- void OnVideoFrameRateChange(absl::optional<int>) override {}
+ void OnVideoFrameRateChange(std::optional<int>) override {}
void OnVideoAverageKeyframeDistanceUpdate() override {}
void OnAudioPipelineInfoChange(const AudioPipelineInfo& info) override {}
void OnVideoPipelineInfoChange(const VideoPipelineInfo& info) override {}
diff --git a/media/filters/video_cadence_estimator.h b/media/filters/video_cadence_estimator.h
index 3d97a9bc..ed95459 100644
--- a/media/filters/video_cadence_estimator.h
+++ b/media/filters/video_cadence_estimator.h
@@ -8,12 +8,12 @@
#include <stddef.h>
#include <stdint.h>
+#include <optional>
#include <string>
#include <vector>
#include "base/time/time.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/filters/vp9_parser_unittest.cc b/media/filters/vp9_parser_unittest.cc
index c44aa13..0483471 100644
--- a/media/filters/vp9_parser_unittest.cc
+++ b/media/filters/vp9_parser_unittest.cc
@@ -207,10 +207,10 @@
std::vector<std::unique_ptr<DecryptConfig>> expected;
expected.push_back(DecryptConfig::CreateCbcsConfig(
- kKeyID, kInitialIV, {SubsampleEntry(16, 16)}, absl::nullopt));
+ kKeyID, kInitialIV, {SubsampleEntry(16, 16)}, std::nullopt));
expected.push_back(DecryptConfig::CreateCbcsConfig(
- kKeyID, kIVIncrementOne, {SubsampleEntry(16, 16)}, absl::nullopt));
+ kKeyID, kIVIncrementOne, {SubsampleEntry(16, 16)}, std::nullopt));
CheckSubsampleValues(
kSuperframe, sizeof(kSuperframe),
@@ -248,10 +248,10 @@
std::vector<std::unique_ptr<DecryptConfig>> expected;
expected.push_back(DecryptConfig::CreateCbcsConfig(
- kKeyID, kInitialIV, {SubsampleEntry(32, 0)}, absl::nullopt));
+ kKeyID, kInitialIV, {SubsampleEntry(32, 0)}, std::nullopt));
expected.push_back(DecryptConfig::CreateCbcsConfig(
- kKeyID, kInitialIV, {SubsampleEntry(16, 16)}, absl::nullopt));
+ kKeyID, kInitialIV, {SubsampleEntry(16, 16)}, std::nullopt));
CheckSubsampleValues(kSuperframe, sizeof(kSuperframe),
DecryptConfig::CreateCencConfig(
@@ -290,10 +290,10 @@
std::vector<std::unique_ptr<DecryptConfig>> expected;
expected.push_back(DecryptConfig::CreateCbcsConfig(
kKeyID, kInitialIV, {SubsampleEntry(16, 16), SubsampleEntry(16, 0)},
- absl::nullopt));
+ std::nullopt));
expected.push_back(DecryptConfig::CreateCbcsConfig(
- kKeyID, kIVIncrementOne, {SubsampleEntry(16, 16)}, absl::nullopt));
+ kKeyID, kIVIncrementOne, {SubsampleEntry(16, 16)}, std::nullopt));
CheckSubsampleValues(
kSuperframe, sizeof(kSuperframe),
@@ -335,10 +335,10 @@
std::vector<std::unique_ptr<DecryptConfig>> expected;
expected.push_back(DecryptConfig::CreateCbcsConfig(
kKeyID, kInitialIV, {SubsampleEntry(16, 16), SubsampleEntry(16, 16)},
- absl::nullopt));
+ std::nullopt));
expected.push_back(DecryptConfig::CreateCbcsConfig(
- kKeyID, kIVIncrementTwo, {SubsampleEntry(16, 16)}, absl::nullopt));
+ kKeyID, kIVIncrementTwo, {SubsampleEntry(16, 16)}, std::nullopt));
CheckSubsampleValues(kSuperframe, sizeof(kSuperframe),
DecryptConfig::CreateCencConfig(
@@ -382,10 +382,10 @@
expected.push_back(DecryptConfig::CreateCbcsConfig(
kKeyID, kInitialIV,
{SubsampleEntry(16, 16), SubsampleEntry(16, 16), SubsampleEntry(8, 0)},
- absl::nullopt));
+ std::nullopt));
expected.push_back(DecryptConfig::CreateCbcsConfig(
- kKeyID, kIVIncrementTwo, {SubsampleEntry(16, 16)}, absl::nullopt));
+ kKeyID, kIVIncrementTwo, {SubsampleEntry(16, 16)}, std::nullopt));
CheckSubsampleValues(
kSuperframe, sizeof(kSuperframe),
diff --git a/media/filters/win/media_foundation_audio_decoder.cc b/media/filters/win/media_foundation_audio_decoder.cc
index c0d318d..9ca7b539 100644
--- a/media/filters/win/media_foundation_audio_decoder.cc
+++ b/media/filters/win/media_foundation_audio_decoder.cc
@@ -77,7 +77,7 @@
return false;
}
-absl::optional<MFT_REGISTER_TYPE_INFO> GetTypeInfo(
+std::optional<MFT_REGISTER_TYPE_INFO> GetTypeInfo(
const AudioDecoderConfig& config) {
switch (config.codec()) {
#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
@@ -107,7 +107,7 @@
return MFT_REGISTER_TYPE_INFO{MFMediaType_Audio, MFAudioFormat_Dolby_AC4};
#endif // BUILDFLAG(ENABLE_PLATFORM_AC4_AUDIO)
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
diff --git a/media/formats/hls/audio_rendition.cc b/media/formats/hls/audio_rendition.cc
index 22f4235..628e39a 100644
--- a/media/formats/hls/audio_rendition.cc
+++ b/media/formats/hls/audio_rendition.cc
@@ -4,10 +4,11 @@
#include "media/formats/hls/audio_rendition.h"
+#include <optional>
+
#include "base/types/pass_key.h"
#include "media/formats/hls/parse_status.h"
#include "media/formats/hls/tags.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace media::hls {
@@ -46,12 +47,12 @@
XMediaTag tag,
const GURL& playlist_uri) {
DCHECK(tag.type == MediaType::kAudio);
- DCHECK(tag.instream_id == absl::nullopt);
+ DCHECK(tag.instream_id == std::nullopt);
DCHECK(tag.group_id.Str() == id_);
DCHECK(tag.forced == false);
DCHECK(playlist_uri.is_valid());
- absl::optional<GURL> uri;
+ std::optional<GURL> uri;
if (tag.uri.has_value()) {
uri = playlist_uri.Resolve(tag.uri->Str());
if (!uri->is_valid()) {
@@ -64,12 +65,12 @@
return ParseStatusCode::kRenditionGroupHasDuplicateRenditionNames;
}
- absl::optional<std::string> language;
+ std::optional<std::string> language;
if (tag.language.has_value()) {
language = std::string(tag.language->Str());
}
- absl::optional<std::string> associated_language;
+ std::optional<std::string> associated_language;
if (tag.associated_language.has_value()) {
associated_language = std::string(tag.associated_language->Str());
}
diff --git a/media/formats/hls/audio_rendition.h b/media/formats/hls/audio_rendition.h
index b6ccafc..5ee8aa9 100644
--- a/media/formats/hls/audio_rendition.h
+++ b/media/formats/hls/audio_rendition.h
@@ -6,6 +6,7 @@
#define MEDIA_FORMATS_HLS_AUDIO_RENDITION_H_
#include <list>
+#include <optional>
#include <string>
#include "base/containers/flat_map.h"
@@ -16,7 +17,6 @@
#include "media/formats/hls/parse_status.h"
#include "media/formats/hls/tags.h"
#include "media/formats/hls/types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "url/gurl.h"
@@ -36,22 +36,22 @@
~AudioRendition();
// Returns the URI for the media playlist of this rendition.
- const absl::optional<GURL>& GetUri() const { return uri_; }
+ const std::optional<GURL>& GetUri() const { return uri_; }
// Returns the name of this rendition, which must be unique within the group
// containing this rendition.
const std::string& GetName() const { return name_; }
// Returns the language of this rendition.
- const absl::optional<std::string>& GetLanguage() const { return language_; }
+ const std::optional<std::string>& GetLanguage() const { return language_; }
// Returns an associated language of this rendition.
- const absl::optional<std::string>& GetAssociatedLanguage() const {
+ const std::optional<std::string>& GetAssociatedLanguage() const {
return associated_language_;
}
// Returns a stable identifier for the URI of this rendition.
- const absl::optional<types::StableId>& GetStableRenditionId() const {
+ const std::optional<types::StableId>& GetStableRenditionId() const {
return stable_rendition_id_;
}
@@ -62,7 +62,7 @@
}
// Returns channel information for this rendition.
- const absl::optional<types::AudioChannels>& GetChannels() const {
+ const std::optional<types::AudioChannels>& GetChannels() const {
return channels_;
}
@@ -71,13 +71,13 @@
bool MayAutoSelect() const { return autoselect_; }
private:
- absl::optional<GURL> uri_;
+ std::optional<GURL> uri_;
std::string name_;
- absl::optional<std::string> language_;
- absl::optional<std::string> associated_language_;
- absl::optional<types::StableId> stable_rendition_id_;
+ std::optional<std::string> language_;
+ std::optional<std::string> associated_language_;
+ std::optional<types::StableId> stable_rendition_id_;
std::vector<std::string> characteristics_;
- absl::optional<types::AudioChannels> channels_;
+ std::optional<types::AudioChannels> channels_;
bool autoselect_ = false;
};
diff --git a/media/formats/hls/items.cc b/media/formats/hls/items.cc
index 3d1b818..12f5748 100644
--- a/media/formats/hls/items.cc
+++ b/media/formats/hls/items.cc
@@ -4,10 +4,11 @@
#include "media/formats/hls/items.h"
+#include <optional>
+
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
#include "media/formats/hls/parse_status.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace media::hls {
@@ -22,7 +23,7 @@
// Extract name and content
const auto name_str = tag.Substr(0, colon_index);
- absl::optional<SourceString> content;
+ std::optional<SourceString> content;
if (colon_index != base::StringPiece::npos) {
content = tag.Substr(colon_index + 1);
}
diff --git a/media/formats/hls/items.h b/media/formats/hls/items.h
index c47ba33..9d20a0a 100644
--- a/media/formats/hls/items.h
+++ b/media/formats/hls/items.h
@@ -23,12 +23,12 @@
public:
// Helper for representing an unknown tag.
static TagItem CreateUnknown(SourceString name) {
- return TagItem{absl::nullopt, name, name.Line()};
+ return TagItem{std::nullopt, name, name.Line()};
}
// Helper for representing a tag with no content.
static TagItem CreateEmpty(TagName name, size_t line_number) {
- return TagItem{name, absl::nullopt, line_number};
+ return TagItem{name, std::nullopt, line_number};
}
// Helper for representing a tag with content.
@@ -37,8 +37,8 @@
}
// Returns the name constant of the tag, if this is a known tag.
- // If this is an unknown tag, returns `absl::nullopt`.
- absl::optional<TagName> GetName() const { return name_; }
+ // If this is an unknown tag, returns `std::nullopt`.
+ std::optional<TagName> GetName() const { return name_; }
// Returns the name of the tag as a string.
base::StringPiece GetNameStr();
@@ -47,21 +47,21 @@
size_t GetLineNumber() const { return line_number_; }
// Returns the content associated with this tag. If this tag is unknown or has
- // no content, returns `absl::nullopt`.
- absl::optional<SourceString> GetContent() const {
- return name_ ? content_or_name_ : absl::nullopt;
+ // no content, returns `std::nullopt`.
+ std::optional<SourceString> GetContent() const {
+ return name_ ? content_or_name_ : std::nullopt;
}
private:
- TagItem(absl::optional<TagName> name,
- absl::optional<SourceString> content_or_name,
+ TagItem(std::optional<TagName> name,
+ std::optional<SourceString> content_or_name,
size_t line_number)
: name_(name),
content_or_name_(content_or_name),
line_number_(line_number) {}
- absl::optional<TagName> name_;
- absl::optional<SourceString> content_or_name_;
+ std::optional<TagName> name_;
+ std::optional<SourceString> content_or_name_;
size_t line_number_;
};
diff --git a/media/formats/hls/items_fuzzer.cc b/media/formats/hls/items_fuzzer.cc
index 1c2b2ff..75d56929 100644
--- a/media/formats/hls/items_fuzzer.cc
+++ b/media/formats/hls/items_fuzzer.cc
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "media/formats/hls/items.h"
+
#include <cstddef>
#include <cstdint>
+#include <optional>
#include "base/check.h"
#include "base/strings/string_piece.h"
-#include "media/formats/hls/items.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace {
@@ -18,7 +19,7 @@
base.data() + base.size() >= sub.data() + sub.size();
}
-absl::optional<media::hls::SourceString> GetItemContent(
+std::optional<media::hls::SourceString> GetItemContent(
media::hls::TagItem tag) {
// Ensure the tag kind returned was valid
if (tag.GetName()) {
@@ -30,7 +31,7 @@
return tag.GetContent();
}
-absl::optional<media::hls::SourceString> GetItemContent(
+std::optional<media::hls::SourceString> GetItemContent(
media::hls::UriItem uri) {
return uri.content;
}
diff --git a/media/formats/hls/media_playlist.cc b/media/formats/hls/media_playlist.cc
index d440c256..e9dc2a6 100644
--- a/media/formats/hls/media_playlist.cc
+++ b/media/formats/hls/media_playlist.cc
@@ -5,6 +5,7 @@
#include "media/formats/hls/media_playlist.h"
#include <cmath>
+#include <optional>
#include <utility>
#include <vector>
@@ -21,7 +22,6 @@
#include "media/formats/hls/tags.h"
#include "media/formats/hls/types.h"
#include "media/formats/hls/variable_dictionary.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "url/gurl.h"
@@ -32,18 +32,18 @@
types::DecimalInteger version;
bool independent_segments;
base::TimeDelta target_duration;
- absl::optional<PartialSegmentInfo> partial_segment_info;
+ std::optional<PartialSegmentInfo> partial_segment_info;
std::vector<scoped_refptr<MediaSegment>> segments;
base::TimeDelta total_duration;
- absl::optional<PlaylistType> playlist_type;
+ std::optional<PlaylistType> playlist_type;
bool end_list;
bool i_frames_only;
bool has_media_sequence_tag;
bool can_skip_dateranges;
bool can_block_reload;
- absl::optional<base::TimeDelta> skip_boundary;
+ std::optional<base::TimeDelta> skip_boundary;
base::TimeDelta hold_back_distance;
- absl::optional<base::TimeDelta> part_hold_back_distance;
+ std::optional<base::TimeDelta> part_hold_back_distance;
};
MediaPlaylist::~MediaPlaylist() = default;
@@ -80,19 +80,19 @@
CommonParserState common_state;
VariableDictionary::SubstitutionBuffer sub_buffer;
- absl::optional<XTargetDurationTag> target_duration_tag;
- absl::optional<InfTag> inf_tag;
- absl::optional<XGapTag> gap_tag;
- absl::optional<XDiscontinuityTag> discontinuity_tag;
- absl::optional<XByteRangeTag> byterange_tag;
- absl::optional<XBitrateTag> bitrate_tag;
- absl::optional<XPlaylistTypeTag> playlist_type_tag;
- absl::optional<XEndListTag> end_list_tag;
- absl::optional<XIFramesOnlyTag> i_frames_only_tag;
- absl::optional<XPartInfTag> part_inf_tag;
- absl::optional<XServerControlTag> server_control_tag;
- absl::optional<XMediaSequenceTag> media_sequence_tag;
- absl::optional<XDiscontinuitySequenceTag> discontinuity_sequence_tag;
+ std::optional<XTargetDurationTag> target_duration_tag;
+ std::optional<InfTag> inf_tag;
+ std::optional<XGapTag> gap_tag;
+ std::optional<XDiscontinuityTag> discontinuity_tag;
+ std::optional<XByteRangeTag> byterange_tag;
+ std::optional<XBitrateTag> bitrate_tag;
+ std::optional<XPlaylistTypeTag> playlist_type_tag;
+ std::optional<XEndListTag> end_list_tag;
+ std::optional<XIFramesOnlyTag> i_frames_only_tag;
+ std::optional<XPartInfTag> part_inf_tag;
+ std::optional<XServerControlTag> server_control_tag;
+ std::optional<XMediaSequenceTag> media_sequence_tag;
+ std::optional<XDiscontinuitySequenceTag> discontinuity_sequence_tag;
std::vector<scoped_refptr<MediaSegment>> segments;
scoped_refptr<MediaSegment::InitializationSegment> initialization_segment;
bool new_init_segment = false;
@@ -247,7 +247,7 @@
}
// Extract the byte range
- absl::optional<types::ByteRange> byte_range;
+ std::optional<types::ByteRange> byte_range;
if (value.byte_range.has_value()) {
// Safari defaults byte range offset to 0, do that here as well.
byte_range = types::ByteRange::Validate(
@@ -354,7 +354,7 @@
const types::DecimalInteger media_sequence_number =
(media_sequence_tag ? media_sequence_tag->number : 0) + segments.size();
- absl::optional<types::ByteRange> byterange;
+ std::optional<types::ByteRange> byterange;
if (byterange_tag.has_value()) {
auto range = byterange_tag->range;
@@ -383,7 +383,7 @@
// The previous occurrence of the EXT-X-BITRATE tag applies to this segment
// only if this segment is not a byterange of its resource.
- absl::optional<types::DecimalInteger> bitrate;
+ std::optional<types::DecimalInteger> bitrate;
if (bitrate_tag.has_value() && !byterange.has_value()) {
// The value in the tag is expressed in kilobits per-second, but we wish
// to normalize all bitrates to bits-per-second. The spec specifically
@@ -420,7 +420,7 @@
return ParseStatusCode::kTargetDurationExceedsMax;
}
- absl::optional<PartialSegmentInfo> partial_segment_info;
+ std::optional<PartialSegmentInfo> partial_segment_info;
if (part_inf_tag.has_value()) {
partial_segment_info = MediaPlaylist::PartialSegmentInfo{
.target_duration = part_inf_tag->target_duration};
@@ -435,9 +435,9 @@
bool can_skip_dateranges = false;
bool can_block_reload = false;
- absl::optional<base::TimeDelta> skip_boundary;
+ std::optional<base::TimeDelta> skip_boundary;
base::TimeDelta hold_back_distance = target_duration * 3;
- absl::optional<base::TimeDelta> part_hold_back_distance;
+ std::optional<base::TimeDelta> part_hold_back_distance;
if (server_control_tag.has_value()) {
can_skip_dateranges = server_control_tag->can_skip_dateranges;
can_block_reload = server_control_tag->can_block_reload;
@@ -512,7 +512,7 @@
common_state.independent_segments_tag.has_value() ||
(parent_playlist && parent_playlist->AreSegmentsIndependent());
- absl::optional<PlaylistType> playlist_type;
+ std::optional<PlaylistType> playlist_type;
if (playlist_type_tag) {
playlist_type = playlist_type_tag->type;
}
diff --git a/media/formats/hls/media_playlist.h b/media/formats/hls/media_playlist.h
index aa00baf..c756fb18 100644
--- a/media/formats/hls/media_playlist.h
+++ b/media/formats/hls/media_playlist.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_FORMATS_HLS_MEDIA_PLAYLIST_H_
#define MEDIA_FORMATS_HLS_MEDIA_PLAYLIST_H_
+#include <optional>
#include <vector>
#include "base/memory/scoped_refptr.h"
@@ -14,7 +15,6 @@
#include "media/formats/hls/parse_status.h"
#include "media/formats/hls/playlist.h"
#include "media/formats/hls/tags.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace media::hls {
@@ -70,14 +70,12 @@
// If this property is absent, that implies that the server may append new
// segments to the end or remove old segments from the beginning of this
// playlist upon reloading.
- absl::optional<PlaylistType> GetPlaylistType() const {
- return playlist_type_;
- }
+ std::optional<PlaylistType> GetPlaylistType() const { return playlist_type_; }
// Returns information about partial segments in this playlist. This will be
// non-empty if this playlist contains at least one partial segment, and may
// be empty if this playlist contains no partial segments.
- absl::optional<PartialSegmentInfo> GetPartialSegmentInfo() const {
+ std::optional<PartialSegmentInfo> GetPartialSegmentInfo() const {
return partial_segment_info_;
}
@@ -105,7 +103,7 @@
// playlist beyond which media segments and their associated tags can be
// skipped.
// https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-6.2.5.1
- absl::optional<base::TimeDelta> GetSkipBoundary() const {
+ std::optional<base::TimeDelta> GetSkipBoundary() const {
return skip_boundary_;
}
@@ -123,7 +121,7 @@
// of the playlist at which clients should begin live playback when playing in
// low-latency mode.
// https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.3.8:~:text=any%20Media%20Playlist.-,PART%2DHOLD%2DBACK,-The%20value%20is
- absl::optional<base::TimeDelta> GetPartHoldBackDistance() const {
+ std::optional<base::TimeDelta> GetPartHoldBackDistance() const {
return part_hold_back_distance_;
}
@@ -151,18 +149,18 @@
~MediaPlaylist() override;
base::TimeDelta target_duration_;
- absl::optional<PartialSegmentInfo> partial_segment_info_;
+ std::optional<PartialSegmentInfo> partial_segment_info_;
std::vector<scoped_refptr<MediaSegment>> segments_;
base::TimeDelta computed_duration_;
- absl::optional<PlaylistType> playlist_type_;
+ std::optional<PlaylistType> playlist_type_;
bool end_list_;
bool i_frames_only_;
bool has_media_sequence_tag_;
bool can_skip_dateranges_;
bool can_block_reload_;
- absl::optional<base::TimeDelta> skip_boundary_;
+ std::optional<base::TimeDelta> skip_boundary_;
base::TimeDelta hold_back_distance_;
- absl::optional<base::TimeDelta> part_hold_back_distance_;
+ std::optional<base::TimeDelta> part_hold_back_distance_;
};
} // namespace media::hls
diff --git a/media/formats/hls/media_playlist_test_builder.h b/media/formats/hls/media_playlist_test_builder.h
index 85abc7cc..be5000357 100644
--- a/media/formats/hls/media_playlist_test_builder.h
+++ b/media/formats/hls/media_playlist_test_builder.h
@@ -81,8 +81,8 @@
std::vector<SegmentExpectations> segment_expectations_;
};
-// Checks that the media playlist has the given type (or `absl::nullopt`).
-inline void HasType(absl::optional<PlaylistType> type,
+// Checks that the media playlist has the given type (or `std::nullopt`).
+inline void HasType(std::optional<PlaylistType> type,
const base::Location& from,
const MediaPlaylist& playlist) {
EXPECT_EQ(playlist.GetPlaylistType(), type) << from.ToString();
@@ -106,7 +106,7 @@
// Checks that the value of `GetPartialSegmentInfo()` matches the given value.
inline void HasPartialSegmentInfo(
- absl::optional<MediaPlaylist::PartialSegmentInfo> partial_segment_info,
+ std::optional<MediaPlaylist::PartialSegmentInfo> partial_segment_info,
const base::Location& from,
const MediaPlaylist& playlist) {
ASSERT_EQ(partial_segment_info.has_value(),
@@ -128,7 +128,7 @@
}
// Checks that the value of `GetSkipBoundary()` matches the given value.
-inline void HasSkipBoundary(absl::optional<base::TimeDelta> value,
+inline void HasSkipBoundary(std::optional<base::TimeDelta> value,
const base::Location& from,
const MediaPlaylist& playlist) {
EXPECT_TRUE(RoughlyEqual(playlist.GetSkipBoundary(), value))
@@ -151,7 +151,7 @@
}
// Checks that the value of `GetPartHoldBackDistance()` matches the given value.
-inline void HasPartHoldBackDistance(absl::optional<base::TimeDelta> value,
+inline void HasPartHoldBackDistance(std::optional<base::TimeDelta> value,
const base::Location& from,
const MediaPlaylist& playlist) {
EXPECT_TRUE(RoughlyEqual(playlist.GetPartHoldBackDistance(), value))
@@ -225,7 +225,7 @@
}
// Checks that the latest media segment has the given byte range.
-inline void HasByteRange(absl::optional<types::ByteRange> range,
+inline void HasByteRange(std::optional<types::ByteRange> range,
const base::Location& from,
const MediaSegment& segment) {
ASSERT_EQ(segment.GetByteRange().has_value(), range.has_value())
@@ -242,7 +242,7 @@
// Checks the latest media segment's `GetBitRate` property against the given
// value.
-inline void HasBitRate(absl::optional<types::DecimalInteger> bitrate,
+inline void HasBitRate(std::optional<types::DecimalInteger> bitrate,
const base::Location& from,
const MediaSegment& segment) {
EXPECT_EQ(segment.GetBitRate(), bitrate);
diff --git a/media/formats/hls/media_playlist_unittest.cc b/media/formats/hls/media_playlist_unittest.cc
index 958be42..87233f6 100644
--- a/media/formats/hls/media_playlist_unittest.cc
+++ b/media/formats/hls/media_playlist_unittest.cc
@@ -345,7 +345,7 @@
builder.ExpectAdditionalSegment();
builder.ExpectSegment(HasMediaSequenceNumber, 0);
builder.ExpectSegment(HasUri, GURL("http://localhost/segment0.ts"));
- builder.ExpectSegment(HasBitRate, absl::nullopt);
+ builder.ExpectSegment(HasBitRate, std::nullopt);
builder.AppendLine("#EXT-X-BITRATE:15");
builder.AppendLine("#EXTINF:9.2,");
@@ -370,14 +370,14 @@
builder.ExpectSegment(HasMediaSequenceNumber, 3);
builder.ExpectSegment(HasUri, GURL("http://localhost/segment3.ts"));
builder.ExpectSegment(HasByteRange, CreateByteRange(1024, 0));
- builder.ExpectSegment(HasBitRate, absl::nullopt);
+ builder.ExpectSegment(HasBitRate, std::nullopt);
builder.AppendLine("#EXTINF:9.2,");
builder.AppendLine("segment4.ts");
builder.ExpectAdditionalSegment();
builder.ExpectSegment(HasMediaSequenceNumber, 4);
builder.ExpectSegment(HasUri, GURL("http://localhost/segment4.ts"));
- builder.ExpectSegment(HasByteRange, absl::nullopt);
+ builder.ExpectSegment(HasByteRange, std::nullopt);
builder.ExpectSegment(HasBitRate, 15000);
// The EXT-X-BITRATE tag is allowed to appear twice
@@ -489,7 +489,7 @@
fork.AppendLine("segment.ts");
fork.ExpectAdditionalSegment();
fork.ExpectSegment(HasUri, GURL("http://localhost/segment.ts"));
- fork.ExpectSegment(HasByteRange, absl::nullopt);
+ fork.ExpectSegment(HasByteRange, std::nullopt);
fork.AppendLine("#EXT-X-BYTERANGE:12@34");
fork.AppendLine("#EXTINF:9.2,\t");
fork.AppendLine("segment.ts");
@@ -551,7 +551,7 @@
fork.AppendLine("segment2.ts");
fork.ExpectAdditionalSegment();
fork.ExpectSegment(HasUri, GURL("http://localhost/segment2.ts"));
- fork.ExpectSegment(HasByteRange, absl::nullopt);
+ fork.ExpectSegment(HasByteRange, std::nullopt);
fork.AppendLine("#EXT-X-BYTERANGE:56@78");
fork.AppendLine("#EXTINF:9.2,\t");
fork.AppendLine("segment1.ts");
@@ -951,7 +951,7 @@
builder.AppendLine("#EXT-X-MAP:URI=\"init1.ts\"");
auto init1 = base::MakeRefCounted<MediaSegment::InitializationSegment>(
- GURL("http://localhost/init1.ts"), absl::nullopt);
+ GURL("http://localhost/init1.ts"), std::nullopt);
builder.AppendLine("#EXTINF:9.2,\t");
builder.AppendLine("foo2.ts");
@@ -1140,7 +1140,7 @@
// Without the EXT-X-PLAYLIST-TYPE tag, the playlist has no type.
{
auto fork = builder;
- fork.ExpectPlaylist(HasType, absl::nullopt);
+ fork.ExpectPlaylist(HasType, std::nullopt);
fork.ExpectOk();
}
@@ -1199,10 +1199,10 @@
// Without the EXT-X-SERVER-CONTROL tag, certain properties have default
// values
auto fork = builder;
- fork.ExpectPlaylist(HasSkipBoundary, absl::nullopt);
+ fork.ExpectPlaylist(HasSkipBoundary, std::nullopt);
fork.ExpectPlaylist(CanSkipDateRanges, false);
fork.ExpectPlaylist(HasHoldBackDistance, base::Seconds(6) * 3);
- fork.ExpectPlaylist(HasPartHoldBackDistance, absl::nullopt);
+ fork.ExpectPlaylist(HasPartHoldBackDistance, std::nullopt);
fork.ExpectPlaylist(CanBlockReload, false);
fork.ExpectOk();
// An empty EXT-X-SERVER-CONTROL tag shouldn't change these defaults
@@ -1228,7 +1228,7 @@
fork.ExpectPlaylist(HasSkipBoundary, base::Seconds(36));
fork.ExpectPlaylist(CanSkipDateRanges, false);
fork.ExpectPlaylist(HasHoldBackDistance, base::Seconds(6) * 3);
- fork.ExpectPlaylist(HasPartHoldBackDistance, absl::nullopt);
+ fork.ExpectPlaylist(HasPartHoldBackDistance, std::nullopt);
fork.ExpectPlaylist(CanBlockReload, false);
fork.ExpectOk();
@@ -1243,7 +1243,7 @@
fork.ExpectPlaylist(CanSkipDateRanges, true);
fork.ExpectPlaylist(HasSkipBoundary, base::Seconds(40));
fork.ExpectPlaylist(HasHoldBackDistance, base::Seconds(6) * 3);
- fork.ExpectPlaylist(HasPartHoldBackDistance, absl::nullopt);
+ fork.ExpectPlaylist(HasPartHoldBackDistance, std::nullopt);
fork.ExpectPlaylist(CanBlockReload, false);
fork.ExpectOk();
@@ -1253,7 +1253,7 @@
fork.ExpectPlaylist(CanSkipDateRanges, true);
fork.ExpectPlaylist(HasSkipBoundary, base::Seconds(40));
fork.ExpectPlaylist(HasHoldBackDistance, base::Seconds(6) * 3);
- fork.ExpectPlaylist(HasPartHoldBackDistance, absl::nullopt);
+ fork.ExpectPlaylist(HasPartHoldBackDistance, std::nullopt);
fork.ExpectPlaylist(CanBlockReload, false);
fork.ExpectOk();
@@ -1289,7 +1289,7 @@
HasPartialSegmentInfo,
MediaPlaylist::PartialSegmentInfo{.target_duration = base::Seconds(0.2)});
fork.ExpectPlaylist(HasPartHoldBackDistance, base::Seconds(0.5));
- fork.ExpectPlaylist(HasSkipBoundary, absl::nullopt);
+ fork.ExpectPlaylist(HasSkipBoundary, std::nullopt);
fork.ExpectPlaylist(CanSkipDateRanges, false);
fork.ExpectPlaylist(HasHoldBackDistance, base::Seconds(6) * 3);
fork.ExpectPlaylist(CanBlockReload, false);
@@ -1304,7 +1304,7 @@
HasPartialSegmentInfo,
MediaPlaylist::PartialSegmentInfo{.target_duration = base::Seconds(0.2)});
fork.ExpectPlaylist(HasPartHoldBackDistance, base::Seconds(0.4));
- fork.ExpectPlaylist(HasSkipBoundary, absl::nullopt);
+ fork.ExpectPlaylist(HasSkipBoundary, std::nullopt);
fork.ExpectPlaylist(CanSkipDateRanges, false);
fork.ExpectPlaylist(HasHoldBackDistance, base::Seconds(6) * 3);
fork.ExpectPlaylist(CanBlockReload, false);
@@ -1317,9 +1317,9 @@
fork = builder;
fork.AppendLine("#EXT-X-SERVER-CONTROL:PART-HOLD-BACK=0.3");
- fork.ExpectPlaylist(HasPartialSegmentInfo, absl::nullopt);
+ fork.ExpectPlaylist(HasPartialSegmentInfo, std::nullopt);
fork.ExpectPlaylist(HasPartHoldBackDistance, base::Seconds(0.3));
- fork.ExpectPlaylist(HasSkipBoundary, absl::nullopt);
+ fork.ExpectPlaylist(HasSkipBoundary, std::nullopt);
fork.ExpectPlaylist(CanSkipDateRanges, false);
fork.ExpectPlaylist(HasHoldBackDistance, base::Seconds(6) * 3);
fork.ExpectPlaylist(CanBlockReload, false);
@@ -1329,9 +1329,9 @@
fork = builder;
fork.AppendLine("#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES");
fork.ExpectPlaylist(CanBlockReload, true);
- fork.ExpectPlaylist(HasPartialSegmentInfo, absl::nullopt);
- fork.ExpectPlaylist(HasPartHoldBackDistance, absl::nullopt);
- fork.ExpectPlaylist(HasSkipBoundary, absl::nullopt);
+ fork.ExpectPlaylist(HasPartialSegmentInfo, std::nullopt);
+ fork.ExpectPlaylist(HasPartHoldBackDistance, std::nullopt);
+ fork.ExpectPlaylist(HasSkipBoundary, std::nullopt);
fork.ExpectPlaylist(CanSkipDateRanges, false);
fork.ExpectPlaylist(HasHoldBackDistance, base::Seconds(6) * 3);
fork.ExpectOk();
diff --git a/media/formats/hls/media_segment.cc b/media/formats/hls/media_segment.cc
index f7d17bd..6dd99eb6 100644
--- a/media/formats/hls/media_segment.cc
+++ b/media/formats/hls/media_segment.cc
@@ -12,7 +12,7 @@
MediaSegment::InitializationSegment::InitializationSegment(
GURL uri,
- absl::optional<types::ByteRange> byte_range)
+ std::optional<types::ByteRange> byte_range)
: uri_(std::move(uri)), byte_range_(byte_range) {}
MediaSegment::InitializationSegment::~InitializationSegment() = default;
@@ -23,8 +23,8 @@
types::DecimalInteger discontinuity_sequence_number,
GURL uri,
scoped_refptr<InitializationSegment> initialization_segment,
- absl::optional<types::ByteRange> byte_range,
- absl::optional<types::DecimalInteger> bitrate,
+ std::optional<types::ByteRange> byte_range,
+ std::optional<types::DecimalInteger> bitrate,
bool has_discontinuity,
bool is_gap,
bool has_new_init_segment)
diff --git a/media/formats/hls/media_segment.h b/media/formats/hls/media_segment.h
index 77f07daf..d5a6619 100644
--- a/media/formats/hls/media_segment.h
+++ b/media/formats/hls/media_segment.h
@@ -19,7 +19,7 @@
class MEDIA_EXPORT InitializationSegment
: public base::RefCounted<InitializationSegment> {
public:
- InitializationSegment(GURL uri, absl::optional<types::ByteRange>);
+ InitializationSegment(GURL uri, std::optional<types::ByteRange>);
InitializationSegment(const InitializationSegment& copy) = delete;
InitializationSegment(InitializationSegment&& copy) = delete;
InitializationSegment& operator=(const InitializationSegment& copy) =
@@ -32,16 +32,14 @@
// If the initialization segment is a subrange of its resource, this
// indicates the range.
- absl::optional<types::ByteRange> GetByteRange() const {
- return byte_range_;
- }
+ std::optional<types::ByteRange> GetByteRange() const { return byte_range_; }
private:
friend class base::RefCounted<InitializationSegment>;
~InitializationSegment();
GURL uri_;
- absl::optional<types::ByteRange> byte_range_;
+ std::optional<types::ByteRange> byte_range_;
};
MediaSegment(base::TimeDelta duration,
@@ -49,8 +47,8 @@
types::DecimalInteger discontinuity_sequence_number,
GURL uri,
scoped_refptr<InitializationSegment> initialization_segment,
- absl::optional<types::ByteRange> byte_range,
- absl::optional<types::DecimalInteger> bitrate,
+ std::optional<types::ByteRange> byte_range,
+ std::optional<types::DecimalInteger> bitrate,
bool has_discontinuity,
bool is_gap,
bool has_new_init_segment);
@@ -90,7 +88,7 @@
// If this media segment is a subrange of its resource, this indicates the
// range.
- absl::optional<types::ByteRange> GetByteRange() const { return byte_range_; }
+ std::optional<types::ByteRange> GetByteRange() const { return byte_range_; }
// Whether there is a decoding discontinuity between the previous media
// segment and this one.
@@ -102,7 +100,7 @@
// Returns the approximate bitrate of this segment (+-10%), expressed in
// bits-per-second.
- absl::optional<types::DecimalInteger> GetBitRate() const { return bitrate_; }
+ std::optional<types::DecimalInteger> GetBitRate() const { return bitrate_; }
private:
friend class base::RefCounted<MediaSegment>;
@@ -113,8 +111,8 @@
types::DecimalInteger discontinuity_sequence_number_;
GURL uri_;
scoped_refptr<InitializationSegment> initialization_segment_;
- absl::optional<types::ByteRange> byte_range_;
- absl::optional<types::DecimalInteger> bitrate_;
+ std::optional<types::ByteRange> byte_range_;
+ std::optional<types::DecimalInteger> bitrate_;
bool has_discontinuity_;
bool is_gap_;
bool has_new_init_segment_;
diff --git a/media/formats/hls/multivariant_playlist.cc b/media/formats/hls/multivariant_playlist.cc
index ef1b5f1e..2d6036c7 100644
--- a/media/formats/hls/multivariant_playlist.cc
+++ b/media/formats/hls/multivariant_playlist.cc
@@ -4,6 +4,7 @@
#include "media/formats/hls/multivariant_playlist.h"
+#include <optional>
#include <utility>
#include <vector>
@@ -22,7 +23,6 @@
#include "media/formats/hls/types.h"
#include "media/formats/hls/variable_dictionary.h"
#include "media/formats/hls/variant_stream.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "url/gurl.h"
@@ -84,7 +84,7 @@
CommonParserState common_state;
VariableDictionary::SubstitutionBuffer sub_buffer;
- absl::optional<XStreamInfTag> inf_tag;
+ std::optional<XStreamInfTag> inf_tag;
std::vector<VariantStream> variants;
base::flat_map<base::StringPiece, scoped_refptr<AudioRenditionGroup>>
audio_rendition_groups;
@@ -221,7 +221,7 @@
inf_tag->audio->Str());
}
- absl::optional<std::string> video_rendition_group_name;
+ std::optional<std::string> video_rendition_group_name;
if (inf_tag->video.has_value()) {
video_rendition_group_name = std::string(inf_tag->video->Str());
}
diff --git a/media/formats/hls/multivariant_playlist_test_builder.h b/media/formats/hls/multivariant_playlist_test_builder.h
index 2df3158..0860974 100644
--- a/media/formats/hls/multivariant_playlist_test_builder.h
+++ b/media/formats/hls/multivariant_playlist_test_builder.h
@@ -169,7 +169,7 @@
// Checks the value of `GetAverageBandwidth` on the latest variant against the
// given value.
inline void HasAverageBandwidth(
- absl::optional<types::DecimalInteger> average_bandwidth,
+ std::optional<types::DecimalInteger> average_bandwidth,
const base::Location& from,
const VariantStream& variant) {
EXPECT_EQ(variant.GetAverageBandwidth(), average_bandwidth)
@@ -177,7 +177,7 @@
}
// Checks the value of `GetScore` on the latest variant against the given value.
-inline void HasScore(absl::optional<types::DecimalFloatingPoint> score,
+inline void HasScore(std::optional<types::DecimalFloatingPoint> score,
const base::Location& from,
const VariantStream& variant) {
EXPECT_EQ(variant.GetScore(), score) << from.ToString();
@@ -185,7 +185,7 @@
// Checks the value of `GetCodecs` on the latest variant against the given
// value.
-inline void HasCodecs(absl::optional<std::vector<std::string>> codecs,
+inline void HasCodecs(std::optional<std::vector<std::string>> codecs,
const base::Location& from,
const VariantStream& variant) {
EXPECT_EQ(variant.GetCodecs(), codecs) << from.ToString();
@@ -193,7 +193,7 @@
// Checks the value of `GetResolution` on the latest variant against the given
// value.
-inline void HasResolution(absl::optional<types::DecimalResolution> resolution,
+inline void HasResolution(std::optional<types::DecimalResolution> resolution,
const base::Location& from,
const VariantStream& variant) {
ASSERT_EQ(variant.GetResolution().has_value(), resolution.has_value())
@@ -208,7 +208,7 @@
// Checks the value of `GetFrameRate` on the latest variant against the given
// value.
-inline void HasFrameRate(absl::optional<types::DecimalFloatingPoint> frame_rate,
+inline void HasFrameRate(std::optional<types::DecimalFloatingPoint> frame_rate,
const base::Location& from,
const VariantStream& variant) {
ASSERT_EQ(variant.GetFrameRate().has_value(), frame_rate.has_value())
@@ -221,40 +221,40 @@
// Checks that the audio rendition group associated with the latest variant has
// the given `group_id`.
-inline void HasAudioRenditionGroup(absl::optional<std::string> group_id,
+inline void HasAudioRenditionGroup(std::optional<std::string> group_id,
const base::Location& from,
const VariantStream& variant) {
if (variant.GetAudioRenditionGroup()) {
EXPECT_EQ(variant.GetAudioRenditionGroup()->GetId(), group_id)
<< from.ToString();
} else {
- EXPECT_EQ(absl::nullopt, group_id) << from.ToString();
+ EXPECT_EQ(std::nullopt, group_id) << from.ToString();
}
}
// Checks that the audio rendition has the given URI.
-inline void RenditionHasUri(absl::optional<GURL> uri,
+inline void RenditionHasUri(std::optional<GURL> uri,
const base::Location& from,
const AudioRendition& rendition) {
EXPECT_EQ(rendition.GetUri(), uri) << from.ToString();
}
// Checks that the audio rendition has the given language.
-inline void HasLanguage(absl::optional<std::string> language,
+inline void HasLanguage(std::optional<std::string> language,
const base::Location& from,
const AudioRendition& rendition) {
EXPECT_EQ(rendition.GetLanguage(), language) << from.ToString();
}
// Checks that the audio rendition has the given associated language.
-inline void HasAssociatedLanguage(absl::optional<std::string> language,
+inline void HasAssociatedLanguage(std::optional<std::string> language,
const base::Location& from,
const AudioRendition& rendition) {
EXPECT_EQ(rendition.GetAssociatedLanguage(), language) << from.ToString();
}
// Checks that the audio rendition has the given StableId.
-inline void HasStableRenditionId(absl::optional<types::StableId> id,
+inline void HasStableRenditionId(std::optional<types::StableId> id,
const base::Location& from,
const AudioRendition& rendition) {
EXPECT_EQ(rendition.GetStableRenditionId(), id) << from.ToString();
@@ -269,14 +269,14 @@
}
// Checks that the audio rendition group has a default rendition with the given
-// name (or `absl::nullopt` for no default rendition).
-inline void HasDefaultRendition(absl::optional<std::string> name,
+// name (or `std::nullopt` for no default rendition).
+inline void HasDefaultRendition(std::optional<std::string> name,
const base::Location& from,
const AudioRenditionGroup& group) {
if (group.GetDefaultRendition()) {
EXPECT_EQ(group.GetDefaultRendition()->GetName(), name) << from.ToString();
} else {
- EXPECT_EQ(absl::nullopt, name) << from.ToString();
+ EXPECT_EQ(std::nullopt, name) << from.ToString();
}
}
diff --git a/media/formats/hls/multivariant_playlist_unittest.cc b/media/formats/hls/multivariant_playlist_unittest.cc
index a836b08..f0e61e9e 100644
--- a/media/formats/hls/multivariant_playlist_unittest.cc
+++ b/media/formats/hls/multivariant_playlist_unittest.cc
@@ -4,12 +4,13 @@
#include "media/formats/hls/multivariant_playlist.h"
+#include <optional>
+
#include "media/formats/hls/multivariant_playlist_test_builder.h"
#include "media/formats/hls/parse_status.h"
#include "media/formats/hls/types.h"
#include "media/formats/hls/variant_stream.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media::hls {
@@ -143,11 +144,11 @@
builder.ExpectVariant(HasPrimaryRenditionUri,
GURL("http://localhost/playlist1.m3u8"));
builder.ExpectVariant(HasBandwidth, 100);
- builder.ExpectVariant(HasAverageBandwidth, absl::nullopt);
- builder.ExpectVariant(HasScore, absl::nullopt);
- builder.ExpectVariant(HasCodecs, absl::nullopt);
- builder.ExpectVariant(HasResolution, absl::nullopt);
- builder.ExpectVariant(HasFrameRate, absl::nullopt);
+ builder.ExpectVariant(HasAverageBandwidth, std::nullopt);
+ builder.ExpectVariant(HasScore, std::nullopt);
+ builder.ExpectVariant(HasCodecs, std::nullopt);
+ builder.ExpectVariant(HasResolution, std::nullopt);
+ builder.ExpectVariant(HasFrameRate, std::nullopt);
builder.ExpectOk();
{
@@ -193,11 +194,11 @@
builder.ExpectVariant(HasPrimaryRenditionUri,
GURL("http://localhost/playlist4.m3u8"));
builder.ExpectVariant(HasBandwidth, 105);
- builder.ExpectVariant(HasAverageBandwidth, absl::nullopt);
- builder.ExpectVariant(HasScore, absl::nullopt);
- builder.ExpectVariant(HasCodecs, absl::nullopt);
- builder.ExpectVariant(HasResolution, absl::nullopt);
- builder.ExpectVariant(HasFrameRate, absl::nullopt);
+ builder.ExpectVariant(HasAverageBandwidth, std::nullopt);
+ builder.ExpectVariant(HasScore, std::nullopt);
+ builder.ExpectVariant(HasCodecs, std::nullopt);
+ builder.ExpectVariant(HasResolution, std::nullopt);
+ builder.ExpectVariant(HasFrameRate, std::nullopt);
builder.ExpectOk();
// URIs without corresponding EXT-X-STREAM-INF tags are not allowed
@@ -215,10 +216,10 @@
GURL("http://localhost/playlist5.m3u8"));
builder.ExpectVariant(HasBandwidth, 106u);
builder.ExpectVariant(HasAverageBandwidth, 105u);
- builder.ExpectVariant(HasScore, absl::nullopt);
- builder.ExpectVariant(HasCodecs, absl::nullopt);
- builder.ExpectVariant(HasResolution, absl::nullopt);
- builder.ExpectVariant(HasFrameRate, absl::nullopt);
+ builder.ExpectVariant(HasScore, std::nullopt);
+ builder.ExpectVariant(HasCodecs, std::nullopt);
+ builder.ExpectVariant(HasResolution, std::nullopt);
+ builder.ExpectVariant(HasFrameRate, std::nullopt);
builder.ExpectOk();
// Check the value of the 'SCORE' attribute
@@ -228,11 +229,11 @@
builder.ExpectVariant(HasPrimaryRenditionUri,
GURL("http://localhost/playlist6.m3u8"));
builder.ExpectVariant(HasBandwidth, 107u);
- builder.ExpectVariant(HasAverageBandwidth, absl::nullopt);
+ builder.ExpectVariant(HasAverageBandwidth, std::nullopt);
builder.ExpectVariant(HasScore, 10.5);
- builder.ExpectVariant(HasCodecs, absl::nullopt);
- builder.ExpectVariant(HasResolution, absl::nullopt);
- builder.ExpectVariant(HasFrameRate, absl::nullopt);
+ builder.ExpectVariant(HasCodecs, std::nullopt);
+ builder.ExpectVariant(HasResolution, std::nullopt);
+ builder.ExpectVariant(HasFrameRate, std::nullopt);
builder.ExpectOk();
// Check the value of the 'CODECS' attribute
@@ -242,11 +243,11 @@
builder.ExpectVariant(HasPrimaryRenditionUri,
GURL("http://localhost/playlist7.m3u8"));
builder.ExpectVariant(HasBandwidth, 108u);
- builder.ExpectVariant(HasAverageBandwidth, absl::nullopt);
- builder.ExpectVariant(HasScore, absl::nullopt);
+ builder.ExpectVariant(HasAverageBandwidth, std::nullopt);
+ builder.ExpectVariant(HasScore, std::nullopt);
builder.ExpectVariant(HasCodecs, std::vector<std::string>{"foo", "bar"});
- builder.ExpectVariant(HasResolution, absl::nullopt);
- builder.ExpectVariant(HasFrameRate, absl::nullopt);
+ builder.ExpectVariant(HasResolution, std::nullopt);
+ builder.ExpectVariant(HasFrameRate, std::nullopt);
builder.ExpectOk();
// Check the value of the 'RESOLUTION' attribute
@@ -256,12 +257,12 @@
builder.ExpectVariant(HasPrimaryRenditionUri,
GURL("http://localhost/playlist8.m3u8"));
builder.ExpectVariant(HasBandwidth, 109u);
- builder.ExpectVariant(HasAverageBandwidth, absl::nullopt);
- builder.ExpectVariant(HasScore, absl::nullopt);
- builder.ExpectVariant(HasCodecs, absl::nullopt);
+ builder.ExpectVariant(HasAverageBandwidth, std::nullopt);
+ builder.ExpectVariant(HasScore, std::nullopt);
+ builder.ExpectVariant(HasCodecs, std::nullopt);
builder.ExpectVariant(
HasResolution, types::DecimalResolution{.width = 1920, .height = 1080});
- builder.ExpectVariant(HasFrameRate, absl::nullopt);
+ builder.ExpectVariant(HasFrameRate, std::nullopt);
builder.ExpectOk();
// Check the value of the 'FRAME-RATE' attribute
@@ -271,10 +272,10 @@
builder.ExpectVariant(HasPrimaryRenditionUri,
GURL("http://localhost/playlist9.m3u8"));
builder.ExpectVariant(HasBandwidth, 110u);
- builder.ExpectVariant(HasAverageBandwidth, absl::nullopt);
- builder.ExpectVariant(HasScore, absl::nullopt);
- builder.ExpectVariant(HasCodecs, absl::nullopt);
- builder.ExpectVariant(HasResolution, absl::nullopt);
+ builder.ExpectVariant(HasAverageBandwidth, std::nullopt);
+ builder.ExpectVariant(HasScore, std::nullopt);
+ builder.ExpectVariant(HasCodecs, std::nullopt);
+ builder.ExpectVariant(HasResolution, std::nullopt);
builder.ExpectVariant(HasFrameRate, 59.94);
builder.ExpectOk();
}
@@ -306,7 +307,7 @@
fork.AppendLine("#EXT-X-STREAM-INF:BANDWIDTH=100");
fork.AppendLine("playlist.m3u8");
fork.ExpectAdditionalVariant();
- fork.ExpectVariant(HasAudioRenditionGroup, absl::nullopt);
+ fork.ExpectVariant(HasAudioRenditionGroup, std::nullopt);
fork.ExpectOk();
// Rendition groups may be referenced by EXT-X-STREAM-INF and EXT-X-MEDIA tags
@@ -321,13 +322,13 @@
"m3u8\"");
fork.ExpectAudioRendition("foo", "English", RenditionHasUri,
GURL("http://localhost/english.m3u8"));
- fork.ExpectAudioRendition("foo", "English", HasLanguage, absl::nullopt);
+ fork.ExpectAudioRendition("foo", "English", HasLanguage, std::nullopt);
fork.ExpectAudioRendition("foo", "English", HasAssociatedLanguage,
- absl::nullopt);
+ std::nullopt);
fork.ExpectAudioRendition("foo", "English", MayAutoSelect, false);
fork.ExpectAudioRendition("foo", "English", HasStableRenditionId,
- absl::nullopt);
- fork.ExpectAudioRenditionGroup("foo", HasDefaultRendition, absl::nullopt);
+ std::nullopt);
+ fork.ExpectAudioRenditionGroup("foo", HasDefaultRendition, std::nullopt);
fork.ExpectOk();
fork = builder;
@@ -340,13 +341,13 @@
fork.ExpectVariant(HasAudioRenditionGroup, "foo");
fork.ExpectAudioRendition("foo", "English", RenditionHasUri,
GURL("http://localhost/english.m3u8"));
- fork.ExpectAudioRendition("foo", "English", HasLanguage, absl::nullopt);
+ fork.ExpectAudioRendition("foo", "English", HasLanguage, std::nullopt);
fork.ExpectAudioRendition("foo", "English", HasAssociatedLanguage,
- absl::nullopt);
+ std::nullopt);
fork.ExpectAudioRendition("foo", "English", MayAutoSelect, false);
fork.ExpectAudioRendition("foo", "English", HasStableRenditionId,
- absl::nullopt);
- fork.ExpectAudioRenditionGroup("foo", HasDefaultRendition, absl::nullopt);
+ std::nullopt);
+ fork.ExpectAudioRenditionGroup("foo", HasDefaultRendition, std::nullopt);
fork.ExpectOk();
// Two EXT-X-MEDIA tags in the same group may not have the same name
diff --git a/media/formats/hls/playlist.cc b/media/formats/hls/playlist.cc
index 82487c0..e06658e 100644
--- a/media/formats/hls/playlist.cc
+++ b/media/formats/hls/playlist.cc
@@ -24,8 +24,8 @@
// static
ParseStatus::Or<Playlist::Identification> Playlist::IdentifyPlaylist(
base::StringPiece source) {
- absl::optional<Kind> playlist_kind;
- absl::optional<XVersionTag> version_tag;
+ std::optional<Kind> playlist_kind;
+ std::optional<XVersionTag> version_tag;
// Iterate through playlist lines until we can identify the version and the
// playlist kind.
diff --git a/media/formats/hls/playlist_common.cc b/media/formats/hls/playlist_common.cc
index af1f493..719ce38 100644
--- a/media/formats/hls/playlist_common.cc
+++ b/media/formats/hls/playlist_common.cc
@@ -53,8 +53,8 @@
// unrecognized tags.
}
-absl::optional<ParseStatus> ParseCommonTag(TagItem tag,
- CommonParserState* state) {
+std::optional<ParseStatus> ParseCommonTag(TagItem tag,
+ CommonParserState* state) {
DCHECK(tag.GetName() && GetTagKind(*tag.GetName()) == TagKind::kCommonTag);
switch (static_cast<CommonTagName>(*tag.GetName())) {
@@ -110,7 +110,7 @@
}
}
- return absl::nullopt;
+ return std::nullopt;
}
ParseStatus::Or<GURL> ParseUri(
diff --git a/media/formats/hls/playlist_common.h b/media/formats/hls/playlist_common.h
index ae688a4..6041c6f 100644
--- a/media/formats/hls/playlist_common.h
+++ b/media/formats/hls/playlist_common.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_FORMATS_HLS_PLAYLIST_COMMON_H_
#define MEDIA_FORMATS_HLS_PLAYLIST_COMMON_H_
+#include <optional>
#include <utility>
#include "base/memory/raw_ptr.h"
@@ -13,15 +14,14 @@
#include "media/formats/hls/tags.h"
#include "media/formats/hls/types.h"
#include "media/formats/hls/variable_dictionary.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace media::hls {
// State common to parsing both multivariant and media playlists.
struct CommonParserState {
- absl::optional<XVersionTag> version_tag;
- absl::optional<XIndependentSegmentsTag> independent_segments_tag;
+ std::optional<XVersionTag> version_tag;
+ std::optional<XIndependentSegmentsTag> independent_segments_tag;
// The dictionary for variables defined in the current playlist.
VariableDictionary variable_dict;
@@ -32,7 +32,7 @@
raw_ptr<const VariableDictionary> parent_variable_dict = nullptr;
// Checks that the versions given by `expected_version` and `version_tag`
- // match. If `version_tag` is `absl::nullopt`, the version given is implicitly
+ // match. If `version_tag` is `std::nullopt`, the version given is implicitly
// `Playlist::kDefaultVersion`.
bool CheckVersion(types::DecimalInteger expected_version) const;
};
@@ -45,14 +45,14 @@
void HandleUnknownTag(TagItem);
// Handles parsing for tags that may appear in multivariant or media playlists.
-absl::optional<ParseStatus> ParseCommonTag(TagItem, CommonParserState* state);
+std::optional<ParseStatus> ParseCommonTag(TagItem, CommonParserState* state);
// Attempts to parse a tag from the given item, ensuring it has not been
// already appeared in the playlist.
template <typename T, typename... Args>
-absl::optional<ParseStatus> ParseUniqueTag(TagItem tag,
- absl::optional<T>& out,
- Args&&... args) {
+std::optional<ParseStatus> ParseUniqueTag(TagItem tag,
+ std::optional<T>& out,
+ Args&&... args) {
DCHECK(tag.GetName() == ToTagName(T::kName));
// Ensure this tag has not already appeared.
@@ -65,7 +65,7 @@
return std::move(tag_result).error();
out = std::move(tag_result).value();
- return absl::nullopt;
+ return std::nullopt;
}
ParseStatus::Or<GURL> ParseUri(UriItem item,
diff --git a/media/formats/hls/rendition_manager.cc b/media/formats/hls/rendition_manager.cc
index ab33ebd..c7aec75 100644
--- a/media/formats/hls/rendition_manager.cc
+++ b/media/formats/hls/rendition_manager.cc
@@ -280,7 +280,7 @@
std::optional<RenditionManager::VariantID>
RenditionManager::SelectBestVariant() {
- std::optional<VariantID> best = absl::nullopt;
+ std::optional<VariantID> best = std::nullopt;
if (selectable_variants_.size()) {
// If there is at least one thing in the list, then consider the lowest
// quality entry to be selectable, even if poor performance would otherwise
@@ -357,7 +357,7 @@
return id;
}
- return absl::nullopt;
+ return std::nullopt;
}
std::optional<RenditionManager::RenditionID>
@@ -368,7 +368,7 @@
// If there are no renditions attached to this variant, then select nothing.
if (!variant.audio_renditions.size() || !variant.audio_rendition_group) {
- return absl::nullopt;
+ return std::nullopt;
}
if (!maybe_rendition.has_value()) {
@@ -384,7 +384,7 @@
// Because there is no selected rendition, there is no language default
// to consider. This should change if we can get a system default language.
// Also, we should only be considering auto-selectable renditions.
- return SelectRenditionBasedOnLanguage(variant, absl::nullopt, true);
+ return SelectRenditionBasedOnLanguage(variant, std::nullopt, true);
}
// The user did select a rendition, but it's possible that a user could, say
@@ -413,7 +413,7 @@
return id;
}
}
- return absl::nullopt;
+ return std::nullopt;
}
} // namespace media::hls
diff --git a/media/formats/hls/rendition_manager.h b/media/formats/hls/rendition_manager.h
index 2599dd0..7bd713c 100644
--- a/media/formats/hls/rendition_manager.h
+++ b/media/formats/hls/rendition_manager.h
@@ -6,6 +6,7 @@
#define MEDIA_FORMATS_HLS_RENDITION_MANAGER_H_
#include <deque>
+#include <optional>
#include <set>
#include <string>
#include <vector>
@@ -22,7 +23,6 @@
#include "media/base/limits.h"
#include "media/base/media_export.h"
#include "media/formats/hls/types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
#include "url/gurl.h"
diff --git a/media/formats/hls/rendition_manager_unittest.cc b/media/formats/hls/rendition_manager_unittest.cc
index c789de7..1207033 100644
--- a/media/formats/hls/rendition_manager_unittest.cc
+++ b/media/formats/hls/rendition_manager_unittest.cc
@@ -4,6 +4,8 @@
#include "media/formats/hls/rendition_manager.h"
+#include <optional>
+
#include "base/logging.h"
#include "base/test/gmock_callback_support.h"
#include "media/base/media_util.h"
@@ -13,7 +15,6 @@
#include "media/formats/hls/types.h"
#include "media/formats/hls/variant_stream.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media::hls {
@@ -606,7 +607,7 @@
// Unselect a preferred rendition, which switches back to english.
EXPECT_CALL(*this, VariantSelected("/video/800kbit.m3u8",
"/audio/stereo/en/128kbit.m3u8"));
- rm.SetPreferredAudioRendition(absl::nullopt);
+ rm.SetPreferredAudioRendition(std::nullopt);
}
} // namespace media::hls
diff --git a/media/formats/hls/segment_stream_unittest.cc b/media/formats/hls/segment_stream_unittest.cc
index f94b8e3..f1dcd74 100644
--- a/media/formats/hls/segment_stream_unittest.cc
+++ b/media/formats/hls/segment_stream_unittest.cc
@@ -4,6 +4,8 @@
#include "media/formats/hls/segment_stream.h"
+#include <optional>
+
#include "base/logging.h"
#include "base/test/gmock_callback_support.h"
#include "media/base/test_helpers.h"
@@ -12,7 +14,6 @@
#include "media/formats/hls/types.h"
#include "media/formats/hls/variant_stream.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media::hls {
diff --git a/media/formats/hls/tag_name.cc b/media/formats/hls/tag_name.cc
index ab2a683..3b22d1b 100644
--- a/media/formats/hls/tag_name.cc
+++ b/media/formats/hls/tag_name.cc
@@ -113,11 +113,11 @@
NOTREACHED_NORETURN();
}
-absl::optional<TagName> ParseTagName(base::StringPiece name) {
+std::optional<TagName> ParseTagName(base::StringPiece name) {
// Search for the tag name
const auto* match = kTagNames.find(name);
if (match == kTagNames.end()) {
- return absl::nullopt;
+ return std::nullopt;
}
return match->second;
diff --git a/media/formats/hls/tag_name.h b/media/formats/hls/tag_name.h
index 074c036..2cb803be 100644
--- a/media/formats/hls/tag_name.h
+++ b/media/formats/hls/tag_name.h
@@ -6,10 +6,10 @@
#define MEDIA_FORMATS_HLS_TAG_NAME_H_
#include <cstdint>
+#include <optional>
#include "base/strings/string_piece.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media::hls {
@@ -110,8 +110,8 @@
}
// Parses the tag name, converting it to one of the `*TagName` enum values.
-// If the tag is not recognized, returns `absl::nullopt`.
-MEDIA_EXPORT absl::optional<TagName> ParseTagName(base::StringPiece name);
+// If the tag is not recognized, returns `std::nullopt`.
+MEDIA_EXPORT std::optional<TagName> ParseTagName(base::StringPiece name);
// Prints the corresponding string representation of the given `TagName`.
MEDIA_EXPORT base::StringPiece TagNameToString(TagName name);
diff --git a/media/formats/hls/tags.cc b/media/formats/hls/tags.cc
index 6edb949..4ebb575e 100644
--- a/media/formats/hls/tags.cc
+++ b/media/formats/hls/tags.cc
@@ -347,7 +347,7 @@
// static
XDefineTag XDefineTag::CreateImport(types::VariableName name) {
- return XDefineTag{.name = name, .value = absl::nullopt};
+ return XDefineTag{.name = name, .value = std::nullopt};
}
// static
@@ -524,7 +524,7 @@
}
// Parse the 'URI' attribute
- absl::optional<ResolvedSourceString> uri;
+ std::optional<ResolvedSourceString> uri;
if (map.HasValue(XMediaTagAttribute::kUri)) {
// This attribute MUST NOT be defined for closed-captions renditions
if (type == MediaType::kClosedCaptions) {
@@ -547,7 +547,7 @@
}
// Parse the 'GROUP-ID' attribute
- absl::optional<ResolvedSourceString> group_id;
+ std::optional<ResolvedSourceString> group_id;
if (map.HasValue(XMediaTagAttribute::kGroupId)) {
auto result = types::ParseQuotedString(
map.GetValue(XMediaTagAttribute::kGroupId), variable_dict, sub_buffer);
@@ -562,7 +562,7 @@
}
// Parse the 'LANGUAGE' attribute
- absl::optional<ResolvedSourceString> language;
+ std::optional<ResolvedSourceString> language;
if (map.HasValue(XMediaTagAttribute::kLanguage)) {
auto result = types::ParseQuotedString(
map.GetValue(XMediaTagAttribute::kLanguage), variable_dict, sub_buffer);
@@ -575,7 +575,7 @@
}
// Parse the 'ASSOC-LANGUAGE' attribute
- absl::optional<ResolvedSourceString> assoc_language;
+ std::optional<ResolvedSourceString> assoc_language;
if (map.HasValue(XMediaTagAttribute::kAssocLanguage)) {
auto result = types::ParseQuotedString(
map.GetValue(XMediaTagAttribute::kAssocLanguage), variable_dict,
@@ -589,7 +589,7 @@
}
// Parse the 'NAME' attribute
- absl::optional<ResolvedSourceString> name;
+ std::optional<ResolvedSourceString> name;
if (map.HasValue(XMediaTagAttribute::kName)) {
auto result = types::ParseQuotedString(
map.GetValue(XMediaTagAttribute::kName), variable_dict, sub_buffer);
@@ -604,7 +604,7 @@
}
// Parse the 'STABLE-RENDITION-ID' attribute
- absl::optional<types::StableId> stable_rendition_id;
+ std::optional<types::StableId> stable_rendition_id;
if (map.HasValue(XMediaTagAttribute::kStableRenditionId)) {
auto result = types::ParseQuotedString(
map.GetValue(XMediaTagAttribute::kStableRenditionId),
@@ -651,7 +651,7 @@
}
// Parse the 'INSTREAM-ID' attribute
- absl::optional<types::InstreamId> instream_id;
+ std::optional<types::InstreamId> instream_id;
if (map.HasValue(XMediaTagAttribute::kInstreamId)) {
// The INSTREAM-ID attribute MUST NOT be present unless TYPE=CLOSED-CAPTIONS
if (type != MediaType::kClosedCaptions) {
@@ -697,7 +697,7 @@
}
// Parse the 'CHANNELS' attribute
- absl::optional<types::AudioChannels> channels;
+ std::optional<types::AudioChannels> channels;
if (map.HasValue(XMediaTagAttribute::kChannels)) {
// Currently only supported type with channel information is `kAudio`.
if (type == MediaType::kAudio) {
@@ -989,7 +989,7 @@
.AddCause(std::move(map_result));
}
- absl::optional<ResolvedSourceString> uri;
+ std::optional<ResolvedSourceString> uri;
if (map.HasValue(XMapTagAttribute::kUri)) {
auto result = types::ParseQuotedString(map.GetValue(XMapTagAttribute::kUri),
variable_dict, sub_buffer);
@@ -1003,7 +1003,7 @@
return ParseStatusCode::kMalformedTag;
}
- absl::optional<types::ByteRangeExpression> byte_range;
+ std::optional<types::ByteRangeExpression> byte_range;
if (map.HasValue(XMapTagAttribute::kByteRange)) {
auto result =
types::ParseQuotedString(map.GetValue(XMapTagAttribute::kByteRange),
@@ -1045,7 +1045,7 @@
}
// Parse the 'URI' attribute
- absl::optional<ResolvedSourceString> uri;
+ std::optional<ResolvedSourceString> uri;
if (map.HasValue(XPartTagAttribute::kUri)) {
auto uri_result = types::ParseQuotedString(
map.GetValue(XPartTagAttribute::kUri), variable_dict, sub_buffer);
@@ -1078,7 +1078,7 @@
}
// Parse the 'BYTERANGE' attribute
- absl::optional<types::ByteRangeExpression> byte_range;
+ std::optional<types::ByteRangeExpression> byte_range;
if (map.HasValue(XPartTagAttribute::kByteRange)) {
auto result =
types::ParseQuotedString(map.GetValue(XPartTagAttribute::kByteRange),
@@ -1193,7 +1193,7 @@
}
// Extract the 'CAN-SKIP-UNTIL' attribute
- absl::optional<base::TimeDelta> can_skip_until;
+ std::optional<base::TimeDelta> can_skip_until;
if (map.HasValue(XServerControlTagAttribute::kCanSkipUntil)) {
auto result = types::ParseDecimalFloatingPoint(
map.GetValue(XServerControlTagAttribute::kCanSkipUntil)
@@ -1227,7 +1227,7 @@
}
// Extract the 'HOLD-BACK' attribute
- absl::optional<base::TimeDelta> hold_back;
+ std::optional<base::TimeDelta> hold_back;
if (map.HasValue(XServerControlTagAttribute::kHoldBack)) {
auto result = types::ParseDecimalFloatingPoint(
map.GetValue(XServerControlTagAttribute::kHoldBack)
@@ -1246,7 +1246,7 @@
}
// Extract the 'PART-HOLD-BACK' attribute
- absl::optional<base::TimeDelta> part_hold_back;
+ std::optional<base::TimeDelta> part_hold_back;
if (map.HasValue(XServerControlTagAttribute::kPartHoldBack)) {
auto result = types::ParseDecimalFloatingPoint(
map.GetValue(XServerControlTagAttribute::kPartHoldBack)
diff --git a/media/formats/hls/tags.h b/media/formats/hls/tags.h
index 1ce5dca..032824c5 100644
--- a/media/formats/hls/tags.h
+++ b/media/formats/hls/tags.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_FORMATS_HLS_TAGS_H_
#define MEDIA_FORMATS_HLS_TAGS_H_
+#include <optional>
#include <string>
#include <vector>
@@ -15,7 +16,6 @@
#include "media/formats/hls/tag_name.h"
#include "media/formats/hls/types.h"
#include "media/formats/hls/variable_dictionary.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media::hls {
@@ -47,7 +47,7 @@
// The value of the variable. If this is `nullopt`, then the value
// is being IMPORT-ed and must be defined in the parent playlist.
- absl::optional<base::StringPiece> value;
+ std::optional<base::StringPiece> value;
};
// Represents the contents of the #EXT-X-INDEPENDENT-SEGMENTS tag
@@ -97,22 +97,22 @@
// of any associated variants, and the absence of this value for `kAudio`
// indicates that the media data is included in every video rendition of any
// associated variants.
- absl::optional<ResolvedSourceString> uri;
+ std::optional<ResolvedSourceString> uri;
// For renditions with type `kClosedCaptions`, this specifies a rendition
// within the segments of an associated media playlist. For all other types
// this will be empty.
- absl::optional<types::InstreamId> instream_id;
+ std::optional<types::InstreamId> instream_id;
// Indicates the group to which this rendition belongs.
ResolvedSourceString group_id;
// This identifies the primary language used in the rendition.
- absl::optional<ResolvedSourceString> language;
+ std::optional<ResolvedSourceString> language;
// This identifies a language that is associated with the rendition, in a
// different role than `language`.
- absl::optional<ResolvedSourceString> associated_language;
+ std::optional<ResolvedSourceString> associated_language;
// A human-readable description of this rendition.
ResolvedSourceString name;
@@ -120,7 +120,7 @@
// A stable identifier for the URI of this rendition within a multivariant
// playlist. All renditions with the same URI SHOULD use the same
// stable-rendition-id.
- absl::optional<types::StableId> stable_rendition_id;
+ std::optional<types::StableId> stable_rendition_id;
// Indicates whether the client should play this rendition in the absence of
// information from the user indicating a different choice.
@@ -141,7 +141,7 @@
// Contains channel information for this rendition. The only type with channel
// information currently defined is `kAudio`, others are ignored for
// forward-compatibility.
- absl::optional<types::AudioChannels> channels;
+ std::optional<types::AudioChannels> channels;
};
// Represents the contents of the #EXT-X-STREAM-INF tag
@@ -165,12 +165,12 @@
// The average segment bitrate of the stream this tag applies to, in bits per
// second.
- absl::optional<types::DecimalInteger> average_bandwidth;
+ std::optional<types::DecimalInteger> average_bandwidth;
// An abstract, relative measure of the quality-of-experience of the stream
// this tag applies to. The determination of this number is up to the playlist
// author, however higher scores must indicate a better playback experience.
- absl::optional<types::DecimalFloatingPoint> score;
+ std::optional<types::DecimalFloatingPoint> score;
// A list of formats, where each format specifies a media
// sample type that is present is one or more renditions of the variant stream
@@ -178,22 +178,22 @@
// every instance of this tag, but in practice it's not. It's represented as
// optional here so that the caller may decide how they wish to handle its
// absence.
- absl::optional<std::vector<std::string>> codecs;
+ std::optional<std::vector<std::string>> codecs;
// The optimal pixel resolution at which to display all video in this variant
// stream.
- absl::optional<types::DecimalResolution> resolution;
+ std::optional<types::DecimalResolution> resolution;
// This describes the maximum framerate for all video in this variant stream.
- absl::optional<types::DecimalFloatingPoint> frame_rate;
+ std::optional<types::DecimalFloatingPoint> frame_rate;
// The id of an audio rendition group that should be used when playing this
// variant.
- absl::optional<ResolvedSourceString> audio;
+ std::optional<ResolvedSourceString> audio;
// The id of a video rendition group that should be used when playing this
// variant.
- absl::optional<ResolvedSourceString> video;
+ std::optional<ResolvedSourceString> video;
};
// Represents the contents of the #EXTINF tag
@@ -275,7 +275,7 @@
// This specifies a byte range into the resource containing the media
// initialization section.
- absl::optional<types::ByteRangeExpression> byte_range;
+ std::optional<types::ByteRangeExpression> byte_range;
};
// Represents the contents of the #EXT-X-MEDIA-SEQUENCE tag.
@@ -306,7 +306,7 @@
// If this partial segment is a subrange of its resource, this defines the
// subrange.
- absl::optional<types::ByteRangeExpression> byte_range;
+ std::optional<types::ByteRangeExpression> byte_range;
// Whether the partial segment contains an independent frame.
bool independent = false;
@@ -351,7 +351,7 @@
// This value (given by the 'CAN-SKIP-UNTIL' attribute) represents the
// distance from the last media segment that the server is able
// to produce a playlist delta update.
- absl::optional<base::TimeDelta> skip_boundary;
+ std::optional<base::TimeDelta> skip_boundary;
// This indicates whether the server supports skipping EXT-X-DATERANGE tags
// older than the skip boundary when producing playlist delta updates.
@@ -360,13 +360,13 @@
// This indicates the distance from the end of the playlist
// at which clients should begin playback. This MUST be at least three times
// the playlist's target duration.
- absl::optional<base::TimeDelta> hold_back;
+ std::optional<base::TimeDelta> hold_back;
// This indicates the distance from the end of the playlist
// at which clients should begin playback when playing in low-latency mode.
// This value MUST be at least twice the playlist's partial segment target
// duration, and SHOULD be at least three times that.
- absl::optional<base::TimeDelta> part_hold_back;
+ std::optional<base::TimeDelta> part_hold_back;
// This indicates whether the server supports blocking playlist reloads.
bool can_block_reload = false;
diff --git a/media/formats/hls/tags_unittest.cc b/media/formats/hls/tags_unittest.cc
index 1222033f..534f420f 100644
--- a/media/formats/hls/tags_unittest.cc
+++ b/media/formats/hls/tags_unittest.cc
@@ -5,6 +5,7 @@
#include "media/formats/hls/tags.h"
#include <array>
+#include <optional>
#include <utility>
#include "base/location.h"
@@ -18,7 +19,6 @@
#include "media/formats/hls/test_util.h"
#include "media/formats/hls/variable_dictionary.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace media::hls {
@@ -32,7 +32,7 @@
}
template <typename T>
-void ErrorTest(absl::optional<base::StringPiece> content,
+void ErrorTest(std::optional<base::StringPiece> content,
ParseStatusCode expected_status,
const base::Location& from = base::Location::Current()) {
auto tag = content ? TagItem::Create(ToTagName(T::kName),
@@ -45,7 +45,7 @@
}
template <typename T>
-void ErrorTest(absl::optional<base::StringPiece> content,
+void ErrorTest(std::optional<base::StringPiece> content,
const VariableDictionary& variable_dict,
VariableDictionary::SubstitutionBuffer& sub_buffer,
ParseStatusCode expected_status,
@@ -69,7 +69,7 @@
};
template <typename T>
-OkTestResult<T> OkTest(absl::optional<std::string> content,
+OkTestResult<T> OkTest(std::optional<std::string> content,
const base::Location& from = base::Location::Current()) {
std::unique_ptr<std::string> source =
content ? std::make_unique<std::string>(std::move(*content)) : nullptr;
@@ -83,7 +83,7 @@
}
template <typename T>
-OkTestResult<T> OkTest(absl::optional<std::string> content,
+OkTestResult<T> OkTest(std::optional<std::string> content,
const VariableDictionary& variable_dict,
VariableDictionary::SubstitutionBuffer& sub_buffer,
const base::Location& from = base::Location::Current()) {
@@ -109,7 +109,7 @@
void RunTagIdenficationTest(
TagName name,
base::StringPiece line,
- absl::optional<base::StringPiece> expected_content,
+ std::optional<base::StringPiece> expected_content,
const base::Location& from = base::Location::Current()) {
auto iter = SourceLineIterator(line);
auto item_result = GetNextLineItem(&iter);
@@ -129,7 +129,7 @@
template <typename T>
void RunTagIdenficationTest(
base::StringPiece line,
- absl::optional<base::StringPiece> expected_content,
+ std::optional<base::StringPiece> expected_content,
const base::Location& from = base::Location::Current()) {
RunTagIdenficationTest(ToTagName(T::kName), line, expected_content, from);
}
@@ -138,7 +138,7 @@
template <typename T>
void RunEmptyTagTest() {
// Empty content is the only allowed content
- OkTest<T>(absl::nullopt);
+ OkTest<T>(std::nullopt);
// Test with non-empty content
ErrorTest<T>("", ParseStatusCode::kMalformedTag);
@@ -154,7 +154,7 @@
template <typename T>
void RunDecimalIntegerTagTest(types::DecimalInteger T::*field) {
// Content is required
- ErrorTest<T>(absl::nullopt, ParseStatusCode::kMalformedTag);
+ ErrorTest<T>(std::nullopt, ParseStatusCode::kMalformedTag);
ErrorTest<T>("", ParseStatusCode::kMalformedTag);
// Content must be a valid decimal-integer
@@ -207,7 +207,7 @@
}
TEST(HlsTagsTest, ParseM3uTag) {
- RunTagIdenficationTest<M3uTag>("#EXTM3U\n", absl::nullopt);
+ RunTagIdenficationTest<M3uTag>("#EXTM3U\n", std::nullopt);
RunEmptyTagTest<M3uTag>();
}
@@ -243,7 +243,7 @@
EXPECT_EQ(result.tag.value.value(), "");
// Empty content is not allowed
- ErrorTest<XDefineTag>(absl::nullopt, ParseStatusCode::kMalformedTag);
+ ErrorTest<XDefineTag>(std::nullopt, ParseStatusCode::kMalformedTag);
ErrorTest<XDefineTag>("", ParseStatusCode::kMalformedTag);
// NAME and IMPORT are NOT allowed
@@ -273,7 +273,7 @@
TEST(HlsTagsTest, ParseXIndependentSegmentsTag) {
RunTagIdenficationTest<XIndependentSegmentsTag>(
- "#EXT-X-INDEPENDENT-SEGMENTS\n", absl::nullopt);
+ "#EXT-X-INDEPENDENT-SEGMENTS\n", std::nullopt);
RunEmptyTagTest<XIndependentSegmentsTag>();
}
@@ -316,7 +316,7 @@
EXPECT_EQ(result.tag.version, 99999u);
// Test invalid versions
- ErrorTest<XVersionTag>(absl::nullopt, ParseStatusCode::kMalformedTag);
+ ErrorTest<XVersionTag>(std::nullopt, ParseStatusCode::kMalformedTag);
ErrorTest<XVersionTag>("", ParseStatusCode::kMalformedTag);
ErrorTest<XVersionTag>("0", ParseStatusCode::kInvalidPlaylistVersion);
ErrorTest<XVersionTag>("-1", ParseStatusCode::kMalformedTag);
@@ -355,7 +355,7 @@
EXPECT_TRUE(variable_dict.Insert(CreateVarName("YEAH"), "{$YES}"));
EXPECT_TRUE(variable_dict.Insert(CreateVarName("SRVC"), "SERVICE"));
- ErrorTest<XMediaTag>(absl::nullopt, variable_dict, sub_buffer,
+ ErrorTest<XMediaTag>(std::nullopt, variable_dict, sub_buffer,
ParseStatusCode::kMalformedTag);
ErrorTest<XMediaTag>("", variable_dict, sub_buffer,
ParseStatusCode::kMalformedTag);
@@ -377,34 +377,34 @@
auto result = OkTest<XMediaTag>("TYPE=AUDIO,GROUP-ID=\"group\",NAME=\"name\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
result = OkTest<XMediaTag>("TYPE=VIDEO,GROUP-ID=\"group\",NAME=\"name\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kVideo);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The URI attribute is REQUIRED if TYPE=SUBTITLES
ErrorTest<XMediaTag>("TYPE=SUBTITLES,GROUP-ID=\"group\",NAME=\"name\"",
@@ -416,16 +416,16 @@
EXPECT_EQ(result.tag.type, MediaType::kSubtitles);
EXPECT_EQ(result.tag.uri->Str(), "foo.m3u8");
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The URI attribute MUST NOT be present if TYPE=CLOSED-CAPTIONS
ErrorTest<XMediaTag>(
@@ -449,16 +449,16 @@
EXPECT_EQ(result.tag.type, MediaType::kAudio);
EXPECT_EQ(result.tag.uri->Str(), "foo.m3u8");
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The URI attribute is subject to variable substitution
result = OkTest<XMediaTag>(
@@ -467,16 +467,16 @@
EXPECT_EQ(result.tag.type, MediaType::kAudio);
EXPECT_EQ(result.tag.uri->Str(), "bar.m3u8");
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The GROUP-ID attribute is REQUIRED, and must be a valid quoted-string
ErrorTest<XMediaTag>("TYPE=AUDIO,NAME=\"name\"", variable_dict, sub_buffer,
@@ -493,18 +493,18 @@
result = OkTest<XMediaTag>("TYPE=AUDIO,GROUP-ID=\"foo{$FOO}\",NAME=\"name\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "foobar");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The LANGUAGE attribute must be a valid quoted-string
ErrorTest<XMediaTag>(
@@ -521,38 +521,38 @@
"TYPE=AUDIO,GROUP-ID=\"group\",NAME=\"name\",LANGUAGE=\"en\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
ASSERT_TRUE(result.tag.language.has_value());
EXPECT_EQ(result.tag.language->Str(), "en");
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The LANGUAGE attribute is subject to variable substitution
result = OkTest<XMediaTag>(
"TYPE=AUDIO,GROUP-ID=\"group\",NAME=\"name\",LANGUAGE=\"{$FOO}\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
ASSERT_TRUE(result.tag.language.has_value());
EXPECT_EQ(result.tag.language->Str(), "bar");
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The ASSOC-LANGUAGE attribute must be a valid quoted-string
ErrorTest<XMediaTag>(
@@ -569,38 +569,38 @@
"TYPE=AUDIO,GROUP-ID=\"group\",NAME=\"name\",ASSOC-LANGUAGE=\"en\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
ASSERT_TRUE(result.tag.associated_language.has_value());
EXPECT_EQ(result.tag.associated_language->Str(), "en");
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The ASSOC-LANGUAGE attribute is subject to variable substitution
result = OkTest<XMediaTag>(
"TYPE=AUDIO,GROUP-ID=\"group\",NAME=\"name\",ASSOC-LANGUAGE=\"{$FOO}\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
ASSERT_TRUE(result.tag.associated_language.has_value());
EXPECT_EQ(result.tag.associated_language->Str(), "bar");
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// LANGUAGE and ASSOC-LANGUAGE are not mutually exclusive
result = OkTest<XMediaTag>(
@@ -608,20 +608,20 @@
"LANGUAGE=\"bar\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
ASSERT_TRUE(result.tag.language.has_value());
EXPECT_EQ(result.tag.language->Str(), "foo");
ASSERT_TRUE(result.tag.associated_language.has_value());
EXPECT_EQ(result.tag.associated_language->Str(), "bar");
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The NAME attribute is REQUIRED, and must be a valid quoted-string
ErrorTest<XMediaTag>("TYPE=AUDIO,GROUP-ID=\"group\"", variable_dict,
@@ -638,18 +638,18 @@
result = OkTest<XMediaTag>("TYPE=AUDIO,GROUP-ID=\"group\",NAME=\"foo{$FOO}\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "foobar");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The STABLE-RENDITION-ID attribute must be a valid quoted-string containing
// a valid StableId
@@ -672,19 +672,19 @@
"\"abcABC123+/=.-_\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
ASSERT_TRUE(result.tag.stable_rendition_id.has_value());
EXPECT_EQ(result.tag.stable_rendition_id->Str(), "abcABC123+/=.-_");
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// STABLE-RENDITION-ID is subject to variable substitution
result = OkTest<XMediaTag>(
@@ -692,19 +692,19 @@
"FOO}\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
ASSERT_TRUE(result.tag.stable_rendition_id.has_value());
EXPECT_EQ(result.tag.stable_rendition_id->Str(), "foobar");
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The DEFAULT attribute must equal 'YES' to evaluate as true. Other values
// are ignored, and it is not subject to variable substitution.
@@ -713,36 +713,36 @@
"TYPE=AUDIO,GROUP-ID=\"group\",NAME=\"name\",DEFAULT=" + x,
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
}
result = OkTest<XMediaTag>(
"TYPE=AUDIO,GROUP-ID=\"group\",NAME=\"name\",DEFAULT=YES", variable_dict,
sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, true);
EXPECT_EQ(result.tag.autoselect, true); // DEFAULT=YES implies AUTOSELECT=YES
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The AUTOSELECT attribute must equal 'YES' to evaluate as true. Other values
// are ignored, and it is not subject to variable substitution.
@@ -751,36 +751,36 @@
"TYPE=AUDIO,GROUP-ID=\"group\",NAME=\"name\",AUTOSELECT=" + x,
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
}
result = OkTest<XMediaTag>(
"TYPE=AUDIO,GROUP-ID=\"group\",NAME=\"name\",AUTOSELECT=YES",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, true);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// If DEFAULT=YES, then AUTOSELECT must be YES if present
ErrorTest<XMediaTag>(
@@ -790,18 +790,18 @@
"TYPE=AUDIO,GROUP-ID=\"group\",NAME=\"name\",DEFAULT=YES,AUTOSELECT=YES",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, true);
EXPECT_EQ(result.tag.autoselect, true);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The FORCED attribute may only appear when TYPE=SUBTITLES
ErrorTest<XMediaTag>(
@@ -823,16 +823,16 @@
ASSERT_TRUE(result.tag.uri.has_value());
EXPECT_EQ(result.tag.uri->Str(), "foo.m3u8");
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
}
result = OkTest<XMediaTag>(
@@ -843,16 +843,16 @@
ASSERT_TRUE(result.tag.uri.has_value());
EXPECT_EQ(result.tag.uri->Str(), "foo.m3u8");
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, true);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// INSTREAM-ID is REQUIRED when TYPE=CLOSED-CAPTIONS, and MUST NOT appear for
// any other type
@@ -872,12 +872,12 @@
"\"CC1\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kClosedCaptions);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
@@ -885,7 +885,7 @@
EXPECT_EQ(result.tag.instream_id->GetType(), types::InstreamId::Type::kCc);
EXPECT_EQ(result.tag.instream_id->GetNumber(), 1);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// INSTREAM-ID must be a valid quoted-string containing an InstreamId, and is
// subject to variable substitution.
@@ -905,12 +905,12 @@
"SRVC}32\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kClosedCaptions);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
@@ -919,7 +919,7 @@
types::InstreamId::Type::kService);
EXPECT_EQ(result.tag.instream_id->GetNumber(), 32);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The CHARACTERISTICS attribute must be a quoted-string containing a sequence
// of media characteristics tags It may not be empty, and is subject to
@@ -936,41 +936,41 @@
"baz\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 3u);
EXPECT_EQ(result.tag.characteristics[0], "foo");
EXPECT_EQ(result.tag.characteristics[1], "bar");
EXPECT_EQ(result.tag.characteristics[2], "baz");
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
result = OkTest<XMediaTag>(
"TYPE=AUDIO,GROUP-ID=\"group\",NAME=\"name\",CHARACTERISTICS=\"{$FOO},{$"
"BAR}\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 2u);
EXPECT_EQ(result.tag.characteristics[0], "bar");
EXPECT_EQ(result.tag.characteristics[1], "baz");
- EXPECT_EQ(result.tag.channels, absl::nullopt);
+ EXPECT_EQ(result.tag.channels, std::nullopt);
// The CHANNELS tag must be a non-empty quoted-string, and is subject to
// variable substitution. The only parameters that are recognized are for
@@ -998,16 +998,16 @@
"TYPE=AUDIO,GROUP-ID=\"group\",NAME=\"name\",CHANNELS=\"1\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
ASSERT_TRUE(result.tag.channels.has_value());
EXPECT_EQ(result.tag.channels->GetMaxChannels(), 1u);
@@ -1017,16 +1017,16 @@
"TYPE=AUDIO,GROUP-ID=\"group\",NAME=\"name\",CHANNELS=\"1/FOO,BAR,-\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
ASSERT_TRUE(result.tag.channels.has_value());
EXPECT_EQ(result.tag.channels->GetMaxChannels(), 1u);
@@ -1040,16 +1040,16 @@
"FOO,{$SRVC},-\"",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.type, MediaType::kAudio);
- EXPECT_EQ(result.tag.uri, absl::nullopt);
+ EXPECT_EQ(result.tag.uri, std::nullopt);
EXPECT_EQ(result.tag.group_id.Str(), "group");
- EXPECT_EQ(result.tag.language, absl::nullopt);
- EXPECT_EQ(result.tag.associated_language, absl::nullopt);
+ EXPECT_EQ(result.tag.language, std::nullopt);
+ EXPECT_EQ(result.tag.associated_language, std::nullopt);
EXPECT_EQ(result.tag.name.Str(), "name");
- EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
+ EXPECT_EQ(result.tag.stable_rendition_id, std::nullopt);
EXPECT_EQ(result.tag.is_default, false);
EXPECT_EQ(result.tag.autoselect, false);
EXPECT_EQ(result.tag.forced, false);
- EXPECT_EQ(result.tag.instream_id, absl::nullopt);
+ EXPECT_EQ(result.tag.instream_id, std::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
EXPECT_TRUE(result.tag.channels.has_value());
EXPECT_EQ(result.tag.channels->GetMaxChannels(), 1u);
@@ -1092,16 +1092,16 @@
ASSERT_TRUE(result.tag.codecs.has_value());
EXPECT_TRUE(
base::ranges::equal(result.tag.codecs.value(), std::array{"foo", "bar"}));
- EXPECT_EQ(result.tag.resolution, absl::nullopt);
- EXPECT_EQ(result.tag.frame_rate, absl::nullopt);
+ EXPECT_EQ(result.tag.resolution, std::nullopt);
+ EXPECT_EQ(result.tag.frame_rate, std::nullopt);
result = OkTest<XStreamInfTag>(
R"(BANDWIDTH=1010,RESOLUTION=1920x1080,FRAME-RATE=29.97)", variable_dict,
sub_buffer);
EXPECT_EQ(result.tag.bandwidth, 1010u);
- EXPECT_EQ(result.tag.average_bandwidth, absl::nullopt);
- EXPECT_EQ(result.tag.score, absl::nullopt);
- EXPECT_EQ(result.tag.codecs, absl::nullopt);
+ EXPECT_EQ(result.tag.average_bandwidth, std::nullopt);
+ EXPECT_EQ(result.tag.score, std::nullopt);
+ EXPECT_EQ(result.tag.codecs, std::nullopt);
ASSERT_TRUE(result.tag.resolution.has_value());
EXPECT_EQ(result.tag.resolution->width, 1920u);
EXPECT_EQ(result.tag.resolution->height, 1080u);
@@ -1111,13 +1111,13 @@
result =
OkTest<XStreamInfTag>(R"(BANDWIDTH=5050)", variable_dict, sub_buffer);
EXPECT_EQ(result.tag.bandwidth, 5050u);
- EXPECT_EQ(result.tag.average_bandwidth, absl::nullopt);
- EXPECT_EQ(result.tag.score, absl::nullopt);
- EXPECT_EQ(result.tag.codecs, absl::nullopt);
- EXPECT_EQ(result.tag.resolution, absl::nullopt);
- EXPECT_EQ(result.tag.frame_rate, absl::nullopt);
+ EXPECT_EQ(result.tag.average_bandwidth, std::nullopt);
+ EXPECT_EQ(result.tag.score, std::nullopt);
+ EXPECT_EQ(result.tag.codecs, std::nullopt);
+ EXPECT_EQ(result.tag.resolution, std::nullopt);
+ EXPECT_EQ(result.tag.frame_rate, std::nullopt);
- ErrorTest<XStreamInfTag>(absl::nullopt, variable_dict, sub_buffer,
+ ErrorTest<XStreamInfTag>(std::nullopt, variable_dict, sub_buffer,
ParseStatusCode::kMalformedTag);
ErrorTest<XStreamInfTag>("", variable_dict, sub_buffer,
ParseStatusCode::kMalformedTag);
@@ -1165,12 +1165,12 @@
result = OkTest<XStreamInfTag>(R"(BANDWIDTH=1010,CODECS="{$FOO},{$BAR}")",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.bandwidth, 1010u);
- EXPECT_EQ(result.tag.average_bandwidth, absl::nullopt);
- EXPECT_EQ(result.tag.score, absl::nullopt);
+ EXPECT_EQ(result.tag.average_bandwidth, std::nullopt);
+ EXPECT_EQ(result.tag.score, std::nullopt);
ASSERT_TRUE(result.tag.codecs.has_value());
EXPECT_TRUE(
base::ranges::equal(result.tag.codecs.value(), std::array{"bar", "baz"}));
- EXPECT_EQ(result.tag.resolution, absl::nullopt);
+ EXPECT_EQ(result.tag.resolution, std::nullopt);
// "RESOLUTION" must be a valid decimal-resolution
ErrorTest<XStreamInfTag>(R"(BANDWIDTH=1010,RESOLUTION=1920x)", variable_dict,
@@ -1198,10 +1198,10 @@
result = OkTest<XStreamInfTag>(R"(BANDWIDTH=1010,AUDIO="{$FOO}{$BAR}")",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.bandwidth, 1010u);
- EXPECT_EQ(result.tag.average_bandwidth, absl::nullopt);
- EXPECT_EQ(result.tag.score, absl::nullopt);
- EXPECT_EQ(result.tag.codecs, absl::nullopt);
- EXPECT_EQ(result.tag.resolution, absl::nullopt);
+ EXPECT_EQ(result.tag.average_bandwidth, std::nullopt);
+ EXPECT_EQ(result.tag.score, std::nullopt);
+ EXPECT_EQ(result.tag.codecs, std::nullopt);
+ EXPECT_EQ(result.tag.resolution, std::nullopt);
ASSERT_TRUE(result.tag.audio.has_value());
ASSERT_FALSE(result.tag.video.has_value());
EXPECT_EQ(result.tag.audio->Str(), "barbaz");
@@ -1218,10 +1218,10 @@
result = OkTest<XStreamInfTag>(R"(BANDWIDTH=1010,VIDEO="{$BAZ}{$FOO}")",
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.bandwidth, 1010u);
- EXPECT_EQ(result.tag.average_bandwidth, absl::nullopt);
- EXPECT_EQ(result.tag.score, absl::nullopt);
- EXPECT_EQ(result.tag.codecs, absl::nullopt);
- EXPECT_EQ(result.tag.resolution, absl::nullopt);
+ EXPECT_EQ(result.tag.average_bandwidth, std::nullopt);
+ EXPECT_EQ(result.tag.score, std::nullopt);
+ EXPECT_EQ(result.tag.codecs, std::nullopt);
+ EXPECT_EQ(result.tag.resolution, std::nullopt);
ASSERT_TRUE(result.tag.video.has_value());
ASSERT_FALSE(result.tag.audio.has_value());
EXPECT_EQ(result.tag.video->Str(), "foobar");
@@ -1261,7 +1261,7 @@
EXPECT_EQ(result.tag.title.Str(), "");
// Test some invalid tags
- ErrorTest<InfTag>(absl::nullopt, ParseStatusCode::kMalformedTag);
+ ErrorTest<InfTag>(std::nullopt, ParseStatusCode::kMalformedTag);
ErrorTest<InfTag>("", ParseStatusCode::kMalformedTag);
ErrorTest<InfTag>(",", ParseStatusCode::kMalformedTag);
ErrorTest<InfTag>("-123,", ParseStatusCode::kMalformedTag);
@@ -1284,7 +1284,7 @@
auto result = OkTest<XByteRangeTag>("12");
EXPECT_EQ(result.tag.range.length, 12u);
- EXPECT_EQ(result.tag.range.offset, absl::nullopt);
+ EXPECT_EQ(result.tag.range.offset, std::nullopt);
result = OkTest<XByteRangeTag>("12@34");
EXPECT_EQ(result.tag.range.length, 12u);
EXPECT_EQ(result.tag.range.offset, 34u);
@@ -1296,7 +1296,7 @@
ErrorTest<XByteRangeTag>(" 12@34", ParseStatusCode::kMalformedTag);
ErrorTest<XByteRangeTag>("12@34 ", ParseStatusCode::kMalformedTag);
ErrorTest<XByteRangeTag>("", ParseStatusCode::kMalformedTag);
- ErrorTest<XByteRangeTag>(absl::nullopt, ParseStatusCode::kMalformedTag);
+ ErrorTest<XByteRangeTag>(std::nullopt, ParseStatusCode::kMalformedTag);
}
TEST(HlsTagsTest, ParseXDateRangeTag) {
@@ -1309,7 +1309,7 @@
TEST(HlsTagsTest, ParseXDiscontinuityTag) {
RunTagIdenficationTest<XDiscontinuityTag>("#EXT-X-DISCONTINUITY\n",
- absl::nullopt);
+ std::nullopt);
RunEmptyTagTest<XDiscontinuityTag>();
}
@@ -1320,18 +1320,18 @@
}
TEST(HlsTagsTest, ParseXEndListTag) {
- RunTagIdenficationTest<XEndListTag>("#EXT-X-ENDLIST\n", absl::nullopt);
+ RunTagIdenficationTest<XEndListTag>("#EXT-X-ENDLIST\n", std::nullopt);
RunEmptyTagTest<XEndListTag>();
}
TEST(HlsTagsTest, ParseXGapTag) {
- RunTagIdenficationTest<XGapTag>("#EXT-X-GAP\n", absl::nullopt);
+ RunTagIdenficationTest<XGapTag>("#EXT-X-GAP\n", std::nullopt);
RunEmptyTagTest<XGapTag>();
}
TEST(HlsTagsTest, ParseXIFramesOnlyTag) {
RunTagIdenficationTest<XIFramesOnlyTag>("#EXT-X-I-FRAMES-ONLY\n",
- absl::nullopt);
+ std::nullopt);
RunEmptyTagTest<XIFramesOnlyTag>();
}
@@ -1352,7 +1352,7 @@
VariableDictionary::SubstitutionBuffer sub_buffer;
// The URI attribute is required
- ErrorTest<XMapTag>(absl::nullopt, variable_dict, sub_buffer,
+ ErrorTest<XMapTag>(std::nullopt, variable_dict, sub_buffer,
ParseStatusCode::kMalformedTag);
ErrorTest<XMapTag>("", variable_dict, sub_buffer,
ParseStatusCode::kMalformedTag);
@@ -1363,7 +1363,7 @@
auto result =
OkTest<XMapTag>("URI=\"foo.ts\",FUTURE=PROOF", variable_dict, sub_buffer);
EXPECT_EQ(result.tag.uri.Str(), "foo.ts");
- EXPECT_EQ(result.tag.byte_range, absl::nullopt);
+ EXPECT_EQ(result.tag.byte_range, std::nullopt);
// The URI attribute is subject to variable substitution
ErrorTest<XMapTag>("URI=\"{$UNDEFINED}.ts\"", variable_dict, sub_buffer,
@@ -1371,7 +1371,7 @@
result =
OkTest<XMapTag>("URI=\"{$FOO}_{$BAR}.ts\"", variable_dict, sub_buffer);
EXPECT_EQ(result.tag.uri.Str(), "bar_baz.ts");
- EXPECT_EQ(result.tag.byte_range, absl::nullopt);
+ EXPECT_EQ(result.tag.byte_range, std::nullopt);
// Test the BYTERANGE attribute
ErrorTest<XMapTag>("URI=\"foo.ts\",BYTERANGE=\"{$UNDEFINED}\"", variable_dict,
@@ -1382,7 +1382,7 @@
sub_buffer);
EXPECT_EQ(result.tag.uri.Str(), "foo.ts");
EXPECT_EQ(result.tag.byte_range->length, 10u);
- EXPECT_EQ(result.tag.byte_range->offset, absl::nullopt);
+ EXPECT_EQ(result.tag.byte_range->offset, std::nullopt);
// The BYTERANGE attribute is subject to variable substitution
result = OkTest<XMapTag>("URI=\"foo.ts\",BYTERANGE=\"{$ONE}{$TWO}@{$THREE}\"",
@@ -1406,7 +1406,7 @@
VariableDictionary::SubstitutionBuffer sub_buffer;
// The URI and DURATION attributes are required
- ErrorTest<XPartTag>(absl::nullopt, variable_dict, sub_buffer,
+ ErrorTest<XPartTag>(std::nullopt, variable_dict, sub_buffer,
ParseStatusCode::kMalformedTag);
ErrorTest<XPartTag>("", variable_dict, sub_buffer,
ParseStatusCode::kMalformedTag);
@@ -1420,7 +1420,7 @@
OkTest<XPartTag>("URI=\"foo.ts\",DURATION=1", variable_dict, sub_buffer);
EXPECT_EQ(result.tag.uri.Str(), "foo.ts");
EXPECT_EQ(result.tag.duration, base::Seconds(1));
- EXPECT_EQ(result.tag.byte_range, absl::nullopt);
+ EXPECT_EQ(result.tag.byte_range, std::nullopt);
EXPECT_EQ(result.tag.independent, false);
EXPECT_EQ(result.tag.gap, false);
@@ -1431,7 +1431,7 @@
sub_buffer);
EXPECT_EQ(result.tag.uri.Str(), "baz.ts");
EXPECT_EQ(result.tag.duration, base::Seconds(1));
- EXPECT_EQ(result.tag.byte_range, absl::nullopt);
+ EXPECT_EQ(result.tag.byte_range, std::nullopt);
EXPECT_EQ(result.tag.independent, false);
EXPECT_EQ(result.tag.gap, false);
@@ -1441,7 +1441,7 @@
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.uri.Str(), "foo.ts");
EXPECT_TRUE(RoughlyEqual(result.tag.duration, base::Seconds(MaxSeconds())));
- EXPECT_EQ(result.tag.byte_range, absl::nullopt);
+ EXPECT_EQ(result.tag.byte_range, std::nullopt);
EXPECT_EQ(result.tag.independent, false);
EXPECT_EQ(result.tag.gap, false);
ErrorTest<XPartTag>(
@@ -1459,7 +1459,7 @@
EXPECT_EQ(result.tag.uri.Str(), "foo.ts");
EXPECT_EQ(result.tag.duration, base::Seconds(1));
EXPECT_EQ(result.tag.byte_range->length, 12u);
- EXPECT_EQ(result.tag.byte_range->offset, absl::nullopt);
+ EXPECT_EQ(result.tag.byte_range->offset, std::nullopt);
EXPECT_EQ(result.tag.independent, false);
EXPECT_EQ(result.tag.gap, false);
@@ -1478,7 +1478,7 @@
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.uri.Str(), "foo.ts");
EXPECT_EQ(result.tag.duration, base::Seconds(1));
- EXPECT_EQ(result.tag.byte_range, absl::nullopt);
+ EXPECT_EQ(result.tag.byte_range, std::nullopt);
EXPECT_EQ(result.tag.independent, true);
EXPECT_EQ(result.tag.gap, false);
@@ -1487,7 +1487,7 @@
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.uri.Str(), "foo.ts");
EXPECT_EQ(result.tag.duration, base::Seconds(1));
- EXPECT_EQ(result.tag.byte_range, absl::nullopt);
+ EXPECT_EQ(result.tag.byte_range, std::nullopt);
EXPECT_EQ(result.tag.independent, false);
EXPECT_EQ(result.tag.gap, false);
}
@@ -1497,7 +1497,7 @@
sub_buffer);
EXPECT_EQ(result.tag.uri.Str(), "foo.ts");
EXPECT_EQ(result.tag.duration, base::Seconds(1));
- EXPECT_EQ(result.tag.byte_range, absl::nullopt);
+ EXPECT_EQ(result.tag.byte_range, std::nullopt);
EXPECT_EQ(result.tag.independent, false);
EXPECT_EQ(result.tag.gap, true);
@@ -1506,7 +1506,7 @@
variable_dict, sub_buffer);
EXPECT_EQ(result.tag.uri.Str(), "foo.ts");
EXPECT_EQ(result.tag.duration, base::Seconds(1));
- EXPECT_EQ(result.tag.byte_range, absl::nullopt);
+ EXPECT_EQ(result.tag.byte_range, std::nullopt);
EXPECT_EQ(result.tag.independent, false);
EXPECT_EQ(result.tag.gap, false);
}
@@ -1517,7 +1517,7 @@
"PART-TARGET=1.0");
// PART-TARGET is required, and must be a valid DecimalFloatingPoint
- ErrorTest<XPartInfTag>(absl::nullopt, ParseStatusCode::kMalformedTag);
+ ErrorTest<XPartInfTag>(std::nullopt, ParseStatusCode::kMalformedTag);
ErrorTest<XPartInfTag>("", ParseStatusCode::kMalformedTag);
ErrorTest<XPartInfTag>("1", ParseStatusCode::kMalformedTag);
ErrorTest<XPartInfTag>("PART-TARGET=-1", ParseStatusCode::kMalformedTag);
@@ -1563,7 +1563,7 @@
ErrorTest<XPlaylistTypeTag>(" EVENT", ParseStatusCode::kUnknownPlaylistType);
ErrorTest<XPlaylistTypeTag>("EVENT ", ParseStatusCode::kUnknownPlaylistType);
ErrorTest<XPlaylistTypeTag>("", ParseStatusCode::kMalformedTag);
- ErrorTest<XPlaylistTypeTag>(absl::nullopt, ParseStatusCode::kMalformedTag);
+ ErrorTest<XPlaylistTypeTag>(std::nullopt, ParseStatusCode::kMalformedTag);
}
TEST(HlsTagsTest, ParseXPreloadHintTag) {
@@ -1594,14 +1594,14 @@
"#EXT-X-SERVER-CONTROL:SKIP-UNTIL=10\n", "SKIP-UNTIL=10");
// Tag requires content
- ErrorTest<XServerControlTag>(absl::nullopt, ParseStatusCode::kMalformedTag);
+ ErrorTest<XServerControlTag>(std::nullopt, ParseStatusCode::kMalformedTag);
// Content is allowed to be empty
auto result = OkTest<XServerControlTag>("");
- EXPECT_EQ(result.tag.skip_boundary, absl::nullopt);
+ EXPECT_EQ(result.tag.skip_boundary, std::nullopt);
EXPECT_EQ(result.tag.can_skip_dateranges, false);
- EXPECT_EQ(result.tag.hold_back, absl::nullopt);
- EXPECT_EQ(result.tag.part_hold_back, absl::nullopt);
+ EXPECT_EQ(result.tag.hold_back, std::nullopt);
+ EXPECT_EQ(result.tag.part_hold_back, std::nullopt);
EXPECT_EQ(result.tag.can_block_reload, false);
result = OkTest<XServerControlTag>(
@@ -1623,8 +1623,8 @@
result = OkTest<XServerControlTag>("CAN-SKIP-UNTIL=5");
EXPECT_TRUE(RoughlyEqual(result.tag.skip_boundary, base::Seconds(5)));
EXPECT_EQ(result.tag.can_skip_dateranges, false);
- EXPECT_EQ(result.tag.hold_back, absl::nullopt);
- EXPECT_EQ(result.tag.part_hold_back, absl::nullopt);
+ EXPECT_EQ(result.tag.hold_back, std::nullopt);
+ EXPECT_EQ(result.tag.part_hold_back, std::nullopt);
EXPECT_EQ(result.tag.can_block_reload, false);
// Test max value
@@ -1633,8 +1633,8 @@
EXPECT_TRUE(
RoughlyEqual(result.tag.skip_boundary, base::Seconds(MaxSeconds())));
EXPECT_EQ(result.tag.can_skip_dateranges, false);
- EXPECT_EQ(result.tag.hold_back, absl::nullopt);
- EXPECT_EQ(result.tag.part_hold_back, absl::nullopt);
+ EXPECT_EQ(result.tag.hold_back, std::nullopt);
+ EXPECT_EQ(result.tag.part_hold_back, std::nullopt);
EXPECT_EQ(result.tag.can_block_reload, false);
ErrorTest<XServerControlTag>(
@@ -1648,8 +1648,8 @@
OkTest<XServerControlTag>("CAN-SKIP-DATERANGES=YES,CAN-SKIP-UNTIL=50");
EXPECT_TRUE(RoughlyEqual(result.tag.skip_boundary, base::Seconds(50)));
EXPECT_EQ(result.tag.can_skip_dateranges, true);
- EXPECT_EQ(result.tag.hold_back, absl::nullopt);
- EXPECT_EQ(result.tag.part_hold_back, absl::nullopt);
+ EXPECT_EQ(result.tag.hold_back, std::nullopt);
+ EXPECT_EQ(result.tag.part_hold_back, std::nullopt);
EXPECT_EQ(result.tag.can_block_reload, false);
// The only value that results in `true` is "YES"
@@ -1658,8 +1658,8 @@
",CAN-SKIP-UNTIL=50");
EXPECT_TRUE(RoughlyEqual(result.tag.skip_boundary, base::Seconds(50)));
EXPECT_EQ(result.tag.can_skip_dateranges, false);
- EXPECT_EQ(result.tag.hold_back, absl::nullopt);
- EXPECT_EQ(result.tag.part_hold_back, absl::nullopt);
+ EXPECT_EQ(result.tag.hold_back, std::nullopt);
+ EXPECT_EQ(result.tag.part_hold_back, std::nullopt);
EXPECT_EQ(result.tag.can_block_reload, false);
}
@@ -1671,19 +1671,19 @@
ParseStatusCode::kMalformedTag);
result = OkTest<XServerControlTag>("HOLD-BACK=50");
- EXPECT_EQ(result.tag.skip_boundary, absl::nullopt);
+ EXPECT_EQ(result.tag.skip_boundary, std::nullopt);
EXPECT_EQ(result.tag.can_skip_dateranges, false);
EXPECT_TRUE(RoughlyEqual(result.tag.hold_back, base::Seconds(50)));
- EXPECT_EQ(result.tag.part_hold_back, absl::nullopt);
+ EXPECT_EQ(result.tag.part_hold_back, std::nullopt);
EXPECT_EQ(result.tag.can_block_reload, false);
// Test max value
result = OkTest<XServerControlTag>("HOLD-BACK=" +
base::NumberToString(MaxSeconds()));
- EXPECT_EQ(result.tag.skip_boundary, absl::nullopt);
+ EXPECT_EQ(result.tag.skip_boundary, std::nullopt);
EXPECT_EQ(result.tag.can_skip_dateranges, false);
EXPECT_TRUE(RoughlyEqual(result.tag.hold_back, base::Seconds(MaxSeconds())));
- EXPECT_EQ(result.tag.part_hold_back, absl::nullopt);
+ EXPECT_EQ(result.tag.part_hold_back, std::nullopt);
EXPECT_EQ(result.tag.can_block_reload, false);
ErrorTest<XServerControlTag>(
"HOLD-BACK=" + base::NumberToString(MaxSeconds() + 1),
@@ -1698,18 +1698,18 @@
ParseStatusCode::kMalformedTag);
result = OkTest<XServerControlTag>("PART-HOLD-BACK=50");
- EXPECT_EQ(result.tag.skip_boundary, absl::nullopt);
+ EXPECT_EQ(result.tag.skip_boundary, std::nullopt);
EXPECT_EQ(result.tag.can_skip_dateranges, false);
- EXPECT_EQ(result.tag.hold_back, absl::nullopt);
+ EXPECT_EQ(result.tag.hold_back, std::nullopt);
EXPECT_EQ(result.tag.part_hold_back, base::Seconds(50));
EXPECT_EQ(result.tag.can_block_reload, false);
// Test max value
result = OkTest<XServerControlTag>("PART-HOLD-BACK=" +
base::NumberToString(MaxSeconds()));
- EXPECT_EQ(result.tag.skip_boundary, absl::nullopt);
+ EXPECT_EQ(result.tag.skip_boundary, std::nullopt);
EXPECT_EQ(result.tag.can_skip_dateranges, false);
- EXPECT_EQ(result.tag.hold_back, absl::nullopt);
+ EXPECT_EQ(result.tag.hold_back, std::nullopt);
EXPECT_TRUE(
RoughlyEqual(result.tag.part_hold_back, base::Seconds(MaxSeconds())));
EXPECT_EQ(result.tag.can_block_reload, false);
@@ -1720,18 +1720,18 @@
// The only value that results in `true` is "YES"
for (std::string x : {"NO", "Y", "TRUE", "1", "yes"}) {
result = OkTest<XServerControlTag>("CAN-BLOCK-RELOAD=" + x);
- EXPECT_EQ(result.tag.skip_boundary, absl::nullopt);
+ EXPECT_EQ(result.tag.skip_boundary, std::nullopt);
EXPECT_EQ(result.tag.can_skip_dateranges, false);
- EXPECT_EQ(result.tag.hold_back, absl::nullopt);
- EXPECT_EQ(result.tag.part_hold_back, absl::nullopt);
+ EXPECT_EQ(result.tag.hold_back, std::nullopt);
+ EXPECT_EQ(result.tag.part_hold_back, std::nullopt);
EXPECT_EQ(result.tag.can_block_reload, false);
}
result = OkTest<XServerControlTag>("CAN-BLOCK-RELOAD=YES");
- EXPECT_EQ(result.tag.skip_boundary, absl::nullopt);
+ EXPECT_EQ(result.tag.skip_boundary, std::nullopt);
EXPECT_EQ(result.tag.can_skip_dateranges, false);
- EXPECT_EQ(result.tag.hold_back, absl::nullopt);
- EXPECT_EQ(result.tag.part_hold_back, absl::nullopt);
+ EXPECT_EQ(result.tag.hold_back, std::nullopt);
+ EXPECT_EQ(result.tag.part_hold_back, std::nullopt);
EXPECT_EQ(result.tag.can_block_reload, true);
}
@@ -1742,7 +1742,7 @@
VariableDictionary variable_dict = CreateBasicDictionary();
VariableDictionary::SubstitutionBuffer sub_buffer;
- ErrorTest<XSkipTag>(absl::nullopt, variable_dict, sub_buffer,
+ ErrorTest<XSkipTag>(std::nullopt, variable_dict, sub_buffer,
ParseStatusCode::kMalformedTag);
ErrorTest<XSkipTag>("-1", variable_dict, sub_buffer,
ParseStatusCode::kMalformedTag);
@@ -1784,7 +1784,7 @@
"10");
// Content must be a valid decimal-integer
- ErrorTest<XTargetDurationTag>(absl::nullopt, ParseStatusCode::kMalformedTag);
+ ErrorTest<XTargetDurationTag>(std::nullopt, ParseStatusCode::kMalformedTag);
ErrorTest<XTargetDurationTag>("", ParseStatusCode::kMalformedTag);
ErrorTest<XTargetDurationTag>("-1", ParseStatusCode::kMalformedTag);
ErrorTest<XTargetDurationTag>("1.5", ParseStatusCode::kMalformedTag);
diff --git a/media/formats/hls/test_util.h b/media/formats/hls/test_util.h
index 6065d6a3..e335122 100644
--- a/media/formats/hls/test_util.h
+++ b/media/formats/hls/test_util.h
@@ -5,12 +5,13 @@
#ifndef MEDIA_FORMATS_HLS_TEST_UTIL_H_
#define MEDIA_FORMATS_HLS_TEST_UTIL_H_
+#include <optional>
+
#include "base/strings/string_piece.h"
#include "base/time/time.h"
#include "media/formats/hls/source_string.h"
#include "media/formats/hls/types.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media::hls {
@@ -39,17 +40,17 @@
}
inline testing::AssertionResult RoughlyEqual(
- absl::optional<base::TimeDelta> lhs,
- absl::optional<base::TimeDelta> rhs,
+ std::optional<base::TimeDelta> lhs,
+ std::optional<base::TimeDelta> rhs,
base::TimeDelta epsilon = base::Milliseconds(1)) {
if (!lhs.has_value() && !rhs.has_value()) {
return testing::AssertionSuccess();
}
if (lhs.has_value() && !rhs.has_value()) {
- return testing::AssertionFailure() << lhs.value() << " != absl::nullopt";
+ return testing::AssertionFailure() << lhs.value() << " != std::nullopt";
}
if (!lhs.has_value() && rhs.has_value()) {
- return testing::AssertionFailure() << "absl::nullopt != " << rhs.value();
+ return testing::AssertionFailure() << "std::nullopt != " << rhs.value();
}
return RoughlyEqual(lhs.value(), rhs.value(), epsilon);
diff --git a/media/formats/hls/types.cc b/media/formats/hls/types.cc
index 2c719f1..2076eedd 100644
--- a/media/formats/hls/types.cc
+++ b/media/formats/hls/types.cc
@@ -26,9 +26,9 @@
// Returns the substring matching a valid AttributeName, advancing `source_str`
// to the following character. If no such substring exists, returns
-// `absl::nullopt` and leaves `source_str` untouched. This is like matching the
+// `std::nullopt` and leaves `source_str` untouched. This is like matching the
// regex `^[A-Z0-9-]+`.
-absl::optional<SourceString> ExtractAttributeName(SourceString* source_str) {
+std::optional<SourceString> ExtractAttributeName(SourceString* source_str) {
auto str = *source_str;
// Returns whether the given char is permitted in an AttributeName
@@ -42,7 +42,7 @@
// At least one character must have matched
if (name.Empty()) {
- return absl::nullopt;
+ return std::nullopt;
}
*source_str = str;
@@ -51,19 +51,19 @@
// Returns the substring matching a valid AttributeValue, advancing `source_str`
// to the following character. If no such substring exists, returns
-// `absl::nullopt` and leaves `source_str` untouched.
+// `std::nullopt` and leaves `source_str` untouched.
// Attribute values may either be quoted or unquoted.
// Quoted attribute values begin and end with a double-quote ("), and may
// contain internal whitespace and commas. Unquoted attribute values must not
// begin with a double-quote, but may contain any character excluding whitespace
// and commas.
-absl::optional<SourceString> ExtractAttributeValue(SourceString* source_str) {
+std::optional<SourceString> ExtractAttributeValue(SourceString* source_str) {
// Cache string to stack so we don't modify it unless its valid
auto str = *source_str;
// Empty strings are not allowed
if (str.Empty()) {
- return absl::nullopt;
+ return std::nullopt;
}
// If this is a quoted attribute value, get everything between the matching
@@ -73,7 +73,7 @@
// If match wasn't found, value isn't valid
if (matching_quote == base::StringPiece::npos) {
- return absl::nullopt;
+ return std::nullopt;
}
const auto result = str.Consume(matching_quote + 1);
@@ -86,7 +86,7 @@
const auto end = str.Str().find_first_of(", \t");
const auto result = str.Consume(end);
if (result.Empty()) {
- return absl::nullopt;
+ return std::nullopt;
}
*source_str = str;
@@ -200,7 +200,7 @@
}
// If the offset was present, try to parse it
- absl::optional<types::DecimalInteger> offset;
+ std::optional<types::DecimalInteger> offset;
if (at_index != base::StringPiece::npos) {
source_str.Consume(1);
auto offset_result = ParseDecimalInteger(source_str);
@@ -217,15 +217,15 @@
}
// static
-absl::optional<ByteRange> ByteRange::Validate(DecimalInteger length,
- DecimalInteger offset) {
+std::optional<ByteRange> ByteRange::Validate(DecimalInteger length,
+ DecimalInteger offset) {
if (length == 0) {
- return absl::nullopt;
+ return std::nullopt;
}
// Ensure that `length+offset` won't overflow `DecimalInteger`
if (std::numeric_limits<DecimalInteger>::max() - offset < length) {
- return absl::nullopt;
+ return std::nullopt;
}
return ByteRange(length, offset);
diff --git a/media/formats/hls/types.h b/media/formats/hls/types.h
index d458972..10d1755 100644
--- a/media/formats/hls/types.h
+++ b/media/formats/hls/types.h
@@ -6,11 +6,12 @@
#define MEDIA_FORMATS_HLS_TYPES_H_
#include <cstdint>
+#include <optional>
+
#include "base/containers/span.h"
#include "media/formats/hls/parse_status.h"
#include "media/formats/hls/source_string.h"
#include "media/formats/hls/variable_dictionary.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media::hls::types {
@@ -62,7 +63,7 @@
// If not present, the sub-range begins at the next byte following that of the
// previous segment. The previous segment must be a subrange of the same
// resource.
- absl::optional<types::DecimalInteger> offset;
+ std::optional<types::DecimalInteger> offset;
};
// This is similar to `ByteRangeExpression`, but with a stronger contract:
@@ -74,8 +75,8 @@
// Validates that the range given by `[offset,offset+length)` is non-empty and
// that `GetEnd()` would not exceed the max value representable by a
// `DecimalInteger`.
- static absl::optional<ByteRange> Validate(DecimalInteger length,
- DecimalInteger offset);
+ static std::optional<ByteRange> Validate(DecimalInteger length,
+ DecimalInteger offset);
DecimalInteger GetLength() const { return length_; }
DecimalInteger GetOffset() const { return offset_; }
@@ -135,7 +136,7 @@
// This is essentially a `base::fixed_flat_map`, with the advantage of erasing
// the size of the map from its type.
struct MEDIA_EXPORT AttributeMap {
- using Item = std::pair<base::StringPiece, absl::optional<SourceString>>;
+ using Item = std::pair<base::StringPiece, std::optional<SourceString>>;
// Constructs an AttributeMap using the given span to store the keys and
// values. The keys present must be unique and sorted in alphabetical order.
@@ -162,7 +163,7 @@
// `keys` must be a set of unique key strings sorted in alphabetical order.
template <typename... T>
static constexpr std::array<Item, sizeof...(T)> MakeStorage(T... keys) {
- return {{{keys, absl::nullopt}...}};
+ return {{{keys, std::nullopt}...}};
}
private:
diff --git a/media/formats/hls/types_unittest.cc b/media/formats/hls/types_unittest.cc
index 6200cf74..6cc792f 100644
--- a/media/formats/hls/types_unittest.cc
+++ b/media/formats/hls/types_unittest.cc
@@ -709,10 +709,9 @@
error_test("\"12@34\"");
// Test some valid inputs
- ok_test("0",
- types::ByteRangeExpression{.length = 0, .offset = absl::nullopt});
+ ok_test("0", types::ByteRangeExpression{.length = 0, .offset = std::nullopt});
ok_test("12",
- types::ByteRangeExpression{.length = 12, .offset = absl::nullopt});
+ types::ByteRangeExpression{.length = 12, .offset = std::nullopt});
ok_test("12@0", types::ByteRangeExpression{.length = 12, .offset = 0});
ok_test("12@34", types::ByteRangeExpression{.length = 12, .offset = 34});
ok_test("0@34", types::ByteRangeExpression{.length = 0, .offset = 34});
diff --git a/media/formats/hls/variable_dictionary.cc b/media/formats/hls/variable_dictionary.cc
index 3c8ac71..ba34eec 100644
--- a/media/formats/hls/variable_dictionary.cc
+++ b/media/formats/hls/variable_dictionary.cc
@@ -20,7 +20,7 @@
// The variable name and the portion of the string following it, if one was
// found.
- absl::optional<std::pair<types::VariableName, SourceString>> tail;
+ std::optional<std::pair<types::VariableName, SourceString>> tail;
};
GetNextVariableResult GetNextVariable(const SourceString input) {
@@ -55,7 +55,7 @@
.head = head, .tail = std::make_pair(var_name, remaining_input)};
}
- return GetNextVariableResult{.head = input, .tail = absl::nullopt};
+ return GetNextVariableResult{.head = input, .tail = std::nullopt};
}
} // namespace
@@ -73,11 +73,11 @@
VariableDictionary& VariableDictionary::operator=(VariableDictionary&&) =
default;
-absl::optional<base::StringPiece> VariableDictionary::Find(
+std::optional<base::StringPiece> VariableDictionary::Find(
types::VariableName name) const& {
auto iter = entries_.find(name.GetName());
if (iter == entries_.end()) {
- return absl::nullopt;
+ return std::nullopt;
}
return *iter->second;
diff --git a/media/formats/hls/variable_dictionary.h b/media/formats/hls/variable_dictionary.h
index 61546e7..fbd80e27 100644
--- a/media/formats/hls/variable_dictionary.h
+++ b/media/formats/hls/variable_dictionary.h
@@ -6,6 +6,7 @@
#define MEDIA_FORMATS_HLS_VARIABLE_DICTIONARY_H_
#include <list>
+#include <optional>
#include <string>
#include "base/strings/string_piece.h"
@@ -13,7 +14,6 @@
#include "media/base/media_export.h"
#include "media/formats/hls/parse_status.h"
#include "media/formats/hls/source_string.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media::hls {
@@ -45,8 +45,8 @@
// Attempts to find the value of the given variable in this dictionary.
// The returned `base::StringPiece` must not outlive this
// `VariableDictionary`.
- absl::optional<base::StringPiece> Find(types::VariableName name) const&;
- absl::optional<base::StringPiece> Find(types::VariableName name) const&& =
+ std::optional<base::StringPiece> Find(types::VariableName name) const&;
+ std::optional<base::StringPiece> Find(types::VariableName name) const&& =
delete;
// Attempts to define the variable `name` with the given value. If the
diff --git a/media/formats/hls/variable_dictionary_unittest.cc b/media/formats/hls/variable_dictionary_unittest.cc
index 3ab701d..dc08dfe 100644
--- a/media/formats/hls/variable_dictionary_unittest.cc
+++ b/media/formats/hls/variable_dictionary_unittest.cc
@@ -4,6 +4,7 @@
#include "media/formats/hls/variable_dictionary.h"
+#include <optional>
#include <utility>
#include "base/location.h"
@@ -13,7 +14,6 @@
#include "media/formats/hls/test_util.h"
#include "media/formats/hls/types.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media::hls {
@@ -79,8 +79,8 @@
// Names are case-sensitive
EXPECT_TRUE(dict.Insert(CreateVarName("TEST"), "FOO"));
EXPECT_EQ(dict.Find(CreateVarName("TEST")),
- absl::make_optional<base::StringPiece>("FOO"));
- EXPECT_EQ(dict.Find(CreateVarName("test")), absl::nullopt);
+ std::make_optional<base::StringPiece>("FOO"));
+ EXPECT_EQ(dict.Find(CreateVarName("test")), std::nullopt);
ErrorTest(dict, "Hello {$test}", ParseStatusCode::kVariableUndefined);
OkTest(dict, "Hello {$TEST}", "Hello FOO", true);
@@ -92,28 +92,28 @@
VariableDictionary dict;
EXPECT_TRUE(dict.Insert(CreateVarName("TEST"), "FOO"));
EXPECT_EQ(dict.Find(CreateVarName("TEST")),
- absl::make_optional<base::StringPiece>("FOO"));
+ std::make_optional<base::StringPiece>("FOO"));
// Redefinition of a variable is not allowed, with the same or different value
EXPECT_FALSE(dict.Insert(CreateVarName("TEST"), "FOO"));
EXPECT_FALSE(dict.Insert(CreateVarName("TEST"), "BAR"));
EXPECT_EQ(dict.Find(CreateVarName("TEST")),
- absl::make_optional<base::StringPiece>("FOO"));
+ std::make_optional<base::StringPiece>("FOO"));
// Variable names are case-sensitive
EXPECT_TRUE(dict.Insert(CreateVarName("TEsT"), "BAR"));
EXPECT_EQ(dict.Find(CreateVarName("TEsT")),
- absl::make_optional<base::StringPiece>("BAR"));
+ std::make_optional<base::StringPiece>("BAR"));
EXPECT_EQ(dict.Find(CreateVarName("TEST")),
- absl::make_optional<base::StringPiece>("FOO"));
+ std::make_optional<base::StringPiece>("FOO"));
EXPECT_TRUE(dict.Insert(CreateVarName("TEST2"), "BAZ"));
EXPECT_EQ(dict.Find(CreateVarName("TEST2")),
- absl::make_optional<base::StringPiece>("BAZ"));
+ std::make_optional<base::StringPiece>("BAZ"));
EXPECT_EQ(dict.Find(CreateVarName("TEsT")),
- absl::make_optional<base::StringPiece>("BAR"));
+ std::make_optional<base::StringPiece>("BAR"));
EXPECT_EQ(dict.Find(CreateVarName("TEST")),
- absl::make_optional<base::StringPiece>("FOO"));
+ std::make_optional<base::StringPiece>("FOO"));
}
TEST(HlsVariableDictionaryTest, IgnoreInvalidRefSequence) {
diff --git a/media/formats/hls/variant_stream.cc b/media/formats/hls/variant_stream.cc
index 166a470..d3d70c5 100644
--- a/media/formats/hls/variant_stream.cc
+++ b/media/formats/hls/variant_stream.cc
@@ -17,13 +17,13 @@
VariantStream::VariantStream(
GURL primary_rendition_uri,
types::DecimalInteger bandwidth,
- absl::optional<types::DecimalInteger> average_bandwidth,
- absl::optional<types::DecimalFloatingPoint> score,
- absl::optional<std::vector<std::string>> codecs,
- absl::optional<types::DecimalResolution> resolution,
- absl::optional<types::DecimalFloatingPoint> frame_rate,
+ std::optional<types::DecimalInteger> average_bandwidth,
+ std::optional<types::DecimalFloatingPoint> score,
+ std::optional<std::vector<std::string>> codecs,
+ std::optional<types::DecimalResolution> resolution,
+ std::optional<types::DecimalFloatingPoint> frame_rate,
scoped_refptr<AudioRenditionGroup> audio_rendition_group,
- absl::optional<std::string> video_rendition_group_name)
+ std::optional<std::string> video_rendition_group_name)
: primary_rendition_uri_(std::move(primary_rendition_uri)),
bandwidth_(bandwidth),
average_bandwidth_(average_bandwidth),
diff --git a/media/formats/hls/variant_stream.h b/media/formats/hls/variant_stream.h
index c50c932..ae89c47 100644
--- a/media/formats/hls/variant_stream.h
+++ b/media/formats/hls/variant_stream.h
@@ -5,11 +5,12 @@
#ifndef MEDIA_FORMATS_HLS_VARIANT_STREAM_H_
#define MEDIA_FORMATS_HLS_VARIANT_STREAM_H_
+#include <optional>
+
#include "base/memory/scoped_refptr.h"
#include "base/strings/string_piece.h"
#include "media/base/media_export.h"
#include "media/formats/hls/types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace media::hls {
@@ -20,13 +21,13 @@
public:
VariantStream(GURL primary_rendition_uri,
types::DecimalInteger bandwidth,
- absl::optional<types::DecimalInteger> average_bandwidth,
- absl::optional<types::DecimalFloatingPoint> score,
- absl::optional<std::vector<std::string>> codecs,
- absl::optional<types::DecimalResolution> resolution,
- absl::optional<types::DecimalFloatingPoint> frame_rate,
+ std::optional<types::DecimalInteger> average_bandwidth,
+ std::optional<types::DecimalFloatingPoint> score,
+ std::optional<std::vector<std::string>> codecs,
+ std::optional<types::DecimalResolution> resolution,
+ std::optional<types::DecimalFloatingPoint> frame_rate,
scoped_refptr<AudioRenditionGroup> audio_renditions,
- absl::optional<std::string> video_rendition_group_name);
+ std::optional<std::string> video_rendition_group_name);
VariantStream(const VariantStream&) = delete;
VariantStream(VariantStream&&);
~VariantStream();
@@ -70,31 +71,29 @@
// representative period of similar content, encoded using the same
// settings."
// https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#:~:text=the%20BANDWIDTH%20attribute.-,AVERAGE%2DBANDWIDTH,-The%20value%20is
- absl::optional<types::DecimalInteger> GetAverageBandwidth() const {
+ std::optional<types::DecimalInteger> GetAverageBandwidth() const {
return average_bandwidth_;
}
// A metric computed by the HLS server to provide a relative measure of
// desireability for each variant. A higher score indicates that this variant
// should be preferred over other variants with lower scores.
- absl::optional<types::DecimalFloatingPoint> GetScore() const {
- return score_;
- }
+ std::optional<types::DecimalFloatingPoint> GetScore() const { return score_; }
// A list of media sample formats present in one or more renditions of this
// variant.
- const absl::optional<std::vector<std::string>>& GetCodecs() const {
+ const std::optional<std::vector<std::string>>& GetCodecs() const {
return codecs_;
}
// A value representing the optimal pixel resolution at which to display all
// video in this variant stream.
- const absl::optional<types::DecimalResolution> GetResolution() const {
+ const std::optional<types::DecimalResolution> GetResolution() const {
return resolution_;
}
// This represents the maximum framerate for all video in this variant stream.
- const absl::optional<types::DecimalFloatingPoint> GetFrameRate() const {
+ const std::optional<types::DecimalFloatingPoint> GetFrameRate() const {
return frame_rate_;
}
@@ -105,20 +104,20 @@
}
// Returns the name of the video rendition group, if it exists.
- const absl::optional<std::string> GetVideoRenditionGroupName() const {
+ const std::optional<std::string> GetVideoRenditionGroupName() const {
return video_rendition_group_name_;
}
private:
GURL primary_rendition_uri_;
types::DecimalInteger bandwidth_;
- absl::optional<types::DecimalInteger> average_bandwidth_;
- absl::optional<types::DecimalFloatingPoint> score_;
- absl::optional<std::vector<std::string>> codecs_;
- absl::optional<types::DecimalResolution> resolution_;
- absl::optional<types::DecimalFloatingPoint> frame_rate_;
+ std::optional<types::DecimalInteger> average_bandwidth_;
+ std::optional<types::DecimalFloatingPoint> score_;
+ std::optional<std::vector<std::string>> codecs_;
+ std::optional<types::DecimalResolution> resolution_;
+ std::optional<types::DecimalFloatingPoint> frame_rate_;
scoped_refptr<AudioRenditionGroup> audio_rendition_group_;
- absl::optional<std::string> video_rendition_group_name_;
+ std::optional<std::string> video_rendition_group_name_;
};
} // namespace media::hls
diff --git a/media/formats/mp2t/es_parser_adts.cc b/media/formats/mp2t/es_parser_adts.cc
index 7577748f..1ece781 100644
--- a/media/formats/mp2t/es_parser_adts.cc
+++ b/media/formats/mp2t/es_parser_adts.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
+#include <optional>
#include <vector>
#include "base/logging.h"
@@ -20,7 +21,6 @@
#include "media/formats/common/offset_byte_queue.h"
#include "media/formats/mp2t/mp2t_common.h"
#include "media/formats/mpeg/adts_constants.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/formats/mp2t/es_parser_h264.cc b/media/formats/mp2t/es_parser_h264.cc
index 675e015..a55d159 100644
--- a/media/formats/mp2t/es_parser_h264.cc
+++ b/media/formats/mp2t/es_parser_h264.cc
@@ -5,6 +5,7 @@
#include "media/formats/mp2t/es_parser_h264.h"
#include <limits>
+#include <optional>
#include "base/containers/adapters.h"
#include "base/logging.h"
@@ -18,7 +19,6 @@
#include "media/formats/common/offset_byte_queue.h"
#include "media/formats/mp2t/mp2t_common.h"
#include "media/video/h264_parser.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -478,11 +478,11 @@
int sar_width = (sps->sar_width == 0) ? 1 : sps->sar_width;
int sar_height = (sps->sar_height == 0) ? 1 : sps->sar_height;
- absl::optional<gfx::Size> coded_size = sps->GetCodedSize();
+ std::optional<gfx::Size> coded_size = sps->GetCodedSize();
if (!coded_size)
return false;
- absl::optional<gfx::Rect> visible_rect = sps->GetVisibleRect();
+ std::optional<gfx::Rect> visible_rect = sps->GetVisibleRect();
if (!visible_rect)
return false;
diff --git a/media/formats/mp2t/mp2t_stream_parser.cc b/media/formats/mp2t/mp2t_stream_parser.cc
index 03c67dd..aedfe501 100644
--- a/media/formats/mp2t/mp2t_stream_parser.cc
+++ b/media/formats/mp2t/mp2t_stream_parser.cc
@@ -5,6 +5,7 @@
#include "media/formats/mp2t/mp2t_stream_parser.h"
#include <memory>
+#include <optional>
#include <utility>
#include "base/functional/bind.h"
@@ -30,7 +31,6 @@
#include "media/formats/mp2t/ts_section_pat.h"
#include "media/formats/mp2t/ts_section_pes.h"
#include "media/formats/mp2t/ts_section_pmt.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace mp2t {
@@ -1005,7 +1005,7 @@
break;
case EncryptionScheme::kCbcs:
decrypt_config_ =
- DecryptConfig::CreateCbcsConfig(key_id, iv, {}, absl::nullopt);
+ DecryptConfig::CreateCbcsConfig(key_id, iv, {}, std::nullopt);
break;
}
}
diff --git a/media/formats/mp4/avc_unittest.cc b/media/formats/mp4/avc_unittest.cc
index d1fb073..557b4004 100644
--- a/media/formats/mp4/avc_unittest.cc
+++ b/media/formats/mp4/avc_unittest.cc
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <string.h>
+#include <optional>
#include <ostream>
#include "base/strings/string_split.h"
@@ -19,7 +20,6 @@
#include "media/formats/mp4/nalu_test_helper.h"
#include "media/video/h264_parser.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace mp4 {
@@ -339,19 +339,19 @@
TEST_F(AVCConversionTest, InvalidAnnexBConstructs) {
struct {
const char* case_string;
- const absl::optional<bool> is_keyframe;
+ const std::optional<bool> is_keyframe;
} test_cases[] = {
// For these cases, lack of conformance is determined before detecting any
// IDR or non-IDR slices, so the non-conformant frames' keyframe analysis
- // reports absl::nullopt (which means undetermined analysis result).
- {"AUD", absl::nullopt}, // No VCL present.
- {"AUD,SEI", absl::nullopt}, // No VCL present.
- {"SPS PPS", absl::nullopt}, // No VCL present.
- {"SPS PPS AUD I", absl::nullopt}, // Parameter sets must come after AUD.
- {"SPSExt SPS P", absl::nullopt}, // SPS must come before SPSExt.
- {"SPS PPS SPSExt P", absl::nullopt}, // SPSExt must follow an SPS.
- {"EOSeq", absl::nullopt}, // EOSeq must come after a VCL.
- {"EOStr", absl::nullopt}, // EOStr must come after a VCL.
+ // reports std::nullopt (which means undetermined analysis result).
+ {"AUD", std::nullopt}, // No VCL present.
+ {"AUD,SEI", std::nullopt}, // No VCL present.
+ {"SPS PPS", std::nullopt}, // No VCL present.
+ {"SPS PPS AUD I", std::nullopt}, // Parameter sets must come after AUD.
+ {"SPSExt SPS P", std::nullopt}, // SPS must come before SPSExt.
+ {"SPS PPS SPSExt P", std::nullopt}, // SPSExt must follow an SPS.
+ {"EOSeq", std::nullopt}, // EOSeq must come after a VCL.
+ {"EOStr", std::nullopt}, // EOStr must come after a VCL.
// For these cases, IDR slice is first VCL and is detected before
// conformance failure, so the non-conformant frame is reported as a
diff --git a/media/formats/mp4/bitstream_converter.h b/media/formats/mp4/bitstream_converter.h
index 072c4853..0f0ed57 100644
--- a/media/formats/mp4/bitstream_converter.h
+++ b/media/formats/mp4/bitstream_converter.h
@@ -7,11 +7,11 @@
#include <stdint.h>
+#include <optional>
#include <vector>
#include "base/memory/ref_counted.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -27,14 +27,14 @@
public:
// Describes the result of Analyze(). Not all analyses are implemented or
// enabled across mp4::BitstreamConverter implementations, hence the use of
- // absl::optional<>.
+ // std::optional<>.
struct MEDIA_EXPORT AnalysisResult {
AnalysisResult();
AnalysisResult(const AnalysisResult&);
~AnalysisResult();
- absl::optional<bool> is_conformant;
- absl::optional<bool> is_keyframe;
+ std::optional<bool> is_conformant;
+ std::optional<bool> is_keyframe;
};
// Converts a single frame/buffer |frame_buf| into the output format.
diff --git a/media/formats/mp4/box_definitions.cc b/media/formats/mp4/box_definitions.cc
index 5a296771..3f5b9b8 100644
--- a/media/formats/mp4/box_definitions.cc
+++ b/media/formats/mp4/box_definitions.cc
@@ -23,10 +23,11 @@
#include "media/media_buildflags.h"
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
+#include <optional>
+
#include "media/formats/mp4/avc.h"
#include "media/formats/mp4/dolby_vision.h"
#include "media/video/h264_parser.h" // nogncheck
-#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
#include "media/formats/mp4/hevc.h"
@@ -44,10 +45,10 @@
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
// Try to parse dvcC or dvvC box if exists, return `video_info` and an optional
// `dv_info` based on the configuration.
-std::tuple<CodecProfileLevel, absl::optional<CodecProfileLevel>> MaybeParseDOVI(
+std::tuple<CodecProfileLevel, std::optional<CodecProfileLevel>> MaybeParseDOVI(
BoxReader* reader,
CodecProfileLevel video_info) {
- absl::optional<DOVIDecoderConfigurationRecord> dovi_config;
+ std::optional<DOVIDecoderConfigurationRecord> dovi_config;
{
DolbyVisionConfiguration dvcc;
@@ -68,7 +69,7 @@
}
if (!dovi_config.has_value()) {
- return {video_info, absl::nullopt};
+ return {video_info, std::nullopt};
}
constexpr int kHDR10CompatibilityId = 1;
@@ -83,7 +84,7 @@
return {video_info, dv_info};
}
// If the buffer is not backward compatible, always treat it as Dolby Vision.
- return {dv_info, absl::nullopt};
+ return {dv_info, std::nullopt};
}
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
diff --git a/media/formats/mp4/box_definitions.h b/media/formats/mp4/box_definitions.h
index ab55db21..5bd60f6 100644
--- a/media/formats/mp4/box_definitions.h
+++ b/media/formats/mp4/box_definitions.h
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <optional>
#include <string>
#include <vector>
@@ -27,7 +28,6 @@
#include "media/formats/mp4/eac3.h"
#include "media/formats/mp4/fourccs.h"
#include "media/media_buildflags.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace mp4 {
@@ -352,8 +352,8 @@
// When set and found on a Dolby Vision source buffer, `dv_info`
// will be used to upgrade `video_info` from its backwards
// compatible codec (e.g., H.264, H.265) to a Dolby Vision codec.
- absl::optional<CodecProfileLevel> dv_info;
- absl::optional<gfx::HDRMetadata> hdr_metadata;
+ std::optional<CodecProfileLevel> dv_info;
+ std::optional<gfx::HDRMetadata> hdr_metadata;
bool IsFormatValid() const;
diff --git a/media/formats/mp4/es_descriptor.h b/media/formats/mp4/es_descriptor.h
index 3ea9b11..94ccde2 100644
--- a/media/formats/mp4/es_descriptor.h
+++ b/media/formats/mp4/es_descriptor.h
@@ -7,10 +7,10 @@
#include <stdint.h>
+#include <optional>
#include <vector>
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/formats/mp4/hevc_unittest.cc b/media/formats/mp4/hevc_unittest.cc
index 6e82702..7920699 100644
--- a/media/formats/mp4/hevc_unittest.cc
+++ b/media/formats/mp4/hevc_unittest.cc
@@ -39,16 +39,16 @@
TEST(HEVCAnalyzeAnnexBTest, InvalidAnnexBConstructs) {
struct {
const char* case_string;
- const absl::optional<bool> is_keyframe;
+ const std::optional<bool> is_keyframe;
} test_cases[] = {
// For these cases, lack of conformance is determined before detecting any
// IDR or non-IDR slices, so the non-conformant frames' keyframe analysis
- // reports absl::nullopt (which means undetermined analysis result).
- {"AUD", absl::nullopt}, // No VCL present.
- {"AUD,SPS", absl::nullopt}, // No VCL present.
- {"SPS AUD I", absl::nullopt}, // Parameter sets must come after AUD.
- {"EOS", absl::nullopt}, // EOS must come after a VCL.
- {"EOB", absl::nullopt}, // EOB must come after a VCL.
+ // reports std::nullopt (which means undetermined analysis result).
+ {"AUD", std::nullopt}, // No VCL present.
+ {"AUD,SPS", std::nullopt}, // No VCL present.
+ {"SPS AUD I", std::nullopt}, // Parameter sets must come after AUD.
+ {"EOS", std::nullopt}, // EOS must come after a VCL.
+ {"EOB", std::nullopt}, // EOB must come after a VCL.
// For these cases, IDR slice is first VCL and is detected before
// conformance failure, so the non-conformant frame is reported as a
diff --git a/media/formats/mp4/writable_box_definitions.h b/media/formats/mp4/writable_box_definitions.h
index 3898567..83b64c60 100644
--- a/media/formats/mp4/writable_box_definitions.h
+++ b/media/formats/mp4/writable_box_definitions.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_FORMATS_MP4_WRITABLE_BOX_DEFINITIONS_H_
#define MEDIA_FORMATS_MP4_WRITABLE_BOX_DEFINITIONS_H_
+#include <optional>
#include <string>
#include <vector>
@@ -14,7 +15,6 @@
#include "media/formats/mp4/box_definitions.h"
#include "media/formats/mp4/fourccs.h"
#include "media/media_buildflags.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media::mp4::writable_boxes {
@@ -132,8 +132,8 @@
uint32_t entry_count = 0;
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
- absl::optional<VisualSampleEntry> visual_sample_entry;
- absl::optional<AudioSampleEntry> audio_sample_entry;
+ std::optional<VisualSampleEntry> visual_sample_entry;
+ std::optional<AudioSampleEntry> audio_sample_entry;
#endif
};
@@ -193,8 +193,8 @@
// Media information (`minf`) box.
struct MEDIA_EXPORT MediaInformation : Box {
- absl::optional<VideoMediaHeader> video_header;
- absl::optional<SoundMediaHeader> sound_header;
+ std::optional<VideoMediaHeader> video_header;
+ std::optional<SoundMediaHeader> sound_header;
DataInformation data_information;
SampleTable sample_table;
};
diff --git a/media/formats/webm/webm_cluster_parser.h b/media/formats/webm/webm_cluster_parser.h
index 350b669a..833ba15 100644
--- a/media/formats/webm/webm_cluster_parser.h
+++ b/media/formats/webm/webm_cluster_parser.h
@@ -9,6 +9,7 @@
#include <map>
#include <memory>
+#include <optional>
#include <set>
#include <string>
@@ -22,7 +23,6 @@
#include "media/base/stream_parser_buffer.h"
#include "media/formats/webm/webm_parser.h"
#include "media/formats/webm/webm_tracks_parser.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -258,8 +258,8 @@
// A |last_block_timecode_| value of -1 is not enough to indicate it is unset
// now that negative block timecodes are allowed, so we explicitly use
- // absl::optional to know if it is currently set.
- absl::optional<int64_t> last_block_timecode_ = absl::nullopt;
+ // std::optional to know if it is currently set.
+ std::optional<int64_t> last_block_timecode_ = std::nullopt;
std::unique_ptr<uint8_t[]> block_data_;
int block_data_size_ = -1;
diff --git a/media/formats/webm/webm_colour_parser.h b/media/formats/webm/webm_colour_parser.h
index cb568a2..1dbb396 100644
--- a/media/formats/webm/webm_colour_parser.h
+++ b/media/formats/webm/webm_colour_parser.h
@@ -5,9 +5,10 @@
#ifndef MEDIA_FORMATS_WEBM_WEBM_COLOUR_PARSER_H_
#define MEDIA_FORMATS_WEBM_WEBM_COLOUR_PARSER_H_
+#include <optional>
+
#include "media/base/video_color_space.h"
#include "media/formats/webm/webm_parser.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/hdr_metadata.h"
namespace media {
@@ -25,7 +26,7 @@
VideoColorSpace color_space;
- absl::optional<gfx::HDRMetadata> hdr_metadata;
+ std::optional<gfx::HDRMetadata> hdr_metadata;
WebMColorMetadata();
WebMColorMetadata(const WebMColorMetadata& rhs);
diff --git a/media/formats/webm/webm_stream_parser_unittest.cc b/media/formats/webm/webm_stream_parser_unittest.cc
index 21d80424..5ce131d 100644
--- a/media/formats/webm/webm_stream_parser_unittest.cc
+++ b/media/formats/webm/webm_stream_parser_unittest.cc
@@ -194,7 +194,7 @@
gfx::ColorSpace::RangeID::FULL);
EXPECT_EQ(video_config.color_space_info(), expected_color_space);
- absl::optional<gfx::HDRMetadata> hdr_metadata = video_config.hdr_metadata();
+ std::optional<gfx::HDRMetadata> hdr_metadata = video_config.hdr_metadata();
EXPECT_TRUE(hdr_metadata.has_value());
EXPECT_EQ(hdr_metadata->cta_861_3->max_content_light_level, 11u);
EXPECT_EQ(hdr_metadata->cta_861_3->max_frame_average_light_level, 12u);
diff --git a/media/fuchsia/audio/fake_audio_capturer.h b/media/fuchsia/audio/fake_audio_capturer.h
index 1ea65fb..dd8b4da 100644
--- a/media/fuchsia/audio/fake_audio_capturer.h
+++ b/media/fuchsia/audio/fake_audio_capturer.h
@@ -9,13 +9,13 @@
#include <lib/fidl/cpp/binding.h>
#include <list>
+#include <optional>
#include <vector>
#include "base/fuchsia/scoped_service_binding.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -71,7 +71,7 @@
zx::vmo buffer_vmo_;
uint64_t buffer_size_ = 0;
- absl::optional<fuchsia::media::AudioStreamType> stream_type_;
+ std::optional<fuchsia::media::AudioStreamType> stream_type_;
bool is_active_ = false;
size_t frames_per_packet_ = 0;
std::vector<bool> packets_usage_;
diff --git a/media/fuchsia/camera/fake_fuchsia_camera.h b/media/fuchsia/camera/fake_fuchsia_camera.h
index 99acd5d1..6e40a53 100644
--- a/media/fuchsia/camera/fake_fuchsia_camera.h
+++ b/media/fuchsia/camera/fake_fuchsia_camera.h
@@ -11,11 +11,11 @@
#include <lib/fidl/cpp/binding_set.h>
#include <lib/sys/cpp/outgoing_directory.h>
+#include <optional>
#include <vector>
#include "base/message_loop/message_pump_for_io.h"
#include "base/run_loop.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
@@ -125,28 +125,28 @@
fuchsia::camera3::Orientation orientation_ =
fuchsia::camera3::Orientation::UP;
- absl::optional<fuchsia::math::Size> resolution_update_ = fuchsia::math::Size{
+ std::optional<fuchsia::math::Size> resolution_update_ = fuchsia::math::Size{
kDefaultFrameSize.width(), kDefaultFrameSize.height()};
WatchResolutionCallback watch_resolution_callback_;
- absl::optional<fuchsia::camera3::Orientation> orientation_update_ =
+ std::optional<fuchsia::camera3::Orientation> orientation_update_ =
fuchsia::camera3::Orientation::UP;
WatchOrientationCallback watch_orientation_callback_;
fuchsia::sysmem::BufferCollectionTokenPtr new_buffer_collection_token_;
- absl::optional<fidl::InterfaceHandle<fuchsia::sysmem::BufferCollectionToken>>
+ std::optional<fidl::InterfaceHandle<fuchsia::sysmem::BufferCollectionToken>>
new_buffer_collection_token_for_client_;
WatchBufferCollectionCallback watch_buffer_collection_callback_;
- absl::optional<fuchsia::camera3::FrameInfo> next_frame_;
+ std::optional<fuchsia::camera3::FrameInfo> next_frame_;
GetNextFrameCallback get_next_frame_callback_;
fuchsia::sysmem::AllocatorPtr sysmem_allocator_;
fuchsia::sysmem::BufferCollectionPtr buffer_collection_;
- absl::optional<base::RunLoop> wait_buffers_allocated_run_loop_;
- absl::optional<base::RunLoop> wait_free_buffer_run_loop_;
+ std::optional<base::RunLoop> wait_buffers_allocated_run_loop_;
+ std::optional<base::RunLoop> wait_free_buffer_run_loop_;
std::vector<std::unique_ptr<Buffer>> buffers_;
size_t num_used_buffers_ = 0;
diff --git a/media/fuchsia/common/vmo_buffer.cc b/media/fuchsia/common/vmo_buffer.cc
index ec7e46a..0225377 100644
--- a/media/fuchsia/common/vmo_buffer.cc
+++ b/media/fuchsia/common/vmo_buffer.cc
@@ -16,7 +16,7 @@
// static
fuchsia::sysmem::BufferCollectionConstraints
VmoBuffer::GetRecommendedConstraints(size_t min_buffer_count,
- absl::optional<size_t> min_buffer_size,
+ std::optional<size_t> min_buffer_size,
bool writable) {
fuchsia::sysmem::BufferCollectionConstraints buffer_constraints;
diff --git a/media/fuchsia/common/vmo_buffer.h b/media/fuchsia/common/vmo_buffer.h
index d09b81a..7c3275dc6 100644
--- a/media/fuchsia/common/vmo_buffer.h
+++ b/media/fuchsia/common/vmo_buffer.h
@@ -9,11 +9,11 @@
#include <fuchsia/sysmem/cpp/fidl.h>
#include <memory>
+#include <optional>
#include "base/containers/span.h"
#include "base/memory/shared_memory_mapping.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -23,7 +23,7 @@
// collection is compatible with this class.
static fuchsia::sysmem::BufferCollectionConstraints GetRecommendedConstraints(
size_t min_buffer_count,
- absl::optional<size_t> min_buffer_size,
+ std::optional<size_t> min_buffer_size,
bool writable);
// Creates a set of buffers from a sysmem collection. An empty vector is
diff --git a/media/fuchsia/common/vmo_buffer_writer_queue.cc b/media/fuchsia/common/vmo_buffer_writer_queue.cc
index f4daf11..ab74fa5 100644
--- a/media/fuchsia/common/vmo_buffer_writer_queue.cc
+++ b/media/fuchsia/common/vmo_buffer_writer_queue.cc
@@ -155,7 +155,7 @@
// All packets that were pending will need to be resent. Reset
// |tail_sysmem_buffer_index| to ensure that these packets are not removed
// from the queue in ReleaseBuffer().
- buffer.tail_sysmem_buffer_index = absl::nullopt;
+ buffer.tail_sysmem_buffer_index = std::nullopt;
}
input_queue_position_ = 0;
is_paused_ = true;
diff --git a/media/fuchsia/common/vmo_buffer_writer_queue.h b/media/fuchsia/common/vmo_buffer_writer_queue.h
index 88bec23..b82342f 100644
--- a/media/fuchsia/common/vmo_buffer_writer_queue.h
+++ b/media/fuchsia/common/vmo_buffer_writer_queue.h
@@ -102,7 +102,7 @@
// Index of the last buffer in the sysmem buffer collection that was used to
// send this input buffer. Should be set only when |bytes_left()==0|.
- absl::optional<size_t> tail_sysmem_buffer_index;
+ std::optional<size_t> tail_sysmem_buffer_index;
};
class SysmemBuffer;
diff --git a/media/fuchsia/video/fuchsia_video_decoder.cc b/media/fuchsia/video/fuchsia_video_decoder.cc
index eab6199a..d11f2816 100644
--- a/media/fuchsia/video/fuchsia_video_decoder.cc
+++ b/media/fuchsia/video/fuchsia_video_decoder.cc
@@ -81,12 +81,12 @@
fuchsia::sysmem::ColorSpaceType::REC709,
};
-absl::optional<gfx::Size> ParseMinBufferSize() {
+std::optional<gfx::Size> ParseMinBufferSize() {
std::string min_buffer_size_arg =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kMinVideoDecoderOutputBufferSize);
if (min_buffer_size_arg.empty())
- return absl::nullopt;
+ return std::nullopt;
size_t width;
size_t height;
if (sscanf(min_buffer_size_arg.c_str(), "%zux%zu" SCNu32, &width, &height) !=
@@ -94,13 +94,13 @@
LOG(WARNING) << "Invalid value for --"
<< switches::kMinVideoDecoderOutputBufferSize << ": '"
<< min_buffer_size_arg << "'";
- return absl::nullopt;
+ return std::nullopt;
}
return gfx::Size(width, height);
}
-absl::optional<gfx::Size> GetMinBufferSize() {
- static absl::optional<gfx::Size> value = ParseMinBufferSize();
+std::optional<gfx::Size> GetMinBufferSize() {
+ static std::optional<gfx::Size> value = ParseMinBufferSize();
return value;
}
diff --git a/media/fuchsia/video/fuchsia_video_decoder_unittest.cc b/media/fuchsia/video/fuchsia_video_decoder_unittest.cc
index 6dea7ae..cc67615 100644
--- a/media/fuchsia/video/fuchsia_video_decoder_unittest.cc
+++ b/media/fuchsia/video/fuchsia_video_decoder_unittest.cc
@@ -95,7 +95,7 @@
fuchsia::sysmem::AllocatorPtr sysmem_allocator_;
fuchsia::sysmem::BufferCollectionSyncPtr buffers_collection_;
- absl::optional<fuchsia::sysmem::BufferCollectionInfo_2>
+ std::optional<fuchsia::sysmem::BufferCollectionInfo_2>
buffer_collection_info_;
};
diff --git a/media/fuchsia/video/fuchsia_video_encode_accelerator.cc b/media/fuchsia/video/fuchsia_video_encode_accelerator.cc
index 0ac8323..a6f09d5 100644
--- a/media/fuchsia/video/fuchsia_video_encode_accelerator.cc
+++ b/media/fuchsia/video/fuchsia_video_encode_accelerator.cc
@@ -515,7 +515,7 @@
void FuchsiaVideoEncodeAccelerator::RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
// TODO(crbug.com/1373298): Implement RequestEncodingParameterChange.
NOTIMPLEMENTED();
}
@@ -547,7 +547,7 @@
fuchsia::sysmem::BufferCollectionConstraints constraints =
VmoBuffer::GetRecommendedConstraints(kInputBufferCount,
- /*min_buffer_size=*/absl::nullopt,
+ /*min_buffer_size=*/std::nullopt,
/*writable=*/true);
input_buffer_collection_->Initialize(constraints, "VideoEncoderInput");
input_buffer_collection_->AcquireBuffers(
diff --git a/media/fuchsia/video/fuchsia_video_encode_accelerator.h b/media/fuchsia/video/fuchsia_video_encode_accelerator.h
index edd3f245..4cd0e3a 100644
--- a/media/fuchsia/video/fuchsia_video_encode_accelerator.h
+++ b/media/fuchsia/video/fuchsia_video_encode_accelerator.h
@@ -46,7 +46,7 @@
void RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
void Destroy() override;
bool IsFlushSupported() override;
bool IsGpuFrameResizeSupported() override;
diff --git a/media/gpu/accelerated_video_decoder.h b/media/gpu/accelerated_video_decoder.h
index 369b8a6..182c433a 100644
--- a/media/gpu/accelerated_video_decoder.h
+++ b/media/gpu/accelerated_video_decoder.h
@@ -88,7 +88,7 @@
virtual VideoColorSpace GetVideoColorSpace() const = 0;
// Returns in-band HDR metadata if it exists. Clients must prefer in-band
// metadata over container metadata to support dynamic HDR metadata.
- virtual absl::optional<gfx::HDRMetadata> GetHDRMetadata() const = 0;
+ virtual std::optional<gfx::HDRMetadata> GetHDRMetadata() const = 0;
virtual size_t GetRequiredNumOfPictures() const = 0;
virtual size_t GetNumReferenceFrames() const = 0;
diff --git a/media/gpu/android/android_video_encode_accelerator.cc b/media/gpu/android/android_video_encode_accelerator.cc
index 46d699b..38cfbb0 100644
--- a/media/gpu/android/android_video_encode_accelerator.cc
+++ b/media/gpu/android/android_video_encode_accelerator.cc
@@ -275,7 +275,7 @@
void AndroidVideoEncodeAccelerator::RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
// If this is changed to use variable bitrate encoding, change the mode check
// to check that the mode matches the current mode.
if (bitrate.mode() != Bitrate::Mode::kConstant) {
diff --git a/media/gpu/android/android_video_encode_accelerator.h b/media/gpu/android/android_video_encode_accelerator.h
index 4463016..0e2bff39 100644
--- a/media/gpu/android/android_video_encode_accelerator.h
+++ b/media/gpu/android/android_video_encode_accelerator.h
@@ -53,7 +53,7 @@
void RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
void Destroy() override;
private:
@@ -133,7 +133,7 @@
bool error_occurred_ = false;
// Required for encoders which are missing stride information.
- absl::optional<gfx::Size> aligned_size_;
+ std::optional<gfx::Size> aligned_size_;
};
} // namespace media
diff --git a/media/gpu/android/android_video_surface_chooser.h b/media/gpu/android/android_video_surface_chooser.h
index 0766163b..ea7763e 100644
--- a/media/gpu/android/android_video_surface_chooser.h
+++ b/media/gpu/android/android_video_surface_chooser.h
@@ -5,12 +5,13 @@
#ifndef MEDIA_GPU_ANDROID_ANDROID_VIDEO_SURFACE_CHOOSER_H_
#define MEDIA_GPU_ANDROID_ANDROID_VIDEO_SURFACE_CHOOSER_H_
+#include <optional>
+
#include "base/functional/bind.h"
#include "base/memory/weak_ptr.h"
#include "media/base/android/android_overlay.h"
#include "media/base/video_transformation.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
namespace media {
@@ -86,7 +87,7 @@
// Updates the current state and makes a new surface choice with the new
// state. If |new_factory| is empty, the factory is left as-is. Otherwise,
// the factory is updated to |*new_factory|.
- virtual void UpdateState(absl::optional<AndroidOverlayFactoryCB> new_factory,
+ virtual void UpdateState(std::optional<AndroidOverlayFactoryCB> new_factory,
const State& new_state) = 0;
};
diff --git a/media/gpu/android/android_video_surface_chooser_impl.cc b/media/gpu/android/android_video_surface_chooser_impl.cc
index 02e67c13..d2b44c9 100644
--- a/media/gpu/android/android_video_surface_chooser_impl.cc
+++ b/media/gpu/android/android_video_surface_chooser_impl.cc
@@ -34,7 +34,7 @@
}
void AndroidVideoSurfaceChooserImpl::UpdateState(
- absl::optional<AndroidOverlayFactoryCB> new_factory,
+ std::optional<AndroidOverlayFactoryCB> new_factory,
const State& new_state) {
DCHECK(use_overlay_cb_);
bool entered_fullscreen =
diff --git a/media/gpu/android/android_video_surface_chooser_impl.h b/media/gpu/android/android_video_surface_chooser_impl.h
index 8d0b062..b44acc0 100644
--- a/media/gpu/android/android_video_surface_chooser_impl.h
+++ b/media/gpu/android/android_video_surface_chooser_impl.h
@@ -37,7 +37,7 @@
// AndroidVideoSurfaceChooser
void SetClientCallbacks(UseOverlayCB use_overlay_cb,
UseTextureOwnerCB use_texture_owner_cb) override;
- void UpdateState(absl::optional<AndroidOverlayFactoryCB> new_factory,
+ void UpdateState(std::optional<AndroidOverlayFactoryCB> new_factory,
const State& new_state) override;
private:
diff --git a/media/gpu/android/android_video_surface_chooser_impl_unittest.cc b/media/gpu/android/android_video_surface_chooser_impl_unittest.cc
index 27d7a159..24e1cbd3 100644
--- a/media/gpu/android/android_video_surface_chooser_impl_unittest.cc
+++ b/media/gpu/android/android_video_surface_chooser_impl_unittest.cc
@@ -141,7 +141,7 @@
base::BindRepeating(&MockClient::UseTextureOwner,
base::Unretained(&client_)));
chooser_->UpdateState(
- factory ? absl::make_optional(std::move(factory)) : absl::nullopt,
+ factory ? std::make_optional(std::move(factory)) : std::nullopt,
chooser_state_);
}
@@ -359,7 +359,7 @@
// Note that if it enforces a delay here before retrying, that might be okay
// too. For now, we assume that it doesn't.
EXPECT_CALL(*this, MockOnOverlayCreated());
- chooser_->UpdateState(absl::optional<AndroidOverlayFactoryCB>(),
+ chooser_->UpdateState(std::optional<AndroidOverlayFactoryCB>(),
chooser_state_);
}
@@ -389,7 +389,7 @@
// instead.
chooser_state_.always_use_texture_owner = true;
EXPECT_CALL(client_, UseTextureOwner());
- chooser_->UpdateState(absl::nullopt, chooser_state_);
+ chooser_->UpdateState(std::nullopt, chooser_state_);
}
TEST_P(AndroidVideoSurfaceChooserImplTest, OverlayIsUsedOrNotBasedOnState) {
diff --git a/media/gpu/android/codec_image_unittest.cc b/media/gpu/android/codec_image_unittest.cc
index 10e9d34..cdec8ec 100644
--- a/media/gpu/android/codec_image_unittest.cc
+++ b/media/gpu/android/codec_image_unittest.cc
@@ -50,7 +50,7 @@
wrapper_ = std::make_unique<CodecWrapper>(
CodecSurfacePair(std::move(codec), new CodecSurfaceBundle()),
base::DoNothing(), base::SequencedTaskRunner::GetCurrentDefault(),
- kFrameSize, absl::nullopt);
+ kFrameSize, std::nullopt);
ON_CALL(*codec_, DequeueOutputBuffer(_, _, _, _, _, _, _))
.WillByDefault(Return(OkStatus()));
@@ -136,8 +136,8 @@
MOCK_METHOD(void,
OnFrameInfoReady,
- (absl::optional<gfx::Size> coded_size,
- absl::optional<gfx::Rect> visible_rect),
+ (std::optional<gfx::Size> coded_size,
+ std::optional<gfx::Rect> visible_rect),
());
virtual bool BindsTextureOnUpdate() { return true; }
@@ -174,7 +174,7 @@
i->AddUnusedCB(cb_2.Get());
EXPECT_CALL(cb_1, Run(i.get()));
EXPECT_CALL(cb_2, Run(i.get()));
- EXPECT_CALL(*this, OnFrameInfoReady(Eq(absl::nullopt), Eq(absl::nullopt)));
+ EXPECT_CALL(*this, OnFrameInfoReady(Eq(std::nullopt), Eq(std::nullopt)));
i = nullptr;
}
@@ -188,7 +188,7 @@
i->AddUnusedCB(cb_2.Get());
EXPECT_CALL(cb_1, Run(i.get()));
EXPECT_CALL(cb_2, Run(i.get()));
- EXPECT_CALL(*this, OnFrameInfoReady(Eq(absl::nullopt), Eq(absl::nullopt)));
+ EXPECT_CALL(*this, OnFrameInfoReady(Eq(std::nullopt), Eq(std::nullopt)));
// Also verify that the output buffer and texture owner are released.
i->NotifyUnused();
@@ -202,21 +202,21 @@
TEST_F(CodecImageTest, ImageStartsUnrendered) {
auto i = NewImage(kTextureOwner);
ASSERT_FALSE(i->was_rendered_to_front_buffer());
- EXPECT_CALL(*this, OnFrameInfoReady(Eq(absl::nullopt), Eq(absl::nullopt)));
+ EXPECT_CALL(*this, OnFrameInfoReady(Eq(std::nullopt), Eq(std::nullopt)));
}
TEST_F(CodecImageTest, CanRenderTextureOwnerImageToBackBuffer) {
auto i = NewImage(kTextureOwner);
ASSERT_TRUE(i->RenderToTextureOwnerBackBuffer());
ASSERT_FALSE(i->was_rendered_to_front_buffer());
- EXPECT_CALL(*this, OnFrameInfoReady(Eq(absl::nullopt), Eq(absl::nullopt)));
+ EXPECT_CALL(*this, OnFrameInfoReady(Eq(std::nullopt), Eq(std::nullopt)));
}
TEST_F(CodecImageTest, CodecBufferInvalidationResultsInRenderingFailure) {
auto i = NewImage(kTextureOwner);
// Invalidate the backing codec buffer.
wrapper_->TakeCodecSurfacePair();
- EXPECT_CALL(*this, OnFrameInfoReady(Eq(absl::nullopt), Eq(absl::nullopt)));
+ EXPECT_CALL(*this, OnFrameInfoReady(Eq(std::nullopt), Eq(std::nullopt)));
ASSERT_FALSE(i->RenderToTextureOwnerBackBuffer());
}
@@ -228,7 +228,7 @@
EXPECT_CALL(*codec_buffer_wait_coordinator_, WaitForFrameAvailable())
.Times(0);
ASSERT_TRUE(i->RenderToTextureOwnerBackBuffer());
- EXPECT_CALL(*this, OnFrameInfoReady(Eq(absl::nullopt), Eq(absl::nullopt)));
+ EXPECT_CALL(*this, OnFrameInfoReady(Eq(std::nullopt), Eq(std::nullopt)));
}
TEST_F(CodecImageTest, PromotingTheBackBufferWaits) {
@@ -255,7 +255,7 @@
TEST_F(CodecImageTest, FrontBufferRenderingFailsIfBackBufferRenderingFailed) {
auto i = NewImage(kTextureOwner);
wrapper_->TakeCodecSurfacePair();
- EXPECT_CALL(*this, OnFrameInfoReady(Eq(absl::nullopt), Eq(absl::nullopt)));
+ EXPECT_CALL(*this, OnFrameInfoReady(Eq(std::nullopt), Eq(std::nullopt)));
i->RenderToTextureOwnerBackBuffer();
ASSERT_FALSE(i->RenderToFrontBuffer());
}
@@ -336,14 +336,14 @@
TEST_F(CodecImageTest, GetAHardwareBufferAfterRelease) {
// Make sure that we get a nullptr AHB once we've marked the image as unused.
auto i = NewImage(kTextureOwner);
- EXPECT_CALL(*this, OnFrameInfoReady(Eq(absl::nullopt), Eq(absl::nullopt)));
+ EXPECT_CALL(*this, OnFrameInfoReady(Eq(std::nullopt), Eq(std::nullopt)));
i->NotifyUnused();
EXPECT_FALSE(i->GetAHardwareBuffer());
}
TEST_F(CodecImageTest, RenderAfterUnusedDoesntCrash) {
auto i = NewImage(kTextureOwner);
- EXPECT_CALL(*this, OnFrameInfoReady(Eq(absl::nullopt), Eq(absl::nullopt)));
+ EXPECT_CALL(*this, OnFrameInfoReady(Eq(std::nullopt), Eq(std::nullopt)));
i->NotifyUnused();
EXPECT_FALSE(i->RenderToTextureOwnerBackBuffer());
EXPECT_FALSE(i->RenderToTextureOwnerFrontBuffer());
diff --git a/media/gpu/android/codec_output_buffer_renderer.cc b/media/gpu/android/codec_output_buffer_renderer.cc
index 4b1524f2..a8eaccbb 100644
--- a/media/gpu/android/codec_output_buffer_renderer.cc
+++ b/media/gpu/android/codec_output_buffer_renderer.cc
@@ -3,13 +3,15 @@
// found in the LICENSE file.
#include "media/gpu/android/codec_output_buffer_renderer.h"
+
#include <string.h>
+#include <optional>
+
#include "base/android/scoped_hardware_buffer_fence_sync.h"
#include "base/functional/callback_helpers.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "gpu/command_buffer/service/texture_manager.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/scoped_make_current.h"
@@ -107,7 +109,7 @@
size(), &coded_size, &visible_rect)) {
std::move(frame_info_callback_).Run(coded_size, visible_rect);
} else {
- std::move(frame_info_callback_).Run(absl::nullopt, absl::nullopt);
+ std::move(frame_info_callback_).Run(std::nullopt, std::nullopt);
}
}
@@ -140,7 +142,7 @@
void CodecOutputBufferRenderer::Invalidate() {
phase_ = Phase::kInvalidated;
if (frame_info_callback_) {
- std::move(frame_info_callback_).Run(absl::nullopt, absl::nullopt);
+ std::move(frame_info_callback_).Run(std::nullopt, std::nullopt);
}
}
diff --git a/media/gpu/android/codec_output_buffer_renderer.h b/media/gpu/android/codec_output_buffer_renderer.h
index f801b77..965eea7 100644
--- a/media/gpu/android/codec_output_buffer_renderer.h
+++ b/media/gpu/android/codec_output_buffer_renderer.h
@@ -60,11 +60,11 @@
void InvalidateForTesting() { Invalidate(); }
// Runs the frame info callback when UpdateTexImage() is called. If the buffer
- // is dropped without being rendered to the front buffer, absl::nullopt will
+ // is dropped without being rendered to the front buffer, std::nullopt will
// be sent for the coded size and visible rect.
using FrameInfoCallback =
- base::OnceCallback<void(absl::optional<gfx::Size> coded_size,
- absl::optional<gfx::Rect> visible_rect)>;
+ base::OnceCallback<void(std::optional<gfx::Size> coded_size,
+ std::optional<gfx::Rect> visible_rect)>;
void set_frame_info_callback(FrameInfoCallback callback) {
frame_info_callback_ = std::move(callback);
}
diff --git a/media/gpu/android/codec_wrapper.cc b/media/gpu/android/codec_wrapper.cc
index e8390091..56109922 100644
--- a/media/gpu/android/codec_wrapper.cc
+++ b/media/gpu/android/codec_wrapper.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <optional>
#include <string>
#include <vector>
@@ -17,7 +18,6 @@
#include "base/metrics/histogram_macros.h"
#include "base/task/sequenced_task_runner.h"
#include "media/base/android/media_codec_util.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -30,7 +30,7 @@
CodecWrapper::OutputReleasedCB output_buffer_release_cb,
scoped_refptr<base::SequencedTaskRunner> release_task_runner,
const gfx::Size& initial_expected_size,
- absl::optional<gfx::Size> coded_size_alignment);
+ std::optional<gfx::Size> coded_size_alignment);
CodecWrapperImpl(const CodecWrapperImpl&) = delete;
CodecWrapperImpl& operator=(const CodecWrapperImpl&) = delete;
@@ -93,7 +93,7 @@
// An input buffer that was dequeued but subsequently rejected from
// QueueInputBuffer() because the codec didn't have the crypto key. We
// maintain ownership of it and reuse it next time.
- absl::optional<int> owned_input_buffer_;
+ std::optional<int> owned_input_buffer_;
// The current output size. Updated when DequeueOutputBuffer() reports
// OUTPUT_FORMAT_CHANGED.
@@ -111,7 +111,7 @@
gfx::ColorSpace color_space_ = gfx::ColorSpace::CreateSRGB();
// The alignment to use for width, height when guessing coded size.
- const absl::optional<gfx::Size> coded_size_alignment_;
+ const std::optional<gfx::Size> coded_size_alignment_;
// Task runner on which we'll release codec buffers without rendering. May be
// null to always do this on the calling task runner.
@@ -123,7 +123,7 @@
int64_t id,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
- absl::optional<gfx::Size> coded_size_alignment)
+ std::optional<gfx::Size> coded_size_alignment)
: codec_(std::move(codec)),
id_(id),
size_(size),
@@ -135,7 +135,7 @@
int64_t id,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
- absl::optional<gfx::Size> coded_size_alignment)
+ std::optional<gfx::Size> coded_size_alignment)
: id_(id),
size_(size),
color_space_(color_space),
@@ -177,7 +177,7 @@
CodecWrapper::OutputReleasedCB output_buffer_release_cb,
scoped_refptr<base::SequencedTaskRunner> release_task_runner,
const gfx::Size& initial_expected_size,
- absl::optional<gfx::Size> coded_size_alignment)
+ std::optional<gfx::Size> coded_size_alignment)
: state_(State::kFlushed),
codec_(std::move(codec_surface_pair.first)),
surface_bundle_(std::move(codec_surface_pair.second)),
@@ -520,7 +520,7 @@
OutputReleasedCB output_buffer_release_cb,
scoped_refptr<base::SequencedTaskRunner> release_task_runner,
const gfx::Size& initial_expected_size,
- absl::optional<gfx::Size> coded_size_alignment)
+ std::optional<gfx::Size> coded_size_alignment)
: impl_(new CodecWrapperImpl(std::move(codec_surface_pair),
std::move(output_buffer_release_cb),
std::move(release_task_runner),
diff --git a/media/gpu/android/codec_wrapper.h b/media/gpu/android/codec_wrapper.h
index 9ff16a8..4d12c2b 100644
--- a/media/gpu/android/codec_wrapper.h
+++ b/media/gpu/android/codec_wrapper.h
@@ -78,13 +78,13 @@
int64_t id,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
- absl::optional<gfx::Size> coded_size_alignment);
+ std::optional<gfx::Size> coded_size_alignment);
// For testing, since CodecWrapperImpl isn't available. Uses nullptr.
CodecOutputBuffer(int64_t id,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
- absl::optional<gfx::Size> coded_size_alignment);
+ std::optional<gfx::Size> coded_size_alignment);
scoped_refptr<CodecWrapperImpl> codec_;
int64_t id_;
@@ -94,7 +94,7 @@
gfx::ColorSpace color_space_;
// The alignment to use for width, height when guessing coded size.
- const absl::optional<gfx::Size> coded_size_alignment_;
+ const std::optional<gfx::Size> coded_size_alignment_;
};
// This wraps a MediaCodecBridge and provides higher level features and tracks
@@ -129,7 +129,7 @@
OutputReleasedCB output_buffer_release_cb,
scoped_refptr<base::SequencedTaskRunner> release_task_runner,
const gfx::Size& initial_expected_size,
- absl::optional<gfx::Size> coded_size_alignment);
+ std::optional<gfx::Size> coded_size_alignment);
CodecWrapper(const CodecWrapper&) = delete;
CodecWrapper& operator=(const CodecWrapper&) = delete;
diff --git a/media/gpu/android/codec_wrapper_unittest.cc b/media/gpu/android/codec_wrapper_unittest.cc
index 1e67966e..4adfc5f 100644
--- a/media/gpu/android/codec_wrapper_unittest.cc
+++ b/media/gpu/android/codec_wrapper_unittest.cc
@@ -242,7 +242,7 @@
std::move(surface_pair), output_buffer_release_cb_.Get(),
// Unrendered output buffers are released on our thread.
base::SequencedTaskRunner::GetCurrentDefault(), kInitialCodedSize,
- absl::nullopt);
+ std::nullopt);
EXPECT_CALL(*codec_, DequeueOutputBuffer(_, _, _, _, _, _, _))
.WillOnce(Return(MediaCodecResult::Codes::kOutputFormatChanged))
diff --git a/media/gpu/android/frame_info_helper.cc b/media/gpu/android/frame_info_helper.cc
index 1014f08..feb0129 100644
--- a/media/gpu/android/frame_info_helper.cc
+++ b/media/gpu/android/frame_info_helper.cc
@@ -90,14 +90,14 @@
void GetFrameInfoImpl(
std::unique_ptr<CodecOutputBufferRenderer> buffer_renderer,
base::OnceCallback<void(std::unique_ptr<CodecOutputBufferRenderer>,
- absl::optional<FrameInfo>)> cb) {
+ std::optional<FrameInfo>)> cb) {
AssertAcquiredDrDcLock();
DCHECK(buffer_renderer);
auto texture_owner = buffer_renderer->texture_owner();
DCHECK(texture_owner);
- absl::optional<FrameInfo> info;
+ std::optional<FrameInfo> info;
if (buffer_renderer->RenderToTextureOwnerFrontBuffer()) {
gfx::Size coded_size;
@@ -117,7 +117,7 @@
void GetFrameInfo(
std::unique_ptr<CodecOutputBufferRenderer> buffer_renderer,
base::OnceCallback<void(std::unique_ptr<CodecOutputBufferRenderer>,
- absl::optional<FrameInfo>)> cb) {
+ std::optional<FrameInfo>)> cb) {
// Note that we need to ensure that no other thread renders another buffer
// in between while we are getting frame info here. Otherwise we will get
// wrong frame info. This is ensured by holding |drdc_lock| from all the
@@ -160,7 +160,7 @@
void GetFrameInfoImpl(
std::unique_ptr<CodecOutputBufferRenderer> buffer_renderer,
base::OnceCallback<void(std::unique_ptr<CodecOutputBufferRenderer>,
- absl::optional<FrameInfo>)> cb) {
+ std::optional<FrameInfo>)> cb) {
base::AutoLock l(lock_);
if (frame_info_helper_on_gpu_) {
frame_info_helper_on_gpu_->GetFrameInfoImpl(
@@ -228,8 +228,8 @@
void OnRealFrameInfoAvailable(gfx::Size visible_size,
gfx::Size guessed_coded_size,
- absl::optional<gfx::Size> coded_size,
- absl::optional<gfx::Rect> visible_rect) {
+ std::optional<gfx::Size> coded_size,
+ std::optional<gfx::Rect> visible_rect) {
DVLOG(1) << __func__
<< ": coded_size=" << (coded_size ? coded_size->ToString() : "")
<< ", visible_rect="
@@ -265,7 +265,7 @@
void OnFrameInfoReady(
std::unique_ptr<CodecOutputBufferRenderer> buffer_renderer,
- absl::optional<FrameInfo> frame_info) {
+ std::optional<FrameInfo> frame_info) {
DCHECK(buffer_renderer);
DCHECK(!requests_.empty());
@@ -367,7 +367,7 @@
base::queue<Request> requests_;
// Cached values.
- absl::optional<FrameInfo> frame_info_;
+ std::optional<FrameInfo> frame_info_;
gfx::Size visible_size_;
bool waiting_for_real_frame_info_ = false;
bool disable_coded_size_guessing_ =
diff --git a/media/gpu/android/frame_info_helper.h b/media/gpu/android/frame_info_helper.h
index 4b63c05..d927e0f 100644
--- a/media/gpu/android/frame_info_helper.h
+++ b/media/gpu/android/frame_info_helper.h
@@ -5,10 +5,11 @@
#ifndef MEDIA_GPU_ANDROID_FRAME_INFO_HELPER_H_
#define MEDIA_GPU_ANDROID_FRAME_INFO_HELPER_H_
+#include <optional>
+
#include "base/task/sequenced_task_runner.h"
#include "media/gpu/android/shared_image_video_provider.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
class CodecOutputBufferRenderer;
@@ -26,7 +27,7 @@
gfx::Size coded_size;
gfx::Rect visible_rect;
- absl::optional<gpu::VulkanYCbCrInfo> ycbcr_info;
+ std::optional<gpu::VulkanYCbCrInfo> ycbcr_info;
};
using FrameInfoReadyCB =
diff --git a/media/gpu/android/frame_info_helper_unittest.cc b/media/gpu/android/frame_info_helper_unittest.cc
index 7c85574a..44de14d 100644
--- a/media/gpu/android/frame_info_helper_unittest.cc
+++ b/media/gpu/android/frame_info_helper_unittest.cc
@@ -64,7 +64,7 @@
std::unique_ptr<CodecOutputBufferRenderer> CreateBufferRenderer(
gfx::Size size,
scoped_refptr<gpu::TextureOwner> texture_owner,
- absl::optional<gfx::Size> coded_size_alignment = absl::nullopt) {
+ std::optional<gfx::Size> coded_size_alignment = std::nullopt) {
auto codec_buffer_wait_coordinator =
texture_owner
? base::MakeRefCounted<CodecBufferWaitCoordinator>(
diff --git a/media/gpu/android/maybe_render_early_manager.h b/media/gpu/android/maybe_render_early_manager.h
index e49c762a..30aae06 100644
--- a/media/gpu/android/maybe_render_early_manager.h
+++ b/media/gpu/android/maybe_render_early_manager.h
@@ -6,13 +6,13 @@
#define MEDIA_GPU_ANDROID_MAYBE_RENDER_EARLY_MANAGER_H_
#include <memory>
+#include <optional>
#include <vector>
#include "base/memory/scoped_refptr.h"
#include "base/task/sequenced_task_runner.h"
#include "media/gpu/android/codec_image.h" // For CodecImage::BlockingMode
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
class CodecImageHolder;
@@ -65,7 +65,7 @@
return;
// Find the latest image rendered to the front buffer (if any).
- absl::optional<size_t> front_buffer_index;
+ std::optional<size_t> front_buffer_index;
for (int i = images.size() - 1; i >= 0; --i) {
if (images[i]->was_rendered_to_front_buffer()) {
front_buffer_index = i;
diff --git a/media/gpu/android/media_codec_video_decoder.cc b/media/gpu/android/media_codec_video_decoder.cc
index d6b9e0e..f785650e 100644
--- a/media/gpu/android/media_codec_video_decoder.cc
+++ b/media/gpu/android/media_codec_video_decoder.cc
@@ -601,8 +601,8 @@
surface_chooser_helper_.SetIsPersistentVideo(
overlay_info_.is_persistent_video);
surface_chooser_helper_.UpdateChooserState(
- overlay_changed ? absl::make_optional(CreateOverlayFactoryCb())
- : absl::nullopt);
+ overlay_changed ? std::make_optional(CreateOverlayFactoryCb())
+ : std::nullopt);
}
void MediaCodecVideoDecoder::OnSurfaceChosen(
@@ -779,7 +779,7 @@
// Since we can't get the coded size w/o rendering the frame, we try to guess
// in cases where we are unable to render the frame (resolution changes). If
// we can't guess, there will be a visible rendering glitch.
- absl::optional<gfx::Size> coded_size_alignment;
+ std::optional<gfx::Size> coded_size_alignment;
if (base::FeatureList::IsEnabled(kMediaCodecCodedSizeGuessing)) {
coded_size_alignment = MediaCodecUtil::LookupCodedSizeAlignment(name);
if (coded_size_alignment) {
diff --git a/media/gpu/android/media_codec_video_decoder.h b/media/gpu/android/media_codec_video_decoder.h
index b9185ef07..6907df7d 100644
--- a/media/gpu/android/media_codec_video_decoder.h
+++ b/media/gpu/android/media_codec_video_decoder.h
@@ -6,6 +6,7 @@
#define MEDIA_GPU_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_
#include <memory>
+#include <optional>
#include <vector>
#include "base/containers/circular_deque.h"
@@ -30,7 +31,6 @@
#include "media/gpu/android/surface_chooser_helper.h"
#include "media/gpu/android/video_frame_factory.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -249,7 +249,7 @@
bool waiting_for_key_ = false;
// The reason for the current drain operation if any.
- absl::optional<DrainType> drain_type_;
+ std::optional<DrainType> drain_type_;
// The current reset cb if a Reset() is in progress.
base::OnceClosure reset_cb_;
diff --git a/media/gpu/android/mock_android_video_surface_chooser.cc b/media/gpu/android/mock_android_video_surface_chooser.cc
index 2b25b4ea..37251b0 100644
--- a/media/gpu/android/mock_android_video_surface_chooser.cc
+++ b/media/gpu/android/mock_android_video_surface_chooser.cc
@@ -18,7 +18,7 @@
}
void MockAndroidVideoSurfaceChooser::UpdateState(
- absl::optional<AndroidOverlayFactoryCB> factory,
+ std::optional<AndroidOverlayFactoryCB> factory,
const State& new_state) {
MockUpdateState();
if (factory) {
diff --git a/media/gpu/android/mock_android_video_surface_chooser.h b/media/gpu/android/mock_android_video_surface_chooser.h
index ac36c021..34bfe7ed 100644
--- a/media/gpu/android/mock_android_video_surface_chooser.h
+++ b/media/gpu/android/mock_android_video_surface_chooser.h
@@ -34,7 +34,7 @@
void SetClientCallbacks(UseOverlayCB use_overlay_cb,
UseTextureOwnerCB use_texture_owner_cb) override;
- void UpdateState(absl::optional<AndroidOverlayFactoryCB> factory,
+ void UpdateState(std::optional<AndroidOverlayFactoryCB> factory,
const State& new_state) override;
// Calls the corresponding callback to choose the surface.
diff --git a/media/gpu/android/ndk_audio_encoder.cc b/media/gpu/android/ndk_audio_encoder.cc
index ec1fecb2..0b261821 100644
--- a/media/gpu/android/ndk_audio_encoder.cc
+++ b/media/gpu/android/ndk_audio_encoder.cc
@@ -10,6 +10,7 @@
#include <media/NdkMediaFormat.h>
#include <memory>
+#include <optional>
#include "base/containers/span.h"
#include "base/logging.h"
@@ -28,7 +29,6 @@
#include "media/base/sample_format.h"
#include "media/base/timestamp_constants.h"
#include "media/gpu/android/ndk_media_codec_wrapper.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#pragma clang attribute push DEFAULT_REQUIRES_ANDROID_API( \
NDK_MEDIA_CODEC_MIN_API)
@@ -586,7 +586,7 @@
output_timestamp_tracker_->GetTimestamp() + base::TimeTicks();
output_timestamp_tracker_->AddFrames(kAacFramesPerBuffer);
- absl::optional<CodecDescription> desc;
+ std::optional<CodecDescription> desc;
if (!codec_desc_.empty()) {
desc = codec_desc_;
codec_desc_.clear();
@@ -642,7 +642,7 @@
}
std::move(done_cb).Run(*pending_error_status_);
- pending_error_status_ = absl::nullopt;
+ pending_error_status_ = std::nullopt;
}
void NdkAudioEncoder::ReportOk(EncoderStatusCB done_cb) {
diff --git a/media/gpu/android/ndk_audio_encoder.h b/media/gpu/android/ndk_audio_encoder.h
index 2de1a37..16735de 100644
--- a/media/gpu/android/ndk_audio_encoder.h
+++ b/media/gpu/android/ndk_audio_encoder.h
@@ -102,7 +102,7 @@
bool error_occurred_ = false;
// Delayed error status to be reported on the next Encode() or Flush() call.
- absl::optional<EncoderStatus> pending_error_status_;
+ std::optional<EncoderStatus> pending_error_status_;
// What portion of the flushing process we are in, if any.
FlushState flush_state_ GUARDED_BY_CONTEXT(sequence_checker_) =
diff --git a/media/gpu/android/ndk_video_encode_accelerator.cc b/media/gpu/android/ndk_video_encode_accelerator.cc
index b015585..86fd4cd 100644
--- a/media/gpu/android/ndk_video_encode_accelerator.cc
+++ b/media/gpu/android/ndk_video_encode_accelerator.cc
@@ -122,7 +122,7 @@
bool require_low_delay,
const gfx::Size& frame_size,
const Bitrate& bitrate,
- absl::optional<gfx::ColorSpace> cs,
+ std::optional<gfx::ColorSpace> cs,
PixelFormat format) {
MediaFormatPtr result(AMediaFormat_new());
AMediaFormat_setString(result.get(), AMEDIAFORMAT_KEY_MIME, mime.c_str());
@@ -166,9 +166,9 @@
return result;
}
-absl::optional<std::string> FindMediaCodecFor(
+std::optional<std::string> FindMediaCodecFor(
const VideoEncodeAccelerator::Config& config) {
- absl::optional<std::string> encoder_name;
+ std::optional<std::string> encoder_name;
for (const auto& info : GetEncoderInfoCache()) {
const auto& profile = info.profile;
if (profile.profile != config.output_profile) {
@@ -335,7 +335,7 @@
void NdkVideoEncodeAccelerator::RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (size.has_value()) {
NotifyErrorStatus({EncoderStatus::Codes::kEncoderUnsupportedConfig,
diff --git a/media/gpu/android/ndk_video_encode_accelerator.h b/media/gpu/android/ndk_video_encode_accelerator.h
index 24982e5..82e4cd1 100644
--- a/media/gpu/android/ndk_video_encode_accelerator.h
+++ b/media/gpu/android/ndk_video_encode_accelerator.h
@@ -52,7 +52,7 @@
void RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
void Destroy() override;
bool IsFlushSupported() override;
@@ -140,13 +140,13 @@
std::vector<uint8_t> config_data_;
// Required for encoders which are missing stride information.
- absl::optional<gfx::Size> aligned_size_;
+ std::optional<gfx::Size> aligned_size_;
// Currently configured color space.
- absl::optional<gfx::ColorSpace> encoder_color_space_;
+ std::optional<gfx::ColorSpace> encoder_color_space_;
// Pending color space to be set on the MediaCodec after flushing.
- absl::optional<gfx::ColorSpace> pending_color_space_;
+ std::optional<gfx::ColorSpace> pending_color_space_;
// True if any frames have been sent to the encoder.
bool have_encoded_frames_ = false;
diff --git a/media/gpu/android/ndk_video_encode_accelerator_tests.cc b/media/gpu/android/ndk_video_encode_accelerator_tests.cc
index f02a63f..7569c75 100644
--- a/media/gpu/android/ndk_video_encode_accelerator_tests.cc
+++ b/media/gpu/android/ndk_video_encode_accelerator_tests.cc
@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "media/gpu/android/ndk_video_encode_accelerator.h"
+
#include <map>
+#include <optional>
#include <vector>
#include "base/android/build_info.h"
@@ -21,10 +24,8 @@
#include "media/base/video_frame.h"
#include "media/base/video_frame_converter.h"
#include "media/base/video_util.h"
-#include "media/gpu/android/ndk_video_encode_accelerator.h"
#include "media/video/fake_gpu_memory_buffer.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/libyuv/include/libyuv.h"
#include "third_party/libyuv/include/libyuv/convert_from.h"
@@ -231,7 +232,7 @@
BitstreamBufferMetadata md;
};
std::vector<Output> outputs_;
- absl::optional<EncoderStatus> error_status_;
+ std::optional<EncoderStatus> error_status_;
size_t input_buffer_size_ = 0;
int32_t last_buffer_id_ = 0;
VideoFrameConverter frame_converter_;
diff --git a/media/gpu/android/surface_chooser_helper.cc b/media/gpu/android/surface_chooser_helper.cc
index 2a3d92f97..6cd23206 100644
--- a/media/gpu/android/surface_chooser_helper.cc
+++ b/media/gpu/android/surface_chooser_helper.cc
@@ -100,7 +100,7 @@
}
void SurfaceChooserHelper::UpdateChooserState(
- absl::optional<AndroidOverlayFactoryCB> new_factory) {
+ std::optional<AndroidOverlayFactoryCB> new_factory) {
surface_chooser_->UpdateState(std::move(new_factory), surface_chooser_state_);
}
@@ -144,7 +144,7 @@
if (update_state) {
most_recent_chooser_retry_ = now;
- UpdateChooserState(absl::optional<AndroidOverlayFactoryCB>());
+ UpdateChooserState(std::optional<AndroidOverlayFactoryCB>());
}
}
diff --git a/media/gpu/android/surface_chooser_helper.h b/media/gpu/android/surface_chooser_helper.h
index 30030562..86d03e9 100644
--- a/media/gpu/android/surface_chooser_helper.h
+++ b/media/gpu/android/surface_chooser_helper.h
@@ -6,6 +6,7 @@
#define MEDIA_GPU_ANDROID_SURFACE_CHOOSER_HELPER_H_
#include <memory>
+#include <optional>
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
@@ -13,7 +14,6 @@
#include "media/gpu/android/android_video_surface_chooser.h"
#include "media/gpu/android/promotion_hint_aggregator.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class TickClock;
@@ -90,7 +90,7 @@
void SetIsPersistentVideo(bool is_persistent_video);
// Update the chooser state using the given factory.
- void UpdateChooserState(absl::optional<AndroidOverlayFactoryCB> new_factory);
+ void UpdateChooserState(std::optional<AndroidOverlayFactoryCB> new_factory);
// Notify us about a promotion hint. This will update the chooser state
// if needed.
diff --git a/media/gpu/android/surface_chooser_helper_unittest.cc b/media/gpu/android/surface_chooser_helper_unittest.cc
index 032be14..6bad907c 100644
--- a/media/gpu/android/surface_chooser_helper_unittest.cc
+++ b/media/gpu/android/surface_chooser_helper_unittest.cc
@@ -52,7 +52,7 @@
// Convenience function.
void UpdateChooserState() {
EXPECT_CALL(*chooser_, MockUpdateState());
- helper_->UpdateChooserState(absl::optional<AndroidOverlayFactoryCB>());
+ helper_->UpdateChooserState(std::optional<AndroidOverlayFactoryCB>());
}
base::SimpleTestTickClock tick_clock_;
diff --git a/media/gpu/android/video_frame_factory_impl.h b/media/gpu/android/video_frame_factory_impl.h
index f7c7c2b..5b50452 100644
--- a/media/gpu/android/video_frame_factory_impl.h
+++ b/media/gpu/android/video_frame_factory_impl.h
@@ -6,6 +6,7 @@
#define MEDIA_GPU_ANDROID_VIDEO_FRAME_FACTORY_IMPL_H_
#include <memory>
+#include <optional>
#include "base/memory/weak_ptr.h"
#include "base/task/sequenced_task_runner.h"
@@ -20,7 +21,6 @@
#include "media/gpu/android/shared_image_video_provider.h"
#include "media/gpu/android/video_frame_factory.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gl/gl_bindings.h"
namespace media {
diff --git a/media/gpu/android/video_frame_factory_impl_unittest.cc b/media/gpu/android/video_frame_factory_impl_unittest.cc
index 5a15e8d8..a1303a3 100644
--- a/media/gpu/android/video_frame_factory_impl_unittest.cc
+++ b/media/gpu/android/video_frame_factory_impl_unittest.cc
@@ -104,7 +104,7 @@
void RequestVideoFrame() {
auto output_buffer = CodecOutputBuffer::CreateForTesting(
0, video_frame_params_.coded_size, video_frame_params_.color_space,
- absl::nullopt);
+ std::nullopt);
ASSERT_TRUE(VideoFrame::IsValidConfig(
PIXEL_FORMAT_ARGB, VideoFrame::STORAGE_OPAQUE,
video_frame_params_.coded_size, video_frame_params_.visible_rect,
@@ -211,7 +211,7 @@
gfx::Rect visible_rect(coded_size);
gfx::Size natural_size(0, 0);
auto output_buffer = CodecOutputBuffer::CreateForTesting(
- 0, coded_size, gfx::ColorSpace(), absl::nullopt);
+ 0, coded_size, gfx::ColorSpace(), std::nullopt);
ASSERT_FALSE(VideoFrame::IsValidConfig(PIXEL_FORMAT_ARGB,
VideoFrame::STORAGE_OPAQUE, coded_size,
visible_rect, natural_size));
diff --git a/media/gpu/av1_decoder.cc b/media/gpu/av1_decoder.cc
index e20e634..b94ac37 100644
--- a/media/gpu/av1_decoder.cc
+++ b/media/gpu/av1_decoder.cc
@@ -603,7 +603,7 @@
return AV1Accelerator::Status::kOk;
}
-absl::optional<gfx::HDRMetadata> AV1Decoder::GetHDRMetadata() const {
+std::optional<gfx::HDRMetadata> AV1Decoder::GetHDRMetadata() const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return hdr_metadata_;
}
diff --git a/media/gpu/av1_decoder.h b/media/gpu/av1_decoder.h
index 52b6d0cf6..791563ee 100644
--- a/media/gpu/av1_decoder.h
+++ b/media/gpu/av1_decoder.h
@@ -20,7 +20,7 @@
// For libgav1::RefCountedBufferPtr.
#include "third_party/libgav1/src/src/buffer_pool.h"
-// For libgav1::ObuSequenceHeader. absl::optional demands ObuSequenceHeader to
+// For libgav1::ObuSequenceHeader. std::optional demands ObuSequenceHeader to
// fulfill std::is_trivially_constructible if it is forward-declared. But
// ObuSequenceHeader doesn't.
#include "third_party/libgav1/src/src/obu_parser.h"
@@ -138,7 +138,7 @@
uint8_t GetBitDepth() const override;
VideoChromaSampling GetChromaSampling() const override;
VideoColorSpace GetVideoColorSpace() const override;
- absl::optional<gfx::HDRMetadata> GetHDRMetadata() const override;
+ std::optional<gfx::HDRMetadata> GetHDRMetadata() const override;
size_t GetRequiredNumOfPictures() const override;
size_t GetNumReferenceFrames() const override;
@@ -169,8 +169,8 @@
const std::unique_ptr<AV1Accelerator> accelerator_;
AV1ReferenceFrameVector ref_frames_;
- absl::optional<libgav1::ObuSequenceHeader> current_sequence_header_;
- absl::optional<libgav1::ObuFrameHeader> current_frame_header_;
+ std::optional<libgav1::ObuSequenceHeader> current_sequence_header_;
+ std::optional<libgav1::ObuFrameHeader> current_frame_header_;
libgav1::RefCountedBufferPtr current_frame_;
gfx::Rect visible_rect_;
@@ -180,7 +180,7 @@
VideoColorSpace picture_color_space_;
uint8_t bit_depth_ = 0;
VideoChromaSampling chroma_sampling_ = VideoChromaSampling::kUnknown;
- absl::optional<gfx::HDRMetadata> hdr_metadata_;
+ std::optional<gfx::HDRMetadata> hdr_metadata_;
int32_t stream_id_ = 0;
const uint8_t* stream_ = nullptr;
diff --git a/media/gpu/chromeos/chromeos_compressed_gpu_memory_buffer_video_frame_utils.cc b/media/gpu/chromeos/chromeos_compressed_gpu_memory_buffer_video_frame_utils.cc
index 6e541f6..ff610f91 100644
--- a/media/gpu/chromeos/chromeos_compressed_gpu_memory_buffer_video_frame_utils.cc
+++ b/media/gpu/chromeos/chromeos_compressed_gpu_memory_buffer_video_frame_utils.cc
@@ -7,13 +7,14 @@
#include <drm_fourcc.h>
#include <stdint.h>
+#include <optional>
+
#include "base/logging.h"
#include "base/time/time.h"
#include "media/base/color_plane_layout.h"
#include "media/base/format_utils.h"
#include "media/base/video_frame.h"
#include "media/base/video_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -26,7 +27,7 @@
const gfx::Size& natural_size,
std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer,
base::TimeDelta timestamp) {
- const absl::optional<VideoPixelFormat> format =
+ const std::optional<VideoPixelFormat> format =
GfxBufferFormatToVideoPixelFormat(gpu_memory_buffer->GetFormat());
if (!format ||
(*format != PIXEL_FORMAT_NV12 && *format != PIXEL_FORMAT_P016LE)) {
diff --git a/media/gpu/chromeos/decoder_buffer_transcryptor.cc b/media/gpu/chromeos/decoder_buffer_transcryptor.cc
index b9a6c03e..f5abbf9 100644
--- a/media/gpu/chromeos/decoder_buffer_transcryptor.cc
+++ b/media/gpu/chromeos/decoder_buffer_transcryptor.cc
@@ -64,7 +64,7 @@
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (current_transcrypt_task_) {
std::move(current_transcrypt_task_->decode_done_cb).Run(status);
- current_transcrypt_task_ = absl::nullopt;
+ current_transcrypt_task_ = std::nullopt;
}
while (!transcrypt_task_queue_.empty()) {
@@ -152,9 +152,9 @@
if (status == Decryptor::kError) {
// Clear |current_transcrypt_task_| now so when the pipeline invokes Reset
// on us we don't try to invoke the move'd callback.
- absl::optional<TranscryptTask> temp_task =
+ std::optional<TranscryptTask> temp_task =
std::move(current_transcrypt_task_);
- current_transcrypt_task_ = absl::nullopt;
+ current_transcrypt_task_ = std::nullopt;
transcrypt_callback_.Run(nullptr, std::move(temp_task->decode_done_cb));
return;
}
@@ -173,9 +173,8 @@
DCHECK(transcrypted_buffer);
const bool eos_buffer = transcrypted_buffer->end_of_stream();
- absl::optional<TranscryptTask> temp_task =
- std::move(current_transcrypt_task_);
- current_transcrypt_task_ = absl::nullopt;
+ std::optional<TranscryptTask> temp_task = std::move(current_transcrypt_task_);
+ current_transcrypt_task_ = std::nullopt;
transcrypt_callback_.Run(std::move(transcrypted_buffer),
std::move(temp_task->decode_done_cb));
diff --git a/media/gpu/chromeos/decoder_buffer_transcryptor.h b/media/gpu/chromeos/decoder_buffer_transcryptor.h
index 67ebc2fe..3c1f5a1 100644
--- a/media/gpu/chromeos/decoder_buffer_transcryptor.h
+++ b/media/gpu/chromeos/decoder_buffer_transcryptor.h
@@ -6,6 +6,7 @@
#define MEDIA_GPU_CHROMEOS_DECODER_BUFFER_TRANSCRYPTOR_H_
#include <memory>
+#include <optional>
#include "base/containers/queue.h"
#include "base/functional/callback_forward.h"
@@ -18,7 +19,6 @@
#include "media/base/decoder_status.h"
#include "media/base/decryptor.h"
#include "media/base/video_decoder.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -100,7 +100,7 @@
// Queue containing all requested transcrypt tasks.
base::queue<TranscryptTask> transcrypt_task_queue_;
// The transcrypt task we're currently trying to execute.
- absl::optional<TranscryptTask> current_transcrypt_task_;
+ std::optional<TranscryptTask> current_transcrypt_task_;
// If true, then a request to the decryptor is in progress which means we
// should not make another transcryption request until the pending one
diff --git a/media/gpu/chromeos/dmabuf_video_frame_pool.h b/media/gpu/chromeos/dmabuf_video_frame_pool.h
index b133f6f..eec50d0 100644
--- a/media/gpu/chromeos/dmabuf_video_frame_pool.h
+++ b/media/gpu/chromeos/dmabuf_video_frame_pool.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_GPU_CHROMEOS_DMABUF_VIDEO_FRAME_POOL_H_
#define MEDIA_GPU_CHROMEOS_DMABUF_VIDEO_FRAME_POOL_H_
+#include <optional>
+
#include "base/memory/scoped_refptr.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
@@ -14,7 +16,6 @@
#include "media/gpu/chromeos/fourcc.h"
#include "media/gpu/chromeos/gpu_buffer_layout.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -90,8 +91,8 @@
virtual void ReleaseAllFrames() = 0;
// Detailed information of the allocated GpuBufferLayout. Only valid after a
- // successful Initialize() call, otherwise returns absl::nullopt.
- virtual absl::optional<GpuBufferLayout> GetGpuBufferLayout() = 0;
+ // successful Initialize() call, otherwise returns std::nullopt.
+ virtual std::optional<GpuBufferLayout> GetGpuBufferLayout() = 0;
// Returns true if and only if the pool is a mock pool used for testing.
virtual bool IsFakeVideoFramePool();
diff --git a/media/gpu/chromeos/fourcc.cc b/media/gpu/chromeos/fourcc.cc
index e141bb17..175cb3eb 100644
--- a/media/gpu/chromeos/fourcc.cc
+++ b/media/gpu/chromeos/fourcc.cc
@@ -17,7 +17,7 @@
namespace media {
// static
-absl::optional<Fourcc> Fourcc::FromUint32(uint32_t fourcc) {
+std::optional<Fourcc> Fourcc::FromUint32(uint32_t fourcc) {
switch (fourcc) {
case YU12:
case YV12:
@@ -40,11 +40,11 @@
return Fourcc(static_cast<Value>(fourcc));
}
DVLOGF(4) << "Unmapped fourcc: " << FourccToString(fourcc);
- return absl::nullopt;
+ return std::nullopt;
}
// static
-absl::optional<Fourcc> Fourcc::FromVideoPixelFormat(
+std::optional<Fourcc> Fourcc::FromVideoPixelFormat(
VideoPixelFormat pixel_format,
bool single_planar) {
if (single_planar) {
@@ -149,7 +149,7 @@
}
DVLOGF(3) << "Unmapped " << VideoPixelFormatToString(pixel_format) << " for "
<< (single_planar ? "single-planar" : "multi-planar");
- return absl::nullopt;
+ return std::nullopt;
}
VideoPixelFormat Fourcc::ToVideoPixelFormat() const {
@@ -209,7 +209,7 @@
#if BUILDFLAG(USE_V4L2_CODEC)
// static
-absl::optional<Fourcc> Fourcc::FromV4L2PixFmt(uint32_t v4l2_pix_fmt) {
+std::optional<Fourcc> Fourcc::FromV4L2PixFmt(uint32_t v4l2_pix_fmt) {
// We can do that because we adopt the same internal definition of Fourcc as
// V4L2.
return FromUint32(v4l2_pix_fmt);
@@ -222,7 +222,7 @@
}
#elif BUILDFLAG(USE_VAAPI)
// static
-absl::optional<Fourcc> Fourcc::FromVAFourCC(uint32_t va_fourcc) {
+std::optional<Fourcc> Fourcc::FromVAFourCC(uint32_t va_fourcc) {
switch (va_fourcc) {
case VA_FOURCC_I420:
return Fourcc(YU12);
@@ -240,10 +240,10 @@
return Fourcc(AR24);
}
DVLOGF(3) << "Unmapped VAFourCC: " << FourccToString(va_fourcc);
- return absl::nullopt;
+ return std::nullopt;
}
-absl::optional<uint32_t> Fourcc::ToVAFourCC() const {
+std::optional<uint32_t> Fourcc::ToVAFourCC() const {
switch (value_) {
case YU12:
return VA_FOURCC_I420;
@@ -274,15 +274,15 @@
// VAAPI does not know about these formats, so signal this by returning
// nullopt.
DVLOGF(3) << "Fourcc not convertible to VaFourCC: " << ToString();
- return absl::nullopt;
+ return std::nullopt;
}
NOTREACHED() << "Unmapped Fourcc: " << ToString();
- return absl::nullopt;
+ return std::nullopt;
}
#endif // BUILDFLAG(USE_VAAPI)
-absl::optional<Fourcc> Fourcc::ToSinglePlanar() const {
+std::optional<Fourcc> Fourcc::ToSinglePlanar() const {
switch (value_) {
case YU12:
case YV12:
@@ -309,7 +309,7 @@
case Q08C:
case Q10C:
case UNDEFINED:
- return absl::nullopt;
+ return std::nullopt;
}
}
diff --git a/media/gpu/chromeos/fourcc.h b/media/gpu/chromeos/fourcc.h
index f35d365f..6f08dba 100644
--- a/media/gpu/chromeos/fourcc.h
+++ b/media/gpu/chromeos/fourcc.h
@@ -6,12 +6,13 @@
#define MEDIA_GPU_CHROMEOS_FOURCC_H_
#include <stdint.h>
+
+#include <optional>
#include <string>
#include "media/base/video_types.h"
#include "media/gpu/buildflags.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -121,23 +122,23 @@
// Builds a Fourcc from a given fourcc code. This will return a valid
// Fourcc if the argument is part of the |Value| enum, or nullopt otherwise.
- static absl::optional<Fourcc> FromUint32(uint32_t fourcc);
+ static std::optional<Fourcc> FromUint32(uint32_t fourcc);
// Converts a VideoPixelFormat to Fourcc.
// Returns nullopt for invalid input.
// Note that a VideoPixelFormat may have two Fourcc counterparts. Caller has
// to specify if it is for single-planar or multi-planar format.
- static absl::optional<Fourcc> FromVideoPixelFormat(
+ static std::optional<Fourcc> FromVideoPixelFormat(
VideoPixelFormat pixel_format,
bool single_planar = true);
#if BUILDFLAG(USE_V4L2_CODEC)
// Converts a V4L2PixFmt to Fourcc.
// Returns nullopt for invalid input.
- static absl::optional<Fourcc> FromV4L2PixFmt(uint32_t v4l2_pix_fmt);
+ static std::optional<Fourcc> FromV4L2PixFmt(uint32_t v4l2_pix_fmt);
#elif BUILDFLAG(USE_VAAPI)
// Converts a VAFourCC to Fourcc.
// Returns nullopt for invalid input.
- static absl::optional<Fourcc> FromVAFourCC(uint32_t va_fourcc);
+ static std::optional<Fourcc> FromVAFourCC(uint32_t va_fourcc);
#endif // BUILDFLAG(USE_VAAPI)
// Value getters:
@@ -151,14 +152,14 @@
#elif BUILDFLAG(USE_VAAPI)
// Returns the VAFourCC counterpart of the value.
// Returns nullopt if no mapping is found.
- absl::optional<uint32_t> ToVAFourCC() const;
+ std::optional<uint32_t> ToVAFourCC() const;
#endif // BUILDFLAG(USE_VAAPI)
// Returns the single-planar Fourcc of the value. If value is a single-planar,
// returns the same Fourcc. Returns nullopt if the value is neither
// single-planar nor multi-planar or if the value is multi-planar but does not
// have a single-planar equivalent.
- absl::optional<Fourcc> ToSinglePlanar() const;
+ std::optional<Fourcc> ToSinglePlanar() const;
// Returns whether |value_| is multi planar format.
bool IsMultiPlanar() const;
diff --git a/media/gpu/chromeos/fourcc_unittests.cc b/media/gpu/chromeos/fourcc_unittests.cc
index 6dcdb8d..610b7fe 100644
--- a/media/gpu/chromeos/fourcc_unittests.cc
+++ b/media/gpu/chromeos/fourcc_unittests.cc
@@ -3,7 +3,8 @@
// found in the LICENSE file.
#include "media/gpu/chromeos/fourcc.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
+
+#include <optional>
#include "media/gpu/buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -20,8 +21,8 @@
// Checks that converting a V4L2 pixel format to Fourcc and back to V4L2
// yields the same format as the original one.
static void CheckFromV4L2PixFmtAndBack(uint32_t fmt) {
- absl::optional<Fourcc> fourcc = Fourcc::FromV4L2PixFmt(fmt);
- EXPECT_NE(fourcc, absl::nullopt);
+ std::optional<Fourcc> fourcc = Fourcc::FromV4L2PixFmt(fmt);
+ EXPECT_NE(fourcc, std::nullopt);
EXPECT_EQ(fourcc->ToV4L2PixFmt(), fmt);
}
@@ -91,7 +92,7 @@
->ToVideoPixelFormat());
// Randomly pick an unmapped v4l2 fourcc.
- EXPECT_EQ(absl::nullopt, Fourcc::FromV4L2PixFmt(V4L2_PIX_FMT_Z16));
+ EXPECT_EQ(std::nullopt, Fourcc::FromV4L2PixFmt(V4L2_PIX_FMT_Z16));
}
TEST(FourccTest, VideoPixelFormatToV4L2PixFmt) {
@@ -133,10 +134,10 @@
// Checks that converting a VaFourCC to Fourcc and back to VaFourCC
// yields the same format as the original one.
static void CheckFromVAFourCCAndBack(uint32_t va_fourcc) {
- absl::optional<Fourcc> fourcc = Fourcc::FromVAFourCC(va_fourcc);
- EXPECT_NE(fourcc, absl::nullopt);
- absl::optional<uint32_t> to_va_fourcc = fourcc->ToVAFourCC();
- EXPECT_NE(to_va_fourcc, absl::nullopt);
+ std::optional<Fourcc> fourcc = Fourcc::FromVAFourCC(va_fourcc);
+ EXPECT_NE(fourcc, std::nullopt);
+ std::optional<uint32_t> to_va_fourcc = fourcc->ToVAFourCC();
+ EXPECT_NE(to_va_fourcc, std::nullopt);
EXPECT_EQ(*to_va_fourcc, va_fourcc);
}
@@ -203,8 +204,8 @@
Fourcc(Fourcc::NV12).ToSinglePlanar());
EXPECT_EQ(Fourcc(Fourcc::NM21).ToSinglePlanar(),
Fourcc(Fourcc::NV21).ToSinglePlanar());
- EXPECT_EQ(Fourcc(Fourcc::MT21).ToSinglePlanar(), absl::nullopt);
- EXPECT_EQ(Fourcc(Fourcc::Q08C).ToSinglePlanar(), absl::nullopt);
- EXPECT_EQ(Fourcc(Fourcc::Q10C).ToSinglePlanar(), absl::nullopt);
+ EXPECT_EQ(Fourcc(Fourcc::MT21).ToSinglePlanar(), std::nullopt);
+ EXPECT_EQ(Fourcc(Fourcc::Q08C).ToSinglePlanar(), std::nullopt);
+ EXPECT_EQ(Fourcc(Fourcc::Q10C).ToSinglePlanar(), std::nullopt);
}
} // namespace media
diff --git a/media/gpu/chromeos/gpu_buffer_layout.cc b/media/gpu/chromeos/gpu_buffer_layout.cc
index fe34f4c..29139c43 100644
--- a/media/gpu/chromeos/gpu_buffer_layout.cc
+++ b/media/gpu/chromeos/gpu_buffer_layout.cc
@@ -29,7 +29,7 @@
} // namespace
// static
-absl::optional<GpuBufferLayout> GpuBufferLayout::Create(
+std::optional<GpuBufferLayout> GpuBufferLayout::Create(
const Fourcc& fourcc,
const gfx::Size& size,
const std::vector<ColorPlaneLayout>& planes,
@@ -41,7 +41,7 @@
<< ", size: " << size.ToString()
<< ", planes: " << VectorToString(planes)
<< ", modifier: " << std::hex << modifier;
- return absl::nullopt;
+ return std::nullopt;
}
return GpuBufferLayout(fourcc, size, planes, modifier);
diff --git a/media/gpu/chromeos/gpu_buffer_layout.h b/media/gpu/chromeos/gpu_buffer_layout.h
index 492f326..c4103954 100644
--- a/media/gpu/chromeos/gpu_buffer_layout.h
+++ b/media/gpu/chromeos/gpu_buffer_layout.h
@@ -5,20 +5,20 @@
#ifndef MEDIA_GPU_CHROMEOS_GPU_BUFFER_LAYOUT_H_
#define MEDIA_GPU_CHROMEOS_GPU_BUFFER_LAYOUT_H_
+#include <optional>
#include <ostream>
#include <vector>
#include "media/base/color_plane_layout.h"
#include "media/gpu/chromeos/fourcc.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
class MEDIA_GPU_EXPORT GpuBufferLayout {
public:
- static absl::optional<GpuBufferLayout> Create(
+ static std::optional<GpuBufferLayout> Create(
const Fourcc& fourcc,
const gfx::Size& size,
const std::vector<ColorPlaneLayout>& planes,
diff --git a/media/gpu/chromeos/image_processor.cc b/media/gpu/chromeos/image_processor.cc
index 6c029d0..1084f67 100644
--- a/media/gpu/chromeos/image_processor.cc
+++ b/media/gpu/chromeos/image_processor.cc
@@ -146,7 +146,7 @@
// static
void ImageProcessor::OnProcessDoneThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
- absl::optional<base::WeakPtr<ImageProcessor>> weak_this,
+ std::optional<base::WeakPtr<ImageProcessor>> weak_this,
int cb_index,
scoped_refptr<VideoFrame> frame) {
DVLOGF(4);
@@ -193,7 +193,7 @@
// static
void ImageProcessor::OnProcessLegacyDoneThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
- absl::optional<base::WeakPtr<ImageProcessor>> weak_this,
+ std::optional<base::WeakPtr<ImageProcessor>> weak_this,
int cb_index,
size_t buffer_id,
scoped_refptr<VideoFrame> frame) {
diff --git a/media/gpu/chromeos/image_processor.h b/media/gpu/chromeos/image_processor.h
index a6c84ad..fb47ed5a 100644
--- a/media/gpu/chromeos/image_processor.h
+++ b/media/gpu/chromeos/image_processor.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <map>
+#include <optional>
#include <utility>
#include <vector>
@@ -20,7 +21,6 @@
#include "media/gpu/chromeos/fourcc.h"
#include "media/gpu/chromeos/image_processor_backend.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/native_pixmap_handle.h"
namespace media {
@@ -140,12 +140,12 @@
// Callbacks of processing frames.
static void OnProcessDoneThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
- absl::optional<base::WeakPtr<ImageProcessor>> weak_this,
+ std::optional<base::WeakPtr<ImageProcessor>> weak_this,
int cb_index,
scoped_refptr<VideoFrame> frame);
static void OnProcessLegacyDoneThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
- absl::optional<base::WeakPtr<ImageProcessor>> weak_this,
+ std::optional<base::WeakPtr<ImageProcessor>> weak_this,
int cb_index,
size_t buffer_id,
scoped_refptr<VideoFrame> frame);
diff --git a/media/gpu/chromeos/image_processor_factory.cc b/media/gpu/chromeos/image_processor_factory.cc
index 6eacebd..0dd3d23 100644
--- a/media/gpu/chromeos/image_processor_factory.cc
+++ b/media/gpu/chromeos/image_processor_factory.cc
@@ -46,7 +46,7 @@
ImageProcessor::ErrorCB error_cb) {
std::vector<Fourcc> vpp_supported_formats =
VaapiWrapper::GetVppSupportedFormats();
- absl::optional<PixelLayoutCandidate> chosen_input_candidate;
+ std::optional<PixelLayoutCandidate> chosen_input_candidate;
for (const auto& input_candidate : input_candidates) {
if (base::Contains(vpp_supported_formats, input_candidate.fourcc) &&
VaapiWrapper::IsVppResolutionAllowed(input_candidate.size)) {
@@ -106,7 +106,7 @@
}
const auto output_fourcc = out_format_picker.Run(
- /*candidates=*/supported_fourccs, /*preferred_fourcc=*/absl::nullopt);
+ /*candidates=*/supported_fourccs, /*preferred_fourcc=*/std::nullopt);
if (!output_fourcc) {
#if DCHECK_IS_ON()
std::string output_fourccs_string;
@@ -190,7 +190,7 @@
matched_candidate.fourcc);
auto output_format =
- out_format_picker.Run(supported_output_formats, absl::nullopt);
+ out_format_picker.Run(supported_output_formats, std::nullopt);
if (!output_format)
return nullptr;
diff --git a/media/gpu/chromeos/image_processor_factory.h b/media/gpu/chromeos/image_processor_factory.h
index 08696fa..e7590f2 100644
--- a/media/gpu/chromeos/image_processor_factory.h
+++ b/media/gpu/chromeos/image_processor_factory.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include <vector>
#include "base/functional/callback_forward.h"
@@ -15,7 +16,6 @@
#include "media/gpu/chromeos/fourcc.h"
#include "media/gpu/chromeos/image_processor.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
@@ -24,9 +24,9 @@
public:
// Callback to pick a valid format from the given |candidates| formats giving
// preference to |preferred_fourcc| if provided.
- using PickFormatCB = base::RepeatingCallback<absl::optional<Fourcc>(
+ using PickFormatCB = base::RepeatingCallback<std::optional<Fourcc>(
const std::vector<Fourcc>& /* candidates */,
- absl::optional<Fourcc> /* preferred_fourcc */)>;
+ std::optional<Fourcc> /* preferred_fourcc */)>;
// Factory method to create an ImageProcessor.
// The caller will either pass in a list of supported inputs,
diff --git a/media/gpu/chromeos/image_processor_perf_test.cc b/media/gpu/chromeos/image_processor_perf_test.cc
index 63b37dac..c6563dcf 100644
--- a/media/gpu/chromeos/image_processor_perf_test.cc
+++ b/media/gpu/chromeos/image_processor_perf_test.cc
@@ -243,8 +243,8 @@
client_task_runner_, quit_closure_, &image_processor_error_);
pick_format_cb_ = base::BindRepeating(
- [](const std::vector<Fourcc>&, absl::optional<Fourcc>) {
- return absl::make_optional<Fourcc>(Fourcc::NV12);
+ [](const std::vector<Fourcc>&, std::optional<Fourcc>) {
+ return std::make_optional<Fourcc>(Fourcc::NV12);
});
}
@@ -551,8 +551,8 @@
},
client_task_runner, quit_closure, &image_processor_error);
ImageProcessorFactory::PickFormatCB pick_format_cb = base::BindRepeating(
- [](const std::vector<Fourcc>&, absl::optional<Fourcc>) {
- return absl::make_optional<Fourcc>(Fourcc::NV12);
+ [](const std::vector<Fourcc>&, std::optional<Fourcc>) {
+ return std::make_optional<Fourcc>(Fourcc::NV12);
});
std::unique_ptr<ImageProcessor> gl_upscaling_image_processor =
diff --git a/media/gpu/chromeos/image_processor_test.cc b/media/gpu/chromeos/image_processor_test.cc
index 989878f..27e63e4f 100644
--- a/media/gpu/chromeos/image_processor_test.cc
+++ b/media/gpu/chromeos/image_processor_test.cc
@@ -148,11 +148,11 @@
}
// Creates a CreateBackendCB for the specified BackendType. If backend is not
-// set, then returns absl::nullopt.
-absl::optional<ImageProcessor::CreateBackendCB> GetCreateBackendCB(
- absl::optional<BackendType> backend) {
+// set, then returns std::nullopt.
+std::optional<ImageProcessor::CreateBackendCB> GetCreateBackendCB(
+ std::optional<BackendType> backend) {
if (!backend) {
- return absl::nullopt;
+ return std::nullopt;
}
switch (*backend) {
@@ -175,7 +175,7 @@
}
}
-absl::optional<BackendType> g_backend_type;
+std::optional<BackendType> g_backend_type;
base::FilePath BuildSourceFilePath(const base::FilePath& filename) {
return media::g_source_directory.Append(filename);
@@ -725,8 +725,8 @@
},
client_task_runner, quit_closure, &image_processor_error);
ImageProcessorFactory::PickFormatCB pick_format_cb = base::BindRepeating(
- [](const std::vector<Fourcc>&, absl::optional<Fourcc>) {
- return absl::make_optional<Fourcc>(Fourcc::NV12);
+ [](const std::vector<Fourcc>&, std::optional<Fourcc>) {
+ return std::make_optional<Fourcc>(Fourcc::NV12);
});
std::unique_ptr<ImageProcessor> libyuv_image_processor =
diff --git a/media/gpu/chromeos/mailbox_video_frame_converter.cc b/media/gpu/chromeos/mailbox_video_frame_converter.cc
index 961b88de..b92745b 100644
--- a/media/gpu/chromeos/mailbox_video_frame_converter.cc
+++ b/media/gpu/chromeos/mailbox_video_frame_converter.cc
@@ -4,6 +4,8 @@
#include "media/gpu/chromeos/mailbox_video_frame_converter.h"
+#include <optional>
+
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
@@ -22,7 +24,6 @@
#include "media/base/video_util.h"
#include "media/gpu/chromeos/platform_video_frame_utils.h"
#include "media/gpu/macros.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gl/gl_bindings.h"
@@ -99,10 +100,10 @@
return !!gpu_channel_;
}
- absl::optional<gpu::SharedImageCapabilities> GetCapabilities() override {
+ std::optional<gpu::SharedImageCapabilities> GetCapabilities() override {
DCHECK(gpu_task_runner_->BelongsToCurrentThread());
if (!gpu_channel_) {
- return absl::nullopt;
+ return std::nullopt;
}
gpu::SharedImageStub* shared_image_stub = gpu_channel_->shared_image_stub();
@@ -555,7 +556,7 @@
const gfx::Size shared_image_size =
GetRectSizeFromOrigin(destination_visible_rect);
- const absl::optional<gpu::SharedImageCapabilities> shared_image_caps =
+ const std::optional<gpu::SharedImageCapabilities> shared_image_caps =
gpu_delegate_->GetCapabilities();
if (!shared_image_caps.has_value()) {
diff --git a/media/gpu/chromeos/mailbox_video_frame_converter.h b/media/gpu/chromeos/mailbox_video_frame_converter.h
index 67d4cba..2252a2c 100644
--- a/media/gpu/chromeos/mailbox_video_frame_converter.h
+++ b/media/gpu/chromeos/mailbox_video_frame_converter.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_GPU_CHROMEOS_MAILBOX_VIDEO_FRAME_CONVERTER_H_
#define MEDIA_GPU_CHROMEOS_MAILBOX_VIDEO_FRAME_CONVERTER_H_
+#include <optional>
+
#include "base/containers/queue.h"
#include "base/containers/small_map.h"
#include "base/functional/callback_forward.h"
@@ -16,7 +18,6 @@
#include "gpu/ipc/service/shared_image_stub.h"
#include "media/base/video_frame.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkAlphaType.h"
#include "third_party/skia/include/gpu/GrTypes.h"
#include "ui/gfx/buffer_types.h"
@@ -56,7 +57,7 @@
virtual ~GpuDelegate() = default;
virtual bool Initialize() = 0;
- virtual absl::optional<gpu::SharedImageCapabilities> GetCapabilities() = 0;
+ virtual std::optional<gpu::SharedImageCapabilities> GetCapabilities() = 0;
virtual gpu::SharedImageStub::SharedImageDestructionCallback
CreateSharedImage(const gpu::Mailbox& mailbox,
gfx::GpuMemoryBufferHandle handle,
diff --git a/media/gpu/chromeos/mailbox_video_frame_converter_unittest.cc b/media/gpu/chromeos/mailbox_video_frame_converter_unittest.cc
index f751b3d..891fd5f 100644
--- a/media/gpu/chromeos/mailbox_video_frame_converter_unittest.cc
+++ b/media/gpu/chromeos/mailbox_video_frame_converter_unittest.cc
@@ -4,6 +4,8 @@
#include "media/gpu/chromeos/mailbox_video_frame_converter.h"
+#include <optional>
+
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/task/single_thread_task_runner.h"
@@ -17,7 +19,6 @@
#include "media/video/fake_gpu_memory_buffer.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/gpu_fence_handle.h"
#include "ui/gfx/gpu_memory_buffer.h"
@@ -40,7 +41,7 @@
class MockGpuDelegate : public MailboxVideoFrameConverter::GpuDelegate {
public:
MOCK_METHOD0(Initialize, bool());
- MOCK_METHOD0(GetCapabilities, absl::optional<gpu::SharedImageCapabilities>());
+ MOCK_METHOD0(GetCapabilities, std::optional<gpu::SharedImageCapabilities>());
MOCK_METHOD9(CreateSharedImage,
gpu::SharedImageStub::SharedImageDestructionCallback(
const gpu::Mailbox& mailbox,
diff --git a/media/gpu/chromeos/oop_video_decoder.cc b/media/gpu/chromeos/oop_video_decoder.cc
index bc078b26..ed10784 100644
--- a/media/gpu/chromeos/oop_video_decoder.cc
+++ b/media/gpu/chromeos/oop_video_decoder.cc
@@ -101,7 +101,7 @@
return nullptr;
}
- absl::optional<gfx::BufferFormat> buffer_format =
+ std::optional<gfx::BufferFormat> buffer_format =
VideoPixelFormatToGfxBufferFormat(mojo_frame->format);
if (!buffer_format) {
VLOGF(2) << "Could not convert the incoming frame's format to a "
@@ -152,7 +152,7 @@
return *instance;
}
- absl::optional<SupportedVideoDecoderConfigs> Get() {
+ std::optional<SupportedVideoDecoderConfigs> Get() {
base::AutoLock lock(lock_);
return configs_;
}
@@ -250,8 +250,8 @@
void OnDecoderDisconnected() {
base::AutoLock lock(lock_);
configs_.emplace();
- decoder_type_ = absl::nullopt;
- interface_version_ = absl::nullopt;
+ decoder_type_ = std::nullopt;
+ interface_version_ = std::nullopt;
disconnected_ = true;
MaybeNotifyWaitingCallbacks();
}
@@ -333,9 +333,9 @@
// The cached supported video decoder configurations, decoder type, and
// interface version.
- absl::optional<SupportedVideoDecoderConfigs> configs_ GUARDED_BY(lock_);
- absl::optional<VideoDecoderType> decoder_type_ GUARDED_BY(lock_);
- absl::optional<uint32_t> interface_version_ GUARDED_BY(lock_);
+ std::optional<SupportedVideoDecoderConfigs> configs_ GUARDED_BY(lock_);
+ std::optional<VideoDecoderType> decoder_type_ GUARDED_BY(lock_);
+ std::optional<uint32_t> interface_version_ GUARDED_BY(lock_);
// This tracks everything that's needed to call a callback passed to
// NotifySupportKnown() that had to be queued because there was a query in
@@ -386,7 +386,7 @@
}
// static
-absl::optional<SupportedVideoDecoderConfigs>
+std::optional<SupportedVideoDecoderConfigs>
OOPVideoDecoder::GetSupportedConfigs() {
return OOPVideoDecoderSupportedConfigsManager::Instance().Get();
}
@@ -954,7 +954,7 @@
const gfx::Rect visible_rect = frame->visible_rect;
const gfx::Size natural_size = frame->natural_size;
const gfx::ColorSpace color_space = frame->color_space;
- const absl::optional<gfx::HDRMetadata> hdr_metadata = frame->hdr_metadata;
+ const std::optional<gfx::HDRMetadata> hdr_metadata = frame->hdr_metadata;
const VideoFrameMetadata metadata = frame->metadata;
const gfx::GpuMemoryBufferId received_gmb_id =
frame->gpu_memory_buffer_handle.id;
diff --git a/media/gpu/chromeos/oop_video_decoder.h b/media/gpu/chromeos/oop_video_decoder.h
index abc3c5b..965e0ff 100644
--- a/media/gpu/chromeos/oop_video_decoder.h
+++ b/media/gpu/chromeos/oop_video_decoder.h
@@ -68,9 +68,9 @@
void(mojo::PendingRemote<stable::mojom::StableVideoDecoder>)> cb);
// Returns the cached supported configurations of the out-of-process video
- // decoder if known (absl::nullopt otherwise). This method is thread- and
+ // decoder if known (std::nullopt otherwise). This method is thread- and
// sequence-safe.
- static absl::optional<SupportedVideoDecoderConfigs> GetSupportedConfigs();
+ static std::optional<SupportedVideoDecoderConfigs> GetSupportedConfigs();
// VideoDecoderMixin implementation, VideoDecoder part.
void Initialize(const VideoDecoderConfig& config,
diff --git a/media/gpu/chromeos/platform_video_frame_pool.cc b/media/gpu/chromeos/platform_video_frame_pool.cc
index 0fa3cb35..a900e26 100644
--- a/media/gpu/chromeos/platform_video_frame_pool.cc
+++ b/media/gpu/chromeos/platform_video_frame_pool.cc
@@ -4,6 +4,7 @@
#include "media/gpu/chromeos/platform_video_frame_pool.h"
+#include <optional>
#include <utility>
#include "base/logging.h"
@@ -14,7 +15,6 @@
#include "media/gpu/chromeos/platform_video_frame_utils.h"
#include "media/gpu/macros.h"
#include "media/media_buildflags.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -283,7 +283,7 @@
weak_this_ = weak_this_factory_.GetWeakPtr();
}
-absl::optional<GpuBufferLayout> PlatformVideoFramePool::GetGpuBufferLayout() {
+std::optional<GpuBufferLayout> PlatformVideoFramePool::GetGpuBufferLayout() {
DCHECK(parent_task_runner_->RunsTasksInCurrentSequence());
base::AutoLock auto_lock(lock_);
return frame_layout_;
@@ -291,7 +291,7 @@
// static
void PlatformVideoFramePool::OnFrameReleasedThunk(
- absl::optional<base::WeakPtr<PlatformVideoFramePool>> pool,
+ std::optional<base::WeakPtr<PlatformVideoFramePool>> pool,
scoped_refptr<base::SequencedTaskRunner> task_runner,
scoped_refptr<VideoFrame> origin_frame) {
TRACE_EVENT2("media", "PlatformVideoFramePool::OnFrameReleasedThunk",
diff --git a/media/gpu/chromeos/platform_video_frame_pool.h b/media/gpu/chromeos/platform_video_frame_pool.h
index dade648..83b84762 100644
--- a/media/gpu/chromeos/platform_video_frame_pool.h
+++ b/media/gpu/chromeos/platform_video_frame_pool.h
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <map>
+#include <optional>
#include <vector>
#include "base/containers/circular_deque.h"
@@ -21,7 +22,6 @@
#include "media/base/video_types.h"
#include "media/gpu/chromeos/dmabuf_video_frame_pool.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/gpu_memory_buffer.h"
namespace media {
@@ -58,7 +58,7 @@
bool IsExhausted() override;
void NotifyWhenFrameAvailable(base::OnceClosure cb) override;
void ReleaseAllFrames() override;
- absl::optional<GpuBufferLayout> GetGpuBufferLayout() override;
+ std::optional<GpuBufferLayout> GetGpuBufferLayout() override;
// Returns the original frame of a wrapped frame. We need this method to
// determine whether the frame returned by GetFrame() is the same one after
@@ -79,10 +79,10 @@
// Thunk to post OnFrameReleased() to |task_runner|.
// Because this thunk may be called in any thread, We don't want to
- // dereference WeakPtr. Therefore we wrap the WeakPtr by absl::optional to
+ // dereference WeakPtr. Therefore we wrap the WeakPtr by std::optional to
// avoid the task runner defererencing the WeakPtr.
static void OnFrameReleasedThunk(
- absl::optional<base::WeakPtr<PlatformVideoFramePool>> pool,
+ std::optional<base::WeakPtr<PlatformVideoFramePool>> pool,
scoped_refptr<base::SequencedTaskRunner> task_runner,
scoped_refptr<VideoFrame> origin_frame);
// Called when a wrapped frame gets destroyed.
@@ -111,7 +111,7 @@
// The arguments of current frame. We allocate new frames only if a pixel
// format or size in |frame_layout_| is changed. When GetFrame() is
// called, we update |visible_rect_| and |natural_size_| of wrapped frames.
- absl::optional<GpuBufferLayout> frame_layout_ GUARDED_BY(lock_);
+ std::optional<GpuBufferLayout> frame_layout_ GUARDED_BY(lock_);
gfx::Rect visible_rect_ GUARDED_BY(lock_);
gfx::Size natural_size_ GUARDED_BY(lock_);
@@ -131,7 +131,7 @@
// True if we need to allocate GPU buffers in a way that is accessible from
// the CPU with a linear layout. Can only be set once per instance.
- absl::optional<bool> use_linear_buffers_ GUARDED_BY(lock_);
+ std::optional<bool> use_linear_buffers_ GUARDED_BY(lock_);
// Callback which is called when the pool is not exhausted.
base::OnceClosure frame_available_cb_ GUARDED_BY(lock_);
diff --git a/media/gpu/chromeos/platform_video_frame_pool_unittest.cc b/media/gpu/chromeos/platform_video_frame_pool_unittest.cc
index 646369f..3af962b 100644
--- a/media/gpu/chromeos/platform_video_frame_pool_unittest.cc
+++ b/media/gpu/chromeos/platform_video_frame_pool_unittest.cc
@@ -37,7 +37,7 @@
bool use_linear_buffers,
bool needs_detiling,
base::TimeDelta timestamp) {
- absl::optional<gfx::BufferFormat> gfx_format =
+ std::optional<gfx::BufferFormat> gfx_format =
VideoPixelFormatToGfxBufferFormat(format);
DCHECK(gfx_format);
const gpu::MailboxHolder mailbox_holders[VideoFrame::kMaxPlanes] = {};
@@ -57,7 +57,7 @@
bool use_linear_buffers,
bool needs_detiling,
base::TimeDelta timestamp) {
- absl::optional<gfx::BufferFormat> gfx_format =
+ std::optional<gfx::BufferFormat> gfx_format =
VideoPixelFormatToGfxBufferFormat(format);
DCHECK(gfx_format);
return WrapChromeOSCompressedGpuMemoryBufferAsVideoFrame(
@@ -129,7 +129,7 @@
base::test::TaskEnvironment task_environment_;
std::unique_ptr<PlatformVideoFramePool> pool_;
- absl::optional<GpuBufferLayout> layout_;
+ std::optional<GpuBufferLayout> layout_;
gfx::Rect visible_rect_;
gfx::Size natural_size_;
};
diff --git a/media/gpu/chromeos/platform_video_frame_utils.cc b/media/gpu/chromeos/platform_video_frame_utils.cc
index 191347c..854a8ea 100644
--- a/media/gpu/chromeos/platform_video_frame_utils.cc
+++ b/media/gpu/chromeos/platform_video_frame_utils.cc
@@ -375,7 +375,7 @@
return frame;
}
-absl::optional<VideoFrameLayout> GetPlatformVideoFrameLayout(
+std::optional<VideoFrameLayout> GetPlatformVideoFrameLayout(
VideoPixelFormat pixel_format,
const gfx::Size& coded_size,
gfx::BufferUsage buffer_usage) {
@@ -384,8 +384,8 @@
auto frame =
CreatePlatformVideoFrame(pixel_format, coded_size, gfx::Rect(coded_size),
coded_size, base::TimeDelta(), buffer_usage);
- return frame ? absl::make_optional<VideoFrameLayout>(frame->layout())
- : absl::nullopt;
+ return frame ? std::make_optional<VideoFrameLayout>(frame->layout())
+ : std::nullopt;
}
gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferHandle(
diff --git a/media/gpu/chromeos/platform_video_frame_utils.h b/media/gpu/chromeos/platform_video_frame_utils.h
index e83264e..77a5d9f 100644
--- a/media/gpu/chromeos/platform_video_frame_utils.h
+++ b/media/gpu/chromeos/platform_video_frame_utils.h
@@ -5,10 +5,11 @@
#ifndef MEDIA_GPU_CHROMEOS_PLATFORM_VIDEO_FRAME_UTILS_H_
#define MEDIA_GPU_CHROMEOS_PLATFORM_VIDEO_FRAME_UTILS_H_
+#include <optional>
+
#include "base/memory/scoped_refptr.h"
#include "media/base/video_frame.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gfx/linux/native_pixmap_dmabuf.h"
@@ -45,9 +46,9 @@
// CreatePlatformVideoFrame(), i.e., all parameters are forwarded to that
// function (|visible_rect| is set to gfx::Rect(|coded_size|), |natural_size| is
// set to |coded_size|, and |timestamp| is set to base::TimeDelta()). This
-// function is not cheap as it allocates a buffer. Returns absl::nullopt if the
+// function is not cheap as it allocates a buffer. Returns std::nullopt if the
// buffer allocation fails. This function is thread-safe.
-MEDIA_GPU_EXPORT absl::optional<VideoFrameLayout> GetPlatformVideoFrameLayout(
+MEDIA_GPU_EXPORT std::optional<VideoFrameLayout> GetPlatformVideoFrameLayout(
VideoPixelFormat pixel_format,
const gfx::Size& coded_size,
gfx::BufferUsage buffer_usage);
diff --git a/media/gpu/chromeos/platform_video_frame_utils_unittest.cc b/media/gpu/chromeos/platform_video_frame_utils_unittest.cc
index f321bd5..9b7c1b9 100644
--- a/media/gpu/chromeos/platform_video_frame_utils_unittest.cc
+++ b/media/gpu/chromeos/platform_video_frame_utils_unittest.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <optional>
#include <utility>
#include <vector>
@@ -24,7 +25,6 @@
#include "media/base/video_types.h"
#include "media/video/fake_gpu_memory_buffer.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -41,7 +41,7 @@
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size) {
- const absl::optional<VideoFrameLayout> layout =
+ const std::optional<VideoFrameLayout> layout =
VideoFrameLayout::Create(pixel_format, coded_size);
if (!layout) {
LOG(ERROR) << "Failed to create video frame layout";
@@ -71,7 +71,7 @@
constexpr VideoPixelFormat kPixelFormat = PIXEL_FORMAT_NV12;
constexpr gfx::Size kCodedSize(320, 240);
- const absl::optional<gfx::BufferFormat> gfx_format =
+ const std::optional<gfx::BufferFormat> gfx_format =
VideoPixelFormatToGfxBufferFormat(kPixelFormat);
ASSERT_TRUE(gfx_format) << "Invalid pixel format: " << kPixelFormat;
diff --git a/media/gpu/chromeos/vd_video_decode_accelerator.cc b/media/gpu/chromeos/vd_video_decode_accelerator.cc
index d7f523d..0a0eff8 100644
--- a/media/gpu/chromeos/vd_video_decode_accelerator.cc
+++ b/media/gpu/chromeos/vd_video_decode_accelerator.cc
@@ -145,7 +145,7 @@
buffer_size += subsample.clear_bytes() + subsample.cypher_bytes();
subsamples.emplace_back(subsample.clear_bytes(), subsample.cypher_bytes());
}
- absl::optional<EncryptionPattern> pattern = absl::nullopt;
+ std::optional<EncryptionPattern> pattern = std::nullopt;
if (buffer_proto.has_pattern()) {
pattern.emplace(buffer_proto.pattern().cypher_bytes(),
buffer_proto.pattern().clear_bytes());
@@ -356,7 +356,7 @@
DCHECK(frame);
DCHECK(client_);
- absl::optional<Picture> picture = GetPicture(*frame);
+ std::optional<Picture> picture = GetPicture(*frame);
if (!picture) {
VLOGF(1) << "Failed to get picture.";
OnError(FROM_HERE, PLATFORM_FAILURE);
@@ -537,7 +537,7 @@
<< ", coded_size: " << coded_size_.ToString()
<< ", planes: " << VectorToString(planes)
<< ", modifier: " << std::hex << modifier;
- layout_ = absl::nullopt;
+ layout_ = std::nullopt;
import_frame_cb_.Reset();
std::move(notify_layout_changed_cb_)
.Run(CroStatus::Codes::kFailedToChangeResolution);
@@ -604,7 +604,7 @@
import_frame_cb_.Run(std::move(wrapped_frame));
}
-absl::optional<Picture> VdVideoDecodeAccelerator::GetPicture(
+std::optional<Picture> VdVideoDecodeAccelerator::GetPicture(
const VideoFrame& frame) {
DVLOGF(4);
DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
@@ -612,18 +612,18 @@
auto it = frame_id_to_picture_id_.find(frame.GetGpuMemoryBuffer()->GetId());
if (it == frame_id_to_picture_id_.end()) {
VLOGF(1) << "Failed to find the picture buffer id.";
- return absl::nullopt;
+ return std::nullopt;
}
int32_t picture_buffer_id = it->second;
int32_t bitstream_id = FakeTimestampToBitstreamId(frame.timestamp());
- return absl::make_optional(Picture(picture_buffer_id, bitstream_id,
- frame.visible_rect(), frame.ColorSpace(),
- frame.metadata().allow_overlay));
+ return std::make_optional(Picture(picture_buffer_id, bitstream_id,
+ frame.visible_rect(), frame.ColorSpace(),
+ frame.metadata().allow_overlay));
}
// static
void VdVideoDecodeAccelerator::OnFrameReleasedThunk(
- absl::optional<base::WeakPtr<VdVideoDecodeAccelerator>> weak_this,
+ std::optional<base::WeakPtr<VdVideoDecodeAccelerator>> weak_this,
scoped_refptr<base::SequencedTaskRunner> task_runner,
scoped_refptr<VideoFrame> origin_frame) {
DVLOGF(4);
diff --git a/media/gpu/chromeos/vd_video_decode_accelerator.h b/media/gpu/chromeos/vd_video_decode_accelerator.h
index 1a72342..957e123a 100644
--- a/media/gpu/chromeos/vd_video_decode_accelerator.h
+++ b/media/gpu/chromeos/vd_video_decode_accelerator.h
@@ -7,6 +7,7 @@
#include <map>
#include <memory>
+#include <optional>
#include "base/functional/callback_forward.h"
#include "base/memory/raw_ptr.h"
@@ -25,7 +26,6 @@
#include "media/gpu/media_gpu_export.h"
#include "media/mojo/mojom/stable/stable_video_decoder.mojom.h"
#include "media/video/video_decode_accelerator.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/gpu_memory_buffer.h"
namespace media {
@@ -101,15 +101,15 @@
void OnResetDone();
// Get Picture instance that represents the same buffer as |frame|. Return
- // absl::nullopt if the buffer is already dismissed.
- absl::optional<Picture> GetPicture(const VideoFrame& frame);
+ // std::nullopt if the buffer is already dismissed.
+ std::optional<Picture> GetPicture(const VideoFrame& frame);
// Thunk to post OnFrameReleased() to |task_runner|.
// Because this thunk may be called in any thread, We don't want to
- // dereference WeakPtr. Therefore we wrap the WeakPtr by absl::optional to
+ // dereference WeakPtr. Therefore we wrap the WeakPtr by std::optional to
// avoid the task runner defererencing the WeakPtr.
static void OnFrameReleasedThunk(
- absl::optional<base::WeakPtr<VdVideoDecodeAccelerator>> weak_this,
+ std::optional<base::WeakPtr<VdVideoDecodeAccelerator>> weak_this,
scoped_refptr<base::SequencedTaskRunner> task_runner,
scoped_refptr<VideoFrame> origin_frame);
// Called when a frame gets destroyed.
@@ -138,7 +138,7 @@
gfx::Size pending_coded_size_;
// The formats of the current buffers.
gfx::Size coded_size_;
- absl::optional<VideoFrameLayout> layout_;
+ std::optional<VideoFrameLayout> layout_;
// Mapping from VideoFrame's GpuMemoryBufferId to picture buffer id.
std::map<gfx::GpuMemoryBufferId, int32_t /* picture_buffer_id */>
diff --git a/media/gpu/chromeos/vda_video_frame_pool.cc b/media/gpu/chromeos/vda_video_frame_pool.cc
index d6a7a1b..7edcb5f 100644
--- a/media/gpu/chromeos/vda_video_frame_pool.cc
+++ b/media/gpu/chromeos/vda_video_frame_pool.cc
@@ -67,8 +67,8 @@
// back to the pool.
frame_pool_ = {};
max_num_frames_ = 0;
- layout_ = absl::nullopt;
- fourcc_ = absl::nullopt;
+ layout_ = std::nullopt;
+ fourcc_ = std::nullopt;
coded_size_ = gfx::Size();
CroStatus::Or<GpuBufferLayout> status_or_layout =
@@ -115,7 +115,7 @@
// static
void VdaVideoFramePool::ImportFrameThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
- absl::optional<base::WeakPtr<VdaVideoFramePool>> weak_this,
+ std::optional<base::WeakPtr<VdaVideoFramePool>> weak_this,
scoped_refptr<VideoFrame> frame) {
DVLOGF(3);
DCHECK(weak_this);
@@ -184,7 +184,7 @@
// NOREACHED() for now in order to prevent a DCHECK when this occurs.
}
-absl::optional<GpuBufferLayout> VdaVideoFramePool::GetGpuBufferLayout() {
+std::optional<GpuBufferLayout> VdaVideoFramePool::GetGpuBufferLayout() {
DVLOGF(3);
DCHECK_CALLED_ON_VALID_SEQUENCE(parent_sequence_checker_);
return layout_;
diff --git a/media/gpu/chromeos/vda_video_frame_pool.h b/media/gpu/chromeos/vda_video_frame_pool.h
index e5621e2..97997bf1 100644
--- a/media/gpu/chromeos/vda_video_frame_pool.h
+++ b/media/gpu/chromeos/vda_video_frame_pool.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_GPU_CHROMEOS_VDA_VIDEO_FRAME_POOL_H_
#define MEDIA_GPU_CHROMEOS_VDA_VIDEO_FRAME_POOL_H_
+#include <optional>
+
#include "base/containers/queue.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
@@ -13,7 +15,6 @@
#include "media/gpu/chromeos/chromeos_status.h"
#include "media/gpu/chromeos/dmabuf_video_frame_pool.h"
#include "media/gpu/chromeos/fourcc.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class WaitableEvent;
@@ -72,7 +73,7 @@
bool IsExhausted() override;
void NotifyWhenFrameAvailable(base::OnceClosure cb) override;
void ReleaseAllFrames() override;
- absl::optional<GpuBufferLayout> GetGpuBufferLayout() override;
+ std::optional<GpuBufferLayout> GetGpuBufferLayout() override;
private:
// Update the layout of the buffers. |vda_| calls this as
@@ -83,11 +84,11 @@
// Thunk to post ImportFrame() to |task_runner|.
// Because this thunk may be called in any thread, We don't want to
- // dereference WeakPtr. Therefore we wrap the WeakPtr by absl::optional to
+ // dereference WeakPtr. Therefore we wrap the WeakPtr by std::optional to
// avoid the task runner defererencing the WeakPtr.
static void ImportFrameThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
- absl::optional<base::WeakPtr<VdaVideoFramePool>> weak_this,
+ std::optional<base::WeakPtr<VdaVideoFramePool>> weak_this,
scoped_refptr<VideoFrame> frame);
// Import an available frame.
void ImportFrame(scoped_refptr<VideoFrame> frame);
@@ -107,11 +108,11 @@
base::OnceClosure frame_available_cb_;
// The layout of the frames in |frame_pool_|.
- absl::optional<GpuBufferLayout> layout_;
+ std::optional<GpuBufferLayout> layout_;
// Data passed from Initialize().
size_t max_num_frames_ = 0;
- absl::optional<Fourcc> fourcc_;
+ std::optional<Fourcc> fourcc_;
gfx::Size coded_size_;
gfx::Rect visible_rect_;
gfx::Size natural_size_;
diff --git a/media/gpu/chromeos/video_decoder_pipeline.cc b/media/gpu/chromeos/video_decoder_pipeline.cc
index 7b31b91..1b5b31ac 100644
--- a/media/gpu/chromeos/video_decoder_pipeline.cc
+++ b/media/gpu/chromeos/video_decoder_pipeline.cc
@@ -5,6 +5,7 @@
#include "media/gpu/chromeos/video_decoder_pipeline.h"
#include <memory>
+#include <optional>
#include "base/containers/contains.h"
#include "base/feature_list.h"
@@ -28,7 +29,6 @@
#include "media/gpu/chromeos/platform_video_frame_pool.h"
#include "media/gpu/macros.h"
#include "media/media_buildflags.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(USE_VAAPI)
#include <drm_fourcc.h>
@@ -50,11 +50,11 @@
// If |preferred_fourcc| is provided, contained in |candidates|, and considered
// renderable, it returns that. Otherwise, it goes through
// |renderable_fourccs| until it finds one that's in |candidates|. If
-// it can't find a renderable format in |candidates|, it returns absl::nullopt.
-absl::optional<Fourcc> PickRenderableFourcc(
+// it can't find a renderable format in |candidates|, it returns std::nullopt.
+std::optional<Fourcc> PickRenderableFourcc(
const std::vector<Fourcc>& renderable_fourccs,
const std::vector<Fourcc>& candidates,
- absl::optional<Fourcc> preferred_fourcc) {
+ std::optional<Fourcc> preferred_fourcc) {
if (preferred_fourcc && base::Contains(candidates, *preferred_fourcc) &&
base::Contains(renderable_fourccs, *preferred_fourcc)) {
return preferred_fourcc;
@@ -63,7 +63,7 @@
if (base::Contains(candidates, value))
return value;
}
- return absl::nullopt;
+ return std::nullopt;
}
// Estimates the number of buffers needed in the output frame pool to fill the
@@ -247,11 +247,11 @@
}
// static
-absl::optional<SupportedVideoDecoderConfigs>
+std::optional<SupportedVideoDecoderConfigs>
VideoDecoderPipeline::GetSupportedConfigs(
VideoDecoderType decoder_type,
const gpu::GpuDriverBugWorkarounds& workarounds) {
- absl::optional<SupportedVideoDecoderConfigs> configs;
+ std::optional<SupportedVideoDecoderConfigs> configs;
switch (decoder_type) {
case VideoDecoderType::kOutOfProcess:
configs = OOPVideoDecoder::GetSupportedConfigs();
@@ -272,11 +272,11 @@
break;
#endif
default:
- configs = absl::nullopt;
+ configs = std::nullopt;
}
if (!configs)
- return absl::nullopt;
+ return std::nullopt;
if (workarounds.disable_accelerated_vp8_decode) {
base::EraseIf(configs.value(), [](const auto& config) {
@@ -774,7 +774,7 @@
if (is_flush) {
client_flush_cb_state_.emplace(
/*flush_cb=*/std::move(decode_cb), /*decoder_decode_status=*/status);
- CallFlushCbIfNeeded(/*override_status=*/absl::nullopt);
+ CallFlushCbIfNeeded(/*override_status=*/std::nullopt);
return;
}
@@ -847,7 +847,7 @@
FROM_HERE, base::BindOnce(client_output_cb_, std::move(frame)));
// After outputting a frame, flush might be completed.
- CallFlushCbIfNeeded(/*override_status=*/absl::nullopt);
+ CallFlushCbIfNeeded(/*override_status=*/std::nullopt);
CallApplyResolutionChangeIfNeeded();
}
@@ -896,7 +896,7 @@
}
void VideoDecoderPipeline::CallFlushCbIfNeeded(
- absl::optional<DecoderStatus> override_status) {
+ std::optional<DecoderStatus> override_status) {
DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
if (!client_flush_cb_state_) {
@@ -959,11 +959,11 @@
const std::vector<PixelLayoutCandidate>& candidates,
const gfx::Rect& decoder_visible_rect,
const gfx::Size& decoder_natural_size,
- absl::optional<gfx::Size> output_size,
+ std::optional<gfx::Size> output_size,
size_t num_codec_reference_frames,
bool use_protected,
bool need_aux_frame_pool,
- absl::optional<DmabufVideoFramePool::CreateFrameCB> allocator) {
+ std::optional<DmabufVideoFramePool::CreateFrameCB> allocator) {
DVLOGF(3);
DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
// Verify |num_codec_reference_frames| has a reasonable value. Anecdotally 16
@@ -981,7 +981,7 @@
// directly renderable. If so, and (VA-API-only) the modifier of buffers
// provided by the frame pool matches the one supported by the |decoder_|, we
// don't need an image processor.
- absl::optional<PixelLayoutCandidate> viable_candidate;
+ std::optional<PixelLayoutCandidate> viable_candidate;
if (!output_size || *output_size == decoder_visible_rect.size()) {
for (const auto& fourcc : renderable_fourccs_) {
for (const auto& candidate : candidates) {
diff --git a/media/gpu/chromeos/video_decoder_pipeline.h b/media/gpu/chromeos/video_decoder_pipeline.h
index eefbe3d..bfbfd45 100644
--- a/media/gpu/chromeos/video_decoder_pipeline.h
+++ b/media/gpu/chromeos/video_decoder_pipeline.h
@@ -7,6 +7,7 @@
#include <atomic>
#include <memory>
+#include <optional>
#include "base/functional/callback_forward.h"
#include "base/gtest_prod_util.h"
@@ -26,7 +27,6 @@
#include "media/gpu/chromeos/mailbox_video_frame_converter.h"
#include "media/gpu/media_gpu_export.h"
#include "media/mojo/mojom/stable/stable_video_decoder.mojom.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/native_pixmap.h"
#include "ui/gfx/native_pixmap_handle.h"
@@ -78,7 +78,7 @@
// initialized and that pool can be obtained by calling GetVideoFramePool().
// This pool will provide buffers consistent with the selected candidate out
// of |candidates|. If false, the caller must allocate its own buffers.
- // if |allocator| is not absl::nullopt, the frame pool will be set
+ // if |allocator| is not std::nullopt, the frame pool will be set
// to use the allocator provided for allocating video frames.
//
// The client also provides the |num_codec_reference_frames|, which is
@@ -92,11 +92,11 @@
const std::vector<ImageProcessor::PixelLayoutCandidate>& candidates,
const gfx::Rect& decoder_visible_rect,
const gfx::Size& decoder_natural_size,
- absl::optional<gfx::Size> output_size,
+ std::optional<gfx::Size> output_size,
size_t num_codec_reference_frames,
bool use_protected,
bool need_aux_frame_pool,
- absl::optional<DmabufVideoFramePool::CreateFrameCB> allocator) = 0;
+ std::optional<DmabufVideoFramePool::CreateFrameCB> allocator) = 0;
};
VideoDecoderMixin(
@@ -197,7 +197,7 @@
base::OnceCallback<
void(mojo::PendingRemote<stable::mojom::StableVideoDecoder>)> cb);
- static absl::optional<SupportedVideoDecoderConfigs> GetSupportedConfigs(
+ static std::optional<SupportedVideoDecoderConfigs> GetSupportedConfigs(
VideoDecoderType decoder_type,
const gpu::GpuDriverBugWorkarounds& workarounds);
@@ -227,11 +227,11 @@
const std::vector<ImageProcessor::PixelLayoutCandidate>& candidates,
const gfx::Rect& decoder_visible_rect,
const gfx::Size& decoder_natural_size,
- absl::optional<gfx::Size> output_size,
+ std::optional<gfx::Size> output_size,
size_t num_codec_reference_frames,
bool use_protected,
bool need_aux_frame_pool,
- absl::optional<DmabufVideoFramePool::CreateFrameCB> allocator) override;
+ std::optional<DmabufVideoFramePool::CreateFrameCB> allocator) override;
private:
friend class VideoDecoderPipelineTest;
@@ -298,7 +298,7 @@
// flush callback but we should pass a DecoderStatus of kAborted instead of
// kOk. In this scenario, the original DecoderStatus is kOk and
// *|override_status| is kAborted.
- void CallFlushCbIfNeeded(absl::optional<DecoderStatus> override_status);
+ void CallFlushCbIfNeeded(std::optional<DecoderStatus> override_status);
#if BUILDFLAG(IS_CHROMEOS)
// Callback for when transcryption of a buffer completes.
@@ -393,7 +393,7 @@
DecodeCB flush_cb;
const DecoderStatus decoder_decode_status;
};
- absl::optional<ClientFlushCBState> client_flush_cb_state_
+ std::optional<ClientFlushCBState> client_flush_cb_state_
GUARDED_BY_CONTEXT(decoder_sequence_checker_);
WaitingCB waiting_cb_ GUARDED_BY_CONTEXT(decoder_sequence_checker_);
diff --git a/media/gpu/chromeos/video_decoder_pipeline_unittest.cc b/media/gpu/chromeos/video_decoder_pipeline_unittest.cc
index e82c994..20fc869 100644
--- a/media/gpu/chromeos/video_decoder_pipeline_unittest.cc
+++ b/media/gpu/chromeos/video_decoder_pipeline_unittest.cc
@@ -69,7 +69,7 @@
MOCK_METHOD0(IsExhausted, bool());
MOCK_METHOD1(NotifyWhenFrameAvailable, void(base::OnceClosure));
MOCK_METHOD0(ReleaseAllFrames, void());
- MOCK_METHOD0(GetGpuBufferLayout, absl::optional<GpuBufferLayout>());
+ MOCK_METHOD0(GetGpuBufferLayout, std::optional<GpuBufferLayout>());
bool IsFakeVideoFramePool() override { return true; }
};
@@ -922,9 +922,9 @@
auto status_or_chosen_candidate = decoder_->PickDecoderOutputFormat(
test_vector.input_candidates, kVisibleRect,
/*decoder_natural_size=*/kVisibleRect.size(),
- /*output_size=*/absl::nullopt,
+ /*output_size=*/std::nullopt,
/*num_codec_reference_frames=*/kNumCodecReferenceFrames,
- /*use_protected=*/false, /*need_aux_frame_pool=*/false, absl::nullopt);
+ /*use_protected=*/false, /*need_aux_frame_pool=*/false, std::nullopt);
ASSERT_TRUE(status_or_chosen_candidate.has_value());
const PixelLayoutCandidate chosen_candidate =
std::move(status_or_chosen_candidate).value();
@@ -981,9 +981,9 @@
auto status_or_chosen_candidate = decoder_->PickDecoderOutputFormat(
{candidate}, kVisibleRect,
/*decoder_natural_size=*/kVisibleRect.size(),
- /*output_size=*/absl::nullopt,
+ /*output_size=*/std::nullopt,
/*num_codec_reference_frames=*/kNumCodecReferenceFrames,
- /*use_protected=*/false, /*need_aux_frame_pool=*/false, absl::nullopt);
+ /*use_protected=*/false, /*need_aux_frame_pool=*/false, std::nullopt);
EXPECT_TRUE(status_or_chosen_candidate.has_value());
// Main concern is that the image processor was set.
@@ -1015,9 +1015,9 @@
auto status_or_chosen_candidate = decoder_->PickDecoderOutputFormat(
{candidate}, kVisibleRect,
/*decoder_natural_size=*/kVisibleRect.size(),
- /*output_size=*/absl::nullopt,
+ /*output_size=*/std::nullopt,
/*num_codec_reference_frames=*/kNumCodecReferenceFrames,
- /*use_protected=*/false, /*need_aux_frame_pool=*/false, absl::nullopt);
+ /*use_protected=*/false, /*need_aux_frame_pool=*/false, std::nullopt);
EXPECT_FALSE(status_or_chosen_candidate.has_value());
EXPECT_FALSE(DecoderHasImageProcessor());
diff --git a/media/gpu/chromeos/vulkan_image_processor.h b/media/gpu/chromeos/vulkan_image_processor.h
index 7029828..e0cb5842d 100644
--- a/media/gpu/chromeos/vulkan_image_processor.h
+++ b/media/gpu/chromeos/vulkan_image_processor.h
@@ -6,7 +6,9 @@
#define MEDIA_GPU_CHROMEOS_VULKAN_IMAGE_PROCESSOR_H_
#include <vulkan/vulkan_core.h>
+
#include <memory>
+#include <optional>
#include <vector>
#include "gpu/vulkan/vulkan_command_buffer.h"
@@ -16,7 +18,6 @@
#include "gpu/vulkan/vulkan_implementation.h"
#include "media/gpu/chromeos/image_processor_backend.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/overlay_transform.h"
diff --git a/media/gpu/codec_picture.h b/media/gpu/codec_picture.h
index 46f50a3..e62961d 100644
--- a/media/gpu/codec_picture.h
+++ b/media/gpu/codec_picture.h
@@ -50,10 +50,10 @@
colorspace_ = colorspace;
}
- const absl::optional<gfx::HDRMetadata>& hdr_metadata() const {
+ const std::optional<gfx::HDRMetadata>& hdr_metadata() const {
return hdr_metadata_;
}
- void set_hdr_metadata(const absl::optional<gfx::HDRMetadata>& hdr_metadata) {
+ void set_hdr_metadata(const std::optional<gfx::HDRMetadata>& hdr_metadata) {
hdr_metadata_ = hdr_metadata;
}
@@ -66,7 +66,7 @@
gfx::Rect visible_rect_;
std::unique_ptr<DecryptConfig> decrypt_config_;
VideoColorSpace colorspace_;
- absl::optional<gfx::HDRMetadata> hdr_metadata_;
+ std::optional<gfx::HDRMetadata> hdr_metadata_;
};
} // namespace media
diff --git a/media/gpu/h264_decoder.cc b/media/gpu/h264_decoder.cc
index b1925dd..de3c99d 100644
--- a/media/gpu/h264_decoder.cc
+++ b/media/gpu/h264_decoder.cc
@@ -6,6 +6,7 @@
#include <limits>
#include <memory>
+#include <optional>
#include "base/feature_list.h"
#include "base/functional/bind.h"
@@ -15,7 +16,6 @@
#include "base/ranges/algorithm.h"
#include "media/base/media_switches.h"
#include "media/video/h264_level_limits.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace {
@@ -1052,7 +1052,7 @@
// outputting all pictures before it, to avoid outputting corrupted
// frames.
(*output_candidate)->frame_num == *recovery_frame_num_) {
- recovery_frame_num_ = absl::nullopt;
+ recovery_frame_num_ = std::nullopt;
if (!OutputPic(*output_candidate))
return false;
}
@@ -1759,7 +1759,7 @@
return picture_color_space_;
}
-absl::optional<gfx::HDRMetadata> H264Decoder::GetHDRMetadata() const {
+std::optional<gfx::HDRMetadata> H264Decoder::GetHDRMetadata() const {
return hdr_metadata_;
}
diff --git a/media/gpu/h264_decoder.h b/media/gpu/h264_decoder.h
index 79d0e46..f6a9d8d 100644
--- a/media/gpu/h264_decoder.h
+++ b/media/gpu/h264_decoder.h
@@ -208,7 +208,7 @@
uint8_t GetBitDepth() const override;
VideoChromaSampling GetChromaSampling() const override;
VideoColorSpace GetVideoColorSpace() const override;
- absl::optional<gfx::HDRMetadata> GetHDRMetadata() const override;
+ std::optional<gfx::HDRMetadata> GetHDRMetadata() const override;
size_t GetRequiredNumOfPictures() const override;
size_t GetNumReferenceFrames() const override;
@@ -416,12 +416,12 @@
std::vector<base::span<const uint8_t>> prior_cencv1_nalus_;
std::vector<SubsampleEntry> prior_cencv1_subsamples_;
- // These are absl::nullopt unless get recovery point SEI message after Reset.
+ // These are std::nullopt unless get recovery point SEI message after Reset.
// A frame_num of the frame at output order that is correct in content.
- absl::optional<int> recovery_frame_num_;
+ std::optional<int> recovery_frame_num_;
// A value in the recovery point SEI message to compute |recovery_frame_num_|
// later.
- absl::optional<int> recovery_frame_cnt_;
+ std::optional<int> recovery_frame_cnt_;
// Output picture size.
gfx::Size pic_size_;
@@ -437,7 +437,7 @@
// Video picture color space of input bitstream.
VideoColorSpace picture_color_space_;
// HDR metadata in the bitstream.
- absl::optional<gfx::HDRMetadata> hdr_metadata_;
+ std::optional<gfx::HDRMetadata> hdr_metadata_;
// PicOrderCount of the previously outputted frame.
int last_output_poc_;
diff --git a/media/gpu/h264_dpb.h b/media/gpu/h264_dpb.h
index 9172d5f..5cfcec2a 100644
--- a/media/gpu/h264_dpb.h
+++ b/media/gpu/h264_dpb.h
@@ -94,7 +94,7 @@
// Position in DPB (i.e. index in DPB).
int dpb_position;
- absl::optional<H264Metadata> metadata_for_encoding;
+ std::optional<H264Metadata> metadata_for_encoding;
protected:
~H264Picture() override;
diff --git a/media/gpu/h265_decoder.cc b/media/gpu/h265_decoder.cc
index 226e9791..e7f2aab 100644
--- a/media/gpu/h265_decoder.cc
+++ b/media/gpu/h265_decoder.cc
@@ -571,7 +571,7 @@
VideoColorSpace H265Decoder::GetVideoColorSpace() const {
return picture_color_space_;
}
-absl::optional<gfx::HDRMetadata> H265Decoder::GetHDRMetadata() const {
+std::optional<gfx::HDRMetadata> H265Decoder::GetHDRMetadata() const {
return hdr_metadata_;
}
diff --git a/media/gpu/h265_decoder.h b/media/gpu/h265_decoder.h
index 10fa9c7..d7ac9976 100644
--- a/media/gpu/h265_decoder.h
+++ b/media/gpu/h265_decoder.h
@@ -210,7 +210,7 @@
uint8_t GetBitDepth() const override;
VideoChromaSampling GetChromaSampling() const override;
VideoColorSpace GetVideoColorSpace() const override;
- absl::optional<gfx::HDRMetadata> GetHDRMetadata() const override;
+ std::optional<gfx::HDRMetadata> GetHDRMetadata() const override;
size_t GetRequiredNumOfPictures() const override;
size_t GetNumReferenceFrames() const override;
@@ -388,7 +388,7 @@
// Video color space of input bitstream.
VideoColorSpace picture_color_space_;
// HDR metadata in the bitstream.
- absl::optional<gfx::HDRMetadata> hdr_metadata_;
+ std::optional<gfx::HDRMetadata> hdr_metadata_;
const std::unique_ptr<H265Accelerator> accelerator_;
};
diff --git a/media/gpu/mac/video_toolbox_av1_accelerator.cc b/media/gpu/mac/video_toolbox_av1_accelerator.cc
index 994b843c8..5a627ba 100644
--- a/media/gpu/mac/video_toolbox_av1_accelerator.cc
+++ b/media/gpu/mac/video_toolbox_av1_accelerator.cc
@@ -13,7 +13,7 @@
VideoToolboxAV1Accelerator::VideoToolboxAV1Accelerator(
std::unique_ptr<MediaLog> media_log,
- absl::optional<gfx::HDRMetadata> hdr_metadata,
+ std::optional<gfx::HDRMetadata> hdr_metadata,
DecodeCB decode_cb,
OutputCB output_cb)
: media_log_(std::move(media_log)),
@@ -180,7 +180,7 @@
break;
}
- absl::optional<gfx::HDRMetadata> hdr_metadata = pic.hdr_metadata();
+ std::optional<gfx::HDRMetadata> hdr_metadata = pic.hdr_metadata();
if (!hdr_metadata) {
hdr_metadata = hdr_metadata_;
}
diff --git a/media/gpu/mac/video_toolbox_av1_accelerator.h b/media/gpu/mac/video_toolbox_av1_accelerator.h
index 37e110c..58712a2 100644
--- a/media/gpu/mac/video_toolbox_av1_accelerator.h
+++ b/media/gpu/mac/video_toolbox_av1_accelerator.h
@@ -6,9 +6,10 @@
#define MEDIA_GPU_MAC_VIDEO_TOOLBOX_AV1_ACCELERATOR_H_
#include <CoreMedia/CoreMedia.h>
-
#include <stdint.h>
+
#include <memory>
+#include <optional>
#include "base/apple/scoped_cftyperef.h"
#include "base/functional/callback.h"
@@ -19,7 +20,6 @@
#include "media/gpu/av1_decoder.h"
#include "media/gpu/mac/video_toolbox_decompression_metadata.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/hdr_metadata.h"
@@ -37,7 +37,7 @@
using OutputCB = base::RepeatingCallback<void(scoped_refptr<CodecPicture>)>;
VideoToolboxAV1Accelerator(std::unique_ptr<MediaLog> media_log,
- absl::optional<gfx::HDRMetadata> hdr_metadata,
+ std::optional<gfx::HDRMetadata> hdr_metadata,
DecodeCB decode_cb,
OutputCB output_cb);
~VideoToolboxAV1Accelerator() override;
@@ -57,7 +57,7 @@
base::span<const uint8_t> data);
std::unique_ptr<MediaLog> media_log_;
- absl::optional<gfx::HDRMetadata> hdr_metadata_;
+ std::optional<gfx::HDRMetadata> hdr_metadata_;
// Callbacks are called synchronously, which is always re-entrant.
DecodeCB decode_cb_;
@@ -66,7 +66,7 @@
// Parameters of the active format.
VideoColorSpace active_color_space_;
VideoCodecProfile active_profile_ = VIDEO_CODEC_PROFILE_UNKNOWN;
- absl::optional<gfx::HDRMetadata> active_hdr_metadata_;
+ std::optional<gfx::HDRMetadata> active_hdr_metadata_;
gfx::Size active_coded_size_;
base::apple::ScopedCFTypeRef<CMFormatDescriptionRef> active_format_;
diff --git a/media/gpu/mac/video_toolbox_av1_accelerator_unittest.cc b/media/gpu/mac/video_toolbox_av1_accelerator_unittest.cc
index 9690d8b2..3a412fc 100644
--- a/media/gpu/mac/video_toolbox_av1_accelerator_unittest.cc
+++ b/media/gpu/mac/video_toolbox_av1_accelerator_unittest.cc
@@ -32,7 +32,7 @@
std::unique_ptr<VideoToolboxAV1Accelerator> accelerator_{
std::make_unique<VideoToolboxAV1Accelerator>(
std::make_unique<NullMediaLog>(),
- absl::nullopt,
+ std::nullopt,
base::BindRepeating(&VideoToolboxAV1AcceleratorTest::OnDecode,
base::Unretained(this)),
base::BindRepeating(&VideoToolboxAV1AcceleratorTest::OnOutput,
diff --git a/media/gpu/mac/video_toolbox_decompression_metadata.h b/media/gpu/mac/video_toolbox_decompression_metadata.h
index 97e9c76..e579ff88 100644
--- a/media/gpu/mac/video_toolbox_decompression_metadata.h
+++ b/media/gpu/mac/video_toolbox_decompression_metadata.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_GPU_MAC_VIDEO_TOOLBOX_DECOMPRESSION_METADATA_H_
#define MEDIA_GPU_MAC_VIDEO_TOOLBOX_DECOMPRESSION_METADATA_H_
+#include <optional>
+
#include "base/apple/scoped_cftyperef.h"
#include "base/memory/scoped_refptr.h"
#include "base/time/time.h"
@@ -12,7 +14,6 @@
#include "media/base/video_aspect_ratio.h"
#include "media/gpu/codec_picture.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/hdr_metadata.h"
@@ -42,7 +43,7 @@
base::TimeDelta duration = kNoTimestamp;
VideoAspectRatio aspect_ratio;
gfx::ColorSpace color_space;
- absl::optional<gfx::HDRMetadata> hdr_metadata;
+ std::optional<gfx::HDRMetadata> hdr_metadata;
// Session metadata is included in case the decoder needs to be reconfigured.
// TODO(crbug.com/1331597): Pass separately, maybe even independently.
diff --git a/media/gpu/mac/video_toolbox_frame_converter.cc b/media/gpu/mac/video_toolbox_frame_converter.cc
index 2dff314f..4d92115 100644
--- a/media/gpu/mac/video_toolbox_frame_converter.cc
+++ b/media/gpu/mac/video_toolbox_frame_converter.cc
@@ -4,6 +4,8 @@
#include "media/gpu/mac/video_toolbox_frame_converter.h"
+#include <optional>
+
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
@@ -20,7 +22,6 @@
#include "media/base/media_log.h"
#include "media/base/media_switches.h"
#include "media/gpu/mac/video_toolbox_decompression_metadata.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -40,7 +41,7 @@
constexpr char kSharedImageDebugLabel[] = "VideoToolboxVideoDecoder";
-absl::optional<viz::SharedImageFormat> PixelFormatToImageFormat(
+std::optional<viz::SharedImageFormat> PixelFormatToImageFormat(
OSType pixel_format) {
switch (pixel_format) {
case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange:
@@ -50,7 +51,7 @@
case kCVPixelFormatType_420YpCbCr8VideoRange_8A_TriPlanar:
return viz::MultiPlaneFormat::kNV12A;
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
@@ -172,7 +173,7 @@
base::scoped_policy::RETAIN);
OSType pixel_format = IOSurfaceGetPixelFormat(handle.io_surface.get());
- absl::optional<viz::SharedImageFormat> format =
+ std::optional<viz::SharedImageFormat> format =
PixelFormatToImageFormat(pixel_format);
if (!format) {
MEDIA_LOG(ERROR, media_log_.get())
diff --git a/media/gpu/mac/video_toolbox_vp9_accelerator.cc b/media/gpu/mac/video_toolbox_vp9_accelerator.cc
index d2b32c39..612bc22 100644
--- a/media/gpu/mac/video_toolbox_vp9_accelerator.cc
+++ b/media/gpu/mac/video_toolbox_vp9_accelerator.cc
@@ -15,7 +15,7 @@
VideoToolboxVP9Accelerator::VideoToolboxVP9Accelerator(
std::unique_ptr<MediaLog> media_log,
- absl::optional<gfx::HDRMetadata> hdr_metadata,
+ std::optional<gfx::HDRMetadata> hdr_metadata,
DecodeCB decode_cb,
OutputCB output_cb)
: media_log_(std::move(media_log)),
@@ -153,7 +153,7 @@
break;
}
- absl::optional<gfx::HDRMetadata> hdr_metadata = pic->hdr_metadata();
+ std::optional<gfx::HDRMetadata> hdr_metadata = pic->hdr_metadata();
if (!hdr_metadata) {
hdr_metadata = hdr_metadata_;
}
@@ -170,7 +170,7 @@
base::apple::ScopedCFTypeRef<CFDictionaryRef> format_config =
CreateFormatExtensions(kCMVideoCodecType_VP9, profile,
pic->frame_hdr->bit_depth, color_space,
- hdr_metadata, absl::nullopt);
+ hdr_metadata, std::nullopt);
if (!format_config) {
MEDIA_LOG(ERROR, media_log_.get())
<< "Failed to create format extensions";
diff --git a/media/gpu/mac/video_toolbox_vp9_accelerator.h b/media/gpu/mac/video_toolbox_vp9_accelerator.h
index ff47fc0..f72951d 100644
--- a/media/gpu/mac/video_toolbox_vp9_accelerator.h
+++ b/media/gpu/mac/video_toolbox_vp9_accelerator.h
@@ -6,9 +6,10 @@
#define MEDIA_GPU_MAC_VIDEO_TOOLBOX_VP9_ACCELERATOR_H_
#include <CoreMedia/CoreMedia.h>
-
#include <stdint.h>
+
#include <memory>
+#include <optional>
#include <vector>
#include "base/apple/scoped_cftyperef.h"
@@ -22,7 +23,6 @@
#include "media/gpu/mac/video_toolbox_decompression_metadata.h"
#include "media/gpu/media_gpu_export.h"
#include "media/gpu/vp9_decoder.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/hdr_metadata.h"
@@ -44,7 +44,7 @@
using OutputCB = base::RepeatingCallback<void(scoped_refptr<CodecPicture>)>;
VideoToolboxVP9Accelerator(std::unique_ptr<MediaLog> media_log,
- absl::optional<gfx::HDRMetadata> hdr_metadata,
+ std::optional<gfx::HDRMetadata> hdr_metadata,
DecodeCB decode_cb,
OutputCB output_cb);
~VideoToolboxVP9Accelerator() override;
@@ -69,7 +69,7 @@
bool AppendData(CMBlockBufferRef dest, const uint8_t* data, size_t data_size);
std::unique_ptr<MediaLog> media_log_;
- absl::optional<gfx::HDRMetadata> hdr_metadata_;
+ std::optional<gfx::HDRMetadata> hdr_metadata_;
// Callbacks are called synchronously, which is always re-entrant.
DecodeCB decode_cb_;
@@ -78,7 +78,7 @@
// Parameters of the active format.
VideoColorSpace active_color_space_;
VideoCodecProfile active_profile_ = VIDEO_CODEC_PROFILE_UNKNOWN;
- absl::optional<gfx::HDRMetadata> active_hdr_metadata_;
+ std::optional<gfx::HDRMetadata> active_hdr_metadata_;
gfx::Size active_coded_size_;
base::apple::ScopedCFTypeRef<CMFormatDescriptionRef> active_format_;
diff --git a/media/gpu/mac/video_toolbox_vp9_accelerator_unittest.cc b/media/gpu/mac/video_toolbox_vp9_accelerator_unittest.cc
index b0fe820..828b0c1 100644
--- a/media/gpu/mac/video_toolbox_vp9_accelerator_unittest.cc
+++ b/media/gpu/mac/video_toolbox_vp9_accelerator_unittest.cc
@@ -32,7 +32,7 @@
std::unique_ptr<VideoToolboxVP9Accelerator> accelerator_{
std::make_unique<VideoToolboxVP9Accelerator>(
std::make_unique<NullMediaLog>(),
- absl::nullopt,
+ std::nullopt,
base::BindRepeating(&VideoToolboxVP9AcceleratorTest::OnDecode,
base::Unretained(this)),
base::BindRepeating(&VideoToolboxVP9AcceleratorTest::OnOutput,
diff --git a/media/gpu/mac/vt_config_util.h b/media/gpu/mac/vt_config_util.h
index c18dd6f9..ac0276f 100644
--- a/media/gpu/mac/vt_config_util.h
+++ b/media/gpu/mac/vt_config_util.h
@@ -8,12 +8,13 @@
#include <CoreFoundation/CoreFoundation.h>
#include <CoreMedia/CoreMedia.h>
+#include <optional>
+
#include "base/apple/scoped_cftyperef.h"
#include "base/containers/span.h"
#include "media/base/video_codecs.h"
#include "media/base/video_color_space.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/hdr_metadata.h"
namespace media {
@@ -23,8 +24,8 @@
VideoCodecProfile profile,
int bit_depth,
const VideoColorSpace& color_space,
- absl::optional<gfx::HDRMetadata> hdr_metadata,
- absl::optional<base::span<const uint8_t>> csd_box);
+ std::optional<gfx::HDRMetadata> hdr_metadata,
+ std::optional<base::span<const uint8_t>> csd_box);
} // namespace media
diff --git a/media/gpu/mac/vt_config_util.mm b/media/gpu/mac/vt_config_util.mm
index de58a77..8f234908 100644
--- a/media/gpu/mac/vt_config_util.mm
+++ b/media/gpu/mac/vt_config_util.mm
@@ -136,7 +136,7 @@
void SetContentLightLevelInfo(
NSMutableDictionary<NSString*, id>* extensions,
- const absl::optional<gfx::HDRMetadata>& hdr_metadata) {
+ const std::optional<gfx::HDRMetadata>& hdr_metadata) {
SetDictionaryValue(
extensions, kCMFormatDescriptionExtension_ContentLightLevelInfo,
base::apple::CFToNSPtrCast(
@@ -145,7 +145,7 @@
void SetColorVolumeMetadata(
NSMutableDictionary<NSString*, id>* extensions,
- const absl::optional<gfx::HDRMetadata>& hdr_metadata) {
+ const std::optional<gfx::HDRMetadata>& hdr_metadata) {
SetDictionaryValue(
extensions, kCMFormatDescriptionExtension_MasteringDisplayColorVolume,
base::apple::CFToNSPtrCast(
@@ -214,8 +214,8 @@
VideoCodecProfile profile,
int bit_depth,
const VideoColorSpace& color_space,
- absl::optional<gfx::HDRMetadata> hdr_metadata,
- absl::optional<base::span<const uint8_t>> csd_box) {
+ std::optional<gfx::HDRMetadata> hdr_metadata,
+ std::optional<base::span<const uint8_t>> csd_box) {
NSMutableDictionary* extensions = [[NSMutableDictionary alloc] init];
SetDictionaryValue(extensions, kCMFormatDescriptionExtension_FormatName,
diff --git a/media/gpu/mac/vt_config_util_unittest.cc b/media/gpu/mac/vt_config_util_unittest.cc
index 12d32c1..f18c4aed 100644
--- a/media/gpu/mac/vt_config_util_unittest.cc
+++ b/media/gpu/mac/vt_config_util_unittest.cc
@@ -61,7 +61,7 @@
media::VideoColorSpace cs) {
base::apple::ScopedCFTypeRef<CFDictionaryRef> fmt =
CreateFormatExtensions(kCMVideoCodecType_H264, media::H264PROFILE_MAIN, 8,
- cs, gfx::HDRMetadata(), absl::nullopt);
+ cs, gfx::HDRMetadata(), std::nullopt);
base::apple::ScopedCFTypeRef<CVImageBufferRef> image_buffer;
OSStatus err =
@@ -117,8 +117,8 @@
void AssertHasDefaultHDRMetadata(CFDictionaryRef fmt) {
// We constructed with an invalid HDRMetadata, so all values should be
// overridden to the default.
- auto mdcv_expected = gfx::GenerateMasteringDisplayColorVolume(absl::nullopt);
- auto clli_expected = gfx::GenerateContentLightLevelInfo(absl::nullopt);
+ auto mdcv_expected = gfx::GenerateMasteringDisplayColorVolume(std::nullopt);
+ auto clli_expected = gfx::GenerateContentLightLevelInfo(std::nullopt);
auto mdcv = GetDataValue(
fmt, kCMFormatDescriptionExtension_MasteringDisplayColorVolume);
@@ -150,7 +150,7 @@
TEST(VTConfigUtil, CreateFormatExtensions_H264_BT709) {
base::apple::ScopedCFTypeRef<CFDictionaryRef> fmt = CreateFormatExtensions(
kCMVideoCodecType_H264, H264PROFILE_MAIN, 8, VideoColorSpace::REC709(),
- absl::nullopt, absl::nullopt);
+ std::nullopt, std::nullopt);
EXPECT_EQ("avc1",
GetStrValue(fmt.get(), kCMFormatDescriptionExtension_FormatName));
@@ -182,7 +182,7 @@
VideoColorSpace::TransferID::SMPTEST2084,
VideoColorSpace::MatrixID::BT2020_NCL,
gfx::ColorSpace::RangeID::FULL),
- gfx::HDRMetadata(), absl::nullopt);
+ gfx::HDRMetadata(), std::nullopt);
EXPECT_EQ("avc1",
GetStrValue(fmt.get(), kCMFormatDescriptionExtension_FormatName));
@@ -208,7 +208,7 @@
VideoColorSpace::TransferID::ARIB_STD_B67,
VideoColorSpace::MatrixID::BT2020_NCL,
gfx::ColorSpace::RangeID::FULL),
- gfx::HDRMetadata(), absl::nullopt);
+ gfx::HDRMetadata(), std::nullopt);
EXPECT_EQ("avc1",
GetStrValue(fmt.get(), kCMFormatDescriptionExtension_FormatName));
@@ -243,7 +243,7 @@
VideoColorSpace::TransferID::SMPTEST2084,
VideoColorSpace::MatrixID::BT2020_NCL,
gfx::ColorSpace::RangeID::FULL),
- hdr_meta, absl::nullopt);
+ hdr_meta, std::nullopt);
{
auto mdcv = GetDataValue(
@@ -289,7 +289,7 @@
const auto kTestColorSpace = VideoColorSpace::REC709();
base::apple::ScopedCFTypeRef<CFDictionaryRef> fmt(
CreateFormatExtensions(kCMVideoCodecType_VP9, kTestProfile, 8,
- kTestColorSpace, absl::nullopt, absl::nullopt));
+ kTestColorSpace, std::nullopt, std::nullopt));
EXPECT_EQ(8, GetIntValue(fmt.get(),
base::SysUTF8ToCFStringRef(kBitDepthKey).get()));
@@ -313,7 +313,7 @@
VideoColorSpace::MatrixID::BT2020_NCL, gfx::ColorSpace::RangeID::LIMITED);
base::apple::ScopedCFTypeRef<CFDictionaryRef> fmt =
CreateFormatExtensions(kCMVideoCodecType_VP9, kTestProfile, 10,
- kTestColorSpace, absl::nullopt, absl::nullopt);
+ kTestColorSpace, std::nullopt, std::nullopt);
EXPECT_EQ(10, GetIntValue(fmt.get(),
base::SysUTF8ToCFStringRef(kBitDepthKey).get()));
@@ -341,7 +341,7 @@
VideoColorSpace::TransferID::SMPTEST2084,
VideoColorSpace::MatrixID::BT2020_NCL, gfx::ColorSpace::RangeID::LIMITED);
base::apple::ScopedCFTypeRef<CFDictionaryRef> fmt = CreateFormatExtensions(
- kCMVideoCodecType_AV1, kTestProfile, 10, kTestColorSpace, absl::nullopt,
+ kCMVideoCodecType_AV1, kTestProfile, 10, kTestColorSpace, std::nullopt,
base::span<const uint8_t>(kAvc1Box, sizeof(kAvc1Box)));
EXPECT_EQ(10, GetIntValue(fmt.get(),
base::SysUTF8ToCFStringRef(kBitDepthKey).get()));
diff --git a/media/gpu/mac/vt_video_decode_accelerator_mac.cc b/media/gpu/mac/vt_video_decode_accelerator_mac.cc
index 0952608..1d99af0b 100644
--- a/media/gpu/mac/vt_video_decode_accelerator_mac.cc
+++ b/media/gpu/mac/vt_video_decode_accelerator_mac.cc
@@ -271,11 +271,11 @@
int bit_depth,
media::VideoColorSpace color_space,
media::VideoCodecProfile profile,
- absl::optional<gfx::HDRMetadata> hdr_metadata,
+ std::optional<gfx::HDRMetadata> hdr_metadata,
const gfx::Size& coded_size) {
base::apple::ScopedCFTypeRef<CFDictionaryRef> format_config =
CreateFormatExtensions(kCMVideoCodecType_VP9, profile, bit_depth,
- color_space, hdr_metadata, absl::nullopt);
+ color_space, hdr_metadata, std::nullopt);
base::apple::ScopedCFTypeRef<CMFormatDescriptionRef> format;
if (!format_config) {
@@ -295,7 +295,7 @@
int bit_depth,
base::span<const uint8_t> av1c,
media::VideoColorSpace color_space,
- absl::optional<gfx::HDRMetadata> hdr_metadata,
+ std::optional<gfx::HDRMetadata> hdr_metadata,
const gfx::Size& coded_size) {
// Profile is unused since we provide the av1c box directly.
base::apple::ScopedCFTypeRef<CFDictionaryRef> format_config =
@@ -1211,7 +1211,7 @@
// Compute and store frame properties. |image_size| gets filled in
// later, since it comes from the decoder configuration.
- absl::optional<int32_t> pic_order_cnt =
+ std::optional<int32_t> pic_order_cnt =
h264_poc_.ComputePicOrderCnt(sps, slice_hdr);
if (!pic_order_cnt.has_value()) {
WriteToMediaLog(MediaLogMessageLevel::kERROR,
diff --git a/media/gpu/mac/vt_video_decode_accelerator_mac.h b/media/gpu/mac/vt_video_decode_accelerator_mac.h
index fa3f0f27..f922ff3 100644
--- a/media/gpu/mac/vt_video_decode_accelerator_mac.h
+++ b/media/gpu/mac/vt_video_decode_accelerator_mac.h
@@ -147,7 +147,7 @@
base::apple::ScopedCFTypeRef<CVImageBufferRef> image;
// Dynamic HDR metadata, if any.
- absl::optional<gfx::HDRMetadata> hdr_metadata;
+ std::optional<gfx::HDRMetadata> hdr_metadata;
};
struct Task {
diff --git a/media/gpu/mac/vt_video_encode_accelerator_mac.cc b/media/gpu/mac/vt_video_encode_accelerator_mac.cc
index f683868..c25a4ab 100644
--- a/media/gpu/mac/vt_video_encode_accelerator_mac.cc
+++ b/media/gpu/mac/vt_video_encode_accelerator_mac.cc
@@ -133,7 +133,7 @@
info.is_hardware_accelerated = true;
#endif
- absl::optional<int> max_frame_delay_property;
+ std::optional<int> max_frame_delay_property;
base::apple::ScopedCFTypeRef<CFNumberRef> max_frame_delay_count;
if (VTSessionCopyProperty(
compression_session, kVTCompressionPropertyKey_MaxFrameDelayCount,
@@ -521,7 +521,7 @@
void VTVideoEncodeAccelerator::RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
std::ostringstream parameters_description;
parameters_description << ": bitrate=" << bitrate.ToString()
<< ": framerate=" << framerate;
@@ -735,7 +735,7 @@
return false;
}
- RequestEncodingParametersChange(bitrate_, frame_rate_, absl::nullopt);
+ RequestEncodingParametersChange(bitrate_, frame_rate_, std::nullopt);
return true;
}
diff --git a/media/gpu/mac/vt_video_encode_accelerator_mac.h b/media/gpu/mac/vt_video_encode_accelerator_mac.h
index 1349483..c2d5172 100644
--- a/media/gpu/mac/vt_video_encode_accelerator_mac.h
+++ b/media/gpu/mac/vt_video_encode_accelerator_mac.h
@@ -48,7 +48,7 @@
void RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
void Destroy() override;
void Flush(FlushCallback flush_callback) override;
bool IsFlushSupported() override;
@@ -155,7 +155,7 @@
FlushCallback pending_flush_cb_;
// Color space of the first frame sent to Encode().
- absl::optional<gfx::ColorSpace> encoder_color_space_;
+ std::optional<gfx::ColorSpace> encoder_color_space_;
bool can_set_encoder_color_space_ = true;
// Monotonically-growing timestamp that will be assigned to the next frame
diff --git a/media/gpu/test/image.cc b/media/gpu/test/image.cc
index 6f3734c..91d841b 100644
--- a/media/gpu/test/image.cc
+++ b/media/gpu/test/image.cc
@@ -21,8 +21,7 @@
// Resolve the specified test file path to an absolute path. The path can be
// either an absolute path, a path relative to the current directory, or a path
// relative to the test data path.
-absl::optional<base::FilePath> ResolveFilePath(
- const base::FilePath& file_path) {
+std::optional<base::FilePath> ResolveFilePath(const base::FilePath& file_path) {
base::FilePath resolved_path = file_path;
// Try to resolve the path into an absolute path. If the path doesn't exist,
@@ -35,8 +34,8 @@
}
return PathExists(resolved_path)
- ? absl::optional<base::FilePath>(resolved_path)
- : absl::nullopt;
+ ? std::optional<base::FilePath>(resolved_path)
+ : std::nullopt;
}
// Converts the |pixel_format| string into a VideoPixelFormat.
@@ -75,7 +74,7 @@
DCHECK(!file_path_.empty());
DCHECK(!IsLoaded());
- absl::optional<base::FilePath> resolved_path = ResolveFilePath(file_path_);
+ std::optional<base::FilePath> resolved_path = ResolveFilePath(file_path_);
if (!resolved_path) {
LOG(ERROR) << "Image file not found: " << file_path_;
return false;
@@ -114,7 +113,7 @@
}
base::FilePath json_path = file_path_.AddExtension(kMetadataSuffix);
- absl::optional<base::FilePath> resolved_path = ResolveFilePath(json_path);
+ std::optional<base::FilePath> resolved_path = ResolveFilePath(json_path);
if (!resolved_path) {
LOG(ERROR) << "Image metadata file not found: " << json_path;
return false;
@@ -154,12 +153,12 @@
}
// Get the image dimensions from the json data.
- absl::optional<int> width = metadata.FindInt("width");
+ std::optional<int> width = metadata.FindInt("width");
if (!width.has_value()) {
VLOGF(1) << "Key \"width\" is not found in " << json_path;
return false;
}
- absl::optional<int> height = metadata.FindInt("height");
+ std::optional<int> height = metadata.FindInt("height");
if (!height) {
VLOGF(1) << "Key \"height\" is not found in " << json_path;
return false;
@@ -187,7 +186,7 @@
}
// Get the image rotation info from the json data.
- absl::optional<int> rotation = metadata.FindInt("rotation");
+ std::optional<int> rotation = metadata.FindInt("rotation");
if (!rotation.has_value()) {
// Default rotation value is VIDEO_ROTATION_0
rotation_ = VIDEO_ROTATION_0;
diff --git a/media/gpu/test/image_processor/image_processor_client.cc b/media/gpu/test/image_processor/image_processor_client.cc
index b5afba1..9968173 100644
--- a/media/gpu/test/image_processor/image_processor_client.cc
+++ b/media/gpu/test/image_processor/image_processor_client.cc
@@ -37,11 +37,11 @@
} \
} while (0)
-absl::optional<VideoFrameLayout> CreateLayout(
+std::optional<VideoFrameLayout> CreateLayout(
const ImageProcessor::PortConfig& config) {
const VideoPixelFormat pixel_format = config.fourcc.ToVideoPixelFormat();
if (config.planes.empty())
- return absl::nullopt;
+ return std::nullopt;
if (config.fourcc.IsMultiPlanar()) {
return VideoFrameLayout::CreateWithPlanes(pixel_format, config.size,
@@ -55,7 +55,7 @@
// static
std::unique_ptr<ImageProcessorClient> ImageProcessorClient::Create(
- absl::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
+ std::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
const ImageProcessor::PortConfig& input_config,
const ImageProcessor::PortConfig& output_config,
size_t num_buffers,
@@ -93,7 +93,7 @@
}
bool ImageProcessorClient::CreateImageProcessor(
- absl::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
+ std::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
const ImageProcessor::PortConfig& input_config,
const ImageProcessor::PortConfig& output_config,
size_t num_buffers) {
@@ -117,7 +117,7 @@
}
void ImageProcessorClient::CreateImageProcessorTask(
- absl::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
+ std::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
const ImageProcessor::PortConfig& input_config,
const ImageProcessor::PortConfig& output_config,
size_t num_buffers,
@@ -139,8 +139,8 @@
} else {
ImageProcessorFactory::PickFormatCB pick_format_cb =
base::BindRepeating([](const std::vector<Fourcc>& fourcc_config,
- absl::optional<Fourcc> fourcc) {
- return absl::make_optional<Fourcc>(fourcc_config[0]);
+ std::optional<Fourcc> fourcc) {
+ return std::make_optional<Fourcc>(fourcc_config[0]);
});
image_processor_ = ImageProcessorFactory::CreateWithInputCandidates(
@@ -162,7 +162,7 @@
image_processor_->input_config();
const VideoFrame::StorageType input_storage_type =
input_config.storage_type();
- absl::optional<VideoFrameLayout> input_layout = CreateLayout(input_config);
+ std::optional<VideoFrameLayout> input_layout = CreateLayout(input_config);
ASSERT_TRUE_OR_RETURN_NULLPTR(input_layout);
if (VideoFrame::IsStorageTypeMappable(input_storage_type)) {
@@ -194,7 +194,7 @@
image_processor_->output_config();
const VideoFrame::StorageType output_storage_type =
output_config.storage_type();
- absl::optional<VideoFrameLayout> output_layout = CreateLayout(output_config);
+ std::optional<VideoFrameLayout> output_layout = CreateLayout(output_config);
ASSERT_TRUE_OR_RETURN_NULLPTR(output_layout);
if (VideoFrame::IsStorageTypeMappable(output_storage_type)) {
return VideoFrame::CreateFrameWithLayout(
diff --git a/media/gpu/test/image_processor/image_processor_client.h b/media/gpu/test/image_processor/image_processor_client.h
index 1bd2715..1d0be65 100644
--- a/media/gpu/test/image_processor/image_processor_client.h
+++ b/media/gpu/test/image_processor/image_processor_client.h
@@ -45,7 +45,7 @@
// validation, writing to file) on each video frame produced by the
// ImageProcessor.
static std::unique_ptr<ImageProcessorClient> Create(
- absl::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
+ std::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
const ImageProcessor::PortConfig& input_config,
const ImageProcessor::PortConfig& output_config,
size_t num_buffers,
@@ -86,14 +86,14 @@
// Create ImageProcessor with |input_config|, |output_config| and
// |num_buffers|.
bool CreateImageProcessor(
- absl::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
+ std::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
const ImageProcessor::PortConfig& input_config,
const ImageProcessor::PortConfig& output_config,
size_t num_buffers);
// Create |image_processor_| on |my_thread_|.
void CreateImageProcessorTask(
- absl::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
+ std::optional<ImageProcessor::CreateBackendCB> create_backend_cb,
const ImageProcessor::PortConfig& input_config,
const ImageProcessor::PortConfig& output_config,
size_t num_buffers,
diff --git a/media/gpu/test/raw_video.cc b/media/gpu/test/raw_video.cc
index b805c4a..5abc174 100644
--- a/media/gpu/test/raw_video.cc
+++ b/media/gpu/test/raw_video.cc
@@ -296,7 +296,7 @@
FFmpegGlue glue(&protocol);
LOG_ASSERT(glue.OpenContext()) << "Failed to open AVFormatContext";
// Find the first VP9 stream in the file.
- absl::optional<size_t> vp9_stream_index;
+ std::optional<size_t> vp9_stream_index;
VideoDecoderConfig config;
for (size_t i = 0; i < glue.format_context()->nb_streams; ++i) {
AVStream* stream = glue.format_context()->streams[i];
@@ -446,26 +446,26 @@
}
is_vp9_data = !!profile;
- absl::optional<int> frame_rate = metadata_dict.FindInt("frame_rate");
+ std::optional<int> frame_rate = metadata_dict.FindInt("frame_rate");
if (!frame_rate.has_value()) {
LOG(ERROR) << "Key \"frame_rate\" is not found in " << json_file_path;
return false;
}
metadata.frame_rate = base::checked_cast<uint32_t>(*frame_rate);
- absl::optional<int> num_frames = metadata_dict.FindInt("num_frames");
+ std::optional<int> num_frames = metadata_dict.FindInt("num_frames");
if (!num_frames.has_value()) {
LOG(ERROR) << "Key \"num_frames\" is not found in " << json_file_path;
return false;
}
metadata.num_frames = base::checked_cast<size_t>(*num_frames);
- absl::optional<int> width = metadata_dict.FindInt("width");
+ std::optional<int> width = metadata_dict.FindInt("width");
if (!width.has_value()) {
LOG(ERROR) << "Key \"width\" is not found in " << json_file_path;
return false;
}
- absl::optional<int> height = metadata_dict.FindInt("height");
+ std::optional<int> height = metadata_dict.FindInt("height");
if (!height) {
LOG(ERROR) << "Key \"height\" is not found in " << json_file_path;
return false;
@@ -610,7 +610,7 @@
LOG_ASSERT(visible_rect.x() % 2 == 0 && visible_rect.y() % 2 == 0)
<< "An odd origin point is not supported";
LOG_ASSERT(!vp9_decoder_ && !!memory_mapped_file_);
- const absl::optional<VideoFrameLayout> dst_layout =
+ const std::optional<VideoFrameLayout> dst_layout =
CreateVideoFrameLayout(PIXEL_FORMAT_NV12, resolution, 1u /* alignment*/);
LOG_ASSERT(dst_layout) << "Failed creating VideoFrameLayout";
const auto& dst_planes = dst_layout->planes();
diff --git a/media/gpu/test/raw_video.h b/media/gpu/test/raw_video.h
index 05276a77..1f50b9f 100644
--- a/media/gpu/test/raw_video.h
+++ b/media/gpu/test/raw_video.h
@@ -6,6 +6,7 @@
#define MEDIA_GPU_TEST_RAW_VIDEO_H_
#include <memory>
+#include <optional>
#include <string>
#include <vector>
@@ -13,7 +14,6 @@
#include "base/files/file_path.h"
#include "media/base/video_frame_layout.h"
#include "media/base/video_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -96,7 +96,7 @@
uint32_t frame_rate;
size_t num_frames;
- absl::optional<VideoFrameLayout> frame_layout;
+ std::optional<VideoFrameLayout> frame_layout;
gfx::Rect visible_rect;
};
class VP9Decoder;
diff --git a/media/gpu/test/video_bitstream.cc b/media/gpu/test/video_bitstream.cc
index bcdeacb..fab0e63 100644
--- a/media/gpu/test/video_bitstream.cc
+++ b/media/gpu/test/video_bitstream.cc
@@ -4,6 +4,8 @@
#include "media/gpu/test/video_bitstream.h"
+#include <optional>
+
#include "base/containers/contains.h"
#include "base/files/file_util.h"
#include "base/files/memory_mapped_file.h"
@@ -12,7 +14,6 @@
#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_util.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media::test {
@@ -22,9 +23,9 @@
constexpr const base::FilePath::CharType* kMetadataSuffix =
FILE_PATH_LITERAL(".json");
-// Converts the string to VideoCodecProfile. This returns absl::nullopt if
+// Converts the string to VideoCodecProfile. This returns std::nullopt if
// it is not supported by video_decode_accelerator(_perf)_tests.
-absl::optional<VideoCodecProfile> ConvertStringtoProfile(
+std::optional<VideoCodecProfile> ConvertStringtoProfile(
const std::string& profile) {
if (profile == "H264PROFILE_BASELINE") {
return H264PROFILE_BASELINE;
@@ -46,7 +47,7 @@
return HEVCPROFILE_MAIN10;
} else {
LOG(ERROR) << profile << " is not supported";
- return absl::nullopt;
+ return std::nullopt;
}
}
@@ -92,7 +93,7 @@
CHECK_NE(metadata.codec, VideoCodec::kUnknown);
// Find the video's bit depth. This is optional.
- absl::optional<int> bit_depth = metadata_dict.FindInt("bit_depth");
+ std::optional<int> bit_depth = metadata_dict.FindInt("bit_depth");
if (bit_depth.has_value()) {
metadata.bit_depth = base::checked_cast<uint8_t>(*bit_depth);
} else {
@@ -104,26 +105,26 @@
metadata.bit_depth = kDefaultBitDepth;
}
- absl::optional<int> frame_rate = metadata_dict.FindInt("frame_rate");
+ std::optional<int> frame_rate = metadata_dict.FindInt("frame_rate");
if (!frame_rate.has_value()) {
LOG(ERROR) << "Key \"frame_rate\" is not found in " << json_file_path;
return false;
}
metadata.frame_rate = base::checked_cast<uint32_t>(*frame_rate);
- absl::optional<int> num_frames = metadata_dict.FindInt("num_frames");
+ std::optional<int> num_frames = metadata_dict.FindInt("num_frames");
if (!num_frames.has_value()) {
LOG(ERROR) << "Key \"num_frames\" is not found in " << json_file_path;
return false;
}
metadata.num_frames = base::checked_cast<size_t>(*num_frames);
- absl::optional<int> width = metadata_dict.FindInt("width");
+ std::optional<int> width = metadata_dict.FindInt("width");
if (!width.has_value()) {
LOG(ERROR) << "Key \"width\" is not found in " << json_file_path;
return false;
}
- absl::optional<int> height = metadata_dict.FindInt("height");
+ std::optional<int> height = metadata_dict.FindInt("height");
if (!height) {
LOG(ERROR) << "Key \"height\" is not found in " << json_file_path;
return false;
diff --git a/media/gpu/test/video_encode_accelerator_perf_tests.cc b/media/gpu/test/video_encode_accelerator_perf_tests.cc
index 1bdb2b0..d82c320 100644
--- a/media/gpu/test/video_encode_accelerator_perf_tests.cc
+++ b/media/gpu/test/video_encode_accelerator_perf_tests.cc
@@ -7,6 +7,7 @@
#include <iostream>
#include <map>
#include <numeric>
+#include <optional>
#include <vector>
#include "base/command_line.h"
@@ -31,7 +32,6 @@
#include "media/gpu/test/video_frame_validator.h"
#include "media/gpu/test/video_test_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace test {
@@ -330,15 +330,15 @@
const LogLikelihoodRatioVideoFrameValidator* const
log_likelihood_validator,
const DecoderBufferValidator* const decoder_buffer_validator,
- const absl::optional<size_t>& spatial_idx,
- const absl::optional<size_t>& temporal_idx,
+ const std::optional<size_t>& spatial_idx,
+ const std::optional<size_t>& temporal_idx,
size_t num_spatial_layers,
SVCInterLayerPredMode inter_layer_pred_mode);
void Output(uint32_t target_bitrate, uint32_t actual_bitrate);
- absl::optional<size_t> spatial_idx;
- absl::optional<size_t> temporal_idx;
+ std::optional<size_t> spatial_idx;
+ std::optional<size_t> temporal_idx;
private:
struct QualityStats {
@@ -392,8 +392,8 @@
const PSNRVideoFrameValidator* const bottom_row_psnr_validator,
const LogLikelihoodRatioVideoFrameValidator* const log_likelihood_validator,
const DecoderBufferValidator* const decoder_buffer_validator,
- const absl::optional<size_t>& spatial_idx,
- const absl::optional<size_t>& temporal_idx,
+ const std::optional<size_t>& spatial_idx,
+ const std::optional<size_t>& temporal_idx,
size_t num_spatial_layers,
SVCInterLayerPredMode inter_layer_pred_mode)
: spatial_idx(spatial_idx),
@@ -622,7 +622,7 @@
// is consumed by VideoEncoder. |measure_quality| measures SSIM and PSNR
// values of encoded bitstream comparing the original input VideoFrames.
std::unique_ptr<VideoEncoder> CreateVideoEncoder(
- absl::optional<uint32_t> encode_rate = absl::nullopt,
+ std::optional<uint32_t> encode_rate = std::nullopt,
bool measure_quality = false,
size_t num_encode_frames = kNumEncodeFramesForSpeedPerformance) {
RawVideo* video = g_env->GenerateNV12Video();
@@ -672,8 +672,8 @@
const VideoCodecProfile profile,
const gfx::Rect& visible_rect,
size_t num_encode_frames,
- const absl::optional<size_t>& spatial_layer_index_to_decode,
- const absl::optional<size_t>& temporal_layer_index_to_decode,
+ const std::optional<size_t>& spatial_layer_index_to_decode,
+ const std::optional<size_t>& temporal_layer_index_to_decode,
const std::vector<gfx::Size>& spatial_layer_resolutions,
DecoderBufferValidator* const decoder_buffer_validator,
SVCInterLayerPredMode inter_layer_pred_mode) {
@@ -752,8 +752,8 @@
// Simple stream encoding.
bitstream_processors.push_back(CreateBitstreamValidator(
profile, gfx::Rect(video->Resolution()), num_encode_frames,
- /*spatial_layer_index_to_decode=*/absl::nullopt,
- /*temporal_layer_index_to_decode=*/absl::nullopt,
+ /*spatial_layer_index_to_decode=*/std::nullopt,
+ /*temporal_layer_index_to_decode=*/std::nullopt,
/*spatial_layer_resolutions=*/{}, decoder_buffer_validator_,
SVCInterLayerPredMode::kOff));
if (g_env->SaveOutputBitstream()) {
@@ -910,7 +910,7 @@
<< "Skip because this test case is to measure quality performance";
}
const size_t num_frames = g_env->Video()->NumFrames();
- auto encoder = CreateVideoEncoder(/*encode_rate=*/absl::nullopt,
+ auto encoder = CreateVideoEncoder(/*encode_rate=*/std::nullopt,
/*measure_quality=*/true,
/*num_encode_frames=*/num_frames);
encoder->SetEventWaitTimeout(kQualityTestEventTimeout);
@@ -923,8 +923,8 @@
const VideoEncoderStats stats = encoder->GetStats();
for (auto& metrics : quality_metrics_) {
- absl::optional<size_t> spatial_idx = metrics.spatial_idx;
- absl::optional<size_t> temporal_idx = metrics.temporal_idx;
+ std::optional<size_t> spatial_idx = metrics.spatial_idx;
+ std::optional<size_t> temporal_idx = metrics.temporal_idx;
uint32_t target_bitrate = 0;
uint32_t actual_bitrate = 0;
if (!spatial_idx && !temporal_idx) {
@@ -976,7 +976,7 @@
media::Bitrate::Mode bitrate_mode = media::Bitrate::Mode::kConstant;
bool reverse = false;
bool output_bitstream = false;
- absl::optional<uint32_t> encode_bitrate;
+ std::optional<uint32_t> encode_bitrate;
std::vector<base::test::FeatureRef> disabled_features;
std::string svc_mode = "L1T1";
diff --git a/media/gpu/test/video_encode_accelerator_tests.cc b/media/gpu/test/video_encode_accelerator_tests.cc
index ee247ac..b74949e 100644
--- a/media/gpu/test/video_encode_accelerator_tests.cc
+++ b/media/gpu/test/video_encode_accelerator_tests.cc
@@ -4,6 +4,7 @@
#include <algorithm>
#include <limits>
+#include <optional>
#include "base/command_line.h"
#include "base/files/file_path.h"
@@ -30,7 +31,6 @@
#include "media/gpu/test/video_test_environment.h"
#include "media/gpu/test/video_test_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace test {
@@ -169,8 +169,8 @@
const size_t last_frame_index,
const double validator_threshold,
VideoFrameValidator::GetModelFrameCB get_model_frame_cb,
- absl::optional<size_t> spatial_layer_index_to_decode,
- absl::optional<size_t> temporal_layer_index_to_decode,
+ std::optional<size_t> spatial_layer_index_to_decode,
+ std::optional<size_t> temporal_layer_index_to_decode,
SVCInterLayerPredMode inter_layer_pred_mode,
const std::vector<gfx::Size>& spatial_layer_resolutions) {
std::vector<std::unique_ptr<VideoFrameProcessor>> video_frame_processors;
@@ -311,7 +311,7 @@
base::Unretained(this), visible_rect);
bitstream_processors.emplace_back(CreateBitstreamValidator(
video, decoder_config, config.num_frames_to_encode - 1,
- validator_threshold, get_model_frame_cb, absl::nullopt, absl::nullopt,
+ validator_threshold, get_model_frame_cb, std::nullopt, std::nullopt,
config.inter_layer_pred_mode, /*spatial_layer_resolutions=*/{}));
LOG_ASSERT(bitstream_processors.back());
}
@@ -853,7 +853,7 @@
std::string codec = "h264";
std::string svc_mode = "L1T1";
bool output_bitstream = false;
- absl::optional<uint32_t> output_bitrate;
+ std::optional<uint32_t> output_bitrate;
bool reverse = false;
media::Bitrate::Mode bitrate_mode = media::Bitrate::Mode::kConstant;
media::test::FrameOutputConfig frame_output_config;
diff --git a/media/gpu/test/video_encoder/bitstream_file_writer.cc b/media/gpu/test/video_encoder/bitstream_file_writer.cc
index 98d8f1f2..b849c479 100644
--- a/media/gpu/test/video_encoder/bitstream_file_writer.cc
+++ b/media/gpu/test/video_encoder/bitstream_file_writer.cc
@@ -41,8 +41,8 @@
BitstreamFileWriter::BitstreamFileWriter(
std::unique_ptr<FrameFileWriter> frame_file_writer,
- absl::optional<size_t> spatial_layer_index_to_write,
- absl::optional<size_t> temporal_layer_index_to_write,
+ std::optional<size_t> spatial_layer_index_to_write,
+ std::optional<size_t> temporal_layer_index_to_write,
const std::vector<gfx::Size>& spatial_layer_resolutions)
: frame_file_writer_(std::move(frame_file_writer)),
spatial_layer_index_to_write_(spatial_layer_index_to_write),
@@ -69,8 +69,8 @@
const gfx::Size& resolution,
uint32_t frame_rate,
uint32_t num_frames,
- absl::optional<size_t> spatial_layer_index_to_write,
- absl::optional<size_t> temporal_layer_index_to_write,
+ std::optional<size_t> spatial_layer_index_to_write,
+ std::optional<size_t> temporal_layer_index_to_write,
const std::vector<gfx::Size>& spatial_layer_resolutions) {
std::unique_ptr<FrameFileWriter> frame_file_writer;
if (!base::DirectoryExists(output_filepath.DirName()))
diff --git a/media/gpu/test/video_encoder/bitstream_file_writer.h b/media/gpu/test/video_encoder/bitstream_file_writer.h
index c70bdef..2118cc1 100644
--- a/media/gpu/test/video_encoder/bitstream_file_writer.h
+++ b/media/gpu/test/video_encoder/bitstream_file_writer.h
@@ -27,8 +27,8 @@
const gfx::Size& resolution,
uint32_t frame_rate,
uint32_t num_frames,
- absl::optional<size_t> spatial_layer_index_to_write = absl::nullopt,
- absl::optional<size_t> temporal_layer_index_to_write = absl::nullopt,
+ std::optional<size_t> spatial_layer_index_to_write = std::nullopt,
+ std::optional<size_t> temporal_layer_index_to_write = std::nullopt,
const std::vector<gfx::Size>& spatial_layer_resolutions = {});
BitstreamFileWriter(const BitstreamFileWriter&) = delete;
BitstreamFileWriter operator=(const BitstreamFileWriter&) = delete;
@@ -41,8 +41,8 @@
private:
class FrameFileWriter;
BitstreamFileWriter(std::unique_ptr<FrameFileWriter> frame_file_writer,
- absl::optional<size_t> spatial_layer_index_to_write,
- absl::optional<size_t> temporal_layer_index_to_write,
+ std::optional<size_t> spatial_layer_index_to_write,
+ std::optional<size_t> temporal_layer_index_to_write,
const std::vector<gfx::Size>& spatial_layer_resolutions);
void WriteBitstreamTask(scoped_refptr<BitstreamRef> bitstream,
size_t frame_index);
@@ -53,8 +53,8 @@
const std::vector<gfx::Size>& spatial_layer_resolutions);
const std::unique_ptr<FrameFileWriter> frame_file_writer_;
- const absl::optional<size_t> spatial_layer_index_to_write_;
- const absl::optional<size_t> temporal_layer_index_to_write_;
+ const std::optional<size_t> spatial_layer_index_to_write_;
+ const std::optional<size_t> temporal_layer_index_to_write_;
const std::vector<gfx::Size> spatial_layer_resolutions_;
uint8_t begin_active_spatial_layer_index_ = 0;
diff --git a/media/gpu/test/video_encoder/bitstream_validator.cc b/media/gpu/test/video_encoder/bitstream_validator.cc
index e12a274..858f477 100644
--- a/media/gpu/test/video_encoder/bitstream_validator.cc
+++ b/media/gpu/test/video_encoder/bitstream_validator.cc
@@ -5,6 +5,7 @@
#include "media/gpu/test/video_encoder/bitstream_validator.h"
#include <numeric>
+#include <optional>
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
@@ -24,7 +25,6 @@
#include "media/gpu/macros.h"
#include "media/gpu/test/video_encoder/decoder_buffer_validator.h"
#include "media/gpu/test/video_frame_helpers.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace test {
@@ -67,8 +67,8 @@
const VideoDecoderConfig& decoder_config,
size_t last_frame_index,
std::vector<std::unique_ptr<VideoFrameProcessor>> video_frame_processors,
- absl::optional<size_t> spatial_layer_index_to_decode,
- absl::optional<size_t> temporal_layer_index_to_decode,
+ std::optional<size_t> spatial_layer_index_to_decode,
+ std::optional<size_t> temporal_layer_index_to_decode,
const std::vector<gfx::Size>& spatial_layer_resolutions) {
std::unique_ptr<MediaLog> media_log;
auto decoder = CreateDecoder(decoder_config.codec(), &media_log);
@@ -130,8 +130,8 @@
std::unique_ptr<MediaLog> media_log,
size_t last_frame_index,
const gfx::Rect& decoding_rect,
- absl::optional<size_t> spatial_layer_index_to_decode,
- absl::optional<size_t> temporal_layer_index_to_decode,
+ std::optional<size_t> spatial_layer_index_to_decode,
+ std::optional<size_t> temporal_layer_index_to_decode,
const std::vector<gfx::Size>& spatial_layer_resolutions,
std::vector<std::unique_ptr<VideoFrameProcessor>> video_frame_processors)
: decoder_(std::move(decoder)),
diff --git a/media/gpu/test/video_encoder/bitstream_validator.h b/media/gpu/test/video_encoder/bitstream_validator.h
index ea45600..d9339ff 100644
--- a/media/gpu/test/video_encoder/bitstream_validator.h
+++ b/media/gpu/test/video_encoder/bitstream_validator.h
@@ -6,6 +6,7 @@
#define MEDIA_GPU_TEST_VIDEO_ENCODER_BITSTREAM_VALIDATOR_H_
#include <memory>
+#include <optional>
#include <utility>
#include <vector>
@@ -22,7 +23,6 @@
#include "media/gpu/test/bitstream_helpers.h"
#include "media/gpu/test/video_frame_helpers.h"
#include "media/video/video_encode_accelerator.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/size.h"
@@ -46,8 +46,8 @@
size_t last_frame_index,
std::vector<std::unique_ptr<VideoFrameProcessor>> video_frame_processors =
{},
- absl::optional<size_t> spatial_layer_index_to_decode_ = absl::nullopt,
- absl::optional<size_t> temporal_layer_index_to_decode = absl::nullopt,
+ std::optional<size_t> spatial_layer_index_to_decode_ = std::nullopt,
+ std::optional<size_t> temporal_layer_index_to_decode = std::nullopt,
const std::vector<gfx::Size>& spatial_layer_resolutions = {});
~BitstreamValidator() override;
@@ -63,8 +63,8 @@
std::unique_ptr<MediaLog> media_log,
size_t last_frame_index,
const gfx::Rect& decoding_rect,
- absl::optional<size_t> spatial_layer_index_to_decode_,
- absl::optional<size_t> temporal_layer_index_to_decode,
+ std::optional<size_t> spatial_layer_index_to_decode_,
+ std::optional<size_t> temporal_layer_index_to_decode,
const std::vector<gfx::Size>& spatial_layer_resolutions,
std::vector<std::unique_ptr<VideoFrameProcessor>> video_frame_processors);
BitstreamValidator(const BitstreamValidator&) = delete;
@@ -91,8 +91,8 @@
const std::unique_ptr<MediaLog> media_log_;
const size_t last_frame_index_;
const gfx::Rect desired_decoding_rect_;
- const absl::optional<size_t> spatial_layer_index_to_decode_;
- const absl::optional<size_t> temporal_layer_index_to_decode_;
+ const std::optional<size_t> spatial_layer_index_to_decode_;
+ const std::optional<size_t> temporal_layer_index_to_decode_;
const std::vector<gfx::Size> spatial_layer_resolutions_;
const std::vector<std::unique_ptr<VideoFrameProcessor>>
video_frame_processors_;
diff --git a/media/gpu/test/video_encoder/decoder_buffer_validator.cc b/media/gpu/test/video_encoder/decoder_buffer_validator.cc
index 9ef3577..83f4501d 100644
--- a/media/gpu/test/video_encoder/decoder_buffer_validator.cc
+++ b/media/gpu/test/video_encoder/decoder_buffer_validator.cc
@@ -94,7 +94,7 @@
H264Validator::H264Validator(VideoCodecProfile profile,
const gfx::Rect& visible_rect,
size_t num_temporal_layers,
- absl::optional<uint8_t> level)
+ std::optional<uint8_t> level)
: DecoderBufferValidator(visible_rect, num_temporal_layers),
cur_pic_(new H264Picture),
profile_(VideoCodecProfileToH264ProfileIDC(profile)),
diff --git a/media/gpu/test/video_encoder/decoder_buffer_validator.h b/media/gpu/test/video_encoder/decoder_buffer_validator.h
index 8b6bb92..ff51ec10 100644
--- a/media/gpu/test/video_encoder/decoder_buffer_validator.h
+++ b/media/gpu/test/video_encoder/decoder_buffer_validator.h
@@ -7,13 +7,14 @@
#include <stdint.h>
+#include <optional>
+
#include "base/memory/scoped_refptr.h"
#include "media/filters/vp9_parser.h"
#include "media/gpu/h264_dpb.h"
#include "media/gpu/test/bitstream_helpers.h"
#include "media/parsers/vp8_parser.h"
#include "media/video/h264_parser.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/libgav1/src/src/obu_parser.h"
#include "ui/gfx/geometry/rect.h"
@@ -71,7 +72,7 @@
H264Validator(VideoCodecProfile profile,
const gfx::Rect& visible_rect,
const size_t num_temporal_layers,
- absl::optional<uint8_t> level = absl::nullopt);
+ std::optional<uint8_t> level = std::nullopt);
~H264Validator() override;
private:
@@ -101,8 +102,8 @@
// The expected h264 profile of |decoder_buffer|.
const int profile_;
// The expected h264 level of |decoder_buffer|. Check if it is not
- // absl::nullopt.
- absl::optional<uint8_t> level_;
+ // std::nullopt.
+ std::optional<uint8_t> level_;
};
class VP8Validator : public DecoderBufferValidator {
@@ -168,10 +169,10 @@
// An optional state for each specified VP9 reference buffer.
// A nullopt indicates either keyframe not yet seen, or that a
// buffer has been invalidated (e.g. due to sync points).
- std::vector<std::array<absl::optional<BufferState>, kVp9NumRefFrames>>
+ std::vector<std::array<std::optional<BufferState>, kVp9NumRefFrames>>
reference_buffers_;
- absl::optional<base::TimeDelta> dropped_superframe_timestamp_;
+ std::optional<base::TimeDelta> dropped_superframe_timestamp_;
};
class AV1Validator : public DecoderBufferValidator {
@@ -188,7 +189,7 @@
libgav1::InternalFrameBufferList buffer_list_;
libgav1::BufferPool buffer_pool_;
libgav1::DecoderState decoder_state_;
- absl::optional<libgav1::ObuSequenceHeader> sequence_header_ = absl::nullopt;
+ std::optional<libgav1::ObuSequenceHeader> sequence_header_ = std::nullopt;
uint64_t frame_num_ = 0;
};
} // namespace test
diff --git a/media/gpu/test/video_encoder/video_encoder_client.cc b/media/gpu/test/video_encoder/video_encoder_client.cc
index 5f4b10c..219b58f 100644
--- a/media/gpu/test/video_encoder/video_encoder_client.cc
+++ b/media/gpu/test/video_encoder/video_encoder_client.cc
@@ -45,7 +45,7 @@
// only dereferenced after rescheduling the task on the specified task runner.
template <typename CallbackFunc, typename... CallbackArgs>
void CallbackThunk(
- absl::optional<base::WeakPtr<VideoEncoderClient>> encoder_client,
+ std::optional<base::WeakPtr<VideoEncoderClient>> encoder_client,
scoped_refptr<base::SequencedTaskRunner> task_runner,
CallbackFunc func,
CallbackArgs... args) {
@@ -619,7 +619,7 @@
DCHECK_CALLED_ON_VALID_SEQUENCE(encoder_client_sequence_checker_);
DVLOGF(4);
aligned_data_helper_->UpdateFrameRate(framerate);
- encoder_->RequestEncodingParametersChange(bitrate, framerate, absl::nullopt);
+ encoder_->RequestEncodingParametersChange(bitrate, framerate, std::nullopt);
base::AutoLock auto_lcok(stats_lock_);
current_stats_.framerate = framerate;
}
diff --git a/media/gpu/test/video_encoder/video_encoder_client.h b/media/gpu/test/video_encoder/video_encoder_client.h
index 1044b038..60c3cfb 100644
--- a/media/gpu/test/video_encoder/video_encoder_client.h
+++ b/media/gpu/test/video_encoder/video_encoder_client.h
@@ -69,9 +69,9 @@
// The desired framerate in frames/second.
uint32_t framerate = 30.0;
// The interval of calling VideoEncodeAccelerator::Encode(). If this is
- // absl::nullopt, Encode() is called once VideoEncodeAccelerator consumes
+ // std::nullopt, Encode() is called once VideoEncodeAccelerator consumes
// the previous VideoFrames.
- absl::optional<base::TimeDelta> encode_interval = absl::nullopt;
+ std::optional<base::TimeDelta> encode_interval = std::nullopt;
// The number of frames to be encoded. This can be more than the number of
// frames in the video, and in which case the VideoEncoderClient loops the
// video during encoding.
diff --git a/media/gpu/test/video_encoder/video_encoder_test_environment.cc b/media/gpu/test/video_encoder/video_encoder_test_environment.cc
index cb9b0e5..c4527a45 100644
--- a/media/gpu/test/video_encoder/video_encoder_test_environment.cc
+++ b/media/gpu/test/video_encoder/video_encoder_test_environment.cc
@@ -132,7 +132,7 @@
const VideoCodec codec,
const gfx::Size& resolution,
uint32_t frame_rate,
- absl::optional<uint32_t> encode_bitrate,
+ std::optional<uint32_t> encode_bitrate,
size_t num_spatial_layers,
size_t num_temporal_layers,
bool is_vbr,
@@ -218,7 +218,7 @@
const std::string& svc_mode,
VideoEncodeAccelerator::Config::ContentType content_type,
bool save_output_bitstream,
- absl::optional<uint32_t> encode_bitrate,
+ std::optional<uint32_t> encode_bitrate,
Bitrate::Mode bitrate_mode,
bool reverse,
const FrameOutputConfig& frame_output_config,
diff --git a/media/gpu/test/video_encoder/video_encoder_test_environment.h b/media/gpu/test/video_encoder/video_encoder_test_environment.h
index 4c9f5ff..7b8d245 100644
--- a/media/gpu/test/video_encoder/video_encoder_test_environment.h
+++ b/media/gpu/test/video_encoder/video_encoder_test_environment.h
@@ -7,6 +7,7 @@
#include <limits>
#include <memory>
+#include <optional>
#include <string>
#include "base/files/file_path.h"
@@ -14,7 +15,6 @@
#include "media/base/video_codecs.h"
#include "media/gpu/test/video_test_environment.h"
#include "media/video/video_encode_accelerator.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace gpu {
class GpuMemoryBufferFactory;
@@ -54,7 +54,7 @@
const std::string& svc_mode,
VideoEncodeAccelerator::Config::ContentType content_type,
bool save_output_bitstream,
- absl::optional<uint32_t> output_bitrate,
+ std::optional<uint32_t> output_bitrate,
Bitrate::Mode bitrate_mode,
bool reverse,
const FrameOutputConfig& frame_output_config = FrameOutputConfig(),
@@ -90,7 +90,7 @@
// True if the video should play backwards at reaching the end of video.
// Otherwise the video loops. See the comment in AlignedDataHelper for detail.
bool Reverse() const;
- absl::optional<base::FilePath> OutputBitstreamFilePath() const;
+ std::optional<base::FilePath> OutputBitstreamFilePath() const;
// Gets the frame output configuration.
const FrameOutputConfig& ImageOutputConfig() const;
diff --git a/media/gpu/test/video_frame_helpers.cc b/media/gpu/test/video_frame_helpers.cc
index 4bc0312..e4dffb2 100644
--- a/media/gpu/test/video_frame_helpers.cc
+++ b/media/gpu/test/video_frame_helpers.cc
@@ -328,7 +328,7 @@
const VideoFrame* const src_frame,
const VideoFrameLayout& dst_layout,
VideoFrame::StorageType dst_storage_type,
- absl::optional<gfx::BufferUsage> dst_buffer_usage) {
+ std::optional<gfx::BufferUsage> dst_buffer_usage) {
if (!src_frame)
return nullptr;
if (!src_frame->IsMappable()) {
@@ -417,7 +417,7 @@
return nullptr;
}
- absl::optional<gfx::BufferFormat> buffer_format =
+ std::optional<gfx::BufferFormat> buffer_format =
VideoPixelFormatToGfxBufferFormat(frame->format());
if (!buffer_format) {
LOG(ERROR) << "Unexpected format: " << frame->format();
@@ -451,7 +451,7 @@
// Create planes for layout. We cannot use WrapExternalData() because it
// calls GetDefaultLayout() and it supports only a few pixel formats.
- absl::optional<VideoFrameLayout> layout =
+ std::optional<VideoFrameLayout> layout =
CreateVideoFrameLayout(format, image_size, /*alignment=*/1u);
if (!layout) {
LOG(ERROR) << "Failed to create VideoFrameLayout";
@@ -470,7 +470,7 @@
return video_frame;
}
-absl::optional<VideoFrameLayout> CreateVideoFrameLayout(
+std::optional<VideoFrameLayout> CreateVideoFrameLayout(
VideoPixelFormat pixel_format,
const gfx::Size& dimension,
const uint32_t alignment,
diff --git a/media/gpu/test/video_frame_helpers.h b/media/gpu/test/video_frame_helpers.h
index 5844b90e..91bc7e5 100644
--- a/media/gpu/test/video_frame_helpers.h
+++ b/media/gpu/test/video_frame_helpers.h
@@ -5,11 +5,12 @@
#ifndef MEDIA_GPU_TEST_VIDEO_FRAME_HELPERS_H_
#define MEDIA_GPU_TEST_VIDEO_FRAME_HELPERS_H_
+#include <optional>
+
#include "base/memory/scoped_refptr.h"
#include "media/base/video_frame.h"
#include "media/base/video_frame_layout.h"
#include "media/base/video_types.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/size.h"
@@ -67,7 +68,7 @@
const VideoFrame* const src_frame,
const VideoFrameLayout& dst_layout,
VideoFrame::StorageType dst_storage_type = VideoFrame::STORAGE_OWNED_MEMORY,
- absl::optional<gfx::BufferUsage> dst_buffer_usage = absl::nullopt);
+ std::optional<gfx::BufferUsage> dst_buffer_usage = std::nullopt);
// Create Dmabuf-backed VideoFrame from |src_frame|. The created VideoFrame
// doesn't depend on |src_frame|'s lifetime. |src_frame| should be a
@@ -93,7 +94,7 @@
// and |alignment|. |plane_rows| is optional. If it is not nullptr, this fills
// the number of rows of each plane into it. The created VideoFrameLayout
// represents all the planes stored in a single physical buffer.
-absl::optional<VideoFrameLayout> CreateVideoFrameLayout(
+std::optional<VideoFrameLayout> CreateVideoFrameLayout(
VideoPixelFormat pixel_format,
const gfx::Size& dimension,
const uint32_t alignment = VideoFrame::kFrameAddressAlignment,
diff --git a/media/gpu/test/video_player/decoder_listener.h b/media/gpu/test/video_player/decoder_listener.h
index 8093f11..9016c75 100644
--- a/media/gpu/test/video_player/decoder_listener.h
+++ b/media/gpu/test/video_player/decoder_listener.h
@@ -6,7 +6,9 @@
#define MEDIA_GPU_TEST_VIDEO_PLAYER_DECODER_LISTENER_H_
#include <limits.h>
+
#include <memory>
+#include <optional>
#include <utility>
#include "base/containers/queue.h"
@@ -18,7 +20,6 @@
#include "base/thread_annotations.h"
#include "base/time/time.h"
#include "media/gpu/test/video_frame_helpers.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace test {
@@ -130,7 +131,7 @@
Event::kNumEvents)] GUARDED_BY(event_lock_){};
// Set by PlayUntil() to automatically pause decoding once this event occurs.
- absl::optional<Event> play_until_;
+ std::optional<Event> play_until_;
SEQUENCE_CHECKER(sequence_checker_);
};
diff --git a/media/gpu/test/video_player/decoder_wrapper.cc b/media/gpu/test/video_player/decoder_wrapper.cc
index 8ca9c96..d81a567 100644
--- a/media/gpu/test/video_player/decoder_wrapper.cc
+++ b/media/gpu/test/video_player/decoder_wrapper.cc
@@ -40,7 +40,7 @@
// This helper thunk wraps a WeakPtr into an 'Optional' value, so the WeakPtr is
// only dereferenced after rescheduling the task on the specified task runner.
template <typename F, typename... Args>
-void CallbackThunk(absl::optional<base::WeakPtr<DecoderWrapper>> decoder_client,
+void CallbackThunk(std::optional<base::WeakPtr<DecoderWrapper>> decoder_client,
scoped_refptr<base::SequencedTaskRunner> task_runner,
F f,
Args... args) {
diff --git a/media/gpu/test/video_player/frame_renderer_dummy.cc b/media/gpu/test/video_player/frame_renderer_dummy.cc
index 351e8dc..39b77cd 100644
--- a/media/gpu/test/video_player/frame_renderer_dummy.cc
+++ b/media/gpu/test/video_player/frame_renderer_dummy.cc
@@ -127,7 +127,7 @@
// Create a dummy video frame. No actual rendering will be done but the video
// frame's properties such as timestamp will be used.
// TODO(dstaessens): Remove this function when allocate mode is deprecated.
- absl::optional<VideoFrameLayout> layout =
+ std::optional<VideoFrameLayout> layout =
CreateVideoFrameLayout(pixel_format, size);
DCHECK(layout);
return VideoFrame::CreateFrameWithLayout(*layout, gfx::Rect(size), size,
diff --git a/media/gpu/test/video_player/test_vda_video_decoder.cc b/media/gpu/test/video_player/test_vda_video_decoder.cc
index 3ce9d28..22700fda 100644
--- a/media/gpu/test/video_player/test_vda_video_decoder.cc
+++ b/media/gpu/test/video_player/test_vda_video_decoder.cc
@@ -329,7 +329,7 @@
// static
void TestVDAVideoDecoder::ReusePictureBufferThunk(
- absl::optional<base::WeakPtr<TestVDAVideoDecoder>> vda_video_decoder,
+ std::optional<base::WeakPtr<TestVDAVideoDecoder>> vda_video_decoder,
scoped_refptr<base::SequencedTaskRunner> task_runner,
int32_t picture_buffer_id) {
DCHECK(vda_video_decoder);
diff --git a/media/gpu/test/video_player/test_vda_video_decoder.h b/media/gpu/test/video_player/test_vda_video_decoder.h
index 4a89e09..da5077a 100644
--- a/media/gpu/test/video_player/test_vda_video_decoder.h
+++ b/media/gpu/test/video_player/test_vda_video_decoder.h
@@ -85,7 +85,7 @@
// Helper thunk to avoid dereferencing WeakPtrs on the wrong thread.
static void ReusePictureBufferThunk(
- absl::optional<base::WeakPtr<TestVDAVideoDecoder>> decoder_client,
+ std::optional<base::WeakPtr<TestVDAVideoDecoder>> decoder_client,
scoped_refptr<base::SequencedTaskRunner> task_runner,
int32_t picture_buffer_id);
diff --git a/media/gpu/test/video_test_helpers.cc b/media/gpu/test/video_test_helpers.cc
index 6b5e1cc59..e49d2867 100644
--- a/media/gpu/test/video_test_helpers.cc
+++ b/media/gpu/test/video_test_helpers.cc
@@ -315,22 +315,21 @@
return buffer;
}
-absl::optional<IvfFrameHeader> EncodedDataHelper::GetNextIvfFrameHeader()
- const {
+std::optional<IvfFrameHeader> EncodedDataHelper::GetNextIvfFrameHeader() const {
const size_t pos = next_pos_to_decode_;
// Read VP8/9 frame size from IVF header.
if (pos + kIvfFrameHeaderSize > data_.size()) {
LOG(ERROR) << "Unexpected data encountered while parsing IVF frame header";
- return absl::nullopt;
+ return std::nullopt;
}
return GetIvfFrameHeader(base::span<const uint8_t>(
reinterpret_cast<const uint8_t*>(&data_[pos]), kIvfFrameHeaderSize));
}
-absl::optional<IvfFrame> EncodedDataHelper::ReadNextIvfFrame() {
+std::optional<IvfFrame> EncodedDataHelper::ReadNextIvfFrame() {
auto frame_header = GetNextIvfFrameHeader();
if (!frame_header)
- return absl::nullopt;
+ return std::nullopt;
// Skip IVF frame header.
const size_t pos = next_pos_to_decode_ + kIvfFrameHeaderSize;
@@ -339,7 +338,7 @@
if (pos + frame_header->frame_size > data_.size()) {
LOG(ERROR) << "Unexpected data encountered while parsing IVF frame header";
next_pos_to_decode_ = data_.size();
- return absl::nullopt;
+ return std::nullopt;
}
// Update next_pos_to_decode_.
@@ -487,7 +486,7 @@
return nullptr;
}
- absl::optional<gfx::BufferFormat> buffer_format =
+ std::optional<gfx::BufferFormat> buffer_format =
VideoPixelFormatToGfxBufferFormat(layout_->format());
if (!buffer_format) {
LOG(ERROR) << "Unexpected format: " << layout_->format();
diff --git a/media/gpu/test/video_test_helpers.h b/media/gpu/test/video_test_helpers.h
index 988a802c..04414382 100644
--- a/media/gpu/test/video_test_helpers.h
+++ b/media/gpu/test/video_test_helpers.h
@@ -6,6 +6,7 @@
#define MEDIA_GPU_TEST_VIDEO_TEST_HELPERS_H_
#include <memory>
+#include <optional>
#include <string>
#include <vector>
@@ -25,7 +26,6 @@
#include "media/base/video_types.h"
#include "media/filters/ivf_parser.h"
#include "media/gpu/test/raw_video.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -125,8 +125,8 @@
scoped_refptr<DecoderBuffer> GetNextFragment();
// For VP8/9.
scoped_refptr<DecoderBuffer> GetNextFrame();
- absl::optional<IvfFrameHeader> GetNextIvfFrameHeader() const;
- absl::optional<IvfFrame> ReadNextIvfFrame();
+ std::optional<IvfFrameHeader> GetNextIvfFrameHeader() const;
+ std::optional<IvfFrame> ReadNextIvfFrame();
// Helpers for GetBytesForNextFragment above.
size_t GetBytesForNextNALU(size_t pos);
@@ -222,7 +222,7 @@
const VideoFrame::StorageType storage_type_;
// The layout of VideoFrames returned by GetNextFrame().
- absl::optional<VideoFrameLayout> layout_;
+ std::optional<VideoFrameLayout> layout_;
const gfx::Rect visible_rect_;
const gfx::Size natural_size_;
diff --git a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
index 544a67aa..4e2fdc7 100644
--- a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
+++ b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.cc
@@ -1436,7 +1436,7 @@
DCHECK_NE(decoder_state_, kUninitialized);
DVLOGF(3);
- while (absl::optional<struct v4l2_event> event = device_->DequeueEvent()) {
+ while (std::optional<struct v4l2_event> event = device_->DequeueEvent()) {
if (event->type == V4L2_EVENT_SOURCE_CHANGE) {
if (event->u.src_change.changes & V4L2_EVENT_SRC_CH_RESOLUTION) {
VLOGF(2) << "got resolution change event.";
diff --git a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.h b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.h
index c7ee850..b09dca3d 100644
--- a/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.h
+++ b/media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.h
@@ -43,10 +43,11 @@
#ifdef SUPPORT_MT21_PIXEL_FORMAT_SOFTWARE_DECOMPRESSION
#include "media/gpu/v4l2/mt21/mt21_decompressor.h"
#endif
+#include <optional>
+
#include "media/gpu/v4l2/v4l2_device.h"
#include "media/video/picture.h"
#include "media/video/video_decode_accelerator.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_fence_egl.h"
@@ -552,7 +553,7 @@
// thread manipulates them.
//
- absl::optional<V4L2WritableBufferRef> current_input_buffer_;
+ std::optional<V4L2WritableBufferRef> current_input_buffer_;
scoped_refptr<V4L2Queue> input_queue_;
scoped_refptr<V4L2Queue> output_queue_;
@@ -614,7 +615,7 @@
// Chosen input format for the video profile we are decoding from.
uint32_t input_format_fourcc_;
// Chosen output format.
- absl::optional<Fourcc> output_format_fourcc_;
+ std::optional<Fourcc> output_format_fourcc_;
// Image processor device, if one is in use.
scoped_refptr<V4L2Device> image_processor_device_;
@@ -626,7 +627,7 @@
#endif
// The format of EGLImage.
- absl::optional<Fourcc> egl_image_format_fourcc_;
+ std::optional<Fourcc> egl_image_format_fourcc_;
// The logical dimensions of EGLImage buffer in pixels.
gfx::Size egl_image_size_;
diff --git a/media/gpu/v4l2/stateless/device.cc b/media/gpu/v4l2/stateless/device.cc
index cbe44f9..860b05ef 100644
--- a/media/gpu/v4l2/stateless/device.cc
+++ b/media/gpu/v4l2/stateless/device.cc
@@ -178,11 +178,11 @@
return VideoCodec::kUnknown;
}
-absl::optional<BufferFormat> V4L2FormatToBufferFormat(
+std::optional<BufferFormat> V4L2FormatToBufferFormat(
const struct v4l2_format& format) {
const auto fourcc = Fourcc::FromV4L2PixFmt(format.fmt.pix_mp.pixelformat);
if (!fourcc) {
- return absl::nullopt;
+ return std::nullopt;
}
const gfx::Size resolution =
@@ -321,20 +321,20 @@
}
// VIDIOC_G_FMT
-absl::optional<BufferFormat> Device::GetOutputFormat() {
+std::optional<BufferFormat> Device::GetOutputFormat() {
DVLOGF(4);
struct v4l2_format format;
memset(&format, 0, sizeof(format));
format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
if (IoctlDevice(VIDIOC_G_FMT, &format) != kIoctlOk) {
- return absl::nullopt;
+ return std::nullopt;
}
return V4L2FormatToBufferFormat(format);
}
-absl::optional<BufferFormat> Device::TrySetOutputFormat(
+std::optional<BufferFormat> Device::TrySetOutputFormat(
int request,
const BufferFormat& format) {
DVLOGF(4);
@@ -343,24 +343,24 @@
BufferFormatToV4L2Format(v_format, format);
if (IoctlDevice(request, &v_format) != kIoctlOk) {
- return absl::nullopt;
+ return std::nullopt;
}
if (format.fourcc.ToV4L2PixFmt() != v_format.fmt.pix_mp.pixelformat) {
DVLOGF(1) << "Format tried is not the format returned.";
- return absl::nullopt;
+ return std::nullopt;
}
return V4L2FormatToBufferFormat(v_format);
}
-absl::optional<BufferFormat> Device::TryOutputFormat(
+std::optional<BufferFormat> Device::TryOutputFormat(
const BufferFormat& format) {
DVLOGF(4);
return TrySetOutputFormat(VIDIOC_TRY_FMT, format);
}
-absl::optional<BufferFormat> Device::SetOutputFormat(
+std::optional<BufferFormat> Device::SetOutputFormat(
const BufferFormat& format) {
DVLOGF(4);
return TrySetOutputFormat(VIDIOC_S_FMT, format);
@@ -441,9 +441,9 @@
}
// VIDIOC_REQBUFS
-absl::optional<uint32_t> Device::RequestBuffers(BufferType type,
- MemoryType memory,
- uint32_t count) {
+std::optional<uint32_t> Device::RequestBuffers(BufferType type,
+ MemoryType memory,
+ uint32_t count) {
DVLOGF(4);
struct v4l2_requestbuffers reqbufs;
memset(&reqbufs, 0, sizeof(reqbufs));
@@ -456,17 +456,17 @@
if (ret) {
DVLOGF(1) << "Failed to allocate " << count
<< " input buffers with VIDIOC_REQBUFS: " << ret;
- return absl::nullopt;
+ return std::nullopt;
}
return reqbufs.count;
}
// VIDIOC_QUERYBUF
-absl::optional<Buffer> Device::QueryBuffer(BufferType buffer_type,
- MemoryType memory_type,
- uint32_t index,
- uint32_t num_planes) {
+std::optional<Buffer> Device::QueryBuffer(BufferType buffer_type,
+ MemoryType memory_type,
+ uint32_t index,
+ uint32_t num_planes) {
struct v4l2_buffer v4l2_buffer;
struct v4l2_plane v4l2_planes[VIDEO_MAX_PLANES];
memset(&v4l2_buffer, 0, sizeof(v4l2_buffer));
@@ -481,7 +481,7 @@
const int ret = IoctlDevice(VIDIOC_QUERYBUF, &v4l2_buffer);
if (ret) {
DVLOGF(1) << "VIDIOC_QUERYBUF failed: ";
- return absl::nullopt;
+ return std::nullopt;
}
return V4L2BufferToBuffer(v4l2_buffer);
@@ -512,9 +512,9 @@
}
// VIDIOC_DQBUF
-absl::optional<Buffer> Device::DequeueBuffer(BufferType buffer_type,
- MemoryType memory_type,
- uint32_t num_planes) {
+std::optional<Buffer> Device::DequeueBuffer(BufferType buffer_type,
+ MemoryType memory_type,
+ uint32_t num_planes) {
DVLOGF(4) << BufferTypeString(buffer_type);
struct v4l2_buffer v4l2_buffer;
struct v4l2_plane v4l2_planes[VIDEO_MAX_PLANES];
@@ -527,7 +527,7 @@
v4l2_buffer.memory = MemoryTypeToV4L2(memory_type);
if (IoctlDevice(VIDIOC_DQBUF, &v4l2_buffer) != kIoctlOk) {
- return absl::nullopt;
+ return std::nullopt;
}
return V4L2BufferToBuffer(v4l2_buffer);
diff --git a/media/gpu/v4l2/stateless/device.h b/media/gpu/v4l2/stateless/device.h
index 7aed872..8035af7 100644
--- a/media/gpu/v4l2/stateless/device.h
+++ b/media/gpu/v4l2/stateless/device.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_GPU_V4L2_STATELESS_DEVICE_H_
#define MEDIA_GPU_V4L2_STATELESS_DEVICE_H_
+#include <optional>
#include <set>
#include <string>
#include <utility>
@@ -16,7 +17,6 @@
#include "media/base/video_codecs.h"
#include "media/gpu/chromeos/fourcc.h"
#include "media/gpu/media_gpu_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
@@ -135,9 +135,9 @@
// the driver via |GetOutputFormat|. If the desired format does not match
// up with the retrieved format, |TryOutputFormat| and |SetOutputFormat| are
// used.
- absl::optional<BufferFormat> GetOutputFormat();
- absl::optional<BufferFormat> TryOutputFormat(const BufferFormat& format);
- absl::optional<BufferFormat> SetOutputFormat(const BufferFormat& format);
+ std::optional<BufferFormat> GetOutputFormat();
+ std::optional<BufferFormat> TryOutputFormat(const BufferFormat& format);
+ std::optional<BufferFormat> SetOutputFormat(const BufferFormat& format);
// Stops streaming on the |type| of buffer using the VIDIOC_STREAMOFF ioctl.
bool StreamOff(BufferType type);
@@ -148,15 +148,15 @@
// Request a |count| of buffers via the VIDIOC_REQBUFS ioctl. The driver
// will return a |uint32_t| with the number of buffers allocated. This
// number does not need to be the same as |count|.
- absl::optional<uint32_t> RequestBuffers(BufferType type,
- MemoryType memory,
- uint32_t count);
+ std::optional<uint32_t> RequestBuffers(BufferType type,
+ MemoryType memory,
+ uint32_t count);
// Uses the VIDIOC_QUERYBUF ioctl to fill out and return a |Buffer|.
- absl::optional<Buffer> QueryBuffer(BufferType type,
- MemoryType memory,
- uint32_t index,
- uint32_t num_planes);
+ std::optional<Buffer> QueryBuffer(BufferType type,
+ MemoryType memory,
+ uint32_t index,
+ uint32_t num_planes);
// Wrap the buffer that was allocated from the driver so that it can be
// passed on to other consumers.
@@ -167,9 +167,9 @@
bool QueueBuffer(const Buffer& buffer, const base::ScopedFD& request_fd);
// Used during frame processing on a per frame basis.
- absl::optional<Buffer> DequeueBuffer(BufferType buffer_type,
- MemoryType memory_type,
- uint32_t num_planes);
+ std::optional<Buffer> DequeueBuffer(BufferType buffer_type,
+ MemoryType memory_type,
+ uint32_t num_planes);
// Query the driver for the smallest and largest uncompressed frame sizes that
// are supported using the VIDIOC_ENUM_FRAMESIZES ioctl.
@@ -203,8 +203,8 @@
// |TryOutputFormat| and |SetOutputFormat| are identical calls, with the
// difference being that |TryOutputFormat| does not change the state of the
// driver while |SetOutputFormat| does.
- absl::optional<BufferFormat> TrySetOutputFormat(int request,
- const BufferFormat& format);
+ std::optional<BufferFormat> TrySetOutputFormat(int request,
+ const BufferFormat& format);
protected:
virtual ~Device();
diff --git a/media/gpu/v4l2/stateless/queue.cc b/media/gpu/v4l2/stateless/queue.cc
index d8c43b8..cfbe516 100644
--- a/media/gpu/v4l2/stateless/queue.cc
+++ b/media/gpu/v4l2/stateless/queue.cc
@@ -97,13 +97,13 @@
return device_->StreamOff(buffer_type_);
}
-absl::optional<uint32_t> BaseQueue::GetFreeBufferIndex() {
+std::optional<uint32_t> BaseQueue::GetFreeBufferIndex() {
// TODO(frkoenig): This is an expected error, there will be times that all of
// the buffers will be in the queue. For now give it a high severity for
// visibility.
if (free_buffer_indices_.empty()) {
DVLOGF(1) << "No buffers available for " << Description();
- return absl::nullopt;
+ return std::nullopt;
}
auto it = free_buffer_indices_.begin();
diff --git a/media/gpu/v4l2/stateless/queue.h b/media/gpu/v4l2/stateless/queue.h
index e55cd93..7b71dcd 100644
--- a/media/gpu/v4l2/stateless/queue.h
+++ b/media/gpu/v4l2/stateless/queue.h
@@ -41,7 +41,7 @@
bool AllocateBuffers(uint32_t num_planes, size_t num_buffers);
virtual std::string Description() = 0;
void ReturnBuffer(uint32_t index);
- absl::optional<uint32_t> GetFreeBufferIndex();
+ std::optional<uint32_t> GetFreeBufferIndex();
scoped_refptr<StatelessDevice> device_;
const BufferType buffer_type_;
diff --git a/media/gpu/v4l2/stateless/v4l2_stateless_video_decoder.cc b/media/gpu/v4l2/stateless/v4l2_stateless_video_decoder.cc
index b9fc8ae..4f49c9c3 100644
--- a/media/gpu/v4l2/stateless/v4l2_stateless_video_decoder.cc
+++ b/media/gpu/v4l2/stateless/v4l2_stateless_video_decoder.cc
@@ -104,20 +104,20 @@
}
// static
-absl::optional<SupportedVideoDecoderConfigs>
+std::optional<SupportedVideoDecoderConfigs>
V4L2StatelessVideoDecoder::GetSupportedConfigs() {
const scoped_refptr<StatelessDevice> device =
base::MakeRefCounted<StatelessDevice>();
if (device->Open()) {
const auto configs = GetSupportedDecodeProfiles(device.get());
if (configs.empty()) {
- return absl::nullopt;
+ return std::nullopt;
}
return ConvertFromSupportedProfiles(configs, false);
}
- return absl::nullopt;
+ return std::nullopt;
}
void V4L2StatelessVideoDecoder::Initialize(const VideoDecoderConfig& config,
@@ -221,7 +221,7 @@
if (current_decode_request_) {
std::move(current_decode_request_->decode_cb)
.Run(DecoderStatus::Codes::kAborted);
- current_decode_request_ = absl::nullopt;
+ current_decode_request_ = std::nullopt;
}
// Then clear out all of the ones that are queued up.
@@ -543,9 +543,9 @@
CroStatus::Or<ImageProcessor::PixelLayoutCandidate> status_or_output_format =
client_->PickDecoderOutputFormat(
candidates, visible_rect, aspect_ratio_.GetNaturalSize(visible_rect),
- /*output_size=*/absl::nullopt, num_codec_reference_frames,
+ /*output_size=*/std::nullopt, num_codec_reference_frames,
/*use_protected=*/false, /*need_aux_frame_pool=*/false,
- /*allocator=*/absl::nullopt);
+ /*allocator=*/std::nullopt);
if (!status_or_output_format.has_value()) {
return false;
}
@@ -681,7 +681,7 @@
// until they are dequeued.
if (last_frame_id_generated_ != last_frame_id_dequeued_) {
flush_cb_ = std::move(current_decode_request_->decode_cb);
- current_decode_request_ = absl::nullopt;
+ current_decode_request_ = std::nullopt;
done = true;
}
} else {
@@ -716,7 +716,7 @@
base::SequencedTaskRunner::GetCurrentDefault()->PostTask(
FROM_HERE, base::BindOnce(std::move(current_decode_request_->decode_cb),
decode_status));
- current_decode_request_ = absl::nullopt;
+ current_decode_request_ = std::nullopt;
}
}
diff --git a/media/gpu/v4l2/stateless/v4l2_stateless_video_decoder.h b/media/gpu/v4l2/stateless/v4l2_stateless_video_decoder.h
index a374fbd..edb175e 100644
--- a/media/gpu/v4l2/stateless/v4l2_stateless_video_decoder.h
+++ b/media/gpu/v4l2/stateless/v4l2_stateless_video_decoder.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_GPU_V4L2_STATELESS_V4L2_STATELESS_VIDEO_DECODER_H_
#define MEDIA_GPU_V4L2_STATELESS_V4L2_STATELESS_VIDEO_DECODER_H_
+#include <optional>
#include <queue>
#include <vector>
@@ -24,7 +25,6 @@
#include "media/gpu/v4l2/stateless/queue.h"
#include "media/gpu/v4l2/stateless/stateless_decode_surface_handler.h"
#include "media/gpu/v4l2/stateless/stateless_device.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -41,7 +41,7 @@
scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
base::WeakPtr<VideoDecoderMixin::Client> client);
- static absl::optional<SupportedVideoDecoderConfigs> GetSupportedConfigs();
+ static std::optional<SupportedVideoDecoderConfigs> GetSupportedConfigs();
// VideoDecoderMixin implementation, VideoDecoder part.
void Initialize(const VideoDecoderConfig& config,
@@ -193,7 +193,7 @@
std::queue<DecodeRequest> decode_request_queue_;
// The decode request decode loop needs to keep this alive.
- absl::optional<DecodeRequest> current_decode_request_;
+ std::optional<DecodeRequest> current_decode_request_;
base::CancelableTaskTracker cancelable_output_queue_tracker_;
base::CancelableTaskTracker cancelable_input_queue_tracker_;
diff --git a/media/gpu/v4l2/test/av1_decoder.cc b/media/gpu/v4l2/test/av1_decoder.cc
index 457908b7..b1f19e8c5 100644
--- a/media/gpu/v4l2/test/av1_decoder.cc
+++ b/media/gpu/v4l2/test/av1_decoder.cc
@@ -93,7 +93,7 @@
// https://aomediacodec.github.io/av1-spec/av1-spec.pdf
void FillSequenceParams(
struct v4l2_ctrl_av1_sequence* v4l2_seq_params,
- const absl::optional<libgav1::ObuSequenceHeader>& seq_header) {
+ const std::optional<libgav1::ObuSequenceHeader>& seq_header) {
conditionally_set_u32_flags(&v4l2_seq_params->flags,
seq_header->still_picture,
V4L2_AV1_SEQUENCE_FLAG_STILL_PICTURE);
@@ -233,7 +233,7 @@
// Section 5.9.17. Quantizer index delta parameters syntax
void FillQuantizerIndexDeltaParams(
struct v4l2_av1_quantization* v4l2_quant,
- const absl::optional<libgav1::ObuSequenceHeader>& seq_header,
+ const std::optional<libgav1::ObuSequenceHeader>& seq_header,
const libgav1::ObuFrameHeader& frm_header) {
// |diff_uv_delta| in the spec doesn't exist in libgav1,
// because libgav1 infers it using the following logic.
@@ -633,7 +633,7 @@
// 5.9.2. Uncompressed header syntax
void Av1Decoder::SetupFrameParams(
struct v4l2_ctrl_av1_frame* v4l2_frame_params,
- const absl::optional<libgav1::ObuSequenceHeader>& seq_header,
+ const std::optional<libgav1::ObuSequenceHeader>& seq_header,
const libgav1::ObuFrameHeader& frm_header) {
FillLoopFilterParams(&v4l2_frame_params->loop_filter, frm_header.loop_filter);
diff --git a/media/gpu/v4l2/test/av1_decoder.h b/media/gpu/v4l2/test/av1_decoder.h
index 7b9309e..965c871 100644
--- a/media/gpu/v4l2/test/av1_decoder.h
+++ b/media/gpu/v4l2/test/av1_decoder.h
@@ -12,10 +12,11 @@
#include "base/files/memory_mapped_file.h"
#include "media/filters/ivf_parser.h"
#include "media/gpu/v4l2/test/v4l2_ioctl_shim.h"
-// For libgav1::ObuSequenceHeader. absl::optional demands ObuSequenceHeader to
+// For libgav1::ObuSequenceHeader. std::optional demands ObuSequenceHeader to
// fulfill std::is_trivially_constructible if it is forward-declared. But
// ObuSequenceHeader doesn't.
-#include "third_party/abseil-cpp/absl/types/optional.h"
+#include <optional>
+
#include "third_party/libgav1/src/src/obu_parser.h"
struct v4l2_ctrl_av1_frame;
@@ -74,7 +75,7 @@
// with VIDIOC_S_EXT_CTRLS ioctl call.
void SetupFrameParams(
struct v4l2_ctrl_av1_frame* v4l2_frame_params,
- const absl::optional<libgav1::ObuSequenceHeader>& seq_header,
+ const std::optional<libgav1::ObuSequenceHeader>& seq_header,
const libgav1::ObuFrameHeader& frm_header);
// Refreshes |ref_frames_| slots with the current |buffer| and refreshes
@@ -113,7 +114,7 @@
std::unique_ptr<libgav1::ObuParser> obu_parser_;
std::unique_ptr<libgav1::BufferPool> buffer_pool_;
std::unique_ptr<libgav1::DecoderState> state_;
- absl::optional<libgav1::ObuSequenceHeader> current_sequence_header_;
+ std::optional<libgav1::ObuSequenceHeader> current_sequence_header_;
};
} // namespace v4l2_test
diff --git a/media/gpu/v4l2/test/h264_decoder.cc b/media/gpu/v4l2/test/h264_decoder.cc
index 6115b6d..477d9a00 100644
--- a/media/gpu/v4l2/test/h264_decoder.cc
+++ b/media/gpu/v4l2/test/h264_decoder.cc
@@ -909,7 +909,7 @@
const H264SPS* sps = parser->GetSPS(sps_id);
CHECK(sps);
- absl::optional<gfx::Size> coded_size = sps->GetCodedSize();
+ std::optional<gfx::Size> coded_size = sps->GetCodedSize();
CHECK(coded_size);
auto v4l2_ioctl = std::make_unique<V4L2IoctlShim>(kDriverCodecFourcc);
diff --git a/media/gpu/v4l2/test/h265_decoder.cc b/media/gpu/v4l2/test/h265_decoder.cc
index 292d362..bd31145 100644
--- a/media/gpu/v4l2/test/h265_decoder.cc
+++ b/media/gpu/v4l2/test/h265_decoder.cc
@@ -477,7 +477,7 @@
const H265SPS* sps = parser->GetSPS(sps_id);
CHECK(sps);
- absl::optional<gfx::Size> coded_size = sps->GetCodedSize();
+ std::optional<gfx::Size> coded_size = sps->GetCodedSize();
CHECK(coded_size);
LOG(INFO) << "H.265 coded size : " << coded_size->ToString();
diff --git a/media/gpu/v4l2/test/v4l2_unittest.cc b/media/gpu/v4l2/test/v4l2_unittest.cc
index e3e6161..f0a1316 100644
--- a/media/gpu/v4l2/test/v4l2_unittest.cc
+++ b/media/gpu/v4l2/test/v4l2_unittest.cc
@@ -88,7 +88,7 @@
scoped_refptr<V4L2Queue> OUTPUT_queue =
device->GetQueue(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
ASSERT_NE(OUTPUT_queue.get(), nullptr);
- const absl::optional<struct v4l2_format> input_v4l2_format =
+ const std::optional<struct v4l2_format> input_v4l2_format =
OUTPUT_queue->SetFormat(codec_fourcc, gfx::Size(), /*buffer_size=*/1E6);
ASSERT_TRUE(input_v4l2_format.has_value());
@@ -105,7 +105,7 @@
scoped_refptr<V4L2Queue> CAPTURE_queue =
device->GetQueue(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
ASSERT_NE(CAPTURE_queue.get(), nullptr);
- absl::optional<struct v4l2_format> output_v4l2_format =
+ std::optional<struct v4l2_format> output_v4l2_format =
CAPTURE_queue->SetFormat(chosen_v4l2_pixel_format, resolution,
/*buffer_size=*/0);
ASSERT_TRUE(output_v4l2_format.has_value());
diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc
index e6eb905..295c64f 100644
--- a/media/gpu/v4l2/v4l2_device.cc
+++ b/media/gpu/v4l2/v4l2_device.cc
@@ -707,7 +707,7 @@
device_poller_->SchedulePoll();
}
-absl::optional<struct v4l2_event> V4L2Device::DequeueEvent() {
+std::optional<struct v4l2_event> V4L2Device::DequeueEvent() {
DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
struct v4l2_event event;
memset(&event, 0, sizeof(event));
@@ -716,7 +716,7 @@
// The ioctl will fail if there are no pending events. This is part of the
// normal flow, so keep this log level low.
VPLOGF(4) << "Failed to dequeue event";
- return absl::nullopt;
+ return std::nullopt;
}
return event;
@@ -851,7 +851,7 @@
return result == 0;
}
-absl::optional<struct v4l2_ext_control> V4L2Device::GetCtrl(uint32_t ctrl_id) {
+std::optional<struct v4l2_ext_control> V4L2Device::GetCtrl(uint32_t ctrl_id) {
DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
struct v4l2_ext_control ctrl;
memset(&ctrl, 0, sizeof(ctrl));
@@ -864,7 +864,7 @@
if (Ioctl(VIDIOC_G_EXT_CTRLS, &ext_ctrls) != 0) {
VPLOGF(3) << "Failed to get control";
- return absl::nullopt;
+ return std::nullopt;
}
return ctrl;
diff --git a/media/gpu/v4l2/v4l2_device.h b/media/gpu/v4l2/v4l2_device.h
index 6c7c6d6..2a3a5c3 100644
--- a/media/gpu/v4l2/v4l2_device.h
+++ b/media/gpu/v4l2/v4l2_device.h
@@ -22,6 +22,8 @@
#endif
#include <linux/videodev2.h>
+#include <optional>
+
#include "base/containers/flat_map.h"
#include "base/containers/small_map.h"
#include "base/files/scoped_file.h"
@@ -39,7 +41,6 @@
#include "media/gpu/v4l2/v4l2_utils.h"
#include "media/video/video_decode_accelerator.h"
#include "media/video/video_encode_accelerator.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gl/gl_bindings.h"
@@ -208,7 +209,7 @@
void SchedulePoll();
// Attempt to dequeue a V4L2 event and return it.
- absl::optional<struct v4l2_event> DequeueEvent();
+ std::optional<struct v4l2_event> DequeueEvent();
// Returns requests queue to get free requests. A null pointer is returned if
// the queue creation failed or if requests are not supported.
@@ -223,9 +224,9 @@
std::vector<V4L2ExtCtrl> ctrls,
V4L2RequestRef* request_ref = nullptr);
- // Get the value of a single control, or absl::nullopt of the control is not
+ // Get the value of a single control, or std::nullopt of the control is not
// exposed by the device.
- absl::optional<struct v4l2_ext_control> GetCtrl(uint32_t ctrl_id);
+ std::optional<struct v4l2_ext_control> GetCtrl(uint32_t ctrl_id);
// Set periodic keyframe placement (group of pictures length)
bool SetGOPLength(uint32_t gop_length);
diff --git a/media/gpu/v4l2/v4l2_image_processor_backend.cc b/media/gpu/v4l2/v4l2_image_processor_backend.cc
index 0a0766a..0291e5dd 100644
--- a/media/gpu/v4l2/v4l2_image_processor_backend.cc
+++ b/media/gpu/v4l2/v4l2_image_processor_backend.cc
@@ -35,12 +35,12 @@
namespace {
-absl::optional<gfx::GpuMemoryBufferHandle> CreateHandle(
+std::optional<gfx::GpuMemoryBufferHandle> CreateHandle(
const VideoFrame* frame) {
gfx::GpuMemoryBufferHandle handle = CreateGpuMemoryBufferHandle(frame);
if (handle.is_null() || handle.type != gfx::NATIVE_PIXMAP)
- return absl::nullopt;
+ return std::nullopt;
return handle;
}
@@ -566,7 +566,7 @@
}
// We need one input and one output buffer to schedule the job
- absl::optional<V4L2WritableBufferRef> input_buffer;
+ std::optional<V4L2WritableBufferRef> input_buffer;
// If we are using DMABUF frames, try to always obtain the same V4L2 buffer.
if (input_memory_type_ == V4L2_MEMORY_DMABUF) {
const VideoFrame& input_frame =
@@ -577,7 +577,7 @@
if (!input_buffer)
input_buffer = input_queue_->GetFreeBuffer();
- absl::optional<V4L2WritableBufferRef> output_buffer;
+ std::optional<V4L2WritableBufferRef> output_buffer;
// If we are using DMABUF frames, try to always obtain the same V4L2 buffer.
if (output_memory_type_ == V4L2_MEMORY_DMABUF) {
const VideoFrame& output_frame =
@@ -762,7 +762,7 @@
// static
void V4L2ImageProcessorBackend::V4L2VFRecycleThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
- absl::optional<base::WeakPtr<V4L2ImageProcessorBackend>> image_processor,
+ std::optional<base::WeakPtr<V4L2ImageProcessorBackend>> image_processor,
V4L2ReadableBufferRef buf) {
DVLOGF(4);
DCHECK(image_processor);
diff --git a/media/gpu/v4l2/v4l2_image_processor_backend.h b/media/gpu/v4l2/v4l2_image_processor_backend.h
index 75a6813c..304b86b 100644
--- a/media/gpu/v4l2/v4l2_image_processor_backend.h
+++ b/media/gpu/v4l2/v4l2_image_processor_backend.h
@@ -5,14 +5,14 @@
#ifndef MEDIA_GPU_V4L2_V4L2_IMAGE_PROCESSOR_BACKEND_H_
#define MEDIA_GPU_V4L2_V4L2_IMAGE_PROCESSOR_BACKEND_H_
+#include <linux/videodev2.h>
#include <stddef.h>
#include <stdint.h>
#include <memory>
+#include <optional>
#include <vector>
-#include <linux/videodev2.h>
-
#include "base/containers/queue.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
@@ -22,7 +22,6 @@
#include "media/gpu/chromeos/image_processor_backend.h"
#include "media/gpu/media_gpu_export.h"
#include "media/gpu/v4l2/v4l2_device.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace base {
@@ -110,7 +109,7 @@
size_t output_buffer_id;
// This is filled only if chrome tracing in "media" category is enabled.
- absl::optional<base::TimeTicks> start_time;
+ std::optional<base::TimeTicks> start_time;
};
V4L2ImageProcessorBackend(scoped_refptr<V4L2Device> device,
@@ -141,7 +140,7 @@
// task to |device_task_runner_|.
static void V4L2VFRecycleThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
- absl::optional<base::WeakPtr<V4L2ImageProcessorBackend>> image_processor,
+ std::optional<base::WeakPtr<V4L2ImageProcessorBackend>> image_processor,
V4L2ReadableBufferRef buf);
void V4L2VFRecycleTask(V4L2ReadableBufferRef buf);
diff --git a/media/gpu/v4l2/v4l2_jpeg_encode_accelerator.h b/media/gpu/v4l2/v4l2_jpeg_encode_accelerator.h
index c7ef982b4..deff0f7 100644
--- a/media/gpu/v4l2/v4l2_jpeg_encode_accelerator.h
+++ b/media/gpu/v4l2/v4l2_jpeg_encode_accelerator.h
@@ -208,7 +208,7 @@
V4L2JpegEncodeAccelerator* parent_;
// Layout that represents the input data.
- absl::optional<VideoFrameLayout> device_input_layout_;
+ std::optional<VideoFrameLayout> device_input_layout_;
// The V4L2Device this class is operating upon.
scoped_refptr<V4L2Device> device_;
diff --git a/media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.cc b/media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.cc
index 0679314..d9eea52 100644
--- a/media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.cc
+++ b/media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.cc
@@ -795,7 +795,7 @@
bool V4L2MjpegDecodeAccelerator::DequeueSourceChangeEvent() {
DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_);
- if (absl::optional<struct v4l2_event> event = device_->DequeueEvent()) {
+ if (std::optional<struct v4l2_event> event = device_->DequeueEvent()) {
if (event->type == V4L2_EVENT_SOURCE_CHANGE) {
VLOGF(2) << ": got source change event: " << event->u.src_change.changes;
if (event->u.src_change.changes & V4L2_EVENT_SRC_CH_RESOLUTION) {
diff --git a/media/gpu/v4l2/v4l2_queue.cc b/media/gpu/v4l2/v4l2_queue.cc
index 32bf4e8..d6b2fba 100644
--- a/media/gpu/v4l2/v4l2_queue.cc
+++ b/media/gpu/v4l2/v4l2_queue.cc
@@ -383,9 +383,9 @@
// Note that it is illegal to return the same buffer twice.
void ReturnBuffer(size_t buffer_id);
// Get any of the buffers in the list. There is no order guarantee whatsoever.
- absl::optional<size_t> GetFreeBuffer();
+ std::optional<size_t> GetFreeBuffer();
// Get the buffer with specified index.
- absl::optional<size_t> GetFreeBuffer(size_t requested_buffer_id);
+ std::optional<size_t> GetFreeBuffer(size_t requested_buffer_id);
// Number of buffers currently in this list.
size_t size() const;
@@ -404,13 +404,13 @@
DCHECK(inserted.second);
}
-absl::optional<size_t> V4L2BuffersList::GetFreeBuffer() {
+std::optional<size_t> V4L2BuffersList::GetFreeBuffer() {
base::AutoLock auto_lock(lock_);
auto iter = free_buffers_.begin();
if (iter == free_buffers_.end()) {
DVLOGF(4) << "No free buffer available!";
- return absl::nullopt;
+ return std::nullopt;
}
size_t buffer_id = *iter;
@@ -419,13 +419,13 @@
return buffer_id;
}
-absl::optional<size_t> V4L2BuffersList::GetFreeBuffer(
+std::optional<size_t> V4L2BuffersList::GetFreeBuffer(
size_t requested_buffer_id) {
base::AutoLock auto_lock(lock_);
return (free_buffers_.erase(requested_buffer_id) > 0)
- ? absl::make_optional(requested_buffer_id)
- : absl::nullopt;
+ ? std::make_optional(requested_buffer_id)
+ : std::nullopt;
}
size_t V4L2BuffersList::size() const {
@@ -1087,37 +1087,37 @@
std::move(destroy_cb_).Run();
}
-absl::optional<struct v4l2_format> V4L2Queue::SetFormat(uint32_t fourcc,
- const gfx::Size& size,
- size_t buffer_size) {
+std::optional<struct v4l2_format> V4L2Queue::SetFormat(uint32_t fourcc,
+ const gfx::Size& size,
+ size_t buffer_size) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
struct v4l2_format format = BuildV4L2Format(type_, fourcc, size, buffer_size);
if (ioctl_cb_.Run(VIDIOC_S_FMT, &format) != 0 ||
format.fmt.pix_mp.pixelformat != fourcc) {
RecordVidiocIoctlErrorUMA(VidiocIoctlRequests::kVidiocSFmt);
VPQLOGF(2) << "Failed to set format fourcc: " << FourccToString(fourcc);
- return absl::nullopt;
+ return std::nullopt;
}
current_format_ = format;
return current_format_;
}
-absl::optional<struct v4l2_format> V4L2Queue::TryFormat(uint32_t fourcc,
- const gfx::Size& size,
- size_t buffer_size) {
+std::optional<struct v4l2_format> V4L2Queue::TryFormat(uint32_t fourcc,
+ const gfx::Size& size,
+ size_t buffer_size) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
struct v4l2_format format = BuildV4L2Format(type_, fourcc, size, buffer_size);
if (ioctl_cb_.Run(VIDIOC_TRY_FMT, &format) != 0 ||
format.fmt.pix_mp.pixelformat != fourcc) {
VPQLOGF(2) << "Failed to try format fourcc: " << FourccToString(fourcc);
- return absl::nullopt;
+ return std::nullopt;
}
return format;
}
-std::pair<absl::optional<struct v4l2_format>, int> V4L2Queue::GetFormat() {
+std::pair<std::optional<struct v4l2_format>, int> V4L2Queue::GetFormat() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
struct v4l2_format format;
memset(&format, 0, sizeof(format));
@@ -1125,13 +1125,13 @@
if (ioctl_cb_.Run(VIDIOC_G_FMT, &format) != 0) {
RecordVidiocIoctlErrorUMA(VidiocIoctlRequests::kVidiocGFmt);
VPQLOGF(2) << "Failed to get format";
- return std::make_pair(absl::nullopt, errno);
+ return std::make_pair(std::nullopt, errno);
}
return std::make_pair(format, 0);
}
-absl::optional<gfx::Rect> V4L2Queue::GetVisibleRect() {
+std::optional<gfx::Rect> V4L2Queue::GetVisibleRect() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
struct v4l2_selection selection = {.type = type_,
@@ -1139,7 +1139,7 @@
if (ioctl_cb_.Run(VIDIOC_G_SELECTION, &selection) != 0) {
RecordVidiocIoctlErrorUMA(VidiocIoctlRequests::kVidiocGSelection);
VQLOGF(1) << "Failed to get visible rect";
- return absl::nullopt;
+ return std::nullopt;
}
return V4L2RectToGfxRect(selection.r);
}
@@ -1172,7 +1172,7 @@
}
// First query the number of planes in the buffers we are about to request.
- absl::optional<v4l2_format> format = GetFormat().first;
+ std::optional<v4l2_format> format = GetFormat().first;
if (!format) {
VQLOGF(1) << "Cannot get format.";
return 0;
@@ -1334,17 +1334,17 @@
}
}
-absl::optional<V4L2WritableBufferRef> V4L2Queue::GetFreeBuffer() {
+std::optional<V4L2WritableBufferRef> V4L2Queue::GetFreeBuffer() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// No buffers allocated at the moment?
if (!free_buffers_) {
- return absl::nullopt;
+ return std::nullopt;
}
auto buffer_id = free_buffers_->GetFreeBuffer();
if (!buffer_id.has_value()) {
- return absl::nullopt;
+ return std::nullopt;
}
return V4L2BufferRefFactory::CreateWritableRef(
@@ -1352,18 +1352,18 @@
weak_this_factory_.GetWeakPtr());
}
-absl::optional<V4L2WritableBufferRef> V4L2Queue::GetFreeBuffer(
+std::optional<V4L2WritableBufferRef> V4L2Queue::GetFreeBuffer(
size_t requested_buffer_id) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// No buffers allocated at the moment?
if (!free_buffers_) {
- return absl::nullopt;
+ return std::nullopt;
}
auto buffer_id = free_buffers_->GetFreeBuffer(requested_buffer_id);
if (!buffer_id.has_value()) {
- return absl::nullopt;
+ return std::nullopt;
}
return V4L2BufferRefFactory::CreateWritableRef(
@@ -1371,30 +1371,30 @@
weak_this_factory_.GetWeakPtr());
}
-absl::optional<V4L2WritableBufferRef> V4L2Queue::GetFreeBufferForFrame(
+std::optional<V4L2WritableBufferRef> V4L2Queue::GetFreeBufferForFrame(
const gfx::GenericSharedMemoryId& id) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// No buffers allocated at the moment?
if (!free_buffers_) {
- return absl::nullopt;
+ return std::nullopt;
}
if (memory_ != V4L2_MEMORY_DMABUF) {
DVLOGF(1) << "Queue is not DMABUF";
- return absl::nullopt;
+ return std::nullopt;
}
if (!id.is_valid()) {
DVLOGF(1) << "Provided identifier was not valid";
- return absl::nullopt;
+ return std::nullopt;
}
// If |id| has already been used in |buffers_|, then return that buffer.
// Otherwise use the next buffer from |free_buffers_indexes_|.
if (!base::Contains(free_buffers_indexes_, id)) {
if (free_buffers_indexes_.size() >= buffers_.size()) {
- return absl::nullopt;
+ return std::nullopt;
}
// The value for |id| is simply the map size(): a poor man's way to have a
// monotonically increasing counter.
@@ -1576,7 +1576,7 @@
return supports_requests_;
}
-absl::optional<struct v4l2_format> V4L2Queue::SetModifierFormat(
+std::optional<struct v4l2_format> V4L2Queue::SetModifierFormat(
uint64_t modifier,
const gfx::Size& size) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@@ -1588,7 +1588,7 @@
}
return format;
}
- return absl::nullopt;
+ return std::nullopt;
}
bool V4L2Queue::SendStopCommand() {
@@ -1828,14 +1828,14 @@
return request_->ApplyQueueBuffer(buffer);
}
-absl::optional<V4L2SubmittedRequestRef> V4L2RequestRef::Submit() && {
+std::optional<V4L2SubmittedRequestRef> V4L2RequestRef::Submit() && {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK_NE(request_, nullptr);
V4L2RequestRef self(std::move(*this));
if (!self.request_->Submit()) {
- return absl::nullopt;
+ return std::nullopt;
}
return V4L2SubmittedRequestRef(self.request_);
@@ -1861,7 +1861,7 @@
media_fd_.reset();
}
-absl::optional<base::ScopedFD> V4L2RequestsQueue::CreateRequestFD() {
+std::optional<base::ScopedFD> V4L2RequestsQueue::CreateRequestFD() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
int request_fd;
@@ -1870,13 +1870,13 @@
if (ret < 0) {
RecordMediaIoctlUMA(MediaIoctlRequests::kMediaIocRequestAlloc);
VPLOGF(1) << "Failed to create request";
- return absl::nullopt;
+ return std::nullopt;
}
return base::ScopedFD(request_fd);
}
-absl::optional<V4L2RequestRef> V4L2RequestsQueue::GetFreeRequest() {
+std::optional<V4L2RequestRef> V4L2RequestsQueue::GetFreeRequest() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
V4L2Request* request_ptr =
@@ -1889,7 +1889,7 @@
auto request_fd = CreateRequestFD();
if (!request_fd.has_value()) {
VLOGF(1) << "Error while creating a new request FD!";
- return absl::nullopt;
+ return std::nullopt;
}
// Not using std::make_unique because constructor is private.
std::unique_ptr<V4L2Request> request(
@@ -1904,7 +1904,7 @@
<< "request is blocking.";
if (!request_ptr->WaitForCompletion()) {
VLOG(1) << "Timeout while waiting for request to complete.";
- return absl::nullopt;
+ return std::nullopt;
}
free_requests_.pop();
}
@@ -1912,7 +1912,7 @@
DCHECK(request_ptr);
if (!request_ptr->Reset()) {
VPLOGF(1) << "Failed to reset request";
- return absl::nullopt;
+ return std::nullopt;
}
return V4L2RequestRef(request_ptr);
diff --git a/media/gpu/v4l2/v4l2_queue.h b/media/gpu/v4l2/v4l2_queue.h
index 0f71fa2b..b54aec9 100644
--- a/media/gpu/v4l2/v4l2_queue.h
+++ b/media/gpu/v4l2/v4l2_queue.h
@@ -5,14 +5,14 @@
#ifndef MEDIA_GPU_V4L2_V4L2_QUEUE_H_
#define MEDIA_GPU_V4L2_V4L2_QUEUE_H_
+#include <linux/videodev2.h>
#include <stddef.h>
#include <stdint.h>
+#include <optional>
#include <queue>
#include <vector>
-#include <linux/videodev2.h>
-
#include "base/containers/small_map.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
@@ -25,7 +25,6 @@
#include "media/gpu/chromeos/fourcc.h"
#include "media/gpu/media_gpu_export.h"
#include "media/gpu/v4l2/v4l2_utils.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/generic_shared_memory_id.h"
#include "ui/gfx/geometry/size.h"
@@ -301,7 +300,7 @@
// Apply buffer to the request.
[[nodiscard]] bool ApplyQueueBuffer(struct v4l2_buffer* buffer) const;
// Submits the request to the driver.
- absl::optional<V4L2SubmittedRequestRef> Submit() &&;
+ std::optional<V4L2SubmittedRequestRef> Submit() &&;
private:
friend class V4L2RequestsQueue;
@@ -349,7 +348,7 @@
// Gets a free request. If no request is available, a non-valid request
// reference will be returned.
- absl::optional<V4L2RequestRef> GetFreeRequest();
+ std::optional<V4L2RequestRef> GetFreeRequest();
private:
// File descriptor of the media device (/dev/mediaX) from which requests
@@ -361,7 +360,7 @@
std::queue<V4L2Request*> free_requests_;
// Returns a new request file descriptor.
- absl::optional<base::ScopedFD> CreateRequestFD();
+ std::optional<base::ScopedFD> CreateRequestFD();
friend class V4L2Request;
// Returns a request to the queue after being used.
@@ -407,21 +406,21 @@
// format is returned. It is guaranteed to feature the specified |fourcc|,
// but any other parameter (including |size| and |buffer_size| may have been
// adjusted by the driver, so the caller must check their values.
- [[nodiscard]] absl::optional<struct v4l2_format>
+ [[nodiscard]] std::optional<struct v4l2_format>
SetFormat(uint32_t fourcc, const gfx::Size& size, size_t buffer_size);
// Identical to |SetFormat|, but does not actually apply the format, and can
// be called anytime.
// Returns an adjusted V4L2 format if |fourcc| is supported by the queue, or
// |nullopt| if |fourcc| is not supported or an ioctl error happened.
- [[nodiscard]] absl::optional<struct v4l2_format>
+ [[nodiscard]] std::optional<struct v4l2_format>
TryFormat(uint32_t fourcc, const gfx::Size& size, size_t buffer_size);
// Returns the currently set format on the queue. The result is returned as
- // a std::pair where the first member is the format, or absl::nullopt if the
+ // a std::pair where the first member is the format, or std::nullopt if the
// format could not be obtained due to an ioctl error. The second member is
// only used in case of an error and contains the |errno| set by the failing
- // ioctl. If the first member is not absl::nullopt, the second member will
+ // ioctl. If the first member is not std::nullopt, the second member will
// always be zero.
//
// If the second member is 0, then the first member is guaranteed to have
@@ -431,11 +430,11 @@
// This pair is used because not all failures to get the format are
// necessarily errors, so we need to way to let the use decide whether it
// is one or not.
- [[nodiscard]] std::pair<absl::optional<struct v4l2_format>, int> GetFormat();
+ [[nodiscard]] std::pair<std::optional<struct v4l2_format>, int> GetFormat();
// Codec-specific method to get the visible rectangle of the queue, using the
// VIDIOC_G_SELECTION ioctl if available, or VIDIOC_G_CROP as a fallback.
- [[nodiscard]] absl::optional<gfx::Rect> GetVisibleRect();
+ [[nodiscard]] std::optional<gfx::Rect> GetVisibleRect();
// Allocate |count| buffers for the current format of this queue, with a
// specific |memory| allocation, and returns the number of buffers allocated
@@ -480,13 +479,13 @@
//
// If the caller discards the returned reference, the underlying buffer is
// made available to clients again.
- [[nodiscard]] absl::optional<V4L2WritableBufferRef> GetFreeBuffer();
+ [[nodiscard]] std::optional<V4L2WritableBufferRef> GetFreeBuffer();
// Return the buffer at index |requested_buffer_id|, if it is available at
// this time.
//
// If the buffer is currently in use or the provided index is invalid,
- // return |absl::nullopt|.
- [[nodiscard]] absl::optional<V4L2WritableBufferRef> GetFreeBuffer(
+ // return |std::nullopt|.
+ [[nodiscard]] std::optional<V4L2WritableBufferRef> GetFreeBuffer(
size_t requested_buffer_id);
// Return a V4L2 buffer suitable for the passed VideoFrame.
//
@@ -503,7 +502,7 @@
// since it will maximize performance in that case provided the number of
// different VideoFrames passed to this method does not exceed the number of
// V4L2 buffers allocated on the queue.
- [[nodiscard]] absl::optional<V4L2WritableBufferRef> GetFreeBufferForFrame(
+ [[nodiscard]] std::optional<V4L2WritableBufferRef> GetFreeBufferForFrame(
const gfx::GenericSharedMemoryId& id);
// Attempt to dequeue a buffer, and return a reference to it if one was
@@ -546,7 +545,7 @@
// TODO (b/166275274) : Remove this once V4L2 properly supports modifiers.
// Out of band method to configure V4L2 for modifier use.
- [[nodiscard]] absl::optional<struct v4l2_format> SetModifierFormat(
+ [[nodiscard]] std::optional<struct v4l2_format> SetModifierFormat(
uint64_t modifier,
const gfx::Size& size);
@@ -580,7 +579,7 @@
bool supports_requests_ = false;
size_t planes_count_ = 0;
// Current format as set by SetFormat.
- absl::optional<struct v4l2_format> current_format_;
+ std::optional<struct v4l2_format> current_format_;
std::vector<std::unique_ptr<V4L2Buffer>> buffers_;
diff --git a/media/gpu/v4l2/v4l2_stateful_video_decoder.cc b/media/gpu/v4l2/v4l2_stateful_video_decoder.cc
index b417aa1..5309660 100644
--- a/media/gpu/v4l2/v4l2_stateful_video_decoder.cc
+++ b/media/gpu/v4l2/v4l2_stateful_video_decoder.cc
@@ -226,11 +226,11 @@
// Size in bytes of the NALU under analysis.
off_t nalu_size;
};
- // Parses |data| and returns either absl::nullopt, if parsing |data| fails, or
+ // Parses |data| and returns either std::nullopt, if parsing |data| fails, or
// a FrameBoundaryInfo describing the first |nalu_size| bytes of |data|.
//
// It is assumed that |data| contains an integer number of NALUs.
- absl::optional<struct FrameBoundaryInfo> FindH264FrameBoundary(
+ std::optional<struct FrameBoundaryInfo> FindH264FrameBoundary(
const uint8_t* const data,
size_t size);
@@ -256,7 +256,7 @@
}
// static
-absl::optional<SupportedVideoDecoderConfigs>
+std::optional<SupportedVideoDecoderConfigs>
V4L2StatefulVideoDecoder::GetSupportedConfigs() {
SupportedVideoDecoderConfigs supported_media_configs;
@@ -264,7 +264,7 @@
base::ScopedFD device_fd(HANDLE_EINTR(
open(kVideoDeviceDriverPath, O_RDWR | O_NONBLOCK | O_CLOEXEC)));
if (!device_fd.is_valid()) {
- return absl::nullopt;
+ return std::nullopt;
}
std::vector<uint32_t> v4l2_codecs = EnumerateSupportedPixFmts(
@@ -715,7 +715,7 @@
// size of the video, e.g. a 1080p sequence could have 1920x1080 "natural" or
// |visible_rect|, but |coded_size| of 1920x1088 because of codec block
// alignment of 16 samples.
- absl::optional<gfx::Rect> visible_rect = CAPTURE_queue_->GetVisibleRect();
+ std::optional<gfx::Rect> visible_rect = CAPTURE_queue_->GetVisibleRect();
if (!visible_rect) {
return false;
}
@@ -730,9 +730,9 @@
client_->PickDecoderOutputFormat(
candidates, *visible_rect,
aspect_ratio_.GetNaturalSize(*visible_rect),
- /*output_size=*/absl::nullopt, num_codec_reference_frames,
+ /*output_size=*/std::nullopt, num_codec_reference_frames,
/*use_protected=*/false, /*need_aux_frame_pool=*/false,
- /*allocator=*/absl::nullopt);
+ /*allocator=*/std::nullopt);
if (!status_or_output_format.has_value()) {
return false;
}
@@ -758,7 +758,7 @@
: VIDEO_MAX_FRAME;
if (!use_v4l2_allocated_buffers) {
- absl::optional<GpuBufferLayout> layout =
+ std::optional<GpuBufferLayout> layout =
client_->GetVideoFramePool()->GetGpuBufferLayout();
if (!layout.has_value()) {
return false;
@@ -1094,7 +1094,7 @@
return false;
}
- for (absl::optional<V4L2WritableBufferRef> v4l2_buffer =
+ for (std::optional<V4L2WritableBufferRef> v4l2_buffer =
OUTPUT_queue_->GetFreeBuffer();
v4l2_buffer && !decoder_buffer_and_callbacks_.empty();
v4l2_buffer = OUTPUT_queue_->GetFreeBuffer()) {
@@ -1225,7 +1225,7 @@
return whole_frames;
}
-absl::optional<struct H264FrameReassembler::FrameBoundaryInfo>
+std::optional<struct H264FrameReassembler::FrameBoundaryInfo>
H264FrameReassembler::FindH264FrameBoundary(const uint8_t* const data,
size_t data_size) {
h264_parser_.SetStream(data, data_size);
@@ -1235,7 +1235,7 @@
if (result == H264Parser::kInvalidStream ||
result == H264Parser::kUnsupportedStream) {
LOG(ERROR) << "Could not parse bitstream.";
- return absl::nullopt;
+ return std::nullopt;
}
if (result == H264Parser::kEOStream) {
NOTREACHED_NORETURN()
@@ -1267,7 +1267,7 @@
result = h264_parser_.ParseSPS(&sps_id_);
if (result != H264Parser::kOk) {
LOG(ERROR) << "Could not parse SPS header.";
- return absl::nullopt;
+ return std::nullopt;
}
previous_slice_header_.reset();
return FrameBoundaryInfo{.is_whole_frame = true,
@@ -1277,7 +1277,7 @@
result = h264_parser_.ParsePPS(&pps_id_);
if (result != H264Parser::kOk) {
LOG(ERROR) << "Could not parse PPS header.";
- return absl::nullopt;
+ return std::nullopt;
}
previous_slice_header_.reset();
return FrameBoundaryInfo{.is_whole_frame = true,
diff --git a/media/gpu/v4l2/v4l2_stateful_video_decoder.h b/media/gpu/v4l2/v4l2_stateful_video_decoder.h
index 5fa74e36..97e395d 100644
--- a/media/gpu/v4l2/v4l2_stateful_video_decoder.h
+++ b/media/gpu/v4l2/v4l2_stateful_video_decoder.h
@@ -49,7 +49,7 @@
scoped_refptr<base::SequencedTaskRunner> task_runner,
base::WeakPtr<VideoDecoderMixin::Client> client);
- static absl::optional<SupportedVideoDecoderConfigs> GetSupportedConfigs();
+ static std::optional<SupportedVideoDecoderConfigs> GetSupportedConfigs();
// VideoDecoderMixin implementation, VideoDecoder part.
void Initialize(const VideoDecoderConfig& config,
diff --git a/media/gpu/v4l2/v4l2_utils.cc b/media/gpu/v4l2/v4l2_utils.cc
index 32734c3..e43ca8e 100644
--- a/media/gpu/v4l2/v4l2_utils.cc
+++ b/media/gpu/v4l2/v4l2_utils.cc
@@ -203,19 +203,19 @@
}
size_t GetNumPlanesOfV4L2PixFmt(uint32_t pix_fmt) {
- absl::optional<Fourcc> fourcc = Fourcc::FromV4L2PixFmt(pix_fmt);
+ std::optional<Fourcc> fourcc = Fourcc::FromV4L2PixFmt(pix_fmt);
if (fourcc && fourcc->IsMultiPlanar()) {
return VideoFrame::NumPlanes(fourcc->ToVideoPixelFormat());
}
return 1u;
}
-absl::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
+std::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
const struct v4l2_format& format) {
if (!V4L2_TYPE_IS_MULTIPLANAR(format.type)) {
VLOGF(1) << "v4l2_buf_type is not multiplanar: " << std::hex << "0x"
<< format.type;
- return absl::nullopt;
+ return std::nullopt;
}
const v4l2_pix_format_mplane& pix_mp = format.fmt.pix_mp;
const uint32_t& pix_fmt = pix_mp.pixelformat;
@@ -223,7 +223,7 @@
if (!video_fourcc) {
VLOGF(1) << "Failed to convert pixel format to VideoPixelFormat: "
<< FourccToString(pix_fmt);
- return absl::nullopt;
+ return std::nullopt;
}
const VideoPixelFormat video_format = video_fourcc->ToVideoPixelFormat();
const size_t num_buffers = pix_mp.num_planes;
@@ -231,14 +231,14 @@
if (num_color_planes == 0) {
VLOGF(1) << "Unsupported video format for NumPlanes(): "
<< VideoPixelFormatToString(video_format);
- return absl::nullopt;
+ return std::nullopt;
}
if (num_buffers > num_color_planes) {
VLOGF(1) << "pix_mp.num_planes: " << num_buffers
<< " should not be larger than NumPlanes("
<< VideoPixelFormatToString(video_format)
<< "): " << num_color_planes;
- return absl::nullopt;
+ return std::nullopt;
}
// Reserve capacity in advance to prevent unnecessary vector reallocation.
std::vector<ColorPlaneLayout> planes;
@@ -272,7 +272,7 @@
if (y_stride % 2 != 0 || pix_mp.height % 2 != 0) {
VLOGF(1) << "Plane-Y stride and height should be even; stride: "
<< y_stride << ", height: " << pix_mp.height;
- return absl::nullopt;
+ return std::nullopt;
}
const int32_t half_stride = y_stride / 2;
const size_t plane_0_area = y_stride_abs * pix_mp.height;
@@ -286,7 +286,7 @@
default:
VLOGF(1) << "Cannot derive stride for each plane for pixel format "
<< FourccToString(pix_fmt);
- return absl::nullopt;
+ return std::nullopt;
}
}
diff --git a/media/gpu/v4l2/v4l2_utils.h b/media/gpu/v4l2/v4l2_utils.h
index dfa9eae..7959c09 100644
--- a/media/gpu/v4l2/v4l2_utils.h
+++ b/media/gpu/v4l2/v4l2_utils.h
@@ -5,18 +5,18 @@
#ifndef MEDIA_GPU_V4L2_V4L2_UTILS_H_
#define MEDIA_GPU_V4L2_V4L2_UTILS_H_
-#include <string>
-
#include <linux/videodev2.h>
#include <sys/mman.h>
+#include <optional>
+#include <string>
+
#include "base/files/scoped_file.h"
#include "base/functional/callback.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "media/base/video_codecs.h"
#include "mojo/public/cpp/platform/platform_handle.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#ifndef V4L2_PIX_FMT_QC08C
#define V4L2_PIX_FMT_QC08C \
@@ -112,8 +112,8 @@
size_t GetNumPlanesOfV4L2PixFmt(uint32_t pix_fmt);
// Composes VideoFrameLayout based on v4l2_format.
-// If error occurs, it returns absl::nullopt.
-absl::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
+// If error occurs, it returns std::nullopt.
+std::optional<VideoFrameLayout> V4L2FormatToVideoFrameLayout(
const struct v4l2_format& format);
// Enumerates the supported VideoCodecProfiles for a given device (accessed via
diff --git a/media/gpu/v4l2/v4l2_vda_helpers.cc b/media/gpu/v4l2/v4l2_vda_helpers.cc
index ee0dd6d..a6815fe1 100644
--- a/media/gpu/v4l2/v4l2_vda_helpers.cc
+++ b/media/gpu/v4l2/v4l2_vda_helpers.cc
@@ -22,7 +22,7 @@
namespace media {
namespace v4l2_vda_helpers {
-absl::optional<Fourcc> FindImageProcessorInputFormat(V4L2Device* vda_device) {
+std::optional<Fourcc> FindImageProcessorInputFormat(V4L2Device* vda_device) {
std::vector<uint32_t> processor_input_formats =
V4L2ImageProcessorBackend::GetSupportedInputFormats();
@@ -36,10 +36,10 @@
}
++fmtdesc.index;
}
- return absl::nullopt;
+ return std::nullopt;
}
-absl::optional<Fourcc> FindImageProcessorOutputFormat(V4L2Device* ip_device) {
+std::optional<Fourcc> FindImageProcessorOutputFormat(V4L2Device* ip_device) {
// Prefer YVU420 and NV12 because ArcGpuVideoDecodeAccelerator only supports
// single physical plane.
static constexpr uint32_t kPreferredFormats[] = {V4L2_PIX_FMT_NV12,
@@ -65,7 +65,7 @@
}
}
- return absl::nullopt;
+ return std::nullopt;
}
std::unique_ptr<ImageProcessor> CreateImageProcessor(
diff --git a/media/gpu/v4l2/v4l2_vda_helpers.h b/media/gpu/v4l2/v4l2_vda_helpers.h
index 2344190..eada297 100644
--- a/media/gpu/v4l2/v4l2_vda_helpers.h
+++ b/media/gpu/v4l2/v4l2_vda_helpers.h
@@ -6,6 +6,7 @@
#define MEDIA_GPU_V4L2_V4L2_VDA_HELPERS_H_
#include <memory>
+#include <optional>
#include "base/memory/scoped_refptr.h"
#include "base/task/sequenced_task_runner.h"
@@ -13,7 +14,6 @@
#include "media/gpu/chromeos/fourcc.h"
#include "media/gpu/chromeos/image_processor.h"
#include "media/media_buildflags.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
@@ -31,9 +31,9 @@
namespace v4l2_vda_helpers {
// Returns a usable input format of image processor, or nullopt if not found.
-absl::optional<Fourcc> FindImageProcessorInputFormat(V4L2Device* vda_device);
+std::optional<Fourcc> FindImageProcessorInputFormat(V4L2Device* vda_device);
// Return a usable output format of image processor, or nullopt if not found.
-absl::optional<Fourcc> FindImageProcessorOutputFormat(V4L2Device* ip_device);
+std::optional<Fourcc> FindImageProcessorOutputFormat(V4L2Device* ip_device);
// Create and return an image processor for the given parameters, or nullptr
// if it cannot be created.
diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc
index 28bb415..d37aa7b 100644
--- a/media/gpu/v4l2/v4l2_video_decoder.cc
+++ b/media/gpu/v4l2/v4l2_video_decoder.cc
@@ -153,12 +153,12 @@
}
// static
-absl::optional<SupportedVideoDecoderConfigs>
+std::optional<SupportedVideoDecoderConfigs>
V4L2VideoDecoder::GetSupportedConfigs() {
auto device = base::MakeRefCounted<V4L2Device>();
auto configs = device->GetSupportedDecodeProfiles(kSupportedInputFourccs);
if (configs.empty())
- return absl::nullopt;
+ return std::nullopt;
return ConvertFromSupportedProfiles(configs,
#if BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA)
@@ -402,7 +402,7 @@
constexpr bool kStateful = false;
constexpr bool kStateless = true;
- absl::optional<std::pair<bool, uint32_t>> api_and_format;
+ std::optional<std::pair<bool, uint32_t>> api_and_format;
// Try both kStateful and kStateless APIs via |fourcc| and select the first
// combination where Open()ing the |device_| works.
for (const auto api : {kStateful, kStateless}) {
@@ -677,7 +677,7 @@
continue;
}
- absl::optional<struct v4l2_format> format =
+ std::optional<struct v4l2_format> format =
output_queue_->TryFormat(pixfmt, size, 0);
if (!format)
continue;
@@ -693,9 +693,9 @@
CroStatus::Or<PixelLayoutCandidate> status_or_output_format =
client_->PickDecoderOutputFormat(
candidates, visible_rect, aspect_ratio_.GetNaturalSize(visible_rect),
- /*output_size=*/absl::nullopt, num_codec_reference_frames,
+ /*output_size=*/std::nullopt, num_codec_reference_frames,
/*use_protected=*/!!cdm_context_ref_, /*need_aux_frame_pool=*/false,
- absl::nullopt);
+ std::nullopt);
if (!status_or_output_format.has_value()) {
VLOGF(1) << "Failed to pick an output format.";
return std::move(status_or_output_format).error().code();
@@ -706,7 +706,7 @@
gfx::Size picked_size = std::move(output_format.size);
// We successfully picked the output format. Now setup output format again.
- absl::optional<struct v4l2_format> format =
+ std::optional<struct v4l2_format> format =
output_queue_->SetFormat(fourcc.ToV4L2PixFmt(), picked_size, 0);
DCHECK(format);
gfx::Size adjusted_size(format->fmt.pix_mp.width, format->fmt.pix_mp.height);
@@ -724,7 +724,7 @@
// created by VideoFramePool.
DmabufVideoFramePool* pool = client_->GetVideoFramePool();
if (pool) {
- absl::optional<GpuBufferLayout> layout = pool->GetGpuBufferLayout();
+ std::optional<GpuBufferLayout> layout = pool->GetGpuBufferLayout();
if (!layout.has_value()) {
VLOGF(1) << "Failed to get format from VFPool";
return CroStatus::Codes::kFailedToChangeResolution;
@@ -741,7 +741,7 @@
VLOGF(1) << "buffer modifier: " << std::hex << layout->modifier();
if (layout->modifier() != DRM_FORMAT_MOD_LINEAR &&
layout->modifier() != gfx::NativePixmapHandle::kNoModifier) {
- absl::optional<struct v4l2_format> modifier_format =
+ std::optional<struct v4l2_format> modifier_format =
output_queue_->SetModifierFormat(layout->modifier(), picked_size);
if (!modifier_format)
return CroStatus::Codes::kFailedToChangeResolution;
diff --git a/media/gpu/v4l2/v4l2_video_decoder.h b/media/gpu/v4l2/v4l2_video_decoder.h
index 82d0eb14..6bc93444 100644
--- a/media/gpu/v4l2/v4l2_video_decoder.h
+++ b/media/gpu/v4l2/v4l2_video_decoder.h
@@ -9,6 +9,7 @@
#include <map>
#include <memory>
+#include <optional>
#include <utility>
#include <vector>
@@ -30,7 +31,6 @@
#include "media/gpu/v4l2/v4l2_device.h"
#include "media/gpu/v4l2/v4l2_status.h"
#include "media/gpu/v4l2/v4l2_video_decoder_backend.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
@@ -49,7 +49,7 @@
scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
base::WeakPtr<VideoDecoderMixin::Client> client);
- static absl::optional<SupportedVideoDecoderConfigs> GetSupportedConfigs();
+ static std::optional<SupportedVideoDecoderConfigs> GetSupportedConfigs();
// VideoDecoderMixin implementation, VideoDecoder part.
void Initialize(const VideoDecoderConfig& config,
diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc
index 49a1e17..1245230b 100644
--- a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc
+++ b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc
@@ -6,6 +6,7 @@
#include <cstddef>
#include <memory>
+#include <optional>
#include <tuple>
#include <utility>
@@ -25,7 +26,6 @@
#include "media/gpu/v4l2/v4l2_vda_helpers.h"
#include "media/gpu/v4l2/v4l2_video_decoder_backend.h"
#include "media/gpu/v4l2/v4l2_vp9_helpers.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -43,13 +43,13 @@
return base::Contains(kVP9KSVCSupportedDrivers, driver_name);
}
-absl::optional<uint8_t> V4L2PixelFormatToBitDepth(uint32_t v4l2_pixelformat) {
+std::optional<uint8_t> V4L2PixelFormatToBitDepth(uint32_t v4l2_pixelformat) {
const auto fourcc = Fourcc::FromV4L2PixFmt(v4l2_pixelformat);
if (fourcc) {
return BitDepth(fourcc->ToVideoPixelFormat());
}
- return absl::nullopt;
+ return std::nullopt;
}
} // namespace
@@ -297,7 +297,7 @@
}
void V4L2StatefulVideoDecoderBackend::ProcessEventQueue() {
- while (absl::optional<struct v4l2_event> ev = device_->DequeueEvent()) {
+ while (std::optional<struct v4l2_event> ev = device_->DequeueEvent()) {
if (ev->type == V4L2_EVENT_SOURCE_CHANGE &&
(ev->u.src_change.changes & V4L2_EVENT_SRC_CH_RESOLUTION)) {
ChangeResolution();
@@ -328,7 +328,7 @@
bool ret = false;
bool no_buffer = false;
- absl::optional<V4L2WritableBufferRef> buffer;
+ std::optional<V4L2WritableBufferRef> buffer;
switch (mem_type) {
case V4L2_MEMORY_MMAP:
buffer = output_queue_->GetFreeBuffer();
@@ -401,7 +401,7 @@
// static
void V4L2StatefulVideoDecoderBackend::ReuseOutputBufferThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
- absl::optional<base::WeakPtr<V4L2StatefulVideoDecoderBackend>> weak_this,
+ std::optional<base::WeakPtr<V4L2StatefulVideoDecoderBackend>> weak_this,
V4L2ReadableBufferRef buffer) {
DVLOGF(3);
DCHECK(weak_this);
diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h
index 180162f3..2f35ca1 100644
--- a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h
+++ b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h
@@ -6,6 +6,7 @@
#define MEDIA_GPU_V4L2_V4L2_VIDEO_DECODER_BACKEND_STATEFUL_H_
#include <memory>
+#include <optional>
#include <string>
#include <vector>
@@ -16,7 +17,6 @@
#include "media/gpu/v4l2/v4l2_device.h"
#include "media/gpu/v4l2/v4l2_framerate_control.h"
#include "media/gpu/v4l2/v4l2_video_decoder_backend.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -86,7 +86,7 @@
static void ReuseOutputBufferThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
- absl::optional<base::WeakPtr<V4L2StatefulVideoDecoderBackend>> weak_this,
+ std::optional<base::WeakPtr<V4L2StatefulVideoDecoderBackend>> weak_this,
V4L2ReadableBufferRef buffer);
void ReuseOutputBuffer(V4L2ReadableBufferRef buffer);
@@ -135,14 +135,14 @@
base::queue<DecodeRequest> decode_request_queue_;
// The decode request which is currently processed.
- absl::optional<DecodeRequest> current_decode_request_;
+ std::optional<DecodeRequest> current_decode_request_;
// V4L2 input buffer currently being prepared.
- absl::optional<V4L2WritableBufferRef> current_input_buffer_;
+ std::optional<V4L2WritableBufferRef> current_input_buffer_;
std::unique_ptr<v4l2_vda_helpers::InputBufferFragmentSplitter>
frame_splitter_;
- absl::optional<gfx::Rect> visible_rect_;
+ std::optional<gfx::Rect> visible_rect_;
// Map of enqueuing timecodes to system timestamp, for histogramming purposes.
std::map<int64_t, base::TimeTicks> encoding_timestamps_;
diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc b/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc
index 9485645..da8579d6 100644
--- a/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc
+++ b/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc
@@ -153,7 +153,7 @@
// static
void V4L2StatelessVideoDecoderBackend::ReuseOutputBufferThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
- absl::optional<base::WeakPtr<V4L2StatelessVideoDecoderBackend>> weak_this,
+ std::optional<base::WeakPtr<V4L2StatelessVideoDecoderBackend>> weak_this,
V4L2ReadableBufferRef buffer) {
DVLOGF(3);
DCHECK(weak_this);
@@ -270,8 +270,7 @@
scoped_refptr<V4L2DecodeSurface> dec_surface;
CHECK(input_queue_->SupportsRequests());
- absl::optional<V4L2RequestRef> request_ref =
- requests_queue_->GetFreeRequest();
+ std::optional<V4L2RequestRef> request_ref = requests_queue_->GetFreeRequest();
if (!request_ref) {
DVLOGF(1) << "Could not get free request.";
return nullptr;
@@ -443,7 +442,7 @@
if (current_decode_request_) {
std::move(current_decode_request_->decode_cb)
.Run(DecoderStatus::Codes::kOk);
- current_decode_request_ = absl::nullopt;
+ current_decode_request_ = std::nullopt;
}
// Process next decode request.
@@ -466,7 +465,7 @@
output_request_queue_.push(OutputRequest::FlushFence());
PumpOutputSurfaces();
- current_decode_request_ = absl::nullopt;
+ current_decode_request_ = std::nullopt;
return true;
}
@@ -664,7 +663,7 @@
// Clear current_decode_request_ and decode_request_queue_.
if (current_decode_request_) {
std::move(current_decode_request_->decode_cb).Run(status);
- current_decode_request_ = absl::nullopt;
+ current_decode_request_ = std::nullopt;
}
while (!decode_request_queue_.empty()) {
diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h b/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h
index 9d6822c1..2932bdcc 100644
--- a/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h
+++ b/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h
@@ -115,7 +115,7 @@
// Callback which is called when the output buffer is not used anymore.
static void ReuseOutputBufferThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
- absl::optional<base::WeakPtr<V4L2StatelessVideoDecoderBackend>> weak_this,
+ std::optional<base::WeakPtr<V4L2StatelessVideoDecoderBackend>> weak_this,
V4L2ReadableBufferRef buffer);
void ReuseOutputBuffer(V4L2ReadableBufferRef buffer);
@@ -154,7 +154,7 @@
std::unique_ptr<AcceleratedVideoDecoder> decoder_;
// The decode request which is currently processed.
- absl::optional<DecodeRequest> current_decode_request_;
+ std::optional<DecodeRequest> current_decode_request_;
// Surfaces enqueued to V4L2 device. Since we are stateless, they are
// guaranteed to be proceeded in FIFO order.
base::queue<scoped_refptr<V4L2DecodeSurface>> surfaces_at_device_;
diff --git a/media/gpu/v4l2/v4l2_video_encode_accelerator.cc b/media/gpu/v4l2/v4l2_video_encode_accelerator.cc
index 385189f6..12fba345f 100644
--- a/media/gpu/v4l2/v4l2_video_encode_accelerator.cc
+++ b/media/gpu/v4l2/v4l2_video_encode_accelerator.cc
@@ -14,6 +14,7 @@
#include <memory>
#include <numeric>
+#include <optional>
#include <utility>
#include "base/bits.h"
@@ -45,7 +46,6 @@
#include "media/gpu/v4l2/v4l2_utils.h"
#include "media/video/h264_level_limits.h"
#include "media/video/h264_parser.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
const uint8_t kH264StartCode[] = {0, 0, 0, 1};
@@ -78,7 +78,7 @@
namespace {
// Convert VideoFrameLayout to ImageProcessor::PortConfig.
-absl::optional<ImageProcessor::PortConfig> VideoFrameLayoutToPortConfig(
+std::optional<ImageProcessor::PortConfig> VideoFrameLayoutToPortConfig(
const VideoFrameLayout& layout,
const gfx::Rect& visible_rect,
const std::vector<VideoFrame::StorageType>& preferred_storage_types) {
@@ -87,7 +87,7 @@
if (!fourcc) {
DVLOGF(1) << "Failed to create Fourcc from video pixel format "
<< VideoPixelFormatToString(layout.format());
- return absl::nullopt;
+ return std::nullopt;
}
return ImageProcessor::PortConfig(*fourcc, layout.coded_size(),
layout.planes(), visible_rect,
@@ -95,10 +95,10 @@
}
// Create Layout from |layout| with is_multi_planar = true.
-absl::optional<VideoFrameLayout> AsMultiPlanarLayout(
+std::optional<VideoFrameLayout> AsMultiPlanarLayout(
const VideoFrameLayout& layout) {
if (layout.is_multi_planar())
- return absl::make_optional<VideoFrameLayout>(layout);
+ return std::make_optional<VideoFrameLayout>(layout);
return VideoFrameLayout::CreateMultiPlanar(
layout.format(), layout.coded_size(), layout.planes());
}
@@ -384,7 +384,7 @@
config.bitrate,
config.initial_framerate.value_or(
VideoEncodeAccelerator::kDefaultFramerate),
- absl::nullopt);
+ std::nullopt);
// input_frame_size_ is the size of input_config of |image_processor_|.
// On native_input_mode_, since the passed size in RequireBitstreamBuffers()
@@ -462,8 +462,8 @@
}
ImageProcessorFactory::PickFormatCB pick_format_cb =
base::BindRepeating([](const std::vector<Fourcc>& fourcc_config,
- absl::optional<Fourcc> fourcc) {
- return absl::make_optional<Fourcc>(fourcc_config[0]);
+ std::optional<Fourcc> fourcc) {
+ return std::make_optional<Fourcc>(fourcc_config[0]);
});
image_processor_ = ImageProcessorFactory::CreateWithInputCandidates(
{}, gfx::Rect(input_config->size), output_config->size,
@@ -596,7 +596,7 @@
void V4L2VideoEncodeAccelerator::RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
DCHECK_CALLED_ON_VALID_SEQUENCE(child_sequence_checker_);
encoder_task_runner_->PostTask(
@@ -1145,7 +1145,7 @@
break;
}
- absl::optional<V4L2WritableBufferRef> input_buffer;
+ std::optional<V4L2WritableBufferRef> input_buffer;
switch (input_memory_type_) {
case V4L2_MEMORY_DMABUF:
input_buffer = input_queue_->GetFreeBufferForFrame(
@@ -1159,7 +1159,7 @@
input_buffer = input_queue_->GetFreeBuffer();
break;
}
- // input_buffer cannot be absl::nullopt since we checked for
+ // input_buffer cannot be std::nullopt since we checked for
// input_queue_->FreeBuffersCount() > 0 before entering the loop.
DCHECK(input_buffer);
if (!EnqueueInputRecord(std::move(*input_buffer)))
@@ -1630,7 +1630,7 @@
void V4L2VideoEncodeAccelerator::RequestEncodingParametersChangeTask(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
DCHECK_CALLED_ON_VALID_SEQUENCE(encoder_sequence_checker_);
if (size.has_value()) {
SetErrorState({EncoderStatus::Codes::kEncoderUnsupportedConfig,
@@ -1708,7 +1708,7 @@
// Sets 0 to width and height in CAPTURE queue, which should be ignored by the
// driver.
- absl::optional<struct v4l2_format> format = output_queue_->SetFormat(
+ std::optional<struct v4l2_format> format = output_queue_->SetFormat(
output_format_fourcc_, gfx::Size(), output_buffer_byte_size_);
if (!format) {
return false;
@@ -1722,7 +1722,7 @@
return true;
}
-absl::optional<struct v4l2_format>
+std::optional<struct v4l2_format>
V4L2VideoEncodeAccelerator::NegotiateInputFormat(VideoPixelFormat input_format,
const gfx::Size& size) {
VLOGF(2);
@@ -1736,7 +1736,7 @@
if (!input_fourcc) {
LOG(ERROR) << "Invalid input format "
<< VideoPixelFormatToString(input_format);
- return absl::nullopt;
+ return std::nullopt;
}
pix_fmt_candidates.push_back(input_fourcc->ToV4L2PixFmt());
// Second try preferred input formats for both single-planar and
@@ -1749,7 +1749,7 @@
for (const auto pix_fmt : pix_fmt_candidates) {
DVLOGF(3) << "Trying S_FMT with " << FourccToString(pix_fmt);
- absl::optional<struct v4l2_format> format =
+ std::optional<struct v4l2_format> format =
input_queue_->SetFormat(pix_fmt, size, 0);
if (!format)
continue;
@@ -1758,7 +1758,7 @@
device_input_layout_ = V4L2FormatToVideoFrameLayout(*format);
if (!device_input_layout_) {
LOG(ERROR) << "Invalid device_input_layout_";
- return absl::nullopt;
+ return std::nullopt;
}
DVLOG(3) << "Negotiated device_input_layout_: " << *device_input_layout_;
if (!gfx::Rect(device_input_layout_->coded_size())
@@ -1766,17 +1766,17 @@
LOG(ERROR) << "Input size " << size.ToString()
<< " exceeds encoder capability. Size encoder can handle: "
<< device_input_layout_->coded_size().ToString();
- return absl::nullopt;
+ return std::nullopt;
}
// Make sure that the crop is preserved as we have changed the input
// resolution.
if (!ApplyCrop()) {
- return absl::nullopt;
+ return std::nullopt;
}
return format;
}
- return absl::nullopt;
+ return std::nullopt;
}
bool V4L2VideoEncodeAccelerator::ApplyCrop() {
@@ -1983,7 +1983,7 @@
if (!CheckH264LevelLimits(config.output_profile, h264_level,
config.bitrate.target_bps(), framerate,
framesize_in_mbs)) {
- absl::optional<uint8_t> valid_level =
+ std::optional<uint8_t> valid_level =
FindValidH264Level(config.output_profile, config.bitrate.target_bps(),
framerate, framesize_in_mbs);
if (!valid_level) {
diff --git a/media/gpu/v4l2/v4l2_video_encode_accelerator.h b/media/gpu/v4l2/v4l2_video_encode_accelerator.h
index acb76d1..6265af0 100644
--- a/media/gpu/v4l2/v4l2_video_encode_accelerator.h
+++ b/media/gpu/v4l2/v4l2_video_encode_accelerator.h
@@ -10,6 +10,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include <vector>
#include "base/containers/circular_deque.h"
@@ -24,7 +25,6 @@
#include "media/gpu/media_gpu_export.h"
#include "media/gpu/v4l2/v4l2_device.h"
#include "media/video/video_encode_accelerator.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace base {
@@ -62,7 +62,7 @@
void RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
void Destroy() override;
void Flush(FlushCallback flush_callback) override;
bool IsFlushSupported() override;
@@ -81,7 +81,7 @@
// This is valid only if image processor is used. The buffer associated with
// this index can be reused in Dequeue().
- absl::optional<size_t> ip_output_buffer_index;
+ std::optional<size_t> ip_output_buffer_index;
};
// Store all the information of input frame passed to Encode().
@@ -98,7 +98,7 @@
// This is valid only if image processor is used. This info needs to be
// propagated to InputRecord.
- absl::optional<size_t> ip_output_buffer_index;
+ std::optional<size_t> ip_output_buffer_index;
};
enum {
@@ -202,7 +202,7 @@
void RequestEncodingParametersChangeTask(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size);
+ const std::optional<gfx::Size>& size);
// Do several initializations (e.g. set up format) on |encoder_task_runner_|.
void InitializeTask(const Config& config);
@@ -218,9 +218,9 @@
// Try to set up the device to the input format we were Initialized() with,
// or if the device doesn't support it, use one it can support, so that we
// can later instantiate an ImageProcessor to convert to it. Return
- // absl::nullopt if no format is supported, otherwise return v4l2_format
+ // std::nullopt if no format is supported, otherwise return v4l2_format
// adjusted by the driver.
- absl::optional<struct v4l2_format> NegotiateInputFormat(
+ std::optional<struct v4l2_format> NegotiateInputFormat(
VideoPixelFormat input_format,
const gfx::Size& frame_size);
@@ -293,7 +293,7 @@
gfx::Rect encoder_input_visible_rect_;
// Layout of device accepted input VideoFrame.
- absl::optional<VideoFrameLayout> device_input_layout_;
+ std::optional<VideoFrameLayout> device_input_layout_;
// Stands for whether an input buffer is native graphic buffer.
bool native_input_mode_;
diff --git a/media/gpu/vaapi/av1_vaapi_video_encoder_delegate.cc b/media/gpu/vaapi/av1_vaapi_video_encoder_delegate.cc
index 33c4be1e..d6f5749 100644
--- a/media/gpu/vaapi/av1_vaapi_video_encoder_delegate.cc
+++ b/media/gpu/vaapi/av1_vaapi_video_encoder_delegate.cc
@@ -190,7 +190,7 @@
bool extension_flag,
bool has_size);
void EncodeLeb128(uint32_t value,
- absl::optional<int> fixed_size = absl::nullopt);
+ std::optional<int> fixed_size = std::nullopt);
std::vector<uint8_t> Flush();
size_t OutstandingBits() { return total_outstanding_bits_; }
@@ -264,7 +264,7 @@
// This function also has a fixed size mode where we pass in a fixed size for
// the data and the function zero pads up to that size.
// See section 4.10.5 of the AV1 specification.
-void PackedData::EncodeLeb128(uint32_t value, absl::optional<int> fixed_size) {
+void PackedData::EncodeLeb128(uint32_t value, std::optional<int> fixed_size) {
for (int i = 0; i < fixed_size.value_or(5); i++) {
uint8_t curr_byte = value & 0x7F;
value >>= 7;
diff --git a/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.cc b/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.cc
index 7a6bee2..5604a79 100644
--- a/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.cc
+++ b/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.cc
@@ -128,7 +128,7 @@
const size_t num_layers,
H264Picture& pic,
unsigned int& frame_num,
- absl::optional<size_t>& ref_frame_idx,
+ std::optional<size_t>& ref_frame_idx,
const unsigned int num_encoded_frames,
const base::circular_deque<scoped_refptr<H264Picture>>& ref_pic_list0) {
DCHECK_GE(num_layers, kMinSupportedH264TemporalLayers);
@@ -254,7 +254,7 @@
// framerate and dimension.
if (!CheckH264LevelLimits(profile_, level_, config.bitrate.target_bps(),
initial_framerate, mb_width_ * mb_height_)) {
- absl::optional<uint8_t> valid_level =
+ std::optional<uint8_t> valid_level =
FindValidH264Level(profile_, config.bitrate.target_bps(),
initial_framerate, mb_width_ * mb_height_);
if (!valid_level) {
@@ -376,7 +376,7 @@
pic->type = pic->idr ? H264SliceHeader::kISlice : H264SliceHeader::kPSlice;
- absl::optional<size_t> ref_frame_index;
+ std::optional<size_t> ref_frame_index;
if (num_temporal_layers_ > 1u) {
UpdatePictureForTemporalLayerEncoding(num_temporal_layers_, *pic,
frame_num_, ref_frame_index,
@@ -879,7 +879,7 @@
const H264PPS& pps,
scoped_refptr<H264Picture> pic,
const base::circular_deque<scoped_refptr<H264Picture>>& ref_pic_list0,
- const absl::optional<size_t>& ref_frame_index) {
+ const std::optional<size_t>& ref_frame_index) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
const Bitrate bitrate = encode_params.bitrate_allocation.GetSumBitrate();
@@ -915,7 +915,7 @@
seq_param.bits_per_second = bitrate_bps;
SPS_TO_SP(max_num_ref_frames);
- absl::optional<gfx::Size> coded_size = sps.GetCodedSize();
+ std::optional<gfx::Size> coded_size = sps.GetCodedSize();
if (!coded_size) {
DVLOGF(1) << "Invalid coded size";
return false;
diff --git a/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.h b/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.h
index d2d5e2e1..ef0604e 100644
--- a/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.h
+++ b/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.h
@@ -108,7 +108,7 @@
const H264PPS& pps,
scoped_refptr<H264Picture> pic,
const base::circular_deque<scoped_refptr<H264Picture>>& ref_pic_list0,
- const absl::optional<size_t>& ref_frame_index);
+ const std::optional<size_t>& ref_frame_index);
// Current SPS, PPS and their packed versions. Packed versions are NALUs
// in AnnexB format *without* emulation prevention three-byte sequences
diff --git a/media/gpu/vaapi/test/av1_decoder.h b/media/gpu/vaapi/test/av1_decoder.h
index ad24bd53..1d339a3 100644
--- a/media/gpu/vaapi/test/av1_decoder.h
+++ b/media/gpu/vaapi/test/av1_decoder.h
@@ -6,12 +6,12 @@
#define MEDIA_GPU_VAAPI_TEST_AV1_DECODER_H_
#include <memory>
+#include <optional>
#include <vector>
#include "media/filters/ivf_parser.h"
#include "media/gpu/vaapi/test/video_decoder.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
-// For libgav1::ObuSequenceHeader. absl::optional demands ObuSequenceHeader to
+// For libgav1::ObuSequenceHeader. std::optional demands ObuSequenceHeader to
// fulfill std::is_trivially_constructible if it is forward-declared. But
// ObuSequenceHeader doesn't.
#include "third_party/libgav1/src/src/obu_parser.h"
@@ -74,7 +74,7 @@
std::unique_ptr<libgav1::ObuParser> obu_parser_;
std::unique_ptr<libgav1::BufferPool> buffer_pool_;
std::unique_ptr<libgav1::DecoderState> state_;
- absl::optional<libgav1::ObuSequenceHeader> current_sequence_header_;
+ std::optional<libgav1::ObuSequenceHeader> current_sequence_header_;
std::vector<scoped_refptr<SharedVASurface>> ref_frames_;
// If film grain is applied, the film grain surface is stored in
// |display_surfaces_|. Otherwise, matches |ref_frames_|.
diff --git a/media/gpu/vaapi/test/decode.cc b/media/gpu/vaapi/test/decode.cc
index 22fb757f..d52c45a 100644
--- a/media/gpu/vaapi/test/decode.cc
+++ b/media/gpu/vaapi/test/decode.cc
@@ -6,6 +6,7 @@
#include <fstream>
#include <iostream>
+#include <optional>
#include <sstream>
#include <string>
@@ -26,7 +27,6 @@
#include "media/gpu/vaapi/test/vp9_decoder.h"
#include "media/gpu/vaapi/va_stubs.h"
#include "media/media_buildflags.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
@@ -166,7 +166,7 @@
return nullptr;
}
-absl::optional<SharedVASurface::FetchPolicy> GetFetchPolicy(
+std::optional<SharedVASurface::FetchPolicy> GetFetchPolicy(
const VaapiDevice& va_device,
const std::string& fetch_policy) {
// Always use kGetImage for AMD devices.
@@ -186,7 +186,7 @@
return SharedVASurface::FetchPolicy::kGetImage;
LOG(ERROR) << "Unrecognized fetch policy " << fetch_policy;
- return absl::nullopt;
+ return std::nullopt;
}
} // namespace
diff --git a/media/gpu/vaapi/test/h264_decoder.cc b/media/gpu/vaapi/test/h264_decoder.cc
index e0c9428..29e0622 100644
--- a/media/gpu/vaapi/test/h264_decoder.cc
+++ b/media/gpu/vaapi/test/h264_decoder.cc
@@ -333,7 +333,7 @@
// outputting all pictures before it, to avoid outputting corrupted
// frames.
(*output_candidate)->frame_num == *recovery_frame_num_) {
- recovery_frame_num_ = absl::nullopt;
+ recovery_frame_num_ = std::nullopt;
output_queue.push(*output_candidate);
(*output_candidate)->outputted = true;
}
diff --git a/media/gpu/vaapi/test/h264_decoder.h b/media/gpu/vaapi/test/h264_decoder.h
index 0f07c90..4fb32f66 100644
--- a/media/gpu/vaapi/test/h264_decoder.h
+++ b/media/gpu/vaapi/test/h264_decoder.h
@@ -157,12 +157,12 @@
int prev_frame_num_offset_;
bool prev_has_memmgmnt5_;
- // These are absl::nullopt unless get recovery point SEI message after Reset.
+ // These are std::nullopt unless get recovery point SEI message after Reset.
// A frame_num of the frame at output order that is correct in content.
- absl::optional<int> recovery_frame_num_;
+ std::optional<int> recovery_frame_num_;
// A value in the recovery point SEI message to compute |recovery_frame_num_|
// later.
- absl::optional<int> recovery_frame_cnt_;
+ std::optional<int> recovery_frame_cnt_;
// Buffer object to keep track of our reference images.
H264DPB dpb_;
diff --git a/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.cc b/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.cc
index 1e88da01..81f3a38 100644
--- a/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.cc
+++ b/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.cc
@@ -9,6 +9,7 @@
#include <va/va.h>
#include <array>
+#include <optional>
#include <utility>
#include "base/files/scoped_file.h"
@@ -40,7 +41,6 @@
#include "media/gpu/vaapi/vaapi_image_decoder.h"
#include "media/gpu/vaapi/vaapi_utils.h"
#include "media/gpu/vaapi/vaapi_wrapper.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_memory_buffer.h"
diff --git a/media/gpu/vaapi/vaapi_unittest.cc b/media/gpu/vaapi/vaapi_unittest.cc
index 815a661..8d66017 100644
--- a/media/gpu/vaapi/vaapi_unittest.cc
+++ b/media/gpu/vaapi/vaapi_unittest.cc
@@ -4,19 +4,18 @@
// This has to be included first.
// See http://code.google.com/p/googletest/issues/detail?id=371
-#include "testing/gtest/include/gtest/gtest.h"
-
#include <drm_fourcc.h>
#include <gbm.h>
#include <unistd.h>
-#include <map>
-#include <vector>
-
#include <va/va.h>
#include <va/va_drmcommon.h>
#include <va/va_str.h>
#include <xf86drm.h>
+#include <map>
+#include <optional>
+#include <vector>
+
#include "base/bits.h"
#include "base/containers/contains.h"
#include "base/cpu.h"
@@ -40,7 +39,7 @@
#include "media/gpu/vaapi/vaapi_wrapper.h"
#include "media/media_buildflags.h"
#include "testing/gmock/include/gmock/gmock.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
+#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/linux/gbm_defines.h"
#ifndef I915_FORMAT_MOD_4_TILED
@@ -50,7 +49,7 @@
namespace media {
namespace {
-absl::optional<VAProfile> ConvertToVAProfile(VideoCodecProfile profile) {
+std::optional<VAProfile> ConvertToVAProfile(VideoCodecProfile profile) {
// A map between VideoCodecProfile and VAProfile.
const std::map<VideoCodecProfile, VAProfile> kProfileMap = {
// VAProfileH264Baseline is deprecated in <va/va.h> from libva 2.0.0.
@@ -68,12 +67,12 @@
#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
};
auto it = kProfileMap.find(profile);
- return it != kProfileMap.end() ? absl::make_optional<VAProfile>(it->second)
- : absl::nullopt;
+ return it != kProfileMap.end() ? std::make_optional<VAProfile>(it->second)
+ : std::nullopt;
}
// Converts the given string to VAProfile
-absl::optional<VAProfile> StringToVAProfile(const std::string& va_profile) {
+std::optional<VAProfile> StringToVAProfile(const std::string& va_profile) {
const std::map<std::string, VAProfile> kStringToVAProfile = {
{"VAProfileNone", VAProfileNone},
{"VAProfileH264ConstrainedBaseline", VAProfileH264ConstrainedBaseline},
@@ -98,12 +97,12 @@
auto it = kStringToVAProfile.find(va_profile);
return it != kStringToVAProfile.end()
- ? absl::make_optional<VAProfile>(it->second)
- : absl::nullopt;
+ ? std::make_optional<VAProfile>(it->second)
+ : std::nullopt;
}
// Converts the given string to VAEntrypoint
-absl::optional<VAEntrypoint> StringToVAEntrypoint(
+std::optional<VAEntrypoint> StringToVAEntrypoint(
const std::string& va_entrypoint) {
const std::map<std::string, VAEntrypoint> kStringToVAEntrypoint = {
{"VAEntrypointVLD", VAEntrypointVLD},
@@ -118,8 +117,8 @@
auto it = kStringToVAEntrypoint.find(va_entrypoint);
return it != kStringToVAEntrypoint.end()
- ? absl::make_optional<VAEntrypoint>(it->second)
- : absl::nullopt;
+ ? std::make_optional<VAEntrypoint>(it->second)
+ : std::nullopt;
}
unsigned int ToVaRTFormat(uint32_t va_fourcc) {
@@ -659,14 +658,14 @@
auto scoped_surfaces = wrapper->CreateScopedVASurfaces(
va_rt_format_in, kInputSize, {VaapiWrapper::SurfaceUsageHint::kGeneric},
- 1u, /*visible_size=*/absl::nullopt, /*va_fourcc=*/absl::nullopt);
+ 1u, /*visible_size=*/std::nullopt, /*va_fourcc=*/std::nullopt);
ASSERT_FALSE(scoped_surfaces.empty());
std::unique_ptr<ScopedVASurface> scoped_surface_in =
std::move(scoped_surfaces[0]);
scoped_surfaces = wrapper->CreateScopedVASurfaces(
va_rt_format_out, kOutputSize, {VaapiWrapper::SurfaceUsageHint::kGeneric},
- 1u, /*visible_size=*/absl::nullopt, /*va_fourcc=*/absl::nullopt);
+ 1u, /*visible_size=*/std::nullopt, /*va_fourcc=*/std::nullopt);
ASSERT_FALSE(scoped_surfaces.empty());
std::unique_ptr<ScopedVASurface> scoped_surface_out =
std::move(scoped_surfaces[0]);
@@ -773,7 +772,7 @@
auto scoped_surfaces = wrapper->CreateScopedVASurfaces(
va_rt_format, resolution, {VaapiWrapper::SurfaceUsageHint::kVideoDecoder},
1u,
- /*visible_size=*/absl::nullopt, /*va_fourcc=*/absl::nullopt);
+ /*visible_size=*/std::nullopt, /*va_fourcc=*/std::nullopt);
ASSERT_FALSE(scoped_surfaces.empty());
const auto scoped_va_surface = std::move(scoped_surfaces[0]);
wrapper->DestroyContext();
diff --git a/media/gpu/vaapi/vaapi_utils_unittest.cc b/media/gpu/vaapi/vaapi_utils_unittest.cc
index 9ef7da47..129d974 100644
--- a/media/gpu/vaapi/vaapi_utils_unittest.cc
+++ b/media/gpu/vaapi/vaapi_utils_unittest.cc
@@ -153,7 +153,7 @@
auto scoped_va_surfaces = vaapi_wrapper_->CreateContextAndScopedVASurfaces(
VA_RT_FORMAT_YUV420, coded_size,
{VaapiWrapper::SurfaceUsageHint::kGeneric}, 1u,
- /*visible_size=*/absl::nullopt);
+ /*visible_size=*/std::nullopt);
ASSERT_FALSE(scoped_va_surfaces.empty());
auto scoped_va_surface = std::move(scoped_va_surfaces[0]);
@@ -188,7 +188,7 @@
->CreateContextAndScopedVASurfaces(
VA_RT_FORMAT_YUV420, invalid_size,
{VaapiWrapper::SurfaceUsageHint::kGeneric}, 1u,
- /*visible_size=*/absl::nullopt)
+ /*visible_size=*/std::nullopt)
.empty());
}
@@ -200,7 +200,7 @@
->CreateContextAndScopedVASurfaces(
kInvalidVaRtFormat, coded_size,
{VaapiWrapper::SurfaceUsageHint::kGeneric}, 1u,
- /*visible_size=*/absl::nullopt)
+ /*visible_size=*/std::nullopt)
.empty());
}
diff --git a/media/gpu/vaapi/vaapi_video_decoder.cc b/media/gpu/vaapi/vaapi_video_decoder.cc
index 688e410..7ee0533 100644
--- a/media/gpu/vaapi/vaapi_video_decoder.cc
+++ b/media/gpu/vaapi/vaapi_video_decoder.cc
@@ -61,14 +61,14 @@
// Size of the timestamp cache, needs to be large enough for frame-reordering.
constexpr size_t kTimestampCacheSize = 128;
-absl::optional<VideoPixelFormat> GetPixelFormatForBitDepth(uint8_t bit_depth) {
+std::optional<VideoPixelFormat> GetPixelFormatForBitDepth(uint8_t bit_depth) {
constexpr auto kSupportedBitDepthAndGfxFormats = base::MakeFixedFlatMap<
uint8_t, gfx::BufferFormat>({
{8u, gfx::BufferFormat::YUV_420_BIPLANAR}, {10u, gfx::BufferFormat::P010},
});
if (!base::Contains(kSupportedBitDepthAndGfxFormats, bit_depth)) {
VLOGF(1) << "Unsupported bit depth: " << base::strict_cast<int>(bit_depth);
- return absl::nullopt;
+ return std::nullopt;
}
return GfxBufferFormatToVideoPixelFormat(
kSupportedBitDepthAndGfxFormats.at(bit_depth));
@@ -118,7 +118,7 @@
}
// static
-absl::optional<SupportedVideoDecoderConfigs>
+std::optional<SupportedVideoDecoderConfigs>
VaapiVideoDecoder::GetSupportedConfigs() {
return ConvertFromSupportedProfiles(
VaapiWrapper::GetSupportedDecodeProfiles(),
@@ -411,7 +411,7 @@
// task. Switch to the idle state if we ran out of buffers to decode.
std::move(current_decode_task_->decode_done_cb_)
.Run(DecoderStatus::Codes::kOk);
- current_decode_task_ = absl::nullopt;
+ current_decode_task_ = std::nullopt;
if (!decode_task_queue_.empty()) {
ScheduleNextDecodeTask();
} else {
@@ -480,7 +480,7 @@
if (current_decode_task_) {
std::move(current_decode_task_->decode_done_cb_).Run(status);
- current_decode_task_ = absl::nullopt;
+ current_decode_task_ = std::nullopt;
}
while (!decode_task_queue_.empty()) {
@@ -669,7 +669,7 @@
return;
const uint8_t bit_depth = decoder_->GetBitDepth();
- const absl::optional<VideoPixelFormat> format =
+ const std::optional<VideoPixelFormat> format =
GetPixelFormatForBitDepth(bit_depth);
if (!format) {
SetErrorState(base::StringPrintf("unsupported bit depth: %d", bit_depth));
@@ -790,21 +790,21 @@
aspect_ratio_.GetNaturalSize(decoder_visible_rect);
#if BUILDFLAG(IS_LINUX)
- absl::optional<DmabufVideoFramePool::CreateFrameCB> allocator =
+ std::optional<DmabufVideoFramePool::CreateFrameCB> allocator =
base::BindRepeating(&AllocateCustomFrameProxy, weak_this_);
std::vector<ImageProcessor::PixelLayoutCandidate> candidates = {
{.fourcc = *format_fourcc,
.size = decoder_pic_size,
.modifier = gfx::NativePixmapHandle::kNoModifier}};
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
- absl::optional<DmabufVideoFramePool::CreateFrameCB> allocator = absl::nullopt;
+ std::optional<DmabufVideoFramePool::CreateFrameCB> allocator = std::nullopt;
std::vector<ImageProcessor::PixelLayoutCandidate> candidates = {
{.fourcc = *format_fourcc,
.size = decoder_pic_size,
.modifier = gfx::NativePixmapHandle::kNoModifier}};
#else
- absl::optional<DmabufVideoFramePool::CreateFrameCB> allocator = absl::nullopt;
+ std::optional<DmabufVideoFramePool::CreateFrameCB> allocator = std::nullopt;
// TODO(b/203240043): We assume that the |dummy_frame|'s modifier matches the
// buffer returned by the video frame pool. We should create a test to make
@@ -1058,7 +1058,7 @@
// Notify the client flushing is done.
std::move(current_decode_task_->decode_done_cb_)
.Run(DecoderStatus::Codes::kOk);
- current_decode_task_ = absl::nullopt;
+ current_decode_task_ = std::nullopt;
// Wait for new decodes, no decode tasks should be queued while flushing.
SetState(State::kWaitingForInput);
diff --git a/media/gpu/vaapi/vaapi_video_decoder.h b/media/gpu/vaapi/vaapi_video_decoder.h
index c77cbdc..3ceafb9 100644
--- a/media/gpu/vaapi/vaapi_video_decoder.h
+++ b/media/gpu/vaapi/vaapi_video_decoder.h
@@ -10,6 +10,7 @@
#include <map>
#include <memory>
+#include <optional>
#include <utility>
#include "base/containers/lru_cache.h"
@@ -32,7 +33,6 @@
#include "media/gpu/chromeos/video_decoder_pipeline.h"
#include "media/gpu/decode_surface_handler.h"
#include "media/gpu/vaapi/vaapi_status.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_memory_buffer.h"
@@ -58,7 +58,7 @@
VaapiVideoDecoder(const VaapiVideoDecoder&) = delete;
VaapiVideoDecoder& operator=(const VaapiVideoDecoder&) = delete;
- static absl::optional<SupportedVideoDecoderConfigs> GetSupportedConfigs();
+ static std::optional<SupportedVideoDecoderConfigs> GetSupportedConfigs();
// VideoDecoderMixin implementation, VideoDecoder part.
void Initialize(const VideoDecoderConfig& config,
@@ -222,7 +222,7 @@
// Bitstream information, written during Initialize().
VideoCodecProfile profile_ = VIDEO_CODEC_PROFILE_UNKNOWN;
VideoColorSpace color_space_;
- absl::optional<gfx::HDRMetadata> hdr_metadata_;
+ std::optional<gfx::HDRMetadata> hdr_metadata_;
// Aspect ratio from the config.
VideoAspectRatio aspect_ratio_;
@@ -236,7 +236,7 @@
// Queue containing all requested decode tasks.
base::queue<DecodeTask> decode_task_queue_;
// The decode task we're currently trying to execute.
- absl::optional<DecodeTask> current_decode_task_;
+ std::optional<DecodeTask> current_decode_task_;
// The next input buffer id.
int32_t next_buffer_id_ = 0;
diff --git a/media/gpu/vaapi/vaapi_video_encode_accelerator.cc b/media/gpu/vaapi/vaapi_video_encode_accelerator.cc
index 89724a7..bfc632c 100644
--- a/media/gpu/vaapi/vaapi_video_encode_accelerator.cc
+++ b/media/gpu/vaapi/vaapi_video_encode_accelerator.cc
@@ -70,8 +70,8 @@
const std::vector<VaapiWrapper::SurfaceUsageHint>& surface_usage_hints) {
auto surfaces = vaapi_wrapper.CreateScopedVASurfaces(
kVaSurfaceFormat, encode_size, surface_usage_hints, 1u,
- /*visible_size=*/absl::nullopt,
- /*va_fourcc=*/absl::nullopt);
+ /*visible_size=*/std::nullopt,
+ /*va_fourcc=*/std::nullopt);
return surfaces.empty() ? nullptr : std::move(surfaces.front());
}
@@ -476,7 +476,7 @@
// vaSyncSurface() is not necessary because GetEncodedChunkSize() has been
// called in VaapiVideoEncoderDelegate::Encode().
if (!vaapi_wrapper_->DownloadFromVABuffer(
- encode_result.coded_buffer_id(), /*sync_surface_id=*/absl::nullopt,
+ encode_result.coded_buffer_id(), /*sync_surface_id=*/std::nullopt,
target_data, shm_mapping.size(), &data_size)) {
NotifyError({EncoderStatus::Codes::kEncoderHardwareDriverError,
"Failed downloading coded buffer"});
@@ -864,9 +864,9 @@
const InputFrameRef& input_frame = input_queue_.front();
if (!input_frame.frame) {
// If this is a flush (null) frame, don't create/submit a new encode
- // result for it, but forward absl::nulloptto the
+ // result for it, but forward std::nulloptto the
// |pending_encode_results_| queue.
- pending_encode_results_.push(absl::nullopt);
+ pending_encode_results_.push(std::nullopt);
input_queue_.pop();
TryToReturnBitstreamBuffers();
continue;
@@ -923,7 +923,7 @@
}
}
for (size_t i = 0; i < jobs.size(); i++) {
- absl::optional<EncodeResult> result =
+ std::optional<EncodeResult> result =
encoder_->GetEncodeResult(std::move(jobs[i]));
if (!result) {
NotifyError({EncoderStatus::Codes::kEncoderFailedEncode,
@@ -987,7 +987,7 @@
void VaapiVideoEncodeAccelerator::RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
DCHECK_CALLED_ON_VALID_SEQUENCE(child_sequence_checker_);
VideoBitrateAllocation allocation;
@@ -1002,7 +1002,7 @@
void VaapiVideoEncodeAccelerator::RequestEncodingParametersChange(
const VideoBitrateAllocation& bitrate_allocation,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
DCHECK_CALLED_ON_VALID_SEQUENCE(child_sequence_checker_);
encoder_task_runner_->PostTask(
@@ -1015,7 +1015,7 @@
void VaapiVideoEncodeAccelerator::RequestEncodingParametersChangeTask(
VideoBitrateAllocation bitrate_allocation,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
DCHECK_CALLED_ON_VALID_SEQUENCE(encoder_sequence_checker_);
DCHECK_NE(state_, kUninitialized);
diff --git a/media/gpu/vaapi/vaapi_video_encode_accelerator.h b/media/gpu/vaapi/vaapi_video_encode_accelerator.h
index 3ec68dd..fb40ab7 100644
--- a/media/gpu/vaapi/vaapi_video_encode_accelerator.h
+++ b/media/gpu/vaapi/vaapi_video_encode_accelerator.h
@@ -56,11 +56,11 @@
void RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
void RequestEncodingParametersChange(
const VideoBitrateAllocation& bitrate_allocation,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
void Destroy() override;
void Flush(FlushCallback flush_callback) override;
bool IsFlushSupported() override;
@@ -127,7 +127,7 @@
void RequestEncodingParametersChangeTask(
VideoBitrateAllocation bitrate_allocation,
uint32_t framerate,
- const absl::optional<gfx::Size>& size);
+ const std::optional<gfx::Size>& size);
void DestroyTask();
void FlushTask(FlushCallback flush_callback);
@@ -295,7 +295,7 @@
// VASurfaces already encoded and waiting for the bitstream buffer to
// be downloaded.
- base::queue<absl::optional<EncodeResult>> pending_encode_results_;
+ base::queue<std::optional<EncodeResult>> pending_encode_results_;
// Task runner for interacting with the client, and its checker.
const scoped_refptr<base::SequencedTaskRunner> child_task_runner_;
diff --git a/media/gpu/vaapi/vaapi_video_encode_accelerator_unittest.cc b/media/gpu/vaapi/vaapi_video_encode_accelerator_unittest.cc
index b34e7b5e..f67fed66 100644
--- a/media/gpu/vaapi/vaapi_video_encode_accelerator_unittest.cc
+++ b/media/gpu/vaapi/vaapi_video_encode_accelerator_unittest.cc
@@ -162,8 +162,8 @@
const gfx::Size&,
const std::vector<SurfaceUsageHint>&,
size_t,
- const absl::optional<gfx::Size>&,
- const absl::optional<uint32_t>&));
+ const std::optional<gfx::Size>&,
+ const std::optional<uint32_t>&));
MOCK_METHOD2(CreateVABuffer,
std::unique_ptr<ScopedVABuffer>(VABufferType, size_t));
MOCK_METHOD2(CreateVASurfaceForPixmap,
@@ -172,7 +172,7 @@
MOCK_METHOD2(GetEncodedChunkSize, uint64_t(VABufferID, VASurfaceID));
MOCK_METHOD5(
DownloadFromVABuffer,
- bool(VABufferID, absl::optional<VASurfaceID>, uint8_t*, size_t, size_t*));
+ bool(VABufferID, std::optional<VASurfaceID>, uint8_t*, size_t, size_t*));
MOCK_METHOD3(UploadVideoFrameToSurface,
bool(const VideoFrame&, VASurfaceID, const gfx::Size&));
MOCK_METHOD1(ExecuteAndDestroyPendingBuffers, bool(VASurfaceID));
@@ -182,12 +182,12 @@
MOCK_METHOD4(DoBlitSurface,
bool(const VASurface&,
const VASurface&,
- absl::optional<gfx::Rect>,
- absl::optional<gfx::Rect>));
+ std::optional<gfx::Rect>,
+ std::optional<gfx::Rect>));
bool BlitSurface(const VASurface& va_surface_src,
const VASurface& va_surface_dest,
- absl::optional<gfx::Rect> src_rect = absl::nullopt,
- absl::optional<gfx::Rect> dest_rect = absl::nullopt
+ std::optional<gfx::Rect> src_rect = std::nullopt,
+ std::optional<gfx::Rect> dest_rect = std::nullopt
#if BUILDFLAG(IS_CHROMEOS_ASH)
,
VAProtectedSessionID va_protected_session_id = VA_INVALID_ID
@@ -371,7 +371,7 @@
VA_RT_FORMAT_YUV420, kDefaultEncodeSize,
std::vector<VaapiWrapper::SurfaceUsageHint>{
VaapiWrapper::SurfaceUsageHint::kVideoEncoder},
- _, absl::optional<gfx::Size>(), absl::optional<uint32_t>()))
+ _, std::optional<gfx::Size>(), std::optional<uint32_t>()))
.WillOnce(
WithArgs<0, 1, 3>([&surface_ids = this->va_encode_surface_ids_[0],
&vaapi_wrapper = this->mock_vaapi_wrapper_](
@@ -394,7 +394,7 @@
VA_RT_FORMAT_YUV420, kDefaultEncodeSize,
std::vector<VaapiWrapper::SurfaceUsageHint>{
VaapiWrapper::SurfaceUsageHint::kVideoEncoder},
- 1, absl::optional<gfx::Size>(), absl::optional<uint32_t>()))
+ 1, std::optional<gfx::Size>(), std::optional<uint32_t>()))
.WillOnce(
WithArgs<0, 1>([&vaapi_wrapper = this->mock_vaapi_wrapper_,
surface_id = kInputSurfaceId](
@@ -455,7 +455,7 @@
BitrateControlUpdate(CheckEncodeData(kEncodedChunkSize)))
.WillOnce(Return());
EXPECT_CALL(*mock_vaapi_wrapper_,
- DownloadFromVABuffer(kCodedBufferId, Eq(absl::nullopt), _,
+ DownloadFromVABuffer(kCodedBufferId, Eq(std::nullopt), _,
output_buffer_size_, _))
.WillOnce(WithArgs<4>([](size_t* coded_data_size) {
*coded_data_size = kEncodedChunkSize;
@@ -532,7 +532,7 @@
VA_RT_FORMAT_YUV420, svc_resolutions[i],
std::vector<VaapiWrapper::SurfaceUsageHint>{
VaapiWrapper::SurfaceUsageHint::kVideoEncoder},
- _, absl::optional<gfx::Size>(), absl::optional<uint32_t>()))
+ _, std::optional<gfx::Size>(), std::optional<uint32_t>()))
.WillOnce(WithArgs<0, 1, 3>(
[&surface_ids = this->va_encode_surface_ids_[i],
&vaapi_wrapper = this->mock_vaapi_wrapper_,
@@ -570,7 +570,7 @@
std::vector<VaapiWrapper::SurfaceUsageHint>{
VaapiWrapper::SurfaceUsageHint::kVideoProcessWrite,
VaapiWrapper::SurfaceUsageHint::kVideoEncoder},
- 1, absl::optional<gfx::Size>(), absl::optional<uint32_t>()))
+ 1, std::optional<gfx::Size>(), std::optional<uint32_t>()))
.WillOnce(WithArgs<0, 1>(
[&surface_id = this->va_vpp_dest_surface_ids_[i],
&vaapi_wrapper = this->mock_vpp_vaapi_wrapper_,
@@ -583,8 +583,8 @@
return va_surfaces;
}));
}
- absl::optional<gfx::Rect> default_rect = gfx::Rect(kDefaultEncodeSize);
- absl::optional<gfx::Rect> layer_rect = gfx::Rect(svc_resolutions[i]);
+ std::optional<gfx::Rect> default_rect = gfx::Rect(kDefaultEncodeSize);
+ std::optional<gfx::Rect> layer_rect = gfx::Rect(svc_resolutions[i]);
EXPECT_CALL(*mock_vpp_vaapi_wrapper_,
DoBlitSurface(_, _, default_rect, layer_rect))
.WillOnce(Return(true));
@@ -642,7 +642,7 @@
const VABufferID kCodedBufferId = kCodedBufferIds[i];
const uint64_t kEncodedChunkSize = kEncodedChunkSizes[i];
EXPECT_CALL(*mock_vaapi_wrapper_,
- DownloadFromVABuffer(kCodedBufferId, Eq(absl::nullopt), _,
+ DownloadFromVABuffer(kCodedBufferId, Eq(std::nullopt), _,
output_buffer_size_, _))
.WillOnce(WithArgs<4>([kEncodedChunkSize](size_t* coded_data_size) {
*coded_data_size = kEncodedChunkSize;
diff --git a/media/gpu/vaapi/vaapi_video_encoder_delegate.cc b/media/gpu/vaapi/vaapi_video_encoder_delegate.cc
index 0d7d9faa..2f65f70 100644
--- a/media/gpu/vaapi/vaapi_video_encoder_delegate.cc
+++ b/media/gpu/vaapi/vaapi_video_encoder_delegate.cc
@@ -154,13 +154,13 @@
return true;
}
-absl::optional<VaapiVideoEncoderDelegate::EncodeResult>
+std::optional<VaapiVideoEncoderDelegate::EncodeResult>
VaapiVideoEncoderDelegate::GetEncodeResult(
std::unique_ptr<EncodeJob> encode_job) {
TRACE_EVENT0("media,gpu", "VAVEDelegate::GetEncodeResult");
if (encode_job->IsFrameDropped()) {
- return absl::make_optional<EncodeResult>(nullptr,
- GetMetadata(*encode_job, 0u));
+ return std::make_optional<EncodeResult>(nullptr,
+ GetMetadata(*encode_job, 0u));
}
const VASurfaceID va_surface_id = encode_job->input_surface_id();
@@ -168,12 +168,12 @@
encode_job->coded_buffer_id(), va_surface_id);
if (encoded_chunk_size == 0) {
VLOGF(1) << "Invalid encoded chunk size";
- return absl::nullopt;
+ return std::nullopt;
}
auto metadata = GetMetadata(*encode_job, encoded_chunk_size);
BitrateControlUpdate(metadata);
- return absl::make_optional<EncodeResult>(
+ return std::make_optional<EncodeResult>(
std::move(*encode_job).CreateEncodeResult(metadata));
}
diff --git a/media/gpu/vaapi/vaapi_video_encoder_delegate.h b/media/gpu/vaapi/vaapi_video_encoder_delegate.h
index d1068893..fef1b69 100644
--- a/media/gpu/vaapi/vaapi_video_encoder_delegate.h
+++ b/media/gpu/vaapi/vaapi_video_encoder_delegate.h
@@ -6,6 +6,8 @@
#define MEDIA_GPU_VAAPI_VAAPI_VIDEO_ENCODER_DELEGATE_H_
#include <va/va.h>
+
+#include <optional>
#include <vector>
#include "base/containers/queue.h"
@@ -17,7 +19,6 @@
#include "media/base/video_codecs.h"
#include "media/video/video_encode_accelerator.h"
#include "media/video/video_encoder_info.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
@@ -170,9 +171,9 @@
bool Encode(EncodeJob& encode_job);
// Creates and returns the encode result for specified EncodeJob by
- // synchronizing the corresponding encode operation. absl::nullopt is returned
+ // synchronizing the corresponding encode operation. std::nullopt is returned
// on failure.
- absl::optional<EncodeResult> GetEncodeResult(
+ std::optional<EncodeResult> GetEncodeResult(
std::unique_ptr<EncodeJob> encode_job);
// Gets the active spatial layer resolutions for K-SVC encoding, VaapiVEA
diff --git a/media/gpu/vaapi/vaapi_webp_decoder.cc b/media/gpu/vaapi/vaapi_webp_decoder.cc
index 48800522..11a96a9 100644
--- a/media/gpu/vaapi/vaapi_webp_decoder.cc
+++ b/media/gpu/vaapi/vaapi_webp_decoder.cc
@@ -108,7 +108,7 @@
auto scoped_va_surfaces = vaapi_wrapper_->CreateContextAndScopedVASurfaces(
kWebPVARtFormat, new_visible_size,
{VaapiWrapper::SurfaceUsageHint::kGeneric}, 1u,
- /*visible_size=*/absl::nullopt);
+ /*visible_size=*/std::nullopt);
if (scoped_va_surfaces.empty()) {
VLOGF(1) << "CreateContextAndScopedVASurface() failed";
return VaapiImageDecodeStatus::kSurfaceCreationFailed;
diff --git a/media/gpu/vaapi/vaapi_wrapper.cc b/media/gpu/vaapi/vaapi_wrapper.cc
index e1da898..12d0768 100644
--- a/media/gpu/vaapi/vaapi_wrapper.cc
+++ b/media/gpu/vaapi/vaapi_wrapper.cc
@@ -2072,7 +2072,7 @@
const gfx::Size& size,
const std::vector<SurfaceUsageHint>& usage_hints,
size_t num_surfaces,
- const absl::optional<gfx::Size>& visible_size) {
+ const std::optional<gfx::Size>& visible_size) {
CHECK(!enforce_sequence_affinity_ ||
sequence_checker_.CalledOnValidSequence());
if (va_context_id_ != VA_INVALID_ID) {
@@ -2083,7 +2083,7 @@
std::vector<std::unique_ptr<ScopedVASurface>> scoped_va_surfaces =
CreateScopedVASurfaces(va_format, size, usage_hints, num_surfaces,
- visible_size, /*va_fourcc=*/absl::nullopt);
+ visible_size, /*va_fourcc=*/std::nullopt);
if (scoped_va_surfaces.empty())
return {};
@@ -2873,7 +2873,7 @@
bool VaapiWrapper::DownloadFromVABuffer(
VABufferID buffer_id,
- absl::optional<VASurfaceID> sync_surface_id,
+ std::optional<VASurfaceID> sync_surface_id,
uint8_t* target_ptr,
size_t target_size,
size_t* coded_data_size) NO_THREAD_SAFETY_ANALYSIS {
@@ -2988,8 +2988,8 @@
bool VaapiWrapper::BlitSurface(const VASurface& va_surface_src,
const VASurface& va_surface_dest,
- absl::optional<gfx::Rect> src_rect,
- absl::optional<gfx::Rect> dest_rect
+ std::optional<gfx::Rect> src_rect,
+ std::optional<gfx::Rect> dest_rect
#if BUILDFLAG(IS_CHROMEOS_ASH)
,
VAProtectedSessionID va_protected_session_id
@@ -3315,8 +3315,8 @@
const gfx::Size& size,
const std::vector<SurfaceUsageHint>& usage_hints,
size_t num_surfaces,
- const absl::optional<gfx::Size>& visible_size,
- const absl::optional<uint32_t>& va_fourcc) {
+ const std::optional<gfx::Size>& visible_size,
+ const std::optional<uint32_t>& va_fourcc) {
CHECK(!enforce_sequence_affinity_ ||
sequence_checker_.CalledOnValidSequence());
if (kInvalidVaRtFormat == va_rt_format) {
diff --git a/media/gpu/vaapi/vaapi_wrapper.h b/media/gpu/vaapi/vaapi_wrapper.h
index dff620e3..fb5b6b10 100644
--- a/media/gpu/vaapi/vaapi_wrapper.h
+++ b/media/gpu/vaapi/vaapi_wrapper.h
@@ -16,6 +16,7 @@
#include <map>
#include <memory>
+#include <optional>
#include <set>
#include <vector>
@@ -33,7 +34,6 @@
#include "media/gpu/vaapi/vaapi_utils.h"
#include "media/video/video_decode_accelerator.h"
#include "media/video/video_encode_accelerator.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace gfx {
@@ -330,7 +330,7 @@
const gfx::Size& size,
const std::vector<SurfaceUsageHint>& usage_hints,
size_t num_surfaces,
- const absl::optional<gfx::Size>& visible_size);
+ const std::optional<gfx::Size>& visible_size);
// Attempts to create a protected session that will be attached to the
// decoding context to enable encrypted video decoding. If it cannot be
@@ -395,8 +395,8 @@
const gfx::Size& size,
const std::vector<SurfaceUsageHint>& usage_hints,
size_t num_surfaces,
- const absl::optional<gfx::Size>& visible_size,
- const absl::optional<uint32_t>& va_fourcc);
+ const std::optional<gfx::Size>& visible_size,
+ const std::optional<uint32_t>& va_fourcc);
// Creates a self-releasing VASurface from |pixmap|. The created VASurface
// shares the ownership of the underlying buffer represented by |pixmap|. The
@@ -520,7 +520,7 @@
// linear size of the resulted encoded frame is larger than |target_size|.
[[nodiscard]] virtual bool DownloadFromVABuffer(
VABufferID buffer_id,
- absl::optional<VASurfaceID> sync_surface_id,
+ std::optional<VASurfaceID> sync_surface_id,
uint8_t* target_ptr,
size_t target_size,
size_t* coded_data_size);
@@ -558,8 +558,8 @@
[[nodiscard]] virtual bool BlitSurface(
const VASurface& va_surface_src,
const VASurface& va_surface_dest,
- absl::optional<gfx::Rect> src_rect = absl::nullopt,
- absl::optional<gfx::Rect> dest_rect = absl::nullopt
+ std::optional<gfx::Rect> src_rect = std::nullopt,
+ std::optional<gfx::Rect> dest_rect = std::nullopt
#if BUILDFLAG(IS_CHROMEOS_ASH)
,
VAProtectedSessionID va_protected_session_id = VA_INVALID_ID
diff --git a/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate.h b/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate.h
index 926682a..58e9824 100644
--- a/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate.h
+++ b/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate.h
@@ -134,12 +134,12 @@
Vp9ReferenceFrameVector reference_frames_;
std::unique_ptr<VP9SVCLayers> svc_layers_;
- absl::optional<std::pair<VideoBitrateAllocation, uint32_t>>
+ std::optional<std::pair<VideoBitrateAllocation, uint32_t>>
pending_update_rates_;
std::unique_ptr<VP9RateControlWrapper> rate_ctrl_;
- absl::optional<base::TimeDelta> dropped_superframe_timestamp_;
+ std::optional<base::TimeDelta> dropped_superframe_timestamp_;
// TODO(b/297226972): Remove the workaround once the iHD driver is fixed.
bool is_last_encoded_key_frame_ = false;
diff --git a/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate_unittest.cc b/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate_unittest.cc
index 66a7eda..b74fb77c 100644
--- a/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate_unittest.cc
+++ b/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate_unittest.cc
@@ -9,6 +9,7 @@
#include <algorithm>
#include <memory>
#include <numeric>
+#include <optional>
#include <tuple>
#include "base/functional/callback.h"
@@ -23,7 +24,6 @@
#include "media/gpu/vp9_svc_layers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/libvpx/source/libvpx/vp9/common/vp9_blockd.h"
#include "third_party/libvpx/source/libvpx/vp9/ratectrl_rtc.h"
@@ -278,7 +278,7 @@
bool end_of_picture,
base::TimeDelta timestamp,
const gfx::Size& layer_size,
- absl::optional<std::array<bool, kVp9NumRefsPerFrame>>
+ std::optional<std::array<bool, kVp9NumRefsPerFrame>>
expected_ref_frames_used,
uint8_t expected_temporal_layer_id,
uint8_t expected_spatial_layer_id,
@@ -400,7 +400,7 @@
bool end_of_picture,
base::TimeDelta timestamp,
const gfx::Size& layer_size,
- absl::optional<std::array<bool, kVp9NumRefsPerFrame>>
+ std::optional<std::array<bool, kVp9NumRefsPerFrame>>
expected_ref_frames_used,
uint8_t expected_temporal_layer_id,
uint8_t expected_spatial_layer_id,
diff --git a/media/gpu/vp8_decoder.cc b/media/gpu/vp8_decoder.cc
index 4666150..1e66e92 100644
--- a/media/gpu/vp8_decoder.cc
+++ b/media/gpu/vp8_decoder.cc
@@ -199,9 +199,9 @@
return VideoColorSpace();
}
-absl::optional<gfx::HDRMetadata> VP8Decoder::GetHDRMetadata() const {
+std::optional<gfx::HDRMetadata> VP8Decoder::GetHDRMetadata() const {
// VP8 doesn't support HDR metadata.
- return absl::nullopt;
+ return std::nullopt;
}
size_t VP8Decoder::GetRequiredNumOfPictures() const {
diff --git a/media/gpu/vp8_decoder.h b/media/gpu/vp8_decoder.h
index 226503e..a3b9f69 100644
--- a/media/gpu/vp8_decoder.h
+++ b/media/gpu/vp8_decoder.h
@@ -79,7 +79,7 @@
uint8_t GetBitDepth() const override;
VideoChromaSampling GetChromaSampling() const override;
VideoColorSpace GetVideoColorSpace() const override;
- absl::optional<gfx::HDRMetadata> GetHDRMetadata() const override;
+ std::optional<gfx::HDRMetadata> GetHDRMetadata() const override;
size_t GetRequiredNumOfPictures() const override;
size_t GetNumReferenceFrames() const override;
diff --git a/media/gpu/vp8_picture.h b/media/gpu/vp8_picture.h
index 84865c8d..c57e4cd 100644
--- a/media/gpu/vp8_picture.h
+++ b/media/gpu/vp8_picture.h
@@ -26,7 +26,7 @@
std::unique_ptr<Vp8FrameHeader> frame_hdr;
- absl::optional<Vp8Metadata> metadata_for_encoding;
+ std::optional<Vp8Metadata> metadata_for_encoding;
protected:
~VP8Picture() override;
diff --git a/media/gpu/vp9_decoder.cc b/media/gpu/vp9_decoder.cc
index 831f72e3..9bb3156 100644
--- a/media/gpu/vp9_decoder.cc
+++ b/media/gpu/vp9_decoder.cc
@@ -431,9 +431,9 @@
return picture_color_space_;
}
-absl::optional<gfx::HDRMetadata> VP9Decoder::GetHDRMetadata() const {
+std::optional<gfx::HDRMetadata> VP9Decoder::GetHDRMetadata() const {
// VP9 only allow HDR metadata exists in the container.
- return absl::nullopt;
+ return std::nullopt;
}
size_t VP9Decoder::GetRequiredNumOfPictures() const {
diff --git a/media/gpu/vp9_decoder.h b/media/gpu/vp9_decoder.h
index e6257a13..de14f0c 100644
--- a/media/gpu/vp9_decoder.h
+++ b/media/gpu/vp9_decoder.h
@@ -138,7 +138,7 @@
uint8_t GetBitDepth() const override;
VideoChromaSampling GetChromaSampling() const override;
VideoColorSpace GetVideoColorSpace() const override;
- absl::optional<gfx::HDRMetadata> GetHDRMetadata() const override;
+ std::optional<gfx::HDRMetadata> GetHDRMetadata() const override;
size_t GetRequiredNumOfPictures() const override;
size_t GetNumReferenceFrames() const override;
diff --git a/media/gpu/vp9_picture.h b/media/gpu/vp9_picture.h
index 45e4b03..c2fdafd2 100644
--- a/media/gpu/vp9_picture.h
+++ b/media/gpu/vp9_picture.h
@@ -6,11 +6,11 @@
#define MEDIA_GPU_VP9_PICTURE_H_
#include <memory>
+#include <optional>
#include "media/filters/vp9_parser.h"
#include "media/gpu/codec_picture.h"
#include "media/video/video_encode_accelerator.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -33,7 +33,7 @@
std::unique_ptr<Vp9FrameHeader> frame_hdr;
- absl::optional<Vp9Metadata> metadata_for_encoding;
+ std::optional<Vp9Metadata> metadata_for_encoding;
protected:
~VP9Picture() override;
diff --git a/media/gpu/vp9_svc_layers_unittest.cc b/media/gpu/vp9_svc_layers_unittest.cc
index 18e85d5..437fe95 100644
--- a/media/gpu/vp9_svc_layers_unittest.cc
+++ b/media/gpu/vp9_svc_layers_unittest.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include <array>
#include <map>
+#include <optional>
#include <vector>
#include "base/containers/contains.h"
@@ -17,7 +18,6 @@
#include "media/video/video_encode_accelerator.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/gpu/windows/d3d11_copying_texture_wrapper.cc b/media/gpu/windows/d3d11_copying_texture_wrapper.cc
index f1cfcd1..4abd59a 100644
--- a/media/gpu/windows/d3d11_copying_texture_wrapper.cc
+++ b/media/gpu/windows/d3d11_copying_texture_wrapper.cc
@@ -20,7 +20,7 @@
std::unique_ptr<Texture2DWrapper> output_wrapper,
scoped_refptr<VideoProcessorProxy> processor,
ComD3D11Texture2D output_texture,
- absl::optional<gfx::ColorSpace> output_color_space)
+ std::optional<gfx::ColorSpace> output_color_space)
: size_(size),
video_processor_(std::move(processor)),
output_texture_wrapper_(std::move(output_wrapper)),
diff --git a/media/gpu/windows/d3d11_copying_texture_wrapper.h b/media/gpu/windows/d3d11_copying_texture_wrapper.h
index ae8ad75..a0f86e5 100644
--- a/media/gpu/windows/d3d11_copying_texture_wrapper.h
+++ b/media/gpu/windows/d3d11_copying_texture_wrapper.h
@@ -6,6 +6,7 @@
#define MEDIA_GPU_WINDOWS_D3D11_COPYING_TEXTURE_WRAPPER_H_
#include <memory>
+#include <optional>
#include <vector>
#include "base/task/single_thread_task_runner.h"
@@ -13,7 +14,6 @@
#include "media/gpu/windows/d3d11_status.h"
#include "media/gpu/windows/d3d11_texture_wrapper.h"
#include "media/gpu/windows/d3d11_video_processor_proxy.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -30,7 +30,7 @@
std::unique_ptr<Texture2DWrapper> output_wrapper,
scoped_refptr<VideoProcessorProxy> processor,
ComD3D11Texture2D output_texture,
- absl::optional<gfx::ColorSpace> output_color_space);
+ std::optional<gfx::ColorSpace> output_color_space);
~CopyingTexture2DWrapper() override;
D3D11Status BeginSharedImageAccess() override;
@@ -57,10 +57,10 @@
std::unique_ptr<Texture2DWrapper> output_texture_wrapper_;
ComD3D11Texture2D output_texture_;
// If set, then this is the desired output color space for the copy.
- absl::optional<gfx::ColorSpace> output_color_space_;
+ std::optional<gfx::ColorSpace> output_color_space_;
// If set, this is the color space that we last saw in ProcessTexture.
- absl::optional<gfx::ColorSpace> previous_input_color_space_;
+ std::optional<gfx::ColorSpace> previous_input_color_space_;
ComD3D11Texture2D texture_;
size_t array_slice_ = 0;
diff --git a/media/gpu/windows/d3d11_copying_texture_wrapper_unittest.cc b/media/gpu/windows/d3d11_copying_texture_wrapper_unittest.cc
index 76c5eb918..1937d7d3 100644
--- a/media/gpu/windows/d3d11_copying_texture_wrapper_unittest.cc
+++ b/media/gpu/windows/d3d11_copying_texture_wrapper_unittest.cc
@@ -78,10 +78,10 @@
MOCK_METHOD0(MockVideoProcessorBlt, HRESULT());
// Most recent arguments to SetStream/OutputColorSpace()/etc.
- absl::optional<gfx::ColorSpace> last_stream_color_space_;
- absl::optional<gfx::ColorSpace> last_output_color_space_;
- absl::optional<DXGI_HDR_METADATA_HDR10> last_stream_metadata_;
- absl::optional<DXGI_HDR_METADATA_HDR10> last_display_metadata_;
+ std::optional<gfx::ColorSpace> last_stream_color_space_;
+ std::optional<gfx::ColorSpace> last_output_color_space_;
+ std::optional<DXGI_HDR_METADATA_HDR10> last_stream_metadata_;
+ std::optional<DXGI_HDR_METADATA_HDR10> last_display_metadata_;
private:
~MockVideoProcessorProxy() override = default;
@@ -225,7 +225,7 @@
MockVideoProcessorProxy* processor_raw = processor.get();
// Provide an unlikely color space, to see if it gets to the video processor,
// if we're not just doing a pass-through of the input.
- absl::optional<gfx::ColorSpace> copy_color_space;
+ std::optional<gfx::ColorSpace> copy_color_space;
if (!GetPassthroughColorSpace())
copy_color_space = gfx::ColorSpace::CreateDisplayP3D65();
auto texture_wrapper = ExpectTextureWrapper();
diff --git a/media/gpu/windows/d3d11_texture_selector.cc b/media/gpu/windows/d3d11_texture_selector.cc
index 0c4d836..56cbfba3 100644
--- a/media/gpu/windows/d3d11_texture_selector.cc
+++ b/media/gpu/windows/d3d11_texture_selector.cc
@@ -79,7 +79,7 @@
bool shared_image_use_shared_handle) {
VideoPixelFormat output_pixel_format;
DXGI_FORMAT output_dxgi_format;
- absl::optional<gfx::ColorSpace> output_color_space;
+ std::optional<gfx::ColorSpace> output_color_space;
bool needs_texture_copy = !SupportsZeroCopy(gpu_preferences, workarounds);
@@ -210,7 +210,7 @@
VideoPixelFormat pixfmt,
DXGI_FORMAT input_dxgifmt,
DXGI_FORMAT output_dxgifmt,
- absl::optional<gfx::ColorSpace> output_color_space,
+ std::optional<gfx::ColorSpace> output_color_space,
ComD3D11VideoDevice video_device,
ComD3D11DeviceContext device_context,
bool shared_image_use_shared_handle)
diff --git a/media/gpu/windows/d3d11_texture_selector.h b/media/gpu/windows/d3d11_texture_selector.h
index 1624e889..e9e88d8 100644
--- a/media/gpu/windows/d3d11_texture_selector.h
+++ b/media/gpu/windows/d3d11_texture_selector.h
@@ -89,7 +89,7 @@
CopyTextureSelector(VideoPixelFormat pixfmt,
DXGI_FORMAT input_dxgifmt,
DXGI_FORMAT output_dxgifmt,
- absl::optional<gfx::ColorSpace> output_color_space,
+ std::optional<gfx::ColorSpace> output_color_space,
ComD3D11VideoDevice video_device,
ComD3D11DeviceContext d3d11_device_context,
bool use_shared_handle);
@@ -105,7 +105,7 @@
bool WillCopyForTesting() const override;
private:
- absl::optional<gfx::ColorSpace> output_color_space_;
+ std::optional<gfx::ColorSpace> output_color_space_;
scoped_refptr<VideoProcessorProxy> video_processor_proxy_;
};
diff --git a/media/gpu/windows/d3d11_texture_wrapper.h b/media/gpu/windows/d3d11_texture_wrapper.h
index e36e246..c48db859 100644
--- a/media/gpu/windows/d3d11_texture_wrapper.h
+++ b/media/gpu/windows/d3d11_texture_wrapper.h
@@ -6,7 +6,9 @@
#define MEDIA_GPU_WINDOWS_D3D11_TEXTURE_WRAPPER_H_
#include <d3d11.h>
+
#include <memory>
+#include <optional>
#include <vector>
#include "base/memory/weak_ptr.h"
@@ -20,7 +22,6 @@
#include "media/gpu/media_gpu_export.h"
#include "media/gpu/windows/d3d11_com_defs.h"
#include "media/gpu/windows/d3d11_status.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/hdr_metadata.h"
#include "ui/gl/gl_bindings.h"
@@ -159,7 +160,7 @@
void OnError(D3D11Status status);
// The first error status that we've received from |gpu_resources_|, if any.
- absl::optional<D3D11Status> received_error_;
+ std::optional<D3D11Status> received_error_;
gfx::Size size_;
gfx::ColorSpace color_space_;
diff --git a/media/gpu/windows/d3d11_video_decoder.cc b/media/gpu/windows/d3d11_video_decoder.cc
index 2080dc7..0d7243e 100644
--- a/media/gpu/windows/d3d11_video_decoder.cc
+++ b/media/gpu/windows/d3d11_video_decoder.cc
@@ -779,7 +779,7 @@
? accelerated_video_decoder_->GetHDRMetadata()
: config_.hdr_metadata();
- absl::optional<DXGI_HDR_METADATA_HDR10> display_metadata;
+ std::optional<DXGI_HDR_METADATA_HDR10> display_metadata;
if (decoder_configurator_->TextureFormat() == DXGI_FORMAT_P010) {
// For HDR formats, try to get the display metadata. This may fail, which
// is okay. We'll just skip sending the metadata.
diff --git a/media/gpu/windows/d3d11_video_decoder.h b/media/gpu/windows/d3d11_video_decoder.h
index 9ba792b..23a2f33 100644
--- a/media/gpu/windows/d3d11_video_decoder.h
+++ b/media/gpu/windows/d3d11_video_decoder.h
@@ -303,7 +303,7 @@
// If set, this is the minimum number of picture buffers that we've seen
// since the last time it was logged to UMA that are unused by both the
// client and the decoder. If unset, then no measurement has been made.
- absl::optional<int> min_unused_buffers_;
+ std::optional<int> min_unused_buffers_;
// Picture buffer usage is measured periodically after some number of decodes.
// This tracks how many until the next measurement. It's used strictly to
diff --git a/media/gpu/windows/d3d11_video_decoder_unittest.cc b/media/gpu/windows/d3d11_video_decoder_unittest.cc
index 852d009..74da492 100644
--- a/media/gpu/windows/d3d11_video_decoder_unittest.cc
+++ b/media/gpu/windows/d3d11_video_decoder_unittest.cc
@@ -9,6 +9,7 @@
#include <initguid.h>
#include <memory>
+#include <optional>
#include <utility>
#include "base/functional/bind.h"
@@ -30,7 +31,6 @@
#include "media/base/win/d3d11_mocks.h"
#include "media/gpu/test/fake_command_buffer_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
using ::testing::_;
using ::testing::DoAll;
@@ -153,7 +153,7 @@
}
// Most recently provided video decoder desc.
- absl::optional<D3D11_VIDEO_DECODER_DESC> last_video_decoder_desc_;
+ std::optional<D3D11_VIDEO_DECODER_DESC> last_video_decoder_desc_;
D3D11_VIDEO_DECODER_CONFIG video_decoder_config_;
void TearDown() override {
@@ -176,8 +176,8 @@
// use it. Otherwise, we'll use the list that's autodetected by the
// decoder based on the current device mock.
void CreateDecoder(
- absl::optional<D3D11VideoDecoder::SupportedConfigs> supported_configs =
- absl::optional<D3D11VideoDecoder::SupportedConfigs>()) {
+ std::optional<D3D11VideoDecoder::SupportedConfigs> supported_configs =
+ std::optional<D3D11VideoDecoder::SupportedConfigs>()) {
auto get_device_cb = base::BindRepeating(
[](Microsoft::WRL::ComPtr<ID3D11Device> device) { return device; },
mock_d3d11_device_);
@@ -242,7 +242,7 @@
DXGI_ADAPTER_DESC mock_adapter_desc_;
- absl::optional<base::test::ScopedFeatureList> scoped_feature_list_;
+ std::optional<base::test::ScopedFeatureList> scoped_feature_list_;
base::win::ScopedCOMInitializer com_initializer_;
};
@@ -304,7 +304,7 @@
// config check kinda works.
// For whatever reason, Optional<SupportedConfigs>({}) results in one that
// doesn't have a value, rather than one that has an empty vector.
- absl::optional<D3D11VideoDecoder::SupportedConfigs> empty_configs;
+ std::optional<D3D11VideoDecoder::SupportedConfigs> empty_configs;
empty_configs.emplace(std::vector<SupportedVideoDecoderConfig>());
CreateDecoder(empty_configs);
diff --git a/media/gpu/windows/d3d_video_decoder_wrapper.h b/media/gpu/windows/d3d_video_decoder_wrapper.h
index 0c61340..8e2bc87b 100644
--- a/media/gpu/windows/d3d_video_decoder_wrapper.h
+++ b/media/gpu/windows/d3d_video_decoder_wrapper.h
@@ -6,15 +6,16 @@
#define MEDIA_GPU_WINDOWS_D3D_VIDEO_DECODER_WRAPPER_H_
#include <Windows.h>
+
#include <cstdint>
#include <memory>
+#include <optional>
#include <vector>
#include "base/containers/span.h"
#include "base/strings/string_piece.h"
#include "media/gpu/windows/d3d11_status.h"
#include "media/gpu/windows/scoped_d3d_buffers.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -86,7 +87,7 @@
// Information that's accumulated during slices and submitted at the end
std::vector<uint8_t> slice_info_bytes_;
- absl::optional<ScopedSequenceD3DInputBuffer> bitstream_buffer_;
+ std::optional<ScopedSequenceD3DInputBuffer> bitstream_buffer_;
private:
raw_ptr<MediaLog> media_log_ = nullptr;
diff --git a/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc b/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc
index 699a7f4..2b745f8 100644
--- a/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc
+++ b/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc
@@ -1093,7 +1093,7 @@
void MediaFoundationVideoEncodeAccelerator::RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
DVLOG(3) << __func__ << ": bitrate=" << bitrate.ToString()
<< ": framerate=" << framerate
<< ": size=" << (size.has_value() ? size->ToString() : "nullopt");
@@ -1118,7 +1118,7 @@
void MediaFoundationVideoEncodeAccelerator::RequestEncodingParametersChange(
const VideoBitrateAllocation& bitrate_allocation,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
DVLOG(3) << __func__ << ": bitrate=" << bitrate_allocation.GetSumBps()
<< ": framerate=" << framerate
<< ": size=" << (size.has_value() ? size->ToString() : "nullopt");
@@ -1672,7 +1672,7 @@
"timestamp", input.frame->timestamp(), "discard_output",
input.discard_output);
- absl::optional<int> metadata_qp;
+ std::optional<int> metadata_qp;
if (has_prepared_input_sample_) {
if (DCHECK_IS_ON()) {
// Let's validate that prepared sample actually matches the frame
@@ -1695,7 +1695,7 @@
HRESULT hr = PopulateInputSampleBuffer(input);
RETURN_ON_HR_FAILURE(hr, "Couldn't populate input sample buffer", hr);
- absl::optional<uint8_t> quantizer;
+ std::optional<uint8_t> quantizer;
int temporal_id = 0;
if (input.options.quantizer.has_value()) {
DCHECK_EQ(codec_, VideoCodec::kH264);
@@ -2026,7 +2026,7 @@
// operation could block other users of the texture. Not holding the mutex
// could theoretically cause issues such as the texture not being bound but
// in practise we've been unable to reproduce issues with this path.
- absl::optional<gpu::DXGIScopedReleaseKeyedMutex> release_keyed_mutex;
+ std::optional<gpu::DXGIScopedReleaseKeyedMutex> release_keyed_mutex;
Microsoft::WRL::ComPtr<IDXGIKeyedMutex> keyed_mutex;
hr = input_texture->QueryInterface(IID_PPV_ARGS(&keyed_mutex));
if (SUCCEEDED(hr)) {
@@ -2132,7 +2132,7 @@
// If not set, the QP may be parsed by WebRTC from the bitstream but only if
// the QP is trusted (`encoder_info_.reports_average_qp` is true, which it is
// by default).
- absl::optional<int32_t> frame_qp;
+ std::optional<int32_t> frame_qp;
bool should_notify_encoder_info_change = false;
// If there exists a valid qp in sample metadata, do not query HMFT for
// MFSampleExtension_VideoEncodeQP.
@@ -2482,7 +2482,7 @@
&output_d3d11_color_space);
{
- absl::optional<gpu::DXGIScopedReleaseKeyedMutex> release_keyed_mutex;
+ std::optional<gpu::DXGIScopedReleaseKeyedMutex> release_keyed_mutex;
ComDXGIKeyedMutex keyed_mutex;
hr = input_texture->QueryInterface(IID_PPV_ARGS(&keyed_mutex));
if (SUCCEEDED(hr)) {
@@ -2593,7 +2593,7 @@
{
// We need to hold a keyed mutex during the copy operation.
- absl::optional<gpu::DXGIScopedReleaseKeyedMutex> release_keyed_mutex;
+ std::optional<gpu::DXGIScopedReleaseKeyedMutex> release_keyed_mutex;
ComDXGIKeyedMutex keyed_mutex;
hr = input_texture->QueryInterface(IID_PPV_ARGS(&keyed_mutex));
if (SUCCEEDED(hr)) {
diff --git a/media/gpu/windows/media_foundation_video_encode_accelerator_win.h b/media/gpu/windows/media_foundation_video_encode_accelerator_win.h
index 67d1b02..dd7b4465 100644
--- a/media/gpu/windows/media_foundation_video_encode_accelerator_win.h
+++ b/media/gpu/windows/media_foundation_video_encode_accelerator_win.h
@@ -75,11 +75,11 @@
void RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
void RequestEncodingParametersChange(
const VideoBitrateAllocation& bitrate_allocation,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
void Destroy() override;
void Flush(FlushCallback flush_callback) override;
bool IsFlushSupported() override;
@@ -118,7 +118,7 @@
struct OutOfBandMetadata {
gfx::ColorSpace color_space;
bool discard_output = false;
- absl::optional<int> qp;
+ std::optional<int> qp;
uint32_t frame_id;
};
@@ -331,7 +331,7 @@
// Enumerating supported profiles takes time, so cache the result here for
// future requests.
- absl::optional<SupportedProfiles> supported_profiles_;
+ std::optional<SupportedProfiles> supported_profiles_;
// Declared last to ensure that all weak pointers are invalidated before
// other destructors run.
diff --git a/media/gpu/windows/mf_audio_encoder.cc b/media/gpu/windows/mf_audio_encoder.cc
index 3d4bf15..d8c9569 100644
--- a/media/gpu/windows/mf_audio_encoder.cc
+++ b/media/gpu/windows/mf_audio_encoder.cc
@@ -769,7 +769,7 @@
return;
}
- absl::optional<CodecDescription> desc;
+ std::optional<CodecDescription> desc;
if (!codec_desc_.empty()) {
desc = codec_desc_;
codec_desc_.clear();
diff --git a/media/learning/common/learning_task.h b/media/learning/common/learning_task.h
index 709578ec..097665f 100644
--- a/media/learning/common/learning_task.h
+++ b/media/learning/common/learning_task.h
@@ -6,12 +6,12 @@
#define MEDIA_LEARNING_COMMON_LEARNING_TASK_H_
#include <initializer_list>
+#include <optional>
#include <string>
#include <vector>
#include "base/component_export.h"
#include "media/learning/common/value.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace learning {
@@ -121,7 +121,7 @@
// of feature to train the model with, to allow for feature importance
// measurement. Note that UMA reporting only supports subsets of size one, or
// the whole set.
- absl::optional<int> feature_subset_size;
+ std::optional<int> feature_subset_size;
// RandomForest parameters
diff --git a/media/learning/common/learning_task_controller.h b/media/learning/common/learning_task_controller.h
index 169d950..762c7d6 100644
--- a/media/learning/common/learning_task_controller.h
+++ b/media/learning/common/learning_task_controller.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_LEARNING_COMMON_LEARNING_TASK_CONTROLLER_H_
#define MEDIA_LEARNING_COMMON_LEARNING_TASK_CONTROLLER_H_
+#include <optional>
+
#include "base/component_export.h"
#include "base/functional/callback.h"
#include "base/unguessable_token.h"
@@ -12,7 +14,6 @@
#include "media/learning/common/learning_task.h"
#include "media/learning/common/target_histogram.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace learning {
@@ -44,8 +45,8 @@
// observed to do that.
class COMPONENT_EXPORT(LEARNING_COMMON) LearningTaskController {
public:
- using PredictionCB = base::OnceCallback<void(
- const absl::optional<TargetHistogram>& predicted)>;
+ using PredictionCB =
+ base::OnceCallback<void(const std::optional<TargetHistogram>& predicted)>;
LearningTaskController() = default;
@@ -71,8 +72,8 @@
virtual void BeginObservation(
base::UnguessableToken id,
const FeatureVector& features,
- const absl::optional<TargetValue>& default_target = absl::nullopt,
- const absl::optional<ukm::SourceId>& source_id = absl::nullopt) = 0;
+ const std::optional<TargetValue>& default_target = std::nullopt,
+ const std::optional<ukm::SourceId>& source_id = std::nullopt) = 0;
// Complete an observation by sending a completion.
virtual void CompleteObservation(base::UnguessableToken id,
@@ -88,13 +89,13 @@
// default value was given.
virtual void UpdateDefaultTarget(
base::UnguessableToken id,
- const absl::optional<TargetValue>& default_target) = 0;
+ const std::optional<TargetValue>& default_target) = 0;
// Returns the LearningTask associated with |this|.
virtual const LearningTask& GetLearningTask() = 0;
// Asynchronously predicts distribution for given |features|. |callback| will
- // receive a absl::nullopt prediction when model is not available. |callback|
+ // receive a std::nullopt prediction when model is not available. |callback|
// may be called immediately without posting.
virtual void PredictDistribution(const FeatureVector& features,
PredictionCB callback) = 0;
diff --git a/media/learning/impl/distribution_reporter.h b/media/learning/impl/distribution_reporter.h
index 6f9a41b..dff4afb 100644
--- a/media/learning/impl/distribution_reporter.h
+++ b/media/learning/impl/distribution_reporter.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_LEARNING_IMPL_DISTRIBUTION_REPORTER_H_
#define MEDIA_LEARNING_IMPL_DISTRIBUTION_REPORTER_H_
+#include <optional>
#include <set>
#include "base/component_export.h"
@@ -14,7 +15,6 @@
#include "media/learning/common/target_histogram.h"
#include "media/learning/impl/model.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace learning {
@@ -83,7 +83,7 @@
virtual void OnPrediction(const PredictionInfo& prediction_info,
TargetHistogram predicted) = 0;
- const absl::optional<std::set<int>>& feature_indices() const {
+ const std::optional<std::set<int>>& feature_indices() const {
return feature_indices_;
}
@@ -92,7 +92,7 @@
// If provided, then these are the features that are used to train the model.
// Otherwise, we assume that all features are used.
- absl::optional<std::set<int>> feature_indices_;
+ std::optional<std::set<int>> feature_indices_;
base::WeakPtrFactory<DistributionReporter> weak_factory_{this};
};
diff --git a/media/learning/impl/learning_fuzzertest.cc b/media/learning/impl/learning_fuzzertest.cc
index 0520970..fd4edd4 100644
--- a/media/learning/impl/learning_fuzzertest.cc
+++ b/media/learning/impl/learning_fuzzertest.cc
@@ -64,11 +64,11 @@
// Build random examples.
while (provider.remaining_bytes() > 0) {
base::UnguessableToken id = base::UnguessableToken::Create();
- absl::optional<TargetValue> default_target;
+ std::optional<TargetValue> default_target;
if (provider.ConsumeBool())
default_target = TargetValue(ConsumeDouble(&provider));
controller.BeginObservation(id, ConsumeFeatureVector(&provider),
- default_target, absl::nullopt);
+ default_target, std::nullopt);
controller.CompleteObservation(
id, ObservationCompletion(TargetValue(ConsumeDouble(&provider)),
ConsumeDouble(&provider)));
diff --git a/media/learning/impl/learning_session_impl.cc b/media/learning/impl/learning_session_impl.cc
index 2fb4846..073ebc9 100644
--- a/media/learning/impl/learning_session_impl.cc
+++ b/media/learning/impl/learning_session_impl.cc
@@ -37,7 +37,7 @@
// Cancel any outstanding observation, unless they have a default value. In
// that case, complete them.
for (auto& id : outstanding_observations_) {
- const absl::optional<TargetValue>& default_value = id.second;
+ const std::optional<TargetValue>& default_value = id.second;
if (default_value) {
controller_->AsyncCall(&LearningTaskController::CompleteObservation)
.WithArgs(id.first, *default_value);
@@ -51,8 +51,8 @@
void BeginObservation(
base::UnguessableToken id,
const FeatureVector& features,
- const absl::optional<TargetValue>& default_target,
- const absl::optional<ukm::SourceId>& source_id) override {
+ const std::optional<TargetValue>& default_target,
+ const std::optional<ukm::SourceId>& source_id) override {
if (!weak_session_)
return;
@@ -61,7 +61,7 @@
// doesn't support it. Since all client calls eventually come through us
// anyway, it seems okay to handle it here.
controller_->AsyncCall(&LearningTaskController::BeginObservation)
- .WithArgs(id, features, absl::nullopt, source_id);
+ .WithArgs(id, features, std::nullopt, source_id);
}
void CompleteObservation(base::UnguessableToken id,
@@ -83,7 +83,7 @@
void UpdateDefaultTarget(
base::UnguessableToken id,
- const absl::optional<TargetValue>& default_target) override {
+ const std::optional<TargetValue>& default_target) override {
if (!weak_session_)
return;
@@ -107,7 +107,7 @@
// Set of ids that have been started but not completed / cancelled yet, and
// any default target value.
- std::map<base::UnguessableToken, absl::optional<TargetValue>>
+ std::map<base::UnguessableToken, std::optional<TargetValue>>
outstanding_observations_;
};
diff --git a/media/learning/impl/learning_session_impl_unittest.cc b/media/learning/impl/learning_session_impl_unittest.cc
index e83ee5ce..4553931 100644
--- a/media/learning/impl/learning_session_impl_unittest.cc
+++ b/media/learning/impl/learning_session_impl_unittest.cc
@@ -45,8 +45,8 @@
void BeginObservation(
base::UnguessableToken id,
const FeatureVector& features,
- const absl::optional<TargetValue>& default_target,
- const absl::optional<ukm::SourceId>& source_id) override {
+ const std::optional<TargetValue>& default_target,
+ const std::optional<ukm::SourceId>& source_id) override {
id_ = id;
observation_features_ = features;
default_target_ = default_target;
@@ -67,7 +67,7 @@
void UpdateDefaultTarget(
base::UnguessableToken id,
- const absl::optional<TargetValue>& default_target) override {
+ const std::optional<TargetValue>& default_target) override {
// Should not be called, since LearningTaskControllerImpl doesn't support
// default values.
updated_id_ = id;
@@ -86,15 +86,15 @@
FeatureVector observation_features_;
FeatureVector predict_features_;
PredictionCB predict_cb_;
- absl::optional<TargetValue> default_target_;
- absl::optional<ukm::SourceId> source_id_;
+ std::optional<TargetValue> default_target_;
+ std::optional<ukm::SourceId> source_id_;
LabelledExample example_;
// Most recently cancelled id.
base::UnguessableToken cancelled_id_;
// Id of most recently changed default target value.
- absl::optional<base::UnguessableToken> updated_id_;
+ std::optional<base::UnguessableToken> updated_id_;
};
class FakeFeatureProvider : public FeatureProvider {
@@ -191,7 +191,7 @@
std::unique_ptr<LearningTaskController> ltc_0 =
session_->GetController(task_0_.name);
ukm::SourceId source_id(123);
- ltc_0->BeginObservation(id, example_0.features, absl::nullopt, source_id);
+ ltc_0->BeginObservation(id, example_0.features, std::nullopt, source_id);
ltc_0->CompleteObservation(
id, ObservationCompletion(example_0.target_value, example_0.weight));
@@ -290,7 +290,7 @@
// Start an observation without a default, then add one.
base::UnguessableToken id = base::UnguessableToken::Create();
- controller->BeginObservation(id, FeatureVector(), absl::nullopt);
+ controller->BeginObservation(id, FeatureVector(), std::nullopt);
TargetValue default_target(123);
controller->UpdateDefaultTarget(id, default_target);
task_environment_.RunUntilIdle();
@@ -316,7 +316,7 @@
base::UnguessableToken id = base::UnguessableToken::Create();
TargetValue default_target(123);
controller->BeginObservation(id, FeatureVector(), default_target);
- controller->UpdateDefaultTarget(id, absl::nullopt);
+ controller->UpdateDefaultTarget(id, std::nullopt);
task_environment_.RunUntilIdle();
EXPECT_EQ(task_controllers_[0]->id_, id);
@@ -341,7 +341,7 @@
controller->PredictDistribution(
features, base::BindOnce(
[](TargetHistogram* test_storage,
- const absl::optional<TargetHistogram>& predicted) {
+ const std::optional<TargetHistogram>& predicted) {
*test_storage = *predicted;
},
&observed_prediction));
diff --git a/media/learning/impl/learning_task_controller_helper.cc b/media/learning/impl/learning_task_controller_helper.cc
index 2e63468..971e7d1 100644
--- a/media/learning/impl/learning_task_controller_helper.cc
+++ b/media/learning/impl/learning_task_controller_helper.cc
@@ -27,7 +27,7 @@
void LearningTaskControllerHelper::BeginObservation(
base::UnguessableToken id,
FeatureVector features,
- absl::optional<ukm::SourceId> source_id) {
+ std::optional<ukm::SourceId> source_id) {
auto& pending_example = pending_examples_[id];
if (source_id)
diff --git a/media/learning/impl/learning_task_controller_helper.h b/media/learning/impl/learning_task_controller_helper.h
index ba57eef..3c8b38b 100644
--- a/media/learning/impl/learning_task_controller_helper.h
+++ b/media/learning/impl/learning_task_controller_helper.h
@@ -7,6 +7,7 @@
#include <map>
#include <memory>
+#include <optional>
#include "base/component_export.h"
#include "base/functional/callback.h"
@@ -17,7 +18,6 @@
#include "media/learning/common/learning_task_controller.h"
#include "media/learning/impl/feature_provider.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace learning {
@@ -50,7 +50,7 @@
// See LearningTaskController::BeginObservation.
void BeginObservation(base::UnguessableToken id,
FeatureVector features,
- absl::optional<ukm::SourceId> source_id);
+ std::optional<ukm::SourceId> source_id);
void CompleteObservation(base::UnguessableToken id,
const ObservationCompletion& completion);
void CancelObservation(base::UnguessableToken id);
diff --git a/media/learning/impl/learning_task_controller_helper_unittest.cc b/media/learning/impl/learning_task_controller_helper_unittest.cc
index 7258cee..68a2468 100644
--- a/media/learning/impl/learning_task_controller_helper_unittest.cc
+++ b/media/learning/impl/learning_task_controller_helper_unittest.cc
@@ -94,7 +94,7 @@
FeatureProvider::FeatureVectorCB fp_cb_;
// Most recently added example via OnLabelledExample, if any.
- absl::optional<LabelledExample> most_recent_example_;
+ std::optional<LabelledExample> most_recent_example_;
ukm::SourceId most_recent_source_id_;
LearningTask task_;
@@ -123,7 +123,7 @@
TEST_F(LearningTaskControllerHelperTest, DropTargetValueWithoutFPWorks) {
// Verify that we can drop an example without labelling it.
CreateClient(false);
- helper_->BeginObservation(id_, example_.features, absl::nullopt);
+ helper_->BeginObservation(id_, example_.features, std::nullopt);
EXPECT_EQ(pending_example_count(), 1u);
helper_->CancelObservation(id_);
task_environment_.RunUntilIdle();
@@ -134,7 +134,7 @@
TEST_F(LearningTaskControllerHelperTest, AddTargetValueBeforeFP) {
// Verify that an example is added if the target value arrives first.
CreateClient(true);
- helper_->BeginObservation(id_, example_.features, absl::nullopt);
+ helper_->BeginObservation(id_, example_.features, std::nullopt);
EXPECT_EQ(pending_example_count(), 1u);
task_environment_.RunUntilIdle();
// The feature provider should know about the example.
@@ -159,7 +159,7 @@
TEST_F(LearningTaskControllerHelperTest, DropTargetValueBeforeFP) {
// Verify that an example is correctly dropped before the FP adds features.
CreateClient(true);
- helper_->BeginObservation(id_, example_.features, absl::nullopt);
+ helper_->BeginObservation(id_, example_.features, std::nullopt);
EXPECT_EQ(pending_example_count(), 1u);
task_environment_.RunUntilIdle();
// The feature provider should know about the example.
@@ -182,7 +182,7 @@
TEST_F(LearningTaskControllerHelperTest, AddTargetValueAfterFP) {
// Verify that an example is added if the target value arrives second.
CreateClient(true);
- helper_->BeginObservation(id_, example_.features, absl::nullopt);
+ helper_->BeginObservation(id_, example_.features, std::nullopt);
EXPECT_EQ(pending_example_count(), 1u);
task_environment_.RunUntilIdle();
// The feature provider should know about the example.
@@ -208,7 +208,7 @@
TEST_F(LearningTaskControllerHelperTest, DropTargetValueAfterFP) {
// Verify that we can cancel the observationc after sending features.
CreateClient(true);
- helper_->BeginObservation(id_, example_.features, absl::nullopt);
+ helper_->BeginObservation(id_, example_.features, std::nullopt);
EXPECT_EQ(pending_example_count(), 1u);
task_environment_.RunUntilIdle();
// The feature provider should know about the example.
diff --git a/media/learning/impl/learning_task_controller_impl.cc b/media/learning/impl/learning_task_controller_impl.cc
index 330fed3..8bb4e24 100644
--- a/media/learning/impl/learning_task_controller_impl.cc
+++ b/media/learning/impl/learning_task_controller_impl.cc
@@ -52,8 +52,8 @@
void LearningTaskControllerImpl::BeginObservation(
base::UnguessableToken id,
const FeatureVector& features,
- const absl::optional<TargetValue>& default_target,
- const absl::optional<ukm::SourceId>& source_id) {
+ const std::optional<TargetValue>& default_target,
+ const std::optional<ukm::SourceId>& source_id) {
// TODO(liberato): Should we enforce that the right number of features are
// present here? Right now, we allow it to be shorter, so that features from
// a FeatureProvider may be omitted. Of course, they have to be at the end in
@@ -87,7 +87,7 @@
void LearningTaskControllerImpl::UpdateDefaultTarget(
base::UnguessableToken id,
- const absl::optional<TargetValue>& default_target) {
+ const std::optional<TargetValue>& default_target) {
NOTREACHED();
}
@@ -101,7 +101,7 @@
if (model_)
std::move(callback).Run(model_->PredictDistribution(features));
else
- std::move(callback).Run(absl::nullopt);
+ std::move(callback).Run(std::nullopt);
}
void LearningTaskControllerImpl::AddFinishedExample(LabelledExample example,
diff --git a/media/learning/impl/learning_task_controller_impl.h b/media/learning/impl/learning_task_controller_impl.h
index 7bf5bba..52b8890 100644
--- a/media/learning/impl/learning_task_controller_impl.h
+++ b/media/learning/impl/learning_task_controller_impl.h
@@ -51,17 +51,16 @@
// service should support default values, but it's much more convenient if
// they're part of the base api. So, since clients shouldn't be dealing with
// us directly (see LearningSessionImpl), it's okay.
- void BeginObservation(
- base::UnguessableToken id,
- const FeatureVector& features,
- const absl::optional<TargetValue>& default_target,
- const absl::optional<ukm::SourceId>& source_id) override;
+ void BeginObservation(base::UnguessableToken id,
+ const FeatureVector& features,
+ const std::optional<TargetValue>& default_target,
+ const std::optional<ukm::SourceId>& source_id) override;
void CompleteObservation(base::UnguessableToken id,
const ObservationCompletion& completion) override;
void CancelObservation(base::UnguessableToken id) override;
void UpdateDefaultTarget(
base::UnguessableToken id,
- const absl::optional<TargetValue>& default_target) override;
+ const std::optional<TargetValue>& default_target) override;
const LearningTask& GetLearningTask() override;
void PredictDistribution(const FeatureVector& features,
PredictionCB callback) override;
diff --git a/media/learning/impl/learning_task_controller_impl_unittest.cc b/media/learning/impl/learning_task_controller_impl_unittest.cc
index d1c6f77..a045d83 100644
--- a/media/learning/impl/learning_task_controller_impl_unittest.cc
+++ b/media/learning/impl/learning_task_controller_impl_unittest.cc
@@ -24,7 +24,7 @@
: DistributionReporter(task) {}
// protected => public
- const absl::optional<std::set<int>>& feature_indices() const {
+ const std::optional<std::set<int>>& feature_indices() const {
return DistributionReporter::feature_indices();
}
@@ -134,21 +134,21 @@
}
void AddExample(const LabelledExample& example,
- absl::optional<ukm::SourceId> source_id = absl::nullopt) {
+ std::optional<ukm::SourceId> source_id = std::nullopt) {
base::UnguessableToken id = base::UnguessableToken::Create();
- controller_->BeginObservation(id, example.features, absl::nullopt,
+ controller_->BeginObservation(id, example.features, std::nullopt,
source_id);
controller_->CompleteObservation(
id, ObservationCompletion(example.target_value, example.weight));
}
void VerifyPrediction(const FeatureVector& features,
- absl::optional<TargetHistogram> expectation) {
- absl::optional<TargetHistogram> observed_prediction;
+ std::optional<TargetHistogram> expectation) {
+ std::optional<TargetHistogram> observed_prediction;
controller_->PredictDistribution(
features, base::BindOnce(
- [](absl::optional<TargetHistogram>* test_storage,
- const absl::optional<TargetHistogram>& predicted) {
+ [](std::optional<TargetHistogram>* test_storage,
+ const std::optional<TargetHistogram>& predicted) {
*test_storage = predicted;
},
&observed_prediction));
@@ -280,9 +280,9 @@
TEST_F(LearningTaskControllerImplTest, PredictDistribution) {
CreateController();
- // Predictions should be absl::nullopt until we have a model.
+ // Predictions should be std::nullopt until we have a model.
LabelledExample example;
- VerifyPrediction(example.features, absl::nullopt);
+ VerifyPrediction(example.features, std::nullopt);
AddExample(example);
TargetHistogram expected_histogram;
diff --git a/media/learning/impl/one_hot.h b/media/learning/impl/one_hot.h
index 0a53e33..56c927b 100644
--- a/media/learning/impl/one_hot.h
+++ b/media/learning/impl/one_hot.h
@@ -7,6 +7,7 @@
#include <map>
#include <memory>
+#include <optional>
#include <vector>
#include "base/component_export.h"
@@ -14,7 +15,6 @@
#include "media/learning/common/learning_task.h"
#include "media/learning/common/value.h"
#include "media/learning/impl/model.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace learning {
@@ -56,7 +56,7 @@
// [original task feature index] = optional converter for it. If the feature
// was kNumeric to begin with, then there will be no converter.
- std::vector<absl::optional<ValueVectorIndexMap>> converters_;
+ std::vector<std::optional<ValueVectorIndexMap>> converters_;
};
// Model that uses |Converter| to convert instances before sending them to the
diff --git a/media/learning/impl/random_tree_trainer.cc b/media/learning/impl/random_tree_trainer.cc
index 0d8c7cc5..ef1618b 100644
--- a/media/learning/impl/random_tree_trainer.cc
+++ b/media/learning/impl/random_tree_trainer.cc
@@ -6,10 +6,11 @@
#include <math.h>
+#include <optional>
+
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/task/sequenced_task_runner.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
namespace learning {
@@ -177,9 +178,9 @@
// and the target value, if the Optional has a value then it's the singular
// value that we've found so far. If we find a second one, then we'll clear
// the Optional.
- absl::optional<TargetValue> target_value(
+ std::optional<TargetValue> target_value(
training_data[training_idx[0]].target_value);
- std::vector<absl::optional<FeatureValue>> feature_values;
+ std::vector<std::optional<FeatureValue>> feature_values;
feature_values.resize(training_data[0].features.size());
for (size_t feature_idx : unused_set) {
feature_values[feature_idx] =
diff --git a/media/learning/mojo/mojo_learning_task_controller_service.cc b/media/learning/mojo/mojo_learning_task_controller_service.cc
index 5081b4e..3662e67 100644
--- a/media/learning/mojo/mojo_learning_task_controller_service.cc
+++ b/media/learning/mojo/mojo_learning_task_controller_service.cc
@@ -28,7 +28,7 @@
void MojoLearningTaskControllerService::BeginObservation(
const base::UnguessableToken& id,
const FeatureVector& features,
- const absl::optional<TargetValue>& default_target) {
+ const std::optional<TargetValue>& default_target) {
// Drop the observation if it doesn't match the feature description size.
if (features.size() != task_.feature_descriptions.size())
return;
@@ -66,7 +66,7 @@
void MojoLearningTaskControllerService::UpdateDefaultTarget(
const base::UnguessableToken& id,
- const absl::optional<TargetValue>& default_target) {
+ const std::optional<TargetValue>& default_target) {
auto iter = in_flight_observations_.find(id);
if (iter == in_flight_observations_.end())
return;
diff --git a/media/learning/mojo/mojo_learning_task_controller_service.h b/media/learning/mojo/mojo_learning_task_controller_service.h
index 6fe33b9f..edf0a0d 100644
--- a/media/learning/mojo/mojo_learning_task_controller_service.h
+++ b/media/learning/mojo/mojo_learning_task_controller_service.h
@@ -39,13 +39,13 @@
void BeginObservation(
const base::UnguessableToken& id,
const FeatureVector& features,
- const absl::optional<TargetValue>& default_target) override;
+ const std::optional<TargetValue>& default_target) override;
void CompleteObservation(const base::UnguessableToken& id,
const ObservationCompletion& completion) override;
void CancelObservation(const base::UnguessableToken& id) override;
void UpdateDefaultTarget(
const base::UnguessableToken& id,
- const absl::optional<TargetValue>& default_target) override;
+ const std::optional<TargetValue>& default_target) override;
void PredictDistribution(const FeatureVector& features,
PredictDistributionCallback callback) override;
diff --git a/media/learning/mojo/mojo_learning_task_controller_service_unittest.cc b/media/learning/mojo/mojo_learning_task_controller_service_unittest.cc
index c4ccd73..de3a7f0 100644
--- a/media/learning/mojo/mojo_learning_task_controller_service_unittest.cc
+++ b/media/learning/mojo/mojo_learning_task_controller_service_unittest.cc
@@ -28,8 +28,8 @@
void BeginObservation(
base::UnguessableToken id,
const FeatureVector& features,
- const absl::optional<TargetValue>& default_target,
- const absl::optional<ukm::SourceId>& source_id) override {
+ const std::optional<TargetValue>& default_target,
+ const std::optional<ukm::SourceId>& source_id) override {
begin_args_.id_ = id;
begin_args_.features_ = features;
begin_args_.default_target_ = default_target;
@@ -48,7 +48,7 @@
void UpdateDefaultTarget(
base::UnguessableToken id,
- const absl::optional<TargetValue>& default_target) override {
+ const std::optional<TargetValue>& default_target) override {
update_default_args_.id_ = id;
update_default_args_.default_target_ = default_target;
}
@@ -66,8 +66,8 @@
struct {
base::UnguessableToken id_;
FeatureVector features_;
- absl::optional<TargetValue> default_target_;
- absl::optional<ukm::SourceId> source_id_;
+ std::optional<TargetValue> default_target_;
+ std::optional<ukm::SourceId> source_id_;
} begin_args_;
struct {
@@ -81,7 +81,7 @@
struct {
base::UnguessableToken id_;
- absl::optional<TargetValue> default_target_;
+ std::optional<TargetValue> default_target_;
} update_default_args_;
struct {
@@ -123,7 +123,7 @@
TEST_F(MojoLearningTaskControllerServiceTest, BeginComplete) {
base::UnguessableToken id = base::UnguessableToken::Create();
FeatureVector features = {FeatureValue(123), FeatureValue(456)};
- service_->BeginObservation(id, features, absl::nullopt);
+ service_->BeginObservation(id, features, std::nullopt);
EXPECT_EQ(id, controller_raw_->begin_args_.id_);
EXPECT_EQ(features, controller_raw_->begin_args_.features_);
EXPECT_FALSE(controller_raw_->begin_args_.default_target_);
@@ -141,7 +141,7 @@
TEST_F(MojoLearningTaskControllerServiceTest, BeginCancel) {
base::UnguessableToken id = base::UnguessableToken::Create();
FeatureVector features = {FeatureValue(123), FeatureValue(456)};
- service_->BeginObservation(id, features, absl::nullopt);
+ service_->BeginObservation(id, features, std::nullopt);
EXPECT_EQ(id, controller_raw_->begin_args_.id_);
EXPECT_EQ(features, controller_raw_->begin_args_.features_);
EXPECT_FALSE(controller_raw_->begin_args_.default_target_);
@@ -167,7 +167,7 @@
// A FeatureVector with too few elements should be ignored.
base::UnguessableToken id = base::UnguessableToken::Create();
FeatureVector short_features = {FeatureValue(123)};
- service_->BeginObservation(id, short_features, absl::nullopt);
+ service_->BeginObservation(id, short_features, std::nullopt);
EXPECT_NE(id, controller_raw_->begin_args_.id_);
EXPECT_EQ(controller_raw_->begin_args_.features_.size(), 0u);
}
@@ -177,7 +177,7 @@
base::UnguessableToken id = base::UnguessableToken::Create();
FeatureVector long_features = {FeatureValue(123), FeatureValue(456),
FeatureValue(789)};
- service_->BeginObservation(id, long_features, absl::nullopt);
+ service_->BeginObservation(id, long_features, std::nullopt);
EXPECT_NE(id, controller_raw_->begin_args_.id_);
EXPECT_EQ(controller_raw_->begin_args_.features_.size(), 0u);
}
@@ -198,7 +198,7 @@
TEST_F(MojoLearningTaskControllerServiceTest, UpdateDefaultTargetToValue) {
base::UnguessableToken id = base::UnguessableToken::Create();
FeatureVector features = {FeatureValue(123), FeatureValue(456)};
- service_->BeginObservation(id, features, absl::nullopt);
+ service_->BeginObservation(id, features, std::nullopt);
TargetValue default_target(987);
service_->UpdateDefaultTarget(id, default_target);
EXPECT_EQ(id, controller_raw_->update_default_args_.id_);
@@ -211,9 +211,9 @@
FeatureVector features = {FeatureValue(123), FeatureValue(456)};
TargetValue default_target(987);
service_->BeginObservation(id, features, default_target);
- service_->UpdateDefaultTarget(id, absl::nullopt);
+ service_->UpdateDefaultTarget(id, std::nullopt);
EXPECT_EQ(id, controller_raw_->update_default_args_.id_);
- EXPECT_EQ(absl::nullopt,
+ EXPECT_EQ(std::nullopt,
controller_raw_->update_default_args_.default_target_);
}
@@ -223,7 +223,7 @@
service_->PredictDistribution(
features, base::BindOnce(
[](TargetHistogram* test_storage,
- const absl::optional<TargetHistogram>& predicted) {
+ const std::optional<TargetHistogram>& predicted) {
*test_storage = *predicted;
},
&observed_prediction));
diff --git a/media/learning/mojo/public/cpp/mojo_learning_task_controller.cc b/media/learning/mojo/public/cpp/mojo_learning_task_controller.cc
index 86d89f36..30424ed 100644
--- a/media/learning/mojo/public/cpp/mojo_learning_task_controller.cc
+++ b/media/learning/mojo/public/cpp/mojo_learning_task_controller.cc
@@ -19,8 +19,8 @@
void MojoLearningTaskController::BeginObservation(
base::UnguessableToken id,
const FeatureVector& features,
- const absl::optional<TargetValue>& default_target,
- const absl::optional<ukm::SourceId>& source_id) {
+ const std::optional<TargetValue>& default_target,
+ const std::optional<ukm::SourceId>& source_id) {
// We don't need to keep track of in-flight observations, since the service
// side handles it for us. Also note that |source_id| is ignored; the service
// has no reason to trust it. It will fill it in for us. DCHECK in case
@@ -41,7 +41,7 @@
void MojoLearningTaskController::UpdateDefaultTarget(
base::UnguessableToken id,
- const absl::optional<TargetValue>& default_target) {
+ const std::optional<TargetValue>& default_target) {
controller_->UpdateDefaultTarget(id, default_target);
}
diff --git a/media/learning/mojo/public/cpp/mojo_learning_task_controller.h b/media/learning/mojo/public/cpp/mojo_learning_task_controller.h
index 6e56ef4..8bb097c 100644
--- a/media/learning/mojo/public/cpp/mojo_learning_task_controller.h
+++ b/media/learning/mojo/public/cpp/mojo_learning_task_controller.h
@@ -30,17 +30,16 @@
~MojoLearningTaskController() override;
// LearningTaskController
- void BeginObservation(
- base::UnguessableToken id,
- const FeatureVector& features,
- const absl::optional<TargetValue>& default_target,
- const absl::optional<ukm::SourceId>& source_id) override;
+ void BeginObservation(base::UnguessableToken id,
+ const FeatureVector& features,
+ const std::optional<TargetValue>& default_target,
+ const std::optional<ukm::SourceId>& source_id) override;
void CompleteObservation(base::UnguessableToken id,
const ObservationCompletion& completion) override;
void CancelObservation(base::UnguessableToken id) override;
void UpdateDefaultTarget(
base::UnguessableToken id,
- const absl::optional<TargetValue>& default_target) override;
+ const std::optional<TargetValue>& default_target) override;
const LearningTask& GetLearningTask() override;
void PredictDistribution(const FeatureVector& features,
PredictionCB callback) override;
diff --git a/media/learning/mojo/public/cpp/mojo_learning_task_controller_unittest.cc b/media/learning/mojo/public/cpp/mojo_learning_task_controller_unittest.cc
index 5743750..f117973a 100644
--- a/media/learning/mojo/public/cpp/mojo_learning_task_controller_unittest.cc
+++ b/media/learning/mojo/public/cpp/mojo_learning_task_controller_unittest.cc
@@ -25,7 +25,7 @@
void BeginObservation(
const base::UnguessableToken& id,
const FeatureVector& features,
- const absl::optional<TargetValue>& default_target) override {
+ const std::optional<TargetValue>& default_target) override {
begin_args_.id_ = id;
begin_args_.features_ = features;
begin_args_.default_target_ = default_target;
@@ -43,7 +43,7 @@
void UpdateDefaultTarget(
const base::UnguessableToken& id,
- const absl::optional<TargetValue>& default_target) override {
+ const std::optional<TargetValue>& default_target) override {
update_default_args_.id_ = id;
update_default_args_.default_target_ = default_target;
}
@@ -57,7 +57,7 @@
struct {
base::UnguessableToken id_;
FeatureVector features_;
- absl::optional<TargetValue> default_target_;
+ std::optional<TargetValue> default_target_;
} begin_args_;
struct {
@@ -71,7 +71,7 @@
struct {
base::UnguessableToken id_;
- absl::optional<TargetValue> default_target_;
+ std::optional<TargetValue> default_target_;
} update_default_args_;
struct {
@@ -114,8 +114,8 @@
TEST_F(MojoLearningTaskControllerTest, BeginWithoutDefaultTarget) {
base::UnguessableToken id = base::UnguessableToken::Create();
FeatureVector features = {FeatureValue(123), FeatureValue(456)};
- learning_controller_->BeginObservation(id, features, absl::nullopt,
- absl::nullopt);
+ learning_controller_->BeginObservation(id, features, std::nullopt,
+ std::nullopt);
task_environment_.RunUntilIdle();
EXPECT_EQ(id, fake_learning_controller_.begin_args_.id_);
EXPECT_EQ(features, fake_learning_controller_.begin_args_.features_);
@@ -127,7 +127,7 @@
TargetValue default_target(987);
FeatureVector features = {FeatureValue(123), FeatureValue(456)};
learning_controller_->BeginObservation(id, features, default_target,
- absl::nullopt);
+ std::nullopt);
task_environment_.RunUntilIdle();
EXPECT_EQ(id, fake_learning_controller_.begin_args_.id_);
EXPECT_EQ(features, fake_learning_controller_.begin_args_.features_);
@@ -139,8 +139,8 @@
// Test if we can update the default target to a non-nullopt.
base::UnguessableToken id = base::UnguessableToken::Create();
FeatureVector features = {FeatureValue(123), FeatureValue(456)};
- learning_controller_->BeginObservation(id, features, absl::nullopt,
- absl::nullopt);
+ learning_controller_->BeginObservation(id, features, std::nullopt,
+ std::nullopt);
TargetValue default_target(987);
learning_controller_->UpdateDefaultTarget(id, default_target);
task_environment_.RunUntilIdle();
@@ -156,12 +156,12 @@
FeatureVector features = {FeatureValue(123), FeatureValue(456)};
TargetValue default_target(987);
learning_controller_->BeginObservation(id, features, default_target,
- absl::nullopt);
- learning_controller_->UpdateDefaultTarget(id, absl::nullopt);
+ std::nullopt);
+ learning_controller_->UpdateDefaultTarget(id, std::nullopt);
task_environment_.RunUntilIdle();
EXPECT_EQ(id, fake_learning_controller_.update_default_args_.id_);
EXPECT_EQ(features, fake_learning_controller_.begin_args_.features_);
- EXPECT_EQ(absl::nullopt,
+ EXPECT_EQ(std::nullopt,
fake_learning_controller_.update_default_args_.default_target_);
}
@@ -189,7 +189,7 @@
learning_controller_->PredictDistribution(
features, base::BindOnce(
[](TargetHistogram* test_storage,
- const absl::optional<TargetHistogram>& predicted) {
+ const std::optional<TargetHistogram>& predicted) {
*test_storage = *predicted;
},
&observed_prediction));
diff --git a/media/midi/midi_manager_win.cc b/media/midi/midi_manager_win.cc
index 00be4f9..7b1256a 100644
--- a/media/midi/midi_manager_win.cc
+++ b/media/midi/midi_manager_win.cc
@@ -16,6 +16,7 @@
#include <limits>
#include <map>
#include <memory>
+#include <optional>
#include <string>
#include <tuple>
#include <utility>
@@ -38,7 +39,6 @@
#include "media/midi/midi_service.mojom.h"
#include "media/midi/midi_switches.h"
#include "services/device/public/cpp/usb/usb_ids.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace midi {
@@ -123,7 +123,7 @@
}
// Issues unique MidiManager instance ID.
-int64_t IssueNextInstanceId(absl::optional<int64_t> override_id) {
+int64_t IssueNextInstanceId(std::optional<int64_t> override_id) {
static int64_t id = kInvalidInstanceId;
if (override_id) {
int64_t result = ++id;
@@ -707,7 +707,7 @@
MidiManagerWin::MidiManagerWin(MidiService* service)
: MidiManager(service),
- instance_id_(IssueNextInstanceId(absl::nullopt)),
+ instance_id_(IssueNextInstanceId(std::nullopt)),
port_manager_(std::make_unique<PortManager>()) {
base::AutoLock lock(*GetInstanceIdLock());
CHECK_EQ(kInvalidInstanceId, g_active_instance_id);
diff --git a/media/mojo/clients/mojo_audio_decoder.cc b/media/mojo/clients/mojo_audio_decoder.cc
index 81db9c7..07bc9910 100644
--- a/media/mojo/clients/mojo_audio_decoder.cc
+++ b/media/mojo/clients/mojo_audio_decoder.cc
@@ -78,7 +78,7 @@
}
// Fail immediately if the stream is encrypted but |cdm_context| is invalid.
- absl::optional<base::UnguessableToken> cdm_id;
+ std::optional<base::UnguessableToken> cdm_id;
if (config.is_encrypted() && cdm_context)
cdm_id = cdm_context->GetCdmId();
diff --git a/media/mojo/clients/mojo_audio_encoder.cc b/media/mojo/clients/mojo_audio_encoder.cc
index cdcaee8..51d6ea9 100644
--- a/media/mojo/clients/mojo_audio_encoder.cc
+++ b/media/mojo/clients/mojo_audio_encoder.cc
@@ -107,7 +107,7 @@
void MojoAudioEncoder::OnEncodedBufferReady(media::EncodedAudioBuffer buffer,
const CodecDescription& desc) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- absl::optional<CodecDescription> opt_desc;
+ std::optional<CodecDescription> opt_desc;
if (desc.size() > 0)
opt_desc = desc;
output_cb_.Run(std::move(buffer), std::move(opt_desc));
diff --git a/media/mojo/clients/mojo_audio_encoder_unittest.cc b/media/mojo/clients/mojo_audio_encoder_unittest.cc
index 98c4ebf..885db7c 100644
--- a/media/mojo/clients/mojo_audio_encoder_unittest.cc
+++ b/media/mojo/clients/mojo_audio_encoder_unittest.cc
@@ -159,7 +159,7 @@
AudioEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](EncodedAudioBuffer output,
- absl::optional<AudioEncoder::CodecDescription>) { FAIL(); });
+ std::optional<AudioEncoder::CodecDescription>) { FAIL(); });
auto done_cb = base::BindLambdaForTesting([&, this](EncoderStatus s) {
EXPECT_TRUE(callback_runner_->RunsTasksInCurrentSequence());
@@ -185,7 +185,7 @@
AudioEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](EncodedAudioBuffer output,
- absl::optional<AudioEncoder::CodecDescription>) { FAIL(); });
+ std::optional<AudioEncoder::CodecDescription>) { FAIL(); });
auto done_cb = base::BindLambdaForTesting([&, this](EncoderStatus s) {
EXPECT_TRUE(callback_runner_->RunsTasksInCurrentSequence());
@@ -265,7 +265,7 @@
EncodedAudioBuffer output(params, std::move(data), size, capture_time);
- absl::optional<AudioEncoder::CodecDescription> desc;
+ std::optional<AudioEncoder::CodecDescription> desc;
if (input_number > 0)
desc.emplace(AudioEncoder::CodecDescription{
static_cast<uint8_t>(input_number)});
@@ -274,7 +274,7 @@
AudioEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](EncodedAudioBuffer output,
- absl::optional<AudioEncoder::CodecDescription> desc) {
+ std::optional<AudioEncoder::CodecDescription> desc) {
int64_t output_number = ToMilliseconds(output.timestamp);
EXPECT_EQ(output_number, output_count);
EXPECT_EQ(output.params.channels(), options.channels);
@@ -338,7 +338,7 @@
AudioEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](EncodedAudioBuffer output,
- absl::optional<AudioEncoder::CodecDescription> desc) {
+ std::optional<AudioEncoder::CodecDescription> desc) {
EXPECT_EQ(output.encoded_data_size, 0u);
run_loop.QuitWhenIdle();
});
@@ -389,7 +389,7 @@
AudioEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](EncodedAudioBuffer output,
- absl::optional<AudioEncoder::CodecDescription>) { output_count++; });
+ std::optional<AudioEncoder::CodecDescription>) { output_count++; });
mojo_audio_encoder_->Initialize(options, std::move(output_cb),
ValidatingStatusCB());
diff --git a/media/mojo/clients/mojo_cdm.cc b/media/mojo/clients/mojo_cdm.cc
index 0fadaab..b454815 100644
--- a/media/mojo/clients/mojo_cdm.cc
+++ b/media/mojo/clients/mojo_cdm.cc
@@ -303,7 +303,7 @@
return decryptor_.get();
}
-absl::optional<base::UnguessableToken> MojoCdm::GetCdmId() const {
+std::optional<base::UnguessableToken> MojoCdm::GetCdmId() const {
// Can be called on a different thread.
base::AutoLock auto_lock(lock_);
DVLOG(2) << __func__ << ": cdm_id="
diff --git a/media/mojo/clients/mojo_cdm.h b/media/mojo/clients/mojo_cdm.h
index da1cd2e..48bea5d 100644
--- a/media/mojo/clients/mojo_cdm.h
+++ b/media/mojo/clients/mojo_cdm.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include <string>
#include <utility>
#include <vector>
@@ -26,7 +27,6 @@
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class SingleThreadTaskRunner;
@@ -83,7 +83,7 @@
// All GetDecryptor() calls must be made on the same thread.
std::unique_ptr<CallbackRegistration> RegisterEventCB(EventCB event_cb) final;
Decryptor* GetDecryptor() final;
- absl::optional<base::UnguessableToken> GetCdmId() const final;
+ std::optional<base::UnguessableToken> GetCdmId() const final;
#if BUILDFLAG(IS_WIN)
bool RequiresMediaFoundationRenderer() final;
#endif // BUILDFLAG(IS_WIN)
@@ -133,7 +133,7 @@
// CDM ID of the remote CDM. Set after initialization is completed. Must not
// be invalid if initialization succeeded.
- absl::optional<base::UnguessableToken> cdm_id_ GUARDED_BY(lock_);
+ std::optional<base::UnguessableToken> cdm_id_ GUARDED_BY(lock_);
// The mojo::PendingRemote<mojom::Decryptor> exposed by the remote CDM. Set
// after initialization is completed and cleared after |decryptor_| is
diff --git a/media/mojo/clients/mojo_demuxer_stream_impl.cc b/media/mojo/clients/mojo_demuxer_stream_impl.cc
index fc759f8..475aed1 100644
--- a/media/mojo/clients/mojo_demuxer_stream_impl.cc
+++ b/media/mojo/clients/mojo_demuxer_stream_impl.cc
@@ -32,8 +32,8 @@
DVLOG(2) << __func__;
// Prepare the initial config.
- absl::optional<AudioDecoderConfig> audio_config;
- absl::optional<VideoDecoderConfig> video_config;
+ std::optional<AudioDecoderConfig> audio_config;
+ std::optional<VideoDecoderConfig> video_config;
if (stream_->type() == Type::AUDIO) {
audio_config = stream_->audio_decoder_config();
} else if (stream_->type() == Type::VIDEO) {
@@ -67,8 +67,8 @@
ReadCallback callback,
Status status,
media::DemuxerStream::DecoderBufferVector buffers) {
- absl::optional<AudioDecoderConfig> audio_config;
- absl::optional<VideoDecoderConfig> video_config;
+ std::optional<AudioDecoderConfig> audio_config;
+ std::optional<VideoDecoderConfig> video_config;
DVLOG(3) << __func__
<< ": status=" << ::media::DemuxerStream::GetStatusName(status)
<< ", buffers.size=" << buffers.size();
diff --git a/media/mojo/clients/mojo_renderer.cc b/media/mojo/clients/mojo_renderer.cc
index 93d3c1e0..ee23b37d 100644
--- a/media/mojo/clients/mojo_renderer.cc
+++ b/media/mojo/clients/mojo_renderer.cc
@@ -123,7 +123,7 @@
url_params.top_frame_origin, url_params.has_storage_access,
url_params.allow_credentials, url_params.is_hls, url_params.headers);
remote_renderer_->Initialize(client_receiver_.BindNewEndpointAndPassRemote(),
- absl::nullopt, std::move(media_url_params),
+ std::nullopt, std::move(media_url_params),
base::BindOnce(&MojoRenderer::OnInitialized,
base::Unretained(this), client));
}
@@ -142,7 +142,7 @@
return;
}
- absl::optional<base::UnguessableToken> cdm_id = cdm_context->GetCdmId();
+ std::optional<base::UnguessableToken> cdm_id = cdm_context->GetCdmId();
if (!cdm_id) {
DVLOG(2) << "MojoRenderer only works with remote CDMs but the CDM ID "
"is invalid.";
@@ -158,8 +158,7 @@
base::Unretained(this)));
}
-void MojoRenderer::SetLatencyHint(
- absl::optional<base::TimeDelta> latency_hint) {
+void MojoRenderer::SetLatencyHint(std::optional<base::TimeDelta> latency_hint) {
// TODO(chcunningham): Proxy to remote renderer if needed.
}
diff --git a/media/mojo/clients/mojo_renderer.h b/media/mojo/clients/mojo_renderer.h
index 44f33f7c..a4d826f 100644
--- a/media/mojo/clients/mojo_renderer.h
+++ b/media/mojo/clients/mojo_renderer.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include <vector>
#include "base/memory/raw_ptr.h"
@@ -21,7 +22,6 @@
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -57,7 +57,7 @@
media::RendererClient* client,
PipelineStatusCallback init_cb) override;
void SetCdm(CdmContext* cdm_context, CdmAttachedCB cdm_attached_cb) override;
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) override;
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) override;
void Flush(base::OnceClosure flush_cb) override;
void StartPlayingFrom(base::TimeDelta time) override;
void SetPlaybackRate(double playback_rate) override;
@@ -162,7 +162,7 @@
mutable base::Lock lock_;
media::TimeDeltaInterpolator media_time_interpolator_;
- absl::optional<PipelineStatistics> pending_stats_;
+ std::optional<PipelineStatistics> pending_stats_;
};
} // namespace media
diff --git a/media/mojo/clients/mojo_renderer_wrapper.cc b/media/mojo/clients/mojo_renderer_wrapper.cc
index 3fd355d..6bdf7238 100644
--- a/media/mojo/clients/mojo_renderer_wrapper.cc
+++ b/media/mojo/clients/mojo_renderer_wrapper.cc
@@ -42,7 +42,7 @@
}
void MojoRendererWrapper::SetLatencyHint(
- absl::optional<base::TimeDelta> latency_hint) {
+ std::optional<base::TimeDelta> latency_hint) {
mojo_renderer_->SetLatencyHint(latency_hint);
}
diff --git a/media/mojo/clients/mojo_renderer_wrapper.h b/media/mojo/clients/mojo_renderer_wrapper.h
index 743cd3f..0b42900 100644
--- a/media/mojo/clients/mojo_renderer_wrapper.h
+++ b/media/mojo/clients/mojo_renderer_wrapper.h
@@ -31,7 +31,7 @@
RendererClient* client,
PipelineStatusCallback init_cb) override;
void SetCdm(CdmContext* cdm_context, CdmAttachedCB cdm_attached_cb) override;
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) override;
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) override;
void Flush(base::OnceClosure flush_cb) override;
void StartPlayingFrom(base::TimeDelta time) override;
void SetPlaybackRate(double playback_rate) override;
diff --git a/media/mojo/clients/mojo_video_decoder.cc b/media/mojo/clients/mojo_video_decoder.cc
index bd0135a..2e6aa3fc 100644
--- a/media/mojo/clients/mojo_video_decoder.cc
+++ b/media/mojo/clients/mojo_video_decoder.cc
@@ -165,8 +165,8 @@
return;
}
- absl::optional<base::UnguessableToken> cdm_id =
- cdm_context ? cdm_context->GetCdmId() : absl::nullopt;
+ std::optional<base::UnguessableToken> cdm_id =
+ cdm_context ? cdm_context->GetCdmId() : std::nullopt;
// Fail immediately if the stream is encrypted but |cdm_id| is invalid.
// This check is needed to avoid unnecessary IPC to the remote process.
@@ -198,7 +198,7 @@
void MojoVideoDecoder::InitializeRemoteDecoder(
const VideoDecoderConfig& config,
bool low_delay,
- absl::optional<base::UnguessableToken> cdm_id) {
+ std::optional<base::UnguessableToken> cdm_id) {
if (has_connection_error_) {
DCHECK(init_cb_);
FailInit(std::move(init_cb_), DecoderStatus::Codes::kDisconnected);
@@ -264,7 +264,7 @@
void MojoVideoDecoder::OnVideoFrameDecoded(
const scoped_refptr<VideoFrame>& frame,
bool can_read_without_stalling,
- const absl::optional<base::UnguessableToken>& release_token) {
+ const std::optional<base::UnguessableToken>& release_token) {
DVLOG(3) << __func__;
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
TRACE_EVENT2("media", "MojoVideoDecoder::OnVideoFrameDecoded", "frame",
diff --git a/media/mojo/clients/mojo_video_decoder.h b/media/mojo/clients/mojo_video_decoder.h
index 598cdfe..904084b0 100644
--- a/media/mojo/clients/mojo_video_decoder.h
+++ b/media/mojo/clients/mojo_video_decoder.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_
#define MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_
+#include <optional>
+
#include "base/containers/lru_cache.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
@@ -19,7 +21,6 @@
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_space.h"
namespace base {
@@ -75,7 +76,7 @@
void OnVideoFrameDecoded(
const scoped_refptr<VideoFrame>& frame,
bool can_read_without_stalling,
- const absl::optional<base::UnguessableToken>& release_token) final;
+ const std::optional<base::UnguessableToken>& release_token) final;
void OnWaiting(WaitingReason reason) final;
void RequestOverlayInfo(bool restart_for_transitions) final;
@@ -101,7 +102,7 @@
base::OnceClosure complete_cb);
void InitializeRemoteDecoder(const VideoDecoderConfig& config,
bool low_delay,
- absl::optional<base::UnguessableToken> cdm_id);
+ std::optional<base::UnguessableToken> cdm_id);
// Forwards |overlay_info| to the remote decoder.
void OnOverlayInfoChanged(const OverlayInfo& overlay_info);
diff --git a/media/mojo/clients/mojo_video_encode_accelerator.cc b/media/mojo/clients/mojo_video_encode_accelerator.cc
index 835b819..a57002a1 100644
--- a/media/mojo/clients/mojo_video_encode_accelerator.cc
+++ b/media/mojo/clients/mojo_video_encode_accelerator.cc
@@ -206,7 +206,7 @@
void MojoVideoEncodeAccelerator::RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
DVLOG(2) << __func__;
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(vea_.is_bound());
@@ -217,7 +217,7 @@
void MojoVideoEncodeAccelerator::RequestEncodingParametersChange(
const VideoBitrateAllocation& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
DVLOG(2) << __func__;
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(vea_.is_bound());
diff --git a/media/mojo/clients/mojo_video_encode_accelerator.h b/media/mojo/clients/mojo_video_encode_accelerator.h
index f6d9cd9..2b705a65 100644
--- a/media/mojo/clients/mojo_video_encode_accelerator.h
+++ b/media/mojo/clients/mojo_video_encode_accelerator.h
@@ -50,11 +50,11 @@
void RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate_num,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
void RequestEncodingParametersChange(
const VideoBitrateAllocation& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
bool IsFlushSupported() override;
void Flush(FlushCallback flush_callback) override;
void Destroy() override;
diff --git a/media/mojo/clients/mojo_video_encode_accelerator_unittest.cc b/media/mojo/clients/mojo_video_encode_accelerator_unittest.cc
index 229ba8e5..f6efe24 100644
--- a/media/mojo/clients/mojo_video_encode_accelerator_unittest.cc
+++ b/media/mojo/clients/mojo_video_encode_accelerator_unittest.cc
@@ -111,23 +111,23 @@
void RequestEncodingParametersChangeWithLayers(
const media::VideoBitrateAllocation& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override {
+ const std::optional<gfx::Size>& size) override {
DoRequestEncodingParametersChangeWithLayers(bitrate, framerate, size);
}
MOCK_METHOD3(DoRequestEncodingParametersChangeWithLayers,
void(const media::VideoBitrateAllocation&,
uint32_t,
- const absl::optional<gfx::Size>&));
+ const std::optional<gfx::Size>&));
void RequestEncodingParametersChangeWithBitrate(
const media::Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override {
+ const std::optional<gfx::Size>& size) override {
DoRequestEncodingParametersChangeWithBitrate(bitrate, framerate, size);
}
MOCK_METHOD3(DoRequestEncodingParametersChangeWithBitrate,
void(const media::Bitrate&,
uint32_t,
- const absl::optional<gfx::Size>&));
+ const std::optional<gfx::Size>&));
void IsFlushSupported(IsFlushSupportedCallback callback) override {
DoIsFlushSupported();
@@ -308,9 +308,9 @@
EXPECT_CALL(*mock_mojo_vea(),
DoRequestEncodingParametersChangeWithBitrate(
- bitrate, kNewFramerate, testing::Eq(absl::nullopt)));
+ bitrate, kNewFramerate, testing::Eq(std::nullopt)));
mojo_vea()->RequestEncodingParametersChange(bitrate, kNewFramerate,
- absl::nullopt);
+ std::nullopt);
base::RunLoop().RunUntilIdle();
}
@@ -335,9 +335,9 @@
EXPECT_CALL(*mock_mojo_vea(), DoRequestEncodingParametersChangeWithLayers(
bitrate_allocation, kNewFramerate,
- testing::Eq(absl::nullopt)));
+ testing::Eq(std::nullopt)));
mojo_vea()->RequestEncodingParametersChange(bitrate_allocation,
- kNewFramerate, absl::nullopt);
+ kNewFramerate, std::nullopt);
base::RunLoop().RunUntilIdle();
}
}
diff --git a/media/mojo/clients/win/media_foundation_renderer_client.cc b/media/mojo/clients/win/media_foundation_renderer_client.cc
index b77766c..ff9bba2 100644
--- a/media/mojo/clients/win/media_foundation_renderer_client.cc
+++ b/media/mojo/clients/win/media_foundation_renderer_client.cc
@@ -151,7 +151,7 @@
}
void MediaFoundationRendererClient::SetLatencyHint(
- absl::optional<base::TimeDelta> /*latency_hint*/) {
+ std::optional<base::TimeDelta> /*latency_hint*/) {
NOTIMPLEMENTED() << "Latency hint not supported in MediaFoundationRenderer";
}
@@ -281,7 +281,7 @@
}
void MediaFoundationRendererClient::OnVideoFrameRateChange(
- absl::optional<int> fps) {
+ std::optional<int> fps) {
DVLOG_FUNC(1) << "fps=" << (fps ? *fps : -1);
DCHECK(has_video_);
@@ -518,7 +518,7 @@
}
void MediaFoundationRendererClient::OnDCOMPSurfaceReceived(
- const absl::optional<base::UnguessableToken>& token,
+ const std::optional<base::UnguessableToken>& token,
const std::string& error) {
DVLOG_FUNC(1);
DCHECK(has_video_);
diff --git a/media/mojo/clients/win/media_foundation_renderer_client.h b/media/mojo/clients/win/media_foundation_renderer_client.h
index 6ee9f0b..51ea2e8c 100644
--- a/media/mojo/clients/win/media_foundation_renderer_client.h
+++ b/media/mojo/clients/win/media_foundation_renderer_client.h
@@ -81,7 +81,7 @@
RendererClient* client,
PipelineStatusCallback init_cb) override;
void SetCdm(CdmContext* cdm_context, CdmAttachedCB cdm_attached_cb) override;
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) override;
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) override;
void Flush(base::OnceClosure flush_cb) override;
void StartPlayingFrom(base::TimeDelta time) override;
void SetPlaybackRate(double playback_rate) override;
@@ -105,7 +105,7 @@
void OnVideoConfigChange(const VideoDecoderConfig& config) override;
void OnVideoNaturalSizeChange(const gfx::Size& size) override;
void OnVideoOpacityChange(bool opaque) override;
- void OnVideoFrameRateChange(absl::optional<int>) override;
+ void OnVideoFrameRateChange(std::optional<int>) override;
// media::VideoRendererSink::RenderCallback implementation.
scoped_refptr<media::VideoFrame> Render(
@@ -131,7 +131,7 @@
void OnSetOutputRectDone(const gfx::Size& output_size, bool success);
void InitializeDCOMPRenderingIfNeeded();
void OnDCOMPSurfaceReceived(
- const absl::optional<base::UnguessableToken>& token,
+ const std::optional<base::UnguessableToken>& token,
const std::string& error);
void OnDCOMPSurfaceHandleSet(bool success);
void OnVideoFrameCreated(scoped_refptr<VideoFrame> video_frame,
diff --git a/media/mojo/clients/win/media_foundation_renderer_client_unittest.cc b/media/mojo/clients/win/media_foundation_renderer_client_unittest.cc
index aa55f5b..4b3431e 100644
--- a/media/mojo/clients/win/media_foundation_renderer_client_unittest.cc
+++ b/media/mojo/clients/win/media_foundation_renderer_client_unittest.cc
@@ -33,7 +33,7 @@
// mojom::Renderer implementations.
void Initialize(
mojo::PendingAssociatedRemote<mojom::RendererClient>,
- absl::optional<std::vector<mojo::PendingRemote<mojom::DemuxerStream>>>,
+ std::optional<std::vector<mojo::PendingRemote<mojom::DemuxerStream>>>,
mojom::MediaUrlParamsPtr,
InitializeCallback cb) override {
std::move(cb).Run(true);
@@ -45,7 +45,7 @@
MOCK_METHOD(void, SetVolume, (float), (override));
MOCK_METHOD(void,
SetCdm,
- (const absl::optional<base::UnguessableToken>&, SetCdmCallback),
+ (const std::optional<base::UnguessableToken>&, SetCdmCallback),
(override));
};
@@ -167,7 +167,7 @@
(override));
MOCK_METHOD(void, OnVideoNaturalSizeChange, (const gfx::Size&), (override));
MOCK_METHOD(void, OnVideoOpacityChange, (bool), (override));
- MOCK_METHOD(void, OnVideoFrameRateChange, (absl::optional<int>), (override));
+ MOCK_METHOD(void, OnVideoFrameRateChange, (std::optional<int>), (override));
};
class MediaFoundationRendererClientTest
diff --git a/media/mojo/common/media_type_converters.cc b/media/mojo/common/media_type_converters.cc
index 67a8c92..470545d 100644
--- a/media/mojo/common/media_type_converters.cc
+++ b/media/mojo/common/media_type_converters.cc
@@ -48,8 +48,8 @@
// static
media::mojom::DecoderBufferSideDataPtr
TypeConverter<media::mojom::DecoderBufferSideDataPtr,
- absl::optional<media::DecoderBufferSideData>>::
- Convert(const absl::optional<media::DecoderBufferSideData>& input) {
+ std::optional<media::DecoderBufferSideData>>::
+ Convert(const std::optional<media::DecoderBufferSideData>& input) {
if (!input.has_value()) {
return nullptr;
}
@@ -63,14 +63,14 @@
}
// static
-absl::optional<media::DecoderBufferSideData>
-TypeConverter<absl::optional<media::DecoderBufferSideData>,
+std::optional<media::DecoderBufferSideData>
+TypeConverter<std::optional<media::DecoderBufferSideData>,
media::mojom::DecoderBufferSideDataPtr>::
Convert(const media::mojom::DecoderBufferSideDataPtr& input) {
if (!input) {
- return absl::nullopt;
+ return std::nullopt;
}
- auto side_data = absl::make_optional<media::DecoderBufferSideData>(
+ auto side_data = std::make_optional<media::DecoderBufferSideData>(
media::DecoderBufferSideData());
side_data->alpha_data = input->alpha_data;
side_data->spatial_layers = input->spatial_layers;
@@ -125,7 +125,7 @@
if (input->side_data) {
buffer->set_side_data(
- input->side_data.To<absl::optional<media::DecoderBufferSideData>>());
+ input->side_data.To<std::optional<media::DecoderBufferSideData>>());
}
buffer->set_timestamp(input->timestamp);
diff --git a/media/mojo/common/media_type_converters.h b/media/mojo/common/media_type_converters.h
index 53654a5..2d75606 100644
--- a/media/mojo/common/media_type_converters.h
+++ b/media/mojo/common/media_type_converters.h
@@ -6,12 +6,12 @@
#define MEDIA_MOJO_COMMON_MEDIA_TYPE_CONVERTERS_H_
#include <memory>
+#include <optional>
#include "base/memory/scoped_refptr.h"
#include "media/mojo/mojom/content_decryption_module.mojom.h"
#include "media/mojo/mojom/media_types.mojom.h"
#include "mojo/public/cpp/bindings/type_converter.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
class AudioBuffer;
@@ -37,14 +37,14 @@
template <>
struct TypeConverter<media::mojom::DecoderBufferSideDataPtr,
- absl::optional<media::DecoderBufferSideData>> {
+ std::optional<media::DecoderBufferSideData>> {
static media::mojom::DecoderBufferSideDataPtr Convert(
- const absl::optional<media::DecoderBufferSideData>& input);
+ const std::optional<media::DecoderBufferSideData>& input);
};
template <>
-struct TypeConverter<absl::optional<media::DecoderBufferSideData>,
+struct TypeConverter<std::optional<media::DecoderBufferSideData>,
media::mojom::DecoderBufferSideDataPtr> {
- static absl::optional<media::DecoderBufferSideData> Convert(
+ static std::optional<media::DecoderBufferSideData> Convert(
const media::mojom::DecoderBufferSideDataPtr& input);
};
diff --git a/media/mojo/mojom/audio_processing_mojom_traits.cc b/media/mojo/mojom/audio_processing_mojom_traits.cc
index 284561b6..f575e3f 100644
--- a/media/mojo/mojom/audio_processing_mojom_traits.cc
+++ b/media/mojo/mojom/audio_processing_mojom_traits.cc
@@ -6,7 +6,7 @@
namespace mojo {
namespace {
-// Deserializes has_field and field into a absl::optional.
+// Deserializes has_field and field into a std::optional.
#define DESERIALIZE_INTO_OPT(field) \
if (input.has_##field()) \
out_stats->field = input.field()
diff --git a/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.cc b/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.cc
index fa834c2..86c20c4d 100644
--- a/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.cc
+++ b/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.cc
@@ -4,7 +4,7 @@
#include "media/mojo/mojom/media_foundation_cdm_data_mojom_traits.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
+#include <optional>
namespace mojo {
@@ -17,7 +17,7 @@
if (!input.ReadOriginId(&origin_id))
return false;
- absl::optional<std::vector<uint8_t>> client_token;
+ std::optional<std::vector<uint8_t>> client_token;
if (!input.ReadClientToken(&client_token))
return false;
diff --git a/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.h b/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.h
index c7d30248..46f48e2 100644
--- a/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.h
+++ b/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.h
@@ -22,7 +22,7 @@
return input->origin_id;
}
- static const absl::optional<std::vector<uint8_t>>& client_token(
+ static const std::optional<std::vector<uint8_t>>& client_token(
const std::unique_ptr<media::MediaFoundationCdmData>& input) {
return input->client_token;
}
diff --git a/media/mojo/mojom/speech_recognition_result.h b/media/mojo/mojom/speech_recognition_result.h
index 0c0718c..98121ba 100644
--- a/media/mojo/mojom/speech_recognition_result.h
+++ b/media/mojo/mojom/speech_recognition_result.h
@@ -5,11 +5,11 @@
#ifndef MEDIA_MOJO_MOJOM_SPEECH_RECOGNITION_RESULT_H_
#define MEDIA_MOJO_MOJOM_SPEECH_RECOGNITION_RESULT_H_
+#include <optional>
#include <string>
#include <vector>
#include "base/time/time.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -59,7 +59,7 @@
// chromeos/services/machine_learning/public/mojom/soda.mojom. Therefore, it
// must be optional. Hypothesis parts maybe non-empty optional containing a
// zero length vector if no words were spoken during the event's time span.
- absl::optional<std::vector<HypothesisParts>> hypothesis_parts;
+ std::optional<std::vector<HypothesisParts>> hypothesis_parts;
};
// A speech recognition result created by the speech service and passed to the
@@ -83,7 +83,7 @@
bool is_final = false;
// Timing information for the current transcription.
- absl::optional<TimingInformation> timing_information;
+ std::optional<TimingInformation> timing_information;
};
} // namespace media
diff --git a/media/mojo/mojom/speech_recognition_result_mojom_traits.cc b/media/mojo/mojom/speech_recognition_result_mojom_traits.cc
index f40bba4..fdec03c5 100644
--- a/media/mojo/mojom/speech_recognition_result_mojom_traits.cc
+++ b/media/mojo/mojom/speech_recognition_result_mojom_traits.cc
@@ -36,7 +36,7 @@
media::TimingInformation* out) {
base::TimeDelta audio_start_time = kZeroTime;
base::TimeDelta audio_end_time = kZeroTime;
- absl::optional<std::vector<media::HypothesisParts>> hypothesis_parts;
+ std::optional<std::vector<media::HypothesisParts>> hypothesis_parts;
if (!data.ReadAudioStartTime(&audio_start_time) ||
!data.ReadAudioEndTime(&audio_end_time) ||
@@ -70,7 +70,7 @@
Read(media::mojom::SpeechRecognitionResultDataView data,
media::SpeechRecognitionResult* out) {
std::string transcription;
- absl::optional<media::TimingInformation> timing_information;
+ std::optional<media::TimingInformation> timing_information;
if (!data.ReadTranscription(&transcription) ||
!data.ReadTimingInformation(&timing_information)) {
diff --git a/media/mojo/mojom/speech_recognition_result_mojom_traits.h b/media/mojo/mojom/speech_recognition_result_mojom_traits.h
index 8188830..2be168a 100644
--- a/media/mojo/mojom/speech_recognition_result_mojom_traits.h
+++ b/media/mojo/mojom/speech_recognition_result_mojom_traits.h
@@ -5,13 +5,13 @@
#ifndef MEDIA_MOJO_MOJOM_SPEECH_RECOGNITION_RESULT_MOJOM_TRAITS_H_
#define MEDIA_MOJO_MOJOM_SPEECH_RECOGNITION_RESULT_MOJOM_TRAITS_H_
+#include <optional>
#include <string>
#include <vector>
#include "base/time/time.h"
#include "media/mojo/mojom/speech_recognition.mojom.h"
#include "media/mojo/mojom/speech_recognition_result.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace mojo {
@@ -44,7 +44,7 @@
return r.audio_end_time;
}
- static const ::absl::optional<std::vector<media::HypothesisParts>>&
+ static const ::std::optional<std::vector<media::HypothesisParts>>&
hypothesis_parts(const media::TimingInformation& r) {
return r.hypothesis_parts;
}
@@ -66,7 +66,7 @@
return r.is_final;
}
- static const ::absl::optional<media::TimingInformation>& timing_information(
+ static const ::std::optional<media::TimingInformation>& timing_information(
const media::SpeechRecognitionResult& r) {
return r.timing_information;
}
diff --git a/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc b/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc
index b2b38c6..1832af8 100644
--- a/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc
+++ b/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc
@@ -407,17 +407,17 @@
}
// static
-absl::optional<media::DecoderBufferSideData>
+std::optional<media::DecoderBufferSideData>
StructTraits<media::stable::mojom::DecoderBufferDataView,
scoped_refptr<media::DecoderBuffer>>::
side_data(const scoped_refptr<media::DecoderBuffer>& input) {
static_assert(
std::is_same<decltype(input->side_data()),
- const absl::optional<media::DecoderBufferSideData>&>::value,
+ const std::optional<media::DecoderBufferSideData>&>::value,
"Unexpected type for input->side_data(). If you need to change this "
"assertion, please contact chromeos-gfx-video@google.com.");
if (input->end_of_stream()) {
- return absl::nullopt;
+ return std::nullopt;
}
return input->side_data();
}
@@ -478,7 +478,7 @@
back_discard);
decoder_buffer->set_discard_padding(discard_padding);
- absl::optional<media::DecoderBufferSideData> side_data;
+ std::optional<media::DecoderBufferSideData> side_data;
if (!input.ReadSideData(&side_data)) {
return false;
}
@@ -622,7 +622,7 @@
}
// static
-const absl::optional<media::EncryptionPattern>&
+const std::optional<media::EncryptionPattern>&
StructTraits<media::stable::mojom::DecryptConfigDataView,
std::unique_ptr<media::DecryptConfig>>::
encryption_pattern(const std::unique_ptr<media::DecryptConfig>& input) {
@@ -671,7 +671,7 @@
if (!input.ReadSubsamples(&subsamples))
return false;
- absl::optional<media::EncryptionPattern> encryption_pattern;
+ std::optional<media::EncryptionPattern> encryption_pattern;
if (!input.ReadEncryptionPattern(&encryption_pattern))
return false;
if (encryption_scheme != media::EncryptionScheme::kCbcs &&
@@ -950,7 +950,7 @@
}
// static
-absl::optional<media::internal::StatusData> StructTraits<
+std::optional<media::internal::StatusData> StructTraits<
media::stable::mojom::StatusDataDataView,
media::internal::StatusData>::cause(const media::internal::StatusData&
input) {
@@ -1037,7 +1037,7 @@
output_cause.group = std::string(media::DecoderStatusTraits::Group());
return output_cause;
}
- return absl::nullopt;
+ return std::nullopt;
}
// static
@@ -1117,7 +1117,7 @@
if (!file) {
return false;
}
- const absl::optional<int> line =
+ const std::optional<int> line =
dict.FindInt(media::StatusConstants::kLineKey);
if (!line) {
return false;
@@ -1127,7 +1127,7 @@
if (!data.ReadData(&output->data))
return false;
- absl::optional<media::internal::StatusData> cause;
+ std::optional<media::internal::StatusData> cause;
if (!data.ReadCause(&cause))
return false;
@@ -1167,7 +1167,7 @@
bool StructTraits<media::stable::mojom::StatusDataView, media::DecoderStatus>::
Read(media::stable::mojom::StatusDataView data,
media::DecoderStatus* output) {
- absl::optional<media::internal::StatusData> internal;
+ std::optional<media::internal::StatusData> internal;
if (!data.ReadInternal(&internal))
return false;
if (internal) {
@@ -1505,7 +1505,7 @@
}
// static
-const absl::optional<gfx::HDRMetadata>& StructTraits<
+const std::optional<gfx::HDRMetadata>& StructTraits<
media::stable::mojom::VideoDecoderConfigDataView,
media::VideoDecoderConfig>::hdr_metadata(const media::VideoDecoderConfig&
input) {
@@ -1573,7 +1573,7 @@
if (!input.ReadColorSpaceInfo(&color_space))
return false;
- absl::optional<gfx::HDRMetadata> hdr_metadata;
+ std::optional<gfx::HDRMetadata> hdr_metadata;
if (!input.ReadHdrMetadata(&hdr_metadata))
return false;
diff --git a/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h b/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h
index 728dea8..65e9298c 100644
--- a/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h
+++ b/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h
@@ -494,7 +494,7 @@
static base::TimeDelta back_discard(
const scoped_refptr<media::DecoderBuffer>& input);
- static absl::optional<media::DecoderBufferSideData> side_data(
+ static std::optional<media::DecoderBufferSideData> side_data(
const scoped_refptr<media::DecoderBuffer>& input);
static bool Read(media::stable::mojom::DecoderBufferDataView input,
@@ -536,7 +536,7 @@
static const std::vector<media::SubsampleEntry>& subsamples(
const std::unique_ptr<media::DecryptConfig>& input);
- static const absl::optional<media::EncryptionPattern>& encryption_pattern(
+ static const std::optional<media::EncryptionPattern>& encryption_pattern(
const std::unique_ptr<media::DecryptConfig>& input);
static bool Read(media::stable::mojom::DecryptConfigDataView input,
@@ -724,7 +724,7 @@
static const base::Value::List& frames(
const media::internal::StatusData& input);
- static absl::optional<media::internal::StatusData> cause(
+ static std::optional<media::internal::StatusData> cause(
const media::internal::StatusData& input);
static const base::Value& data(const media::internal::StatusData& input);
@@ -1185,7 +1185,7 @@
static const gfx::ColorSpace color_space_info(
const media::VideoDecoderConfig& input);
- static const absl::optional<gfx::HDRMetadata>& hdr_metadata(
+ static const std::optional<gfx::HDRMetadata>& hdr_metadata(
const media::VideoDecoderConfig& input);
static uint32_t level(const media::VideoDecoderConfig& input);
diff --git a/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits_unittest.cc b/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits_unittest.cc
index 4c5418b..c5a541e 100644
--- a/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits_unittest.cc
+++ b/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits_unittest.cc
@@ -380,7 +380,7 @@
stable::mojom::StatusData::New();
mojom_status_data->group = std::string(DecoderStatusTraits::Group());
mojom_status_data->code = stable::mojom::StatusCode::kError;
- mojom_status_data->cause = absl::make_optional<internal::StatusData>(
+ mojom_status_data->cause = std::make_optional<internal::StatusData>(
DecoderStatusTraits::Group(),
static_cast<StatusCodeType>(DecoderStatus::Codes::kAborted),
/*message=*/"",
@@ -415,7 +415,7 @@
mojom_decrypt_config->subsamples = {
SubsampleEntry(/*clear_bytes=*/4u, /*cypher_bytes=*/10u),
SubsampleEntry(/*clear_bytes=*/90u, /*cypher_bytes=*/2u)};
- mojom_decrypt_config->encryption_pattern = absl::nullopt;
+ mojom_decrypt_config->encryption_pattern = std::nullopt;
std::vector<uint8_t> serialized_decrypt_config =
stable::mojom::DecryptConfig::Serialize(&mojom_decrypt_config);
diff --git a/media/mojo/mojom/status_mojom_traits.cc b/media/mojo/mojom/status_mojom_traits.cc
index 2556d4a..082bf00 100644
--- a/media/mojo/mojom/status_mojom_traits.cc
+++ b/media/mojo/mojom/status_mojom_traits.cc
@@ -29,7 +29,7 @@
if (!data.ReadData(&output->data))
return false;
- absl::optional<media::internal::StatusData> cause;
+ std::optional<media::internal::StatusData> cause;
if (!data.ReadCause(&cause))
return false;
diff --git a/media/mojo/mojom/status_mojom_traits.h b/media/mojo/mojom/status_mojom_traits.h
index dc4ce48..f410f63 100644
--- a/media/mojo/mojom/status_mojom_traits.h
+++ b/media/mojo/mojom/status_mojom_traits.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_MOJO_MOJOM_STATUS_MOJOM_TRAITS_H_
#define MEDIA_MOJO_MOJOM_STATUS_MOJOM_TRAITS_H_
+#include <optional>
+
#include "base/containers/span.h"
#include "base/values.h"
#include "media/base/decoder_status.h"
@@ -13,7 +15,6 @@
#include "media/base/status.h"
#include "media/mojo/mojom/media_types.mojom.h"
#include "mojo/public/cpp/bindings/optional_as_pointer.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace mojo {
@@ -64,7 +65,7 @@
}
static bool Read(DataView data, media::TypedStatus<StatusEnum>* output) {
- absl::optional<media::internal::StatusData> internal;
+ std::optional<media::internal::StatusData> internal;
if (!data.ReadInternal(&internal))
return false;
if (internal)
diff --git a/media/mojo/mojom/video_decoder_config_mojom_traits.cc b/media/mojo/mojom/video_decoder_config_mojom_traits.cc
index fbb3712e..df6dac0 100644
--- a/media/mojo/mojom/video_decoder_config_mojom_traits.cc
+++ b/media/mojo/mojom/video_decoder_config_mojom_traits.cc
@@ -47,7 +47,7 @@
if (!input.ReadColorSpaceInfo(&color_space))
return false;
- absl::optional<gfx::HDRMetadata> hdr_metadata;
+ std::optional<gfx::HDRMetadata> hdr_metadata;
if (!input.ReadHdrMetadata(&hdr_metadata))
return false;
diff --git a/media/mojo/mojom/video_decoder_config_mojom_traits.h b/media/mojo/mojom/video_decoder_config_mojom_traits.h
index f79c60f..2cd322c 100644
--- a/media/mojo/mojom/video_decoder_config_mojom_traits.h
+++ b/media/mojo/mojom/video_decoder_config_mojom_traits.h
@@ -5,12 +5,13 @@
#ifndef MEDIA_MOJO_MOJOM_VIDEO_DECODER_CONFIG_MOJOM_TRAITS_H_
#define MEDIA_MOJO_MOJOM_VIDEO_DECODER_CONFIG_MOJOM_TRAITS_H_
+#include <optional>
+
#include "media/base/ipc/media_param_traits.h"
#include "media/base/video_decoder_config.h"
#include "media/mojo/mojom/media_types.mojom.h"
#include "media/mojo/mojom/video_color_space_mojom_traits.h"
#include "media/mojo/mojom/video_transformation_mojom_traits.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/mojom/geometry_mojom_traits.h"
#include "ui/gfx/mojom/hdr_metadata_mojom_traits.h"
@@ -65,7 +66,7 @@
return input.video_transformation();
}
- static const absl::optional<gfx::HDRMetadata>& hdr_metadata(
+ static const std::optional<gfx::HDRMetadata>& hdr_metadata(
const media::VideoDecoderConfig& input) {
return input.hdr_metadata();
}
diff --git a/media/mojo/mojom/video_encode_accelerator_mojom_traits.cc b/media/mojo/mojom/video_encode_accelerator_mojom_traits.cc
index 8d55113..94bafbe 100644
--- a/media/mojo/mojom/video_encode_accelerator_mojom_traits.cc
+++ b/media/mojo/mojom/video_encode_accelerator_mojom_traits.cc
@@ -4,12 +4,13 @@
#include "media/mojo/mojom/video_encode_accelerator_mojom_traits.h"
+#include <optional>
+
#include "base/notreached.h"
#include "media/base/video_bitrate_allocation.h"
#include "media/mojo/mojom/video_encode_accelerator.mojom.h"
#include "media/video/video_encode_accelerator.h"
#include "mojo/public/cpp/base/time_mojom_traits.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace mojo {
@@ -129,7 +130,7 @@
media::VideoBitrateAllocation>::
Read(media::mojom::VideoBitrateAllocationDataView data,
media::VideoBitrateAllocation* out_bitrate_allocation) {
- absl::optional<uint32_t> peak_bps;
+ std::optional<uint32_t> peak_bps;
if (!data.ReadVariableBitratePeak(&peak_bps))
return false;
if (peak_bps.has_value()) {
@@ -479,21 +480,21 @@
if (!input.ReadBitrate(&bitrate))
return false;
- absl::optional<uint32_t> initial_framerate;
+ std::optional<uint32_t> initial_framerate;
if (input.has_initial_framerate())
initial_framerate = input.initial_framerate();
- absl::optional<uint32_t> gop_length;
+ std::optional<uint32_t> gop_length;
if (input.has_gop_length())
gop_length = input.gop_length();
- absl::optional<uint8_t> h264_output_level;
+ std::optional<uint8_t> h264_output_level;
if (input.has_h264_output_level())
h264_output_level = input.h264_output_level();
bool is_constrained_h264 = input.is_constrained_h264();
- absl::optional<media::VideoEncodeAccelerator::Config::StorageType>
+ std::optional<media::VideoEncodeAccelerator::Config::StorageType>
storage_type;
if (input.has_storage_type()) {
if (!input.ReadStorageType(&storage_type))
@@ -528,11 +529,11 @@
gfx::Size input_visible_size;
media::VideoCodecProfile output_profile;
media::Bitrate bitrate;
- absl::optional<uint32_t> initial_framerate;
- absl::optional<uint32_t> gop_length;
- absl::optional<uint8_t> h264_output_level;
+ std::optional<uint32_t> initial_framerate;
+ std::optional<uint32_t> gop_length;
+ std::optional<uint8_t> h264_output_level;
bool is_constrained_h264;
- absl::optional<media::VideoEncodeAccelerator::Config::StorageType>
+ std::optional<media::VideoEncodeAccelerator::Config::StorageType>
storage_type;
media::VideoEncodeAccelerator::Config::ContentType content_type;
uint8_t drop_frame_thresh_percentage;
diff --git a/media/mojo/mojom/video_encode_accelerator_mojom_traits.h b/media/mojo/mojom/video_encode_accelerator_mojom_traits.h
index 9e7312c..484d2cd 100644
--- a/media/mojo/mojom/video_encode_accelerator_mojom_traits.h
+++ b/media/mojo/mojom/video_encode_accelerator_mojom_traits.h
@@ -108,12 +108,12 @@
static std::vector<uint32_t> bitrates(
const media::VideoBitrateAllocation& bitrate_allocation);
- static absl::optional<uint32_t> variable_bitrate_peak(
+ static std::optional<uint32_t> variable_bitrate_peak(
const media::VideoBitrateAllocation& bitrate_allocation) {
if (bitrate_allocation.GetMode() == media::Bitrate::Mode::kConstant) {
- return absl::nullopt;
+ return std::nullopt;
} else {
- return absl::optional<uint32_t>(
+ return std::optional<uint32_t>(
bitrate_allocation.GetSumBitrate().peak_bps());
}
}
@@ -223,11 +223,11 @@
const media::BitstreamBufferMetadata& bbm) {
return bbm;
}
- static absl::optional<gfx::Size> encoded_size(
+ static std::optional<gfx::Size> encoded_size(
const media::BitstreamBufferMetadata& bbm) {
return bbm.encoded_size;
}
- static absl::optional<gfx::ColorSpace> encoded_color_space(
+ static std::optional<gfx::ColorSpace> encoded_color_space(
const media::BitstreamBufferMetadata& bbm) {
return bbm.encoded_color_space;
}
diff --git a/media/mojo/mojom/video_frame_metadata_mojom_traits.cc b/media/mojo/mojom/video_frame_metadata_mojom_traits.cc
index 7bb91b7..b73e57f 100644
--- a/media/mojo/mojom/video_frame_metadata_mojom_traits.cc
+++ b/media/mojo/mojom/video_frame_metadata_mojom_traits.cc
@@ -14,13 +14,13 @@
namespace mojo {
-// Deserializes has_field and field into a absl::optional.
+// Deserializes has_field and field into a std::optional.
#define DESERIALIZE_INTO_OPT(field) \
if (input.has_##field()) \
output->field = input.field()
#define READ_AND_ASSIGN_OPT(type, field, FieldInCamelCase) \
- absl::optional<type> field; \
+ std::optional<type> field; \
if (!input.Read##FieldInCamelCase(&field)) \
return false; \
\
diff --git a/media/mojo/mojom/video_frame_metadata_mojom_traits.h b/media/mojo/mojom/video_frame_metadata_mojom_traits.h
index 8314b44..ea721fd 100644
--- a/media/mojo/mojom/video_frame_metadata_mojom_traits.h
+++ b/media/mojo/mojom/video_frame_metadata_mojom_traits.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_MOJO_MOJOM_VIDEO_FRAME_METADATA_MOJOM_TRAITS_H_
#define MEDIA_MOJO_MOJOM_VIDEO_FRAME_METADATA_MOJOM_TRAITS_H_
+#include <optional>
+
#include "media/base/ipc/media_param_traits_macros.h"
#include "media/base/video_frame_metadata.h"
#include "media/base/video_transformation.h"
@@ -12,12 +14,11 @@
#include "media/mojo/mojom/media_types_enum_mojom_traits.h"
#include "media/mojo/mojom/video_transformation_mojom_traits.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/mojom/geometry_mojom_traits.h"
namespace mojo {
-// Creates a has_foo() and a foo() to serialize a foo absl::optional<>.
+// Creates a has_foo() and a foo() to serialize a foo std::optional<>.
#define GENERATE_OPT_SERIALIZATION(type, field, default_value) \
static bool has_##field(const media::VideoFrameMetadata& input) { \
return input.field.has_value(); \
@@ -90,7 +91,7 @@
GENERATE_OPT_SERIALIZATION(int, capture_counter, 0)
- static const absl::optional<media::VideoTransformation>& transformation(
+ static const std::optional<media::VideoTransformation>& transformation(
const media::VideoFrameMetadata& input) {
return input.transformation;
}
@@ -103,72 +104,72 @@
GENERATE_OPT_SERIALIZATION(double, frame_rate, 0.0)
GENERATE_OPT_SERIALIZATION(double, rtp_timestamp, 0.0)
- static const absl::optional<gfx::Rect>& capture_update_rect(
+ static const std::optional<gfx::Rect>& capture_update_rect(
const media::VideoFrameMetadata& input) {
return input.capture_update_rect;
}
- static const absl::optional<gfx::Size>& source_size(
+ static const std::optional<gfx::Size>& source_size(
const media::VideoFrameMetadata& input) {
return input.source_size;
}
- static const absl::optional<gfx::Rect>& region_capture_rect(
+ static const std::optional<gfx::Rect>& region_capture_rect(
const media::VideoFrameMetadata& input) {
return input.region_capture_rect;
}
- static const absl::optional<base::UnguessableToken>& overlay_plane_id(
+ static const std::optional<base::UnguessableToken>& overlay_plane_id(
const media::VideoFrameMetadata& input) {
return input.overlay_plane_id;
}
- static absl::optional<base::TimeTicks> receive_time(
+ static std::optional<base::TimeTicks> receive_time(
const media::VideoFrameMetadata& input) {
return input.receive_time;
}
- static absl::optional<base::TimeTicks> capture_begin_time(
+ static std::optional<base::TimeTicks> capture_begin_time(
const media::VideoFrameMetadata& input) {
return input.capture_begin_time;
}
- static absl::optional<base::TimeTicks> capture_end_time(
+ static std::optional<base::TimeTicks> capture_end_time(
const media::VideoFrameMetadata& input) {
return input.capture_end_time;
}
- static absl::optional<base::TimeTicks> decode_begin_time(
+ static std::optional<base::TimeTicks> decode_begin_time(
const media::VideoFrameMetadata& input) {
return input.decode_begin_time;
}
- static absl::optional<base::TimeTicks> decode_end_time(
+ static std::optional<base::TimeTicks> decode_end_time(
const media::VideoFrameMetadata& input) {
return input.decode_end_time;
}
- static absl::optional<base::TimeTicks> reference_time(
+ static std::optional<base::TimeTicks> reference_time(
const media::VideoFrameMetadata& input) {
return input.reference_time;
}
- static absl::optional<base::TimeDelta> processing_time(
+ static std::optional<base::TimeDelta> processing_time(
const media::VideoFrameMetadata& input) {
return input.processing_time;
}
- static absl::optional<base::TimeDelta> frame_duration(
+ static std::optional<base::TimeDelta> frame_duration(
const media::VideoFrameMetadata& input) {
return input.frame_duration;
}
- static absl::optional<base::TimeDelta> wallclock_frame_duration(
+ static std::optional<base::TimeDelta> wallclock_frame_duration(
const media::VideoFrameMetadata& input) {
return input.wallclock_frame_duration;
}
- static absl::optional<uint64_t> frame_sequence(
+ static std::optional<uint64_t> frame_sequence(
const media::VideoFrameMetadata& input) {
return input.frame_sequence;
}
diff --git a/media/mojo/mojom/video_frame_mojom_traits.cc b/media/mojo/mojom/video_frame_mojom_traits.cc
index ee3428c..430e081 100644
--- a/media/mojo/mojom/video_frame_mojom_traits.cc
+++ b/media/mojo/mojom/video_frame_mojom_traits.cc
@@ -301,7 +301,7 @@
for (size_t i = 0; i < mailbox_holder.size(); i++)
mailbox_holder_array[i] = mailbox_holder[i];
- absl::optional<gfx::BufferFormat> buffer_format =
+ std::optional<gfx::BufferFormat> buffer_format =
VideoPixelFormatToGfxBufferFormat(format);
if (!buffer_format)
return false;
@@ -336,7 +336,7 @@
for (size_t i = 0; i < media::VideoFrame::kMaxPlanes; i++)
mailbox_holder_array[i] = mailbox_holder[i];
- absl::optional<gpu::VulkanYCbCrInfo> ycbcr_info;
+ std::optional<gpu::VulkanYCbCrInfo> ycbcr_info;
if (!mailbox_data.ReadYcbcrData(&ycbcr_info))
return false;
@@ -364,7 +364,7 @@
return false;
frame->set_color_space(color_space);
- absl::optional<gfx::HDRMetadata> hdr_metadata;
+ std::optional<gfx::HDRMetadata> hdr_metadata;
if (!input.ReadHdrMetadata(&hdr_metadata))
return false;
frame->set_hdr_metadata(std::move(hdr_metadata));
diff --git a/media/mojo/mojom/video_frame_mojom_traits.h b/media/mojo/mojom/video_frame_mojom_traits.h
index 9cb8e33..114f7c9 100644
--- a/media/mojo/mojom/video_frame_mojom_traits.h
+++ b/media/mojo/mojom/video_frame_mojom_traits.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_MOJO_MOJOM_VIDEO_FRAME_MOJOM_TRAITS_H_
#define MEDIA_MOJO_MOJOM_VIDEO_FRAME_MOJOM_TRAITS_H_
+#include <optional>
+
#include "base/memory/scoped_refptr.h"
#include "gpu/ipc/common/mailbox_holder_mojom_traits.h"
#include "gpu/ipc/common/vulkan_ycbcr_info_mojom_traits.h"
@@ -13,7 +15,6 @@
#include "media/mojo/mojom/media_types.mojom.h"
#include "mojo/public/cpp/bindings/enum_traits.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/mojom/geometry_mojom_traits.h"
#include "ui/gfx/ipc/color/gfx_param_traits.h"
@@ -72,7 +73,7 @@
return input->ColorSpace();
}
- static const absl::optional<gfx::HDRMetadata>& hdr_metadata(
+ static const std::optional<gfx::HDRMetadata>& hdr_metadata(
const scoped_refptr<media::VideoFrame>& input) {
return input->hdr_metadata();
}
@@ -82,7 +83,7 @@
return input->shared_image_format_type();
}
- static const absl::optional<gpu::VulkanYCbCrInfo>& ycbcr_info(
+ static const std::optional<gpu::VulkanYCbCrInfo>& ycbcr_info(
const scoped_refptr<media::VideoFrame>& input) {
return input->ycbcr_info();
}
diff --git a/media/mojo/services/fuchsia_cdm_manager.cc b/media/mojo/services/fuchsia_cdm_manager.cc
index f6efd40..258bfed 100644
--- a/media/mojo/services/fuchsia_cdm_manager.cc
+++ b/media/mojo/services/fuchsia_cdm_manager.cc
@@ -8,6 +8,8 @@
#include <lib/fidl/cpp/binding_set.h>
#include <lib/fpromise/promise.h>
+#include <optional>
+
#include "base/containers/flat_set.h"
#include "base/containers/unique_ptr_adapters.h"
#include "base/files/file_enumerator.h"
@@ -24,7 +26,6 @@
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "media/mojo/services/fuchsia_cdm_provisioning_fetcher_impl.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
namespace media {
@@ -134,7 +135,7 @@
}
// Returns a nullopt if storage was created successfully.
-absl::optional<base::File::Error> CreateStorageDirectory(base::FilePath path) {
+std::optional<base::File::Error> CreateStorageDirectory(base::FilePath path) {
base::File::Error error;
bool success = base::CreateDirectoryAndGetError(path, &error);
if (!success) {
@@ -178,7 +179,7 @@
CreateFetcherCB create_fetcher_callback,
fidl::InterfaceRequest<fuchsia::media::drm::ContentDecryptionModule>
request) {
- absl::optional<DataStoreId> data_store_id = GetDataStoreIdForPath(
+ std::optional<DataStoreId> data_store_id = GetDataStoreIdForPath(
std::move(storage_path), std::move(create_fetcher_callback));
if (!data_store_id) {
request.Close(ZX_ERR_NO_RESOURCES);
@@ -196,7 +197,7 @@
private:
using DataStoreId = uint32_t;
- absl::optional<DataStoreId> GetDataStoreIdForPath(
+ std::optional<DataStoreId> GetDataStoreIdForPath(
base::FilePath storage_path,
CreateFetcherCB create_fetcher_callback) {
// If we have already added a data store id for that path, just use that
@@ -210,7 +211,7 @@
base::OpenDirectoryHandle(storage_path);
if (!data_directory.is_valid()) {
DLOG(ERROR) << "Unable to OpenDirectory " << storage_path;
- return absl::nullopt;
+ return std::nullopt;
}
auto provisioning_fetcher =
@@ -280,7 +281,7 @@
FuchsiaCdmManager::FuchsiaCdmManager(
CreateKeySystemCallbackMap create_key_system_callbacks_by_name,
base::FilePath cdm_data_path,
- absl::optional<uint64_t> cdm_data_quota_bytes)
+ std::optional<uint64_t> cdm_data_quota_bytes)
: create_key_system_callbacks_by_name_(
std::move(create_key_system_callbacks_by_name)),
cdm_data_path_(std::move(cdm_data_path)),
@@ -375,7 +376,7 @@
fidl::InterfaceRequest<fuchsia::media::drm::ContentDecryptionModule>
request,
base::FilePath storage_path,
- absl::optional<base::File::Error> storage_creation_error) {
+ std::optional<base::File::Error> storage_creation_error) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (storage_creation_error) {
diff --git a/media/mojo/services/fuchsia_cdm_manager.h b/media/mojo/services/fuchsia_cdm_manager.h
index 69ff969..ef97b9ea 100644
--- a/media/mojo/services/fuchsia_cdm_manager.h
+++ b/media/mojo/services/fuchsia_cdm_manager.h
@@ -6,6 +6,8 @@
#define MEDIA_MOJO_SERVICES_FUCHSIA_CDM_MANAGER_H_
#include <fuchsia/media/drm/cpp/fidl.h>
+
+#include <optional>
#include <string>
#include "base/containers/flat_map.h"
@@ -17,7 +19,6 @@
#include "base/threading/thread_checker.h"
#include "media/base/provision_fetcher.h"
#include "media/mojo/services/media_mojo_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace url {
class Origin;
@@ -43,7 +44,7 @@
FuchsiaCdmManager(
CreateKeySystemCallbackMap create_key_system_callbacks_by_name,
base::FilePath cdm_data_path,
- absl::optional<uint64_t> cdm_data_quota_bytes);
+ std::optional<uint64_t> cdm_data_quota_bytes);
~FuchsiaCdmManager();
@@ -78,13 +79,13 @@
fidl::InterfaceRequest<fuchsia::media::drm::ContentDecryptionModule>
request,
base::FilePath storage_path,
- absl::optional<base::File::Error> storage_creation_error);
+ std::optional<base::File::Error> storage_creation_error);
void OnKeySystemClientError(const std::string& key_system_name);
// A map of callbacks to create KeySystem channels indexed by their EME name.
const CreateKeySystemCallbackMap create_key_system_callbacks_by_name_;
const base::FilePath cdm_data_path_;
- const absl::optional<uint64_t> cdm_data_quota_bytes_;
+ const std::optional<uint64_t> cdm_data_quota_bytes_;
// Used for operations on the CDM data directory.
const scoped_refptr<base::SequencedTaskRunner> storage_task_runner_;
diff --git a/media/mojo/services/fuchsia_cdm_manager_unittest.cc b/media/mojo/services/fuchsia_cdm_manager_unittest.cc
index e826fd9..27aa628 100644
--- a/media/mojo/services/fuchsia_cdm_manager_unittest.cc
+++ b/media/mojo/services/fuchsia_cdm_manager_unittest.cc
@@ -92,7 +92,7 @@
std::unique_ptr<FuchsiaCdmManager> CreateFuchsiaCdmManager(
std::vector<base::StringPiece> key_systems,
- absl::optional<uint64_t> cdm_data_quota_bytes = absl::nullopt) {
+ std::optional<uint64_t> cdm_data_quota_bytes = std::nullopt) {
FuchsiaCdmManager::CreateKeySystemCallbackMap create_key_system_callbacks;
for (const base::StringPiece& name : key_systems) {
diff --git a/media/mojo/services/fuchsia_cdm_provisioning_fetcher_impl.cc b/media/mojo/services/fuchsia_cdm_provisioning_fetcher_impl.cc
index 4d16ed3..892326a 100644
--- a/media/mojo/services/fuchsia_cdm_provisioning_fetcher_impl.cc
+++ b/media/mojo/services/fuchsia_cdm_provisioning_fetcher_impl.cc
@@ -45,7 +45,7 @@
return;
}
- absl::optional<std::string> request_str =
+ std::optional<std::string> request_str =
base::StringFromMemBuffer(request.message);
if (!request_str) {
DLOG(WARNING) << "Failed to read ProvisioningRequest.";
diff --git a/media/mojo/services/fuchsia_cdm_provisioning_fetcher_impl_unittest.cc b/media/mojo/services/fuchsia_cdm_provisioning_fetcher_impl_unittest.cc
index 3d3258d4..8297ace 100644
--- a/media/mojo/services/fuchsia_cdm_provisioning_fetcher_impl_unittest.cc
+++ b/media/mojo/services/fuchsia_cdm_provisioning_fetcher_impl_unittest.cc
@@ -78,7 +78,7 @@
fetcher.Bind(base::MakeExpectedNotRunClosure(FROM_HERE));
- absl::optional<std::string> response_message;
+ std::optional<std::string> response_message;
fetcher.Fetch(CreateProvisioningRequest(kTestDefaultUrl, kTestRequest),
[&](drm::ProvisioningResponse response) {
response_message =
@@ -102,7 +102,7 @@
fetcher.Bind(base::MakeExpectedNotRunClosure(FROM_HERE));
- absl::optional<std::string> response_message;
+ std::optional<std::string> response_message;
fetcher.Fetch(CreateProvisioningRequest(kTestDefaultUrl, kTestRequest),
[&](drm::ProvisioningResponse response) {
response_message =
diff --git a/media/mojo/services/gpu_mojo_media_client.cc b/media/mojo/services/gpu_mojo_media_client.cc
index 276a68f2..571b9c5 100644
--- a/media/mojo/services/gpu_mojo_media_client.cc
+++ b/media/mojo/services/gpu_mojo_media_client.cc
@@ -4,6 +4,7 @@
#include "media/mojo/services/gpu_mojo_media_client.h"
+#include <optional>
#include <utility>
#include "base/feature_list.h"
@@ -28,7 +29,6 @@
#include "media/gpu/ipc/service/media_gpu_channel_manager.h"
#include "media/mojo/mojom/video_decoder.mojom.h"
#include "media/video/video_decode_accelerator.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -208,7 +208,7 @@
return supported_config_cache_.value_or(SupportedVideoDecoderConfigs{});
}
-absl::optional<SupportedVideoDecoderConfigs>
+std::optional<SupportedVideoDecoderConfigs>
GpuMojoMediaClient::GetSupportedVideoDecoderConfigsStatic(
base::WeakPtr<MediaGpuChannelManager> manager,
const gpu::GpuPreferences& gpu_preferences,
diff --git a/media/mojo/services/gpu_mojo_media_client.h b/media/mojo/services/gpu_mojo_media_client.h
index 050cb79b..e07286a 100644
--- a/media/mojo/services/gpu_mojo_media_client.h
+++ b/media/mojo/services/gpu_mojo_media_client.h
@@ -6,6 +6,7 @@
#define MEDIA_MOJO_SERVICES_GPU_MOJO_MEDIA_CLIENT_H_
#include <memory>
+#include <optional>
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
@@ -22,7 +23,6 @@
#include "media/base/supported_video_decoder_config.h"
#include "media/media_buildflags.h"
#include "media/mojo/services/mojo_media_client.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace gpu {
class GpuMemoryBufferFactory;
@@ -111,7 +111,7 @@
// supported profiles. Some platforms fall back to use the VDAVideoDecoder
// so that implementation is shared, and its supported configs can be
// queries using the |get_vda_configs| callback.
-absl::optional<SupportedVideoDecoderConfigs>
+std::optional<SupportedVideoDecoderConfigs>
GetPlatformSupportedVideoDecoderConfigs(
base::WeakPtr<MediaGpuChannelManager> manager,
gpu::GpuDriverBugWorkarounds gpu_workarounds,
@@ -187,7 +187,7 @@
std::unique_ptr<CdmFactory> CreateCdmFactory(
mojom::FrameInterfaceFactory* interface_provider) final;
- static absl::optional<SupportedVideoDecoderConfigs>
+ static std::optional<SupportedVideoDecoderConfigs>
GetSupportedVideoDecoderConfigsStatic(
base::WeakPtr<MediaGpuChannelManager> manager,
const gpu::GpuPreferences& gpu_preferences,
@@ -196,7 +196,7 @@
private:
// Cross-platform cache supported config cache.
- absl::optional<SupportedVideoDecoderConfigs> supported_config_cache_;
+ std::optional<SupportedVideoDecoderConfigs> supported_config_cache_;
gpu::GpuPreferences gpu_preferences_;
gpu::GpuDriverBugWorkarounds gpu_workarounds_;
diff --git a/media/mojo/services/gpu_mojo_media_client_android.cc b/media/mojo/services/gpu_mojo_media_client_android.cc
index 68f72b60..bb083cb 100644
--- a/media/mojo/services/gpu_mojo_media_client_android.cc
+++ b/media/mojo/services/gpu_mojo_media_client_android.cc
@@ -81,7 +81,7 @@
ref_counted_lock);
}
-absl::optional<SupportedVideoDecoderConfigs>
+std::optional<SupportedVideoDecoderConfigs>
GetPlatformSupportedVideoDecoderConfigs(
base::WeakPtr<MediaGpuChannelManager> manager,
gpu::GpuDriverBugWorkarounds gpu_workarounds,
diff --git a/media/mojo/services/gpu_mojo_media_client_cros.cc b/media/mojo/services/gpu_mojo_media_client_cros.cc
index 1b540be8..b34e80c 100644
--- a/media/mojo/services/gpu_mojo_media_client_cros.cc
+++ b/media/mojo/services/gpu_mojo_media_client_cros.cc
@@ -117,7 +117,7 @@
}
}
-absl::optional<SupportedVideoDecoderConfigs>
+std::optional<SupportedVideoDecoderConfigs>
GetPlatformSupportedVideoDecoderConfigs(
base::WeakPtr<MediaGpuChannelManager> manager,
gpu::GpuDriverBugWorkarounds gpu_workarounds,
@@ -135,7 +135,7 @@
return VideoDecoderPipeline::GetSupportedConfigs(decoder_implementation,
gpu_workarounds);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
diff --git a/media/mojo/services/gpu_mojo_media_client_linux.cc b/media/mojo/services/gpu_mojo_media_client_linux.cc
index e383fbeb..dbf739b 100644
--- a/media/mojo/services/gpu_mojo_media_client_linux.cc
+++ b/media/mojo/services/gpu_mojo_media_client_linux.cc
@@ -177,7 +177,7 @@
}
}
-absl::optional<SupportedVideoDecoderConfigs>
+std::optional<SupportedVideoDecoderConfigs>
GetPlatformSupportedVideoDecoderConfigs(
base::WeakPtr<MediaGpuChannelManager> manager,
gpu::GpuDriverBugWorkarounds gpu_workarounds,
@@ -195,7 +195,7 @@
return VideoDecoderPipeline::GetSupportedConfigs(decoder_implementation,
gpu_workarounds);
default:
- return absl::nullopt;
+ return std::nullopt;
}
}
diff --git a/media/mojo/services/gpu_mojo_media_client_mac.cc b/media/mojo/services/gpu_mojo_media_client_mac.cc
index 18d0b20..cc41bf27 100644
--- a/media/mojo/services/gpu_mojo_media_client_mac.cc
+++ b/media/mojo/services/gpu_mojo_media_client_mac.cc
@@ -42,7 +42,7 @@
VideoDecodeAccelerator::Config::OutputMode::kAllocate);
}
-absl::optional<SupportedVideoDecoderConfigs>
+std::optional<SupportedVideoDecoderConfigs>
GetPlatformSupportedVideoDecoderConfigs(
base::WeakPtr<MediaGpuChannelManager> manager,
gpu::GpuDriverBugWorkarounds gpu_workarounds,
diff --git a/media/mojo/services/gpu_mojo_media_client_stubs.cc b/media/mojo/services/gpu_mojo_media_client_stubs.cc
index d829b6b..9e8d71a 100644
--- a/media/mojo/services/gpu_mojo_media_client_stubs.cc
+++ b/media/mojo/services/gpu_mojo_media_client_stubs.cc
@@ -17,7 +17,7 @@
return nullptr;
}
-absl::optional<SupportedVideoDecoderConfigs>
+std::optional<SupportedVideoDecoderConfigs>
GetPlatformSupportedVideoDecoderConfigs(
base::WeakPtr<MediaGpuChannelManager> manager,
gpu::GpuDriverBugWorkarounds gpu_workarounds,
diff --git a/media/mojo/services/gpu_mojo_media_client_win.cc b/media/mojo/services/gpu_mojo_media_client_win.cc
index e50e62a..9eb1137e 100644
--- a/media/mojo/services/gpu_mojo_media_client_win.cc
+++ b/media/mojo/services/gpu_mojo_media_client_win.cc
@@ -65,7 +65,7 @@
std::move(task_runner));
}
-absl::optional<SupportedVideoDecoderConfigs>
+std::optional<SupportedVideoDecoderConfigs>
GetPlatformSupportedVideoDecoderConfigs(
base::WeakPtr<MediaGpuChannelManager> manager,
gpu::GpuDriverBugWorkarounds gpu_workarounds,
diff --git a/media/mojo/services/media_foundation_renderer_wrapper.cc b/media/mojo/services/media_foundation_renderer_wrapper.cc
index 633cf781..9d975f9c 100644
--- a/media/mojo/services/media_foundation_renderer_wrapper.cc
+++ b/media/mojo/services/media_foundation_renderer_wrapper.cc
@@ -96,7 +96,7 @@
}
void MediaFoundationRendererWrapper::SetLatencyHint(
- absl::optional<base::TimeDelta> latency_hint) {
+ std::optional<base::TimeDelta> latency_hint) {
renderer_->SetLatencyHint(latency_hint);
}
@@ -169,7 +169,7 @@
base::win::ScopedHandle handle,
const std::string& error) {
if (!handle.IsValid()) {
- std::move(callback).Run(absl::nullopt, "invalid handle: " + error);
+ std::move(callback).Run(std::nullopt, "invalid handle: " + error);
return;
}
@@ -185,12 +185,12 @@
dcomp_surface_registry_->RegisterDCOMPSurfaceHandle(
mojo::PlatformHandle(std::move(handle)),
mojo::WrapCallbackWithDefaultInvokeIfNotRun(std::move(register_cb),
- absl::nullopt));
+ std::nullopt));
}
void MediaFoundationRendererWrapper::OnDCOMPSurfaceHandleRegistered(
GetDCOMPSurfaceCallback callback,
- const absl::optional<base::UnguessableToken>& token) {
+ const std::optional<base::UnguessableToken>& token) {
std::string error;
if (token) {
DCHECK(dcomp_surface_token_.is_empty());
diff --git a/media/mojo/services/media_foundation_renderer_wrapper.h b/media/mojo/services/media_foundation_renderer_wrapper.h
index 334d51e4..54400f0a 100644
--- a/media/mojo/services/media_foundation_renderer_wrapper.h
+++ b/media/mojo/services/media_foundation_renderer_wrapper.h
@@ -51,7 +51,7 @@
RendererClient* client,
PipelineStatusCallback init_cb) override;
void SetCdm(CdmContext* cdm_context, CdmAttachedCB cdm_attached_cb) override;
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) override;
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) override;
void Flush(base::OnceClosure flush_cb) override;
void StartPlayingFrom(base::TimeDelta time) override;
void SetPlaybackRate(double playback_rate) override;
@@ -79,7 +79,7 @@
const std::string& error);
void OnDCOMPSurfaceHandleRegistered(
GetDCOMPSurfaceCallback callback,
- const absl::optional<base::UnguessableToken>& token);
+ const std::optional<base::UnguessableToken>& token);
void OnFrameGeneratedByMediaFoundation(
const base::UnguessableToken& frame_token,
const gfx::Size& frame_size,
diff --git a/media/mojo/services/media_foundation_service.cc b/media/mojo/services/media_foundation_service.cc
index 781442d..141288a 100644
--- a/media/mojo/services/media_foundation_service.cc
+++ b/media/mojo/services/media_foundation_service.cc
@@ -6,6 +6,7 @@
#include <map>
#include <memory>
+#include <optional>
#include "base/check.h"
#include "base/feature_list.h"
@@ -34,7 +35,6 @@
#include "media/mojo/mojom/interface_factory.mojom.h"
#include "media/mojo/mojom/key_system_support.mojom.h"
#include "media/mojo/services/interface_factory_impl.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
using Microsoft::WRL::ComPtr;
@@ -206,7 +206,7 @@
// Construct the query type string based on `video_codec`, optional
// `audio_codec`, `kDefaultFeatures` and `extra_features`.
std::string GetTypeString(VideoCodec video_codec,
- absl::optional<AudioCodec> audio_codec,
+ std::optional<AudioCodec> audio_codec,
const FeatureMap& extra_features) {
auto codec_string = GetFourCCString(video_codec);
if (audio_codec.has_value())
@@ -228,7 +228,7 @@
// This will help us avoid errors in faulty creation of the type string, and
// centralize from where we call IsTypeSupportedInternal()
bool IsTypeSupported(VideoCodec video_codec,
- absl::optional<AudioCodec> audio_codec,
+ std::optional<AudioCodec> audio_codec,
const FeatureMap& extra_features,
ComPtr<IMFContentDecryptionModuleFactory> cdm_factory,
const std::string& key_system,
@@ -251,7 +251,7 @@
{kEncryptionIvQueryName, base::NumberToString(GetIvSize(scheme))},
{kRobustnessQueryName, robustness.c_str()}};
- if (IsTypeSupported(video_codec, /*audio_codec=*/absl::nullopt,
+ if (IsTypeSupported(video_codec, /*audio_codec=*/std::nullopt,
extra_features, cdm_factory, key_system,
is_hw_secure)) {
supported_schemes.insert(scheme);
@@ -285,7 +285,7 @@
// Create the dummy CDM.
Microsoft::WRL::ComPtr<IMFContentDecryptionModule> mf_cdm;
auto hr = CreateMediaFoundationCdm(cdm_factory, cdm_config, cdm_origin_id,
- /*cdm_client_token=*/absl::nullopt,
+ /*cdm_client_token=*/std::nullopt,
dummy_cdm_store_path_root, mf_cdm);
DLOG_IF(ERROR, FAILED(hr)) << __func__ << ": Failed for " << key_system;
mf_cdm.Reset();
@@ -302,7 +302,7 @@
return hr;
}
-absl::optional<CdmCapability> GetCdmCapability(
+std::optional<CdmCapability> GetCdmCapability(
ComPtr<IMFContentDecryptionModuleFactory> cdm_factory,
const std::string& key_system,
bool is_hw_secure) {
@@ -313,7 +313,7 @@
// dummy CDM instance to detect this case.
if (is_hw_secure &&
FAILED(CreateDummyMediaFoundationCdm(cdm_factory, key_system))) {
- return absl::nullopt;
+ return std::nullopt;
}
// TODO(hmchen): make this generic for more key systems.
@@ -342,7 +342,7 @@
const FeatureMap extra_features = {{kRobustnessQueryName, robustness}};
- if (IsTypeSupported(video_codec, /*audio_codec=*/absl::nullopt,
+ if (IsTypeSupported(video_codec, /*audio_codec=*/std::nullopt,
extra_features, cdm_factory, key_system,
is_hw_secure)) {
// IsTypeSupported() does not support querying profiling, in general
@@ -380,7 +380,7 @@
// codecs are supported.
if (capability.video_codecs.empty()) {
DVLOG(2) << "No video codecs supported for is_hw_secure=" << is_hw_secure;
- return absl::nullopt;
+ return std::nullopt;
}
// Query audio codecs.
@@ -414,7 +414,7 @@
if (intersection.empty()) {
// Fail if no supported encryption scheme.
- return absl::nullopt;
+ return std::nullopt;
}
capability.encryption_schemes = intersection;
@@ -457,9 +457,9 @@
return;
}
- absl::optional<CdmCapability> sw_secure_capability =
+ std::optional<CdmCapability> sw_secure_capability =
GetCdmCapability(cdm_factory, key_system, /*is_hw_secure=*/false);
- absl::optional<CdmCapability> hw_secure_capability =
+ std::optional<CdmCapability> hw_secure_capability =
GetCdmCapability(cdm_factory, key_system, /*is_hw_secure=*/true);
if (!sw_secure_capability && !hw_secure_capability) {
diff --git a/media/mojo/services/media_metrics_provider.h b/media/mojo/services/media_metrics_provider.h
index 4c64d27..ce666ab 100644
--- a/media/mojo/services/media_metrics_provider.h
+++ b/media/mojo/services/media_metrics_provider.h
@@ -6,6 +6,8 @@
#define MEDIA_MOJO_SERVICES_MEDIA_METRICS_PROVIDER_H_
#include <stdint.h>
+
+#include <optional>
#include <string>
#include "base/time/time.h"
@@ -20,7 +22,6 @@
#include "media/mojo/services/video_decode_perf_history.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace media {
@@ -161,7 +162,7 @@
PipelineInfo uma_info_;
// The values below are only set if `Initialize` has been called.
- absl::optional<MediaInfo> media_info_;
+ std::optional<MediaInfo> media_info_;
RendererType renderer_type_ = RendererType::kRendererImpl;
std::string key_system_;
@@ -172,7 +173,7 @@
base::TimeDelta time_to_first_frame_ = kNoTimestamp;
base::TimeDelta time_to_play_ready_ = kNoTimestamp;
- absl::optional<container_names::MediaContainerName> container_name_;
+ std::optional<container_names::MediaContainerName> container_name_;
};
} // namespace media
diff --git a/media/mojo/services/mojo_audio_decoder_service.cc b/media/mojo/services/mojo_audio_decoder_service.cc
index c7dae383..59086fc 100644
--- a/media/mojo/services/mojo_audio_decoder_service.cc
+++ b/media/mojo/services/mojo_audio_decoder_service.cc
@@ -47,7 +47,7 @@
void MojoAudioDecoderService::Initialize(
const AudioDecoderConfig& config,
- const absl::optional<base::UnguessableToken>& cdm_id,
+ const std::optional<base::UnguessableToken>& cdm_id,
InitializeCallback callback) {
DVLOG(1) << __func__ << " " << config.AsHumanReadableString();
diff --git a/media/mojo/services/mojo_audio_decoder_service.h b/media/mojo/services/mojo_audio_decoder_service.h
index 657d1727c..42abb64 100644
--- a/media/mojo/services/mojo_audio_decoder_service.h
+++ b/media/mojo/services/mojo_audio_decoder_service.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
@@ -19,7 +20,6 @@
#include "media/mojo/services/media_mojo_export.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class SingleThreadTaskRunner;
@@ -49,7 +49,7 @@
mojo::PendingAssociatedRemote<mojom::AudioDecoderClient> client,
mojo::PendingRemote<mojom::MediaLog> media_log) final;
void Initialize(const AudioDecoderConfig& config,
- const absl::optional<base::UnguessableToken>& cdm_id,
+ const std::optional<base::UnguessableToken>& cdm_id,
InitializeCallback callback) final;
void SetDataSource(mojo::ScopedDataPipeConsumerHandle receive_pipe) final;
@@ -93,7 +93,7 @@
// The CDM ID and the corresponding CdmContextRef, which must be held to keep
// the CdmContext alive for the lifetime of the |decoder_|.
- absl::optional<base::UnguessableToken> cdm_id_;
+ std::optional<base::UnguessableToken> cdm_id_;
std::unique_ptr<CdmContextRef> cdm_context_ref_;
// The AudioDecoder that does actual decoding work.
diff --git a/media/mojo/services/mojo_audio_encoder_service.cc b/media/mojo/services/mojo_audio_encoder_service.cc
index b51375bc..04877de 100644
--- a/media/mojo/services/mojo_audio_encoder_service.cc
+++ b/media/mojo/services/mojo_audio_encoder_service.cc
@@ -74,7 +74,7 @@
void MojoAudioEncoderService::OnOutput(
EncodedAudioBuffer output,
- absl::optional<media::AudioEncoder::CodecDescription> desc) {
+ std::optional<media::AudioEncoder::CodecDescription> desc) {
client_->OnEncodedBufferReady(
std::move(output),
desc.value_or(media::AudioEncoder::CodecDescription()));
diff --git a/media/mojo/services/mojo_audio_encoder_service.h b/media/mojo/services/mojo_audio_encoder_service.h
index 1e1bbe9..f69b370 100644
--- a/media/mojo/services/mojo_audio_encoder_service.h
+++ b/media/mojo/services/mojo_audio_encoder_service.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include "base/memory/weak_ptr.h"
#include "media/base/audio_encoder.h"
@@ -16,7 +17,6 @@
#include "media/mojo/services/media_mojo_export.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -46,7 +46,7 @@
base::OnceCallback<void(const media::EncoderStatus&)>;
void OnDone(MojoDoneCallback callback, EncoderStatus error);
void OnOutput(EncodedAudioBuffer output,
- absl::optional<media::AudioEncoder::CodecDescription> desc);
+ std::optional<media::AudioEncoder::CodecDescription> desc);
std::unique_ptr<media::AudioEncoder> encoder_;
mojo::AssociatedRemote<mojom::AudioEncoderClient> client_;
diff --git a/media/mojo/services/mojo_audio_input_stream.cc b/media/mojo/services/mojo_audio_input_stream.cc
index a3f03b9..cb9ecb3 100644
--- a/media/mojo/services/mojo_audio_input_stream.cc
+++ b/media/mojo/services/mojo_audio_input_stream.cc
@@ -91,7 +91,7 @@
mojo::PlatformHandle socket_handle(foreign_socket->Take());
std::move(stream_created_callback_)
- .Run({absl::in_place, std::move(shared_memory_region),
+ .Run({std::in_place, std::move(shared_memory_region),
std::move(socket_handle)},
initially_muted);
}
diff --git a/media/mojo/services/mojo_cdm_service.h b/media/mojo/services/mojo_cdm_service.h
index f5d32f1..5f3966e6 100644
--- a/media/mojo/services/mojo_cdm_service.h
+++ b/media/mojo/services/mojo_cdm_service.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include "base/compiler_specific.h"
#include "base/functional/callback.h"
@@ -25,7 +26,6 @@
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -117,7 +117,7 @@
std::unique_ptr<mojo::Receiver<mojom::Decryptor>> decryptor_receiver_;
// Set to a valid CDM ID if the |cdm_| is successfully created.
- absl::optional<base::UnguessableToken> cdm_id_;
+ std::optional<base::UnguessableToken> cdm_id_;
mojo::AssociatedRemote<mojom::ContentDecryptionModuleClient> client_;
diff --git a/media/mojo/services/mojo_demuxer_stream_adapter.cc b/media/mojo/services/mojo_demuxer_stream_adapter.cc
index 35a2872..97e5eb94 100644
--- a/media/mojo/services/mojo_demuxer_stream_adapter.cc
+++ b/media/mojo/services/mojo_demuxer_stream_adapter.cc
@@ -71,8 +71,8 @@
void MojoDemuxerStreamAdapter::OnStreamReady(
Type type,
mojo::ScopedDataPipeConsumerHandle consumer_handle,
- const absl::optional<AudioDecoderConfig>& audio_config,
- const absl::optional<VideoDecoderConfig>& video_config) {
+ const std::optional<AudioDecoderConfig>& audio_config,
+ const std::optional<VideoDecoderConfig>& video_config) {
DVLOG(1) << __func__;
DCHECK_EQ(UNKNOWN, type_);
DCHECK(consumer_handle.is_valid());
@@ -90,8 +90,8 @@
void MojoDemuxerStreamAdapter::OnBufferReady(
Status status,
std::vector<mojom::DecoderBufferPtr> batch_buffers,
- const absl::optional<AudioDecoderConfig>& audio_config,
- const absl::optional<VideoDecoderConfig>& video_config) {
+ const std::optional<AudioDecoderConfig>& audio_config,
+ const std::optional<VideoDecoderConfig>& video_config) {
DVLOG(3) << __func__
<< ": status=" << ::media::DemuxerStream::GetStatusName(status)
<< ", batch_buffers.size=" << batch_buffers.size();
@@ -155,8 +155,8 @@
}
void MojoDemuxerStreamAdapter::UpdateConfig(
- const absl::optional<AudioDecoderConfig>& audio_config,
- const absl::optional<VideoDecoderConfig>& video_config) {
+ const std::optional<AudioDecoderConfig>& audio_config,
+ const std::optional<VideoDecoderConfig>& video_config) {
DCHECK_NE(type_, Type::UNKNOWN);
std::string old_decoder_config_str;
diff --git a/media/mojo/services/mojo_demuxer_stream_adapter.h b/media/mojo/services/mojo_demuxer_stream_adapter.h
index b924fd0..79dc534 100644
--- a/media/mojo/services/mojo_demuxer_stream_adapter.h
+++ b/media/mojo/services/mojo_demuxer_stream_adapter.h
@@ -6,6 +6,7 @@
#define MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_
#include <memory>
+#include <optional>
#include "base/memory/weak_ptr.h"
#include "media/base/audio_decoder_config.h"
@@ -15,7 +16,6 @@
#include "media/mojo/services/media_mojo_export.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -53,20 +53,20 @@
private:
void OnStreamReady(Type type,
mojo::ScopedDataPipeConsumerHandle consumer_handle,
- const absl::optional<AudioDecoderConfig>& audio_config,
- const absl::optional<VideoDecoderConfig>& video_config);
+ const std::optional<AudioDecoderConfig>& audio_config,
+ const std::optional<VideoDecoderConfig>& video_config);
// The callback from |demuxer_stream_| that a read operation has completed.
// |read_cb| is a callback from the client who invoked Read() on |this|.
void OnBufferReady(Status status,
std::vector<mojom::DecoderBufferPtr> batch_buffers,
- const absl::optional<AudioDecoderConfig>& audio_config,
- const absl::optional<VideoDecoderConfig>& video_config);
+ const std::optional<AudioDecoderConfig>& audio_config,
+ const std::optional<VideoDecoderConfig>& video_config);
void OnBufferRead(scoped_refptr<DecoderBuffer> buffer);
- void UpdateConfig(const absl::optional<AudioDecoderConfig>& audio_config,
- const absl::optional<VideoDecoderConfig>& video_config);
+ void UpdateConfig(const std::optional<AudioDecoderConfig>& audio_config,
+ const std::optional<VideoDecoderConfig>& video_config);
// See constructor for descriptions.
mojo::Remote<mojom::DemuxerStream> demuxer_stream_;
diff --git a/media/mojo/services/mojo_media_drm_storage.cc b/media/mojo/services/mojo_media_drm_storage.cc
index d9efabb..f395e44 100644
--- a/media/mojo/services/mojo_media_drm_storage.cc
+++ b/media/mojo/services/mojo_media_drm_storage.cc
@@ -4,6 +4,7 @@
#include "media/mojo/services/mojo_media_drm_storage.h"
+#include <optional>
#include <string>
#include <utility>
@@ -12,7 +13,6 @@
#include "base/unguessable_token.h"
#include "media/mojo/mojom/media_drm_storage.mojom.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -30,7 +30,7 @@
void MojoMediaDrmStorage::Initialize(InitCB init_cb) {
DVLOG(1) << __func__;
media_drm_storage_->Initialize(mojo::WrapCallbackWithDefaultInvokeIfNotRun(
- std::move(init_cb), false, absl::nullopt));
+ std::move(init_cb), false, std::nullopt));
}
void MojoMediaDrmStorage::OnProvisioned(ResultCB result_cb) {
diff --git a/media/mojo/services/mojo_renderer_service.cc b/media/mojo/services/mojo_renderer_service.cc
index 8ebd7ca..3a0641c2 100644
--- a/media/mojo/services/mojo_renderer_service.cc
+++ b/media/mojo/services/mojo_renderer_service.cc
@@ -5,6 +5,7 @@
#include "media/mojo/services/mojo_renderer_service.h"
#include <memory>
+#include <optional>
#include <utility>
#include "base/functional/bind.h"
@@ -16,7 +17,6 @@
#include "media/mojo/common/media_type_converters.h"
#include "media/mojo/services/media_resource_shim.h"
#include "media/mojo/services/mojo_cdm_service_context.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -55,7 +55,7 @@
void MojoRendererService::Initialize(
mojo::PendingAssociatedRemote<mojom::RendererClient> client,
- absl::optional<std::vector<mojo::PendingRemote<mojom::DemuxerStream>>>
+ std::optional<std::vector<mojo::PendingRemote<mojom::DemuxerStream>>>
streams,
mojom::MediaUrlParamsPtr media_url_params,
InitializeCallback callback) {
@@ -119,7 +119,7 @@
}
void MojoRendererService::SetCdm(
- const absl::optional<base::UnguessableToken>& cdm_id,
+ const std::optional<base::UnguessableToken>& cdm_id,
SetCdmCallback callback) {
if (cdm_context_ref_) {
DVLOG(1) << "Switching CDM not supported";
@@ -214,7 +214,7 @@
client_->OnVideoOpacityChange(opaque);
}
-void MojoRendererService::OnVideoFrameRateChange(absl::optional<int> fps) {
+void MojoRendererService::OnVideoFrameRateChange(std::optional<int> fps) {
DVLOG(2) << __func__ << "(" << (fps ? *fps : -1) << ")";
// TODO(liberato): plumb to |client_|.
}
diff --git a/media/mojo/services/mojo_renderer_service.h b/media/mojo/services/mojo_renderer_service.h
index 2db458a0..ef4d59a 100644
--- a/media/mojo/services/mojo_renderer_service.h
+++ b/media/mojo/services/mojo_renderer_service.h
@@ -6,7 +6,9 @@
#define MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_
#include <stdint.h>
+
#include <memory>
+#include <optional>
#include "base/compiler_specific.h"
#include "base/functional/callback.h"
@@ -26,7 +28,6 @@
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -60,7 +61,7 @@
// mojom::Renderer implementation.
void Initialize(
mojo::PendingAssociatedRemote<mojom::RendererClient> client,
- absl::optional<std::vector<mojo::PendingRemote<mojom::DemuxerStream>>>
+ std::optional<std::vector<mojo::PendingRemote<mojom::DemuxerStream>>>
streams,
mojom::MediaUrlParamsPtr media_url_params,
InitializeCallback callback) final;
@@ -68,7 +69,7 @@
void StartPlayingFrom(base::TimeDelta time_delta) final;
void SetPlaybackRate(double playback_rate) final;
void SetVolume(float volume) final;
- void SetCdm(const absl::optional<base::UnguessableToken>& cdm_id,
+ void SetCdm(const std::optional<base::UnguessableToken>& cdm_id,
SetCdmCallback callback) final;
private:
@@ -92,7 +93,7 @@
void OnVideoConfigChange(const VideoDecoderConfig& config) final;
void OnVideoNaturalSizeChange(const gfx::Size& size) final;
void OnVideoOpacityChange(bool opaque) final;
- void OnVideoFrameRateChange(absl::optional<int> fps) final;
+ void OnVideoFrameRateChange(std::optional<int> fps) final;
// Called when the MediaResourceShim is ready to go (has a config,
// pipe handle, etc) and can be handed off to a renderer for use.
diff --git a/media/mojo/services/mojo_video_decoder_service.cc b/media/mojo/services/mojo_video_decoder_service.cc
index 83166f6..1a49aba 100644
--- a/media/mojo/services/mojo_video_decoder_service.cc
+++ b/media/mojo/services/mojo_video_decoder_service.cc
@@ -5,6 +5,7 @@
#include "media/mojo/services/mojo_video_decoder_service.h"
#include <memory>
+#include <optional>
#include <utility>
#include "base/functional/bind.h"
@@ -30,7 +31,6 @@
#include "mojo/public/cpp/bindings/message.h"
#include "mojo/public/cpp/system/buffer.h"
#include "mojo/public/cpp/system/handle.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -83,7 +83,7 @@
// mojom::MojoVideoFrameHandleReleaser implementation
void ReleaseVideoFrame(
const base::UnguessableToken& release_token,
- const absl::optional<gpu::SyncToken>& release_sync_token) final {
+ const std::optional<gpu::SyncToken>& release_sync_token) final {
DVLOG(3) << __func__ << "(" << release_token.ToString() << ")";
TRACE_EVENT2("media", "VideoFrameHandleReleaserImpl::ReleaseVideoFrame",
"release_token", release_token.ToString(),
@@ -212,7 +212,7 @@
void MojoVideoDecoderService::Initialize(
const VideoDecoderConfig& config,
bool low_delay,
- const absl::optional<base::UnguessableToken>& cdm_id,
+ const std::optional<base::UnguessableToken>& cdm_id,
InitializeCallback callback) {
DVLOG(1) << __func__ << " config = " << config.AsHumanReadableString()
<< ", cdm_id = "
@@ -427,7 +427,7 @@
// you can remove this DCHECK.
DCHECK(frame->metadata().power_efficient);
- absl::optional<base::UnguessableToken> release_token;
+ std::optional<base::UnguessableToken> release_token;
if ((decoder_->FramesHoldExternalResources() ||
frame->HasReleaseMailboxCB()) &&
video_frame_handle_releaser_) {
diff --git a/media/mojo/services/mojo_video_decoder_service.h b/media/mojo/services/mojo_video_decoder_service.h
index 13d8cd0a..dc613e9b 100644
--- a/media/mojo/services/mojo_video_decoder_service.h
+++ b/media/mojo/services/mojo_video_decoder_service.h
@@ -7,6 +7,7 @@
#include <map>
#include <memory>
+#include <optional>
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
@@ -24,7 +25,6 @@
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -63,7 +63,7 @@
const gfx::ColorSpace& target_color_space) final;
void Initialize(const VideoDecoderConfig& config,
bool low_delay,
- const absl::optional<base::UnguessableToken>& cdm_id,
+ const std::optional<base::UnguessableToken>& cdm_id,
InitializeCallback callback) final;
void Decode(mojom::DecoderBufferPtr buffer, DecodeCallback callback) final;
void Reset(ResetCallback callback) final;
@@ -122,7 +122,7 @@
// The CDM ID and the corresponding CdmContextRef, which must be held to keep
// the CdmContext alive for the lifetime of the |decoder_|.
- absl::optional<base::UnguessableToken> cdm_id_;
+ std::optional<base::UnguessableToken> cdm_id_;
std::unique_ptr<CdmContextRef> cdm_context_ref_;
std::unique_ptr<media::VideoDecoder> decoder_;
diff --git a/media/mojo/services/mojo_video_encode_accelerator_service.cc b/media/mojo/services/mojo_video_encode_accelerator_service.cc
index dd9d344..1168dd1 100644
--- a/media/mojo/services/mojo_video_encode_accelerator_service.cc
+++ b/media/mojo/services/mojo_video_encode_accelerator_service.cc
@@ -214,7 +214,7 @@
RequestEncodingParametersChangeWithLayers(
const media::VideoBitrateAllocation& bitrate_allocation,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
std::string parameters_description = base::StringPrintf(
"bitrate_allocation=%s, framerate=%d, size=%s",
@@ -244,7 +244,7 @@
RequestEncodingParametersChangeWithBitrate(
const media::Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
std::string parameters_description = base::StringPrintf(
"bitrate=%s, framerate=%d, size=%s", bitrate.ToString().c_str(),
diff --git a/media/mojo/services/mojo_video_encode_accelerator_service.h b/media/mojo/services/mojo_video_encode_accelerator_service.h
index 2600f20..55b7b65 100644
--- a/media/mojo/services/mojo_video_encode_accelerator_service.h
+++ b/media/mojo/services/mojo_video_encode_accelerator_service.h
@@ -81,11 +81,11 @@
void RequestEncodingParametersChangeWithBitrate(
const media::Bitrate& bitrate_allocation,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
void RequestEncodingParametersChangeWithLayers(
const media::VideoBitrateAllocation& bitrate_allocation,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
void IsFlushSupported(IsFlushSupportedCallback callback) override;
void Flush(FlushCallback callback) override;
diff --git a/media/mojo/services/mojo_video_encode_accelerator_service_unittest.cc b/media/mojo/services/mojo_video_encode_accelerator_service_unittest.cc
index ef45e77..2f2fae4 100644
--- a/media/mojo/services/mojo_video_encode_accelerator_service_unittest.cc
+++ b/media/mojo/services/mojo_video_encode_accelerator_service_unittest.cc
@@ -207,7 +207,7 @@
VideoBitrateAllocation bitrate_allocation;
bitrate_allocation.SetBitrate(0, 0, kNewBitrate);
mojo_vea_service()->RequestEncodingParametersChangeWithLayers(
- bitrate_allocation, kNewFramerate, absl::nullopt);
+ bitrate_allocation, kNewFramerate, std::nullopt);
base::RunLoop().RunUntilIdle();
ASSERT_TRUE(fake_vea());
@@ -240,7 +240,7 @@
}
mojo_vea_service()->RequestEncodingParametersChangeWithLayers(
- bitrate_allocation, kNewFramerate, absl::nullopt);
+ bitrate_allocation, kNewFramerate, std::nullopt);
base::RunLoop().RunUntilIdle();
ASSERT_TRUE(fake_vea());
@@ -407,7 +407,7 @@
media::VideoBitrateAllocation bitrate_allocation;
bitrate_allocation.SetBitrate(0, 0, kNewBitrate);
mojo_vea_service()->RequestEncodingParametersChangeWithLayers(
- bitrate_allocation, kNewFramerate, absl::nullopt);
+ bitrate_allocation, kNewFramerate, std::nullopt);
base::RunLoop().RunUntilIdle();
}
}
diff --git a/media/mojo/services/playback_events_recorder.h b/media/mojo/services/playback_events_recorder.h
index c95a4a84..8a7d9569 100644
--- a/media/mojo/services/playback_events_recorder.h
+++ b/media/mojo/services/playback_events_recorder.h
@@ -5,12 +5,13 @@
#ifndef MEDIA_MOJO_SERVICES_PLAYBACK_EVENTS_RECORDER_H_
#define MEDIA_MOJO_SERVICES_PLAYBACK_EVENTS_RECORDER_H_
+#include <optional>
+
#include "base/time/time.h"
#include "media/mojo/mojom/playback_events_recorder.mojom.h"
#include "media/mojo/services/media_mojo_export.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -52,7 +53,7 @@
size_t audio_bytes_ = 0;
size_t video_bytes_ = 0;
- absl::optional<PipelineStatistics> last_stats_;
+ std::optional<PipelineStatistics> last_stats_;
base::TimeTicks last_stats_time_;
};
diff --git a/media/mojo/services/stable_video_decoder_factory_service.cc b/media/mojo/services/stable_video_decoder_factory_service.cc
index b359b32..d01f031 100644
--- a/media/mojo/services/stable_video_decoder_factory_service.cc
+++ b/media/mojo/services/stable_video_decoder_factory_service.cc
@@ -46,7 +46,7 @@
// MojoMediaClient implementation.
std::vector<SupportedVideoDecoderConfig> GetSupportedVideoDecoderConfigs()
final {
- absl::optional<std::vector<SupportedVideoDecoderConfig>> configs;
+ std::optional<std::vector<SupportedVideoDecoderConfig>> configs;
switch (GetDecoderImplementationType()) {
case VideoDecoderType::kVaapi:
case VideoDecoderType::kV4L2:
diff --git a/media/mojo/services/stable_video_decoder_service.cc b/media/mojo/services/stable_video_decoder_service.cc
index b8ae422..5fcb5a1 100644
--- a/media/mojo/services/stable_video_decoder_service.cc
+++ b/media/mojo/services/stable_video_decoder_service.cc
@@ -298,13 +298,13 @@
// ultimate client (the renderer process) before calling ReleaseVideoFrame()
// on the out-of-process video decoder.
video_frame_handle_releaser_remote_->ReleaseVideoFrame(
- release_token, /*release_sync_token=*/absl::nullopt);
+ release_token, /*release_sync_token=*/std::nullopt);
}
void StableVideoDecoderService::OnVideoFrameDecoded(
const scoped_refptr<VideoFrame>& frame,
bool can_read_without_stalling,
- const absl::optional<base::UnguessableToken>& release_token) {
+ const std::optional<base::UnguessableToken>& release_token) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(stable_video_decoder_client_remote_.is_bound());
DCHECK(release_token.has_value());
diff --git a/media/mojo/services/stable_video_decoder_service.h b/media/mojo/services/stable_video_decoder_service.h
index 6428953..b7434b5 100644
--- a/media/mojo/services/stable_video_decoder_service.h
+++ b/media/mojo/services/stable_video_decoder_service.h
@@ -88,7 +88,7 @@
void OnVideoFrameDecoded(
const scoped_refptr<VideoFrame>& frame,
bool can_read_without_stalling,
- const absl::optional<base::UnguessableToken>& release_token) final;
+ const std::optional<base::UnguessableToken>& release_token) final;
void OnWaiting(WaitingReason reason) final;
void RequestOverlayInfo(bool restart_for_transitions) final;
@@ -154,7 +154,7 @@
GUARDED_BY_CONTEXT(sequence_checker_);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
- absl::optional<base::UnguessableToken> cdm_id_
+ std::optional<base::UnguessableToken> cdm_id_
GUARDED_BY_CONTEXT(sequence_checker_);
SEQUENCE_CHECKER(sequence_checker_);
diff --git a/media/mojo/services/stable_video_decoder_service_unittest.cc b/media/mojo/services/stable_video_decoder_service_unittest.cc
index a9cf7502..0c3f83b 100644
--- a/media/mojo/services/stable_video_decoder_service_unittest.cc
+++ b/media/mojo/services/stable_video_decoder_service_unittest.cc
@@ -120,7 +120,7 @@
// mojom::VideoFrameHandleReleaser implementation.
MOCK_METHOD2(ReleaseVideoFrame,
void(const base::UnguessableToken& release_token,
- const absl::optional<gpu::SyncToken>& release_sync_token));
+ const std::optional<gpu::SyncToken>& release_sync_token));
private:
mojo::Receiver<mojom::VideoFrameHandleReleaser>
@@ -173,7 +173,7 @@
MOCK_METHOD4(Initialize,
void(const VideoDecoderConfig& config,
bool low_delay,
- const absl::optional<base::UnguessableToken>& cdm_id,
+ const std::optional<base::UnguessableToken>& cdm_id,
InitializeCallback callback));
MOCK_METHOD2(Decode,
void(mojom::DecoderBufferPtr buffer, DecodeCallback callback));
@@ -527,7 +527,7 @@
const VideoDecoderConfig config_to_send = CreateValidVideoDecoderConfig();
VideoDecoderConfig received_config;
constexpr bool kLowDelay = true;
- constexpr absl::optional<base::UnguessableToken> kCdmId = absl::nullopt;
+ constexpr std::optional<base::UnguessableToken> kCdmId = std::nullopt;
StrictMock<base::MockOnceCallback<void(
const media::DecoderStatus& status, bool needs_bitstream_conversion,
int32_t max_decode_requests, VideoDecoderType decoder_type,
@@ -543,7 +543,7 @@
Initialize(/*config=*/_, kLowDelay, kCdmId,
/*callback=*/_))
.WillOnce([&](const VideoDecoderConfig& config, bool low_delay,
- const absl::optional<base::UnguessableToken>& cdm_id,
+ const std::optional<base::UnguessableToken>& cdm_id,
mojom::VideoDecoder::InitializeCallback callback) {
received_config = config;
received_initialize_cb = std::move(callback);
@@ -753,8 +753,8 @@
const base::UnguessableToken release_token_to_send =
base::UnguessableToken::Create();
- const absl::optional<gpu::SyncToken> expected_release_sync_token =
- absl::nullopt;
+ const std::optional<gpu::SyncToken> expected_release_sync_token =
+ std::nullopt;
EXPECT_CALL(
*auxiliary_endpoints->mock_video_frame_handle_releaser,
diff --git a/media/mojo/services/watch_time_recorder.cc b/media/mojo/services/watch_time_recorder.cc
index 19ba049..71bf1b5 100644
--- a/media/mojo/services/watch_time_recorder.cc
+++ b/media/mojo/services/watch_time_recorder.cc
@@ -316,7 +316,7 @@
return;
// Round duration to the most significant digit in milliseconds for privacy.
- absl::optional<uint64_t> clamped_duration_ms;
+ std::optional<uint64_t> clamped_duration_ms;
if (duration_ != kNoTimestamp && duration_ != kInfiniteDuration) {
clamped_duration_ms = duration_.InMilliseconds();
if (duration_ > base::Seconds(1)) {
diff --git a/media/mojo/services/watch_time_recorder.h b/media/mojo/services/watch_time_recorder.h
index 26ba4f9..3ef40a5 100644
--- a/media/mojo/services/watch_time_recorder.h
+++ b/media/mojo/services/watch_time_recorder.h
@@ -119,7 +119,7 @@
PipelineStatusCodes pipeline_status_ = PIPELINE_OK;
base::TimeDelta duration_ = kNoTimestamp;
- absl::optional<bool> autoplay_initiated_;
+ std::optional<bool> autoplay_initiated_;
};
} // namespace media
diff --git a/media/mojo/services/webrtc_video_perf_history.cc b/media/mojo/services/webrtc_video_perf_history.cc
index cd6c841..d762848 100644
--- a/media/mojo/services/webrtc_video_perf_history.cc
+++ b/media/mojo/services/webrtc_video_perf_history.cc
@@ -297,7 +297,7 @@
int frames_per_second,
GetPerfInfoCallback got_info_cb,
bool database_success,
- absl::optional<WebrtcVideoStatsDB::VideoStatsCollection> stats_collection) {
+ std::optional<WebrtcVideoStatsDB::VideoStatsCollection> stats_collection) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(got_info_cb);
DCHECK_EQ(db_init_status_, COMPLETE);
@@ -309,16 +309,16 @@
// Create a vector filled with smoothness
// predictions for all entries in the collection. `specific_key_index`
// will point to the entry corresponding to the requested `video_key`. If
- // there is no entry corresponding to `video_key` an absl::nullopt will be
+ // there is no entry corresponding to `video_key` an std::nullopt will be
// inserted as a placeholder.
- std::vector<absl::optional<bool>> smooth_per_pixel;
- absl::optional<size_t> specific_key_index;
+ std::vector<std::optional<bool>> smooth_per_pixel;
+ std::optional<size_t> specific_key_index;
for (auto const& [key_index, video_stats_entry] : *stats_collection) {
if (key_index >= video_key.pixels && !specific_key_index) {
specific_key_index = smooth_per_pixel.size();
if (key_index > video_key.pixels) {
// No exact match found, insert a nullopt.
- smooth_per_pixel.push_back(absl::nullopt);
+ smooth_per_pixel.push_back(std::nullopt);
}
}
smooth_per_pixel.push_back(PredictSmooth(
@@ -328,7 +328,7 @@
// Pixels for the specific key is higher than any pixels number that
// exists in the database.
specific_key_index = smooth_per_pixel.size();
- smooth_per_pixel.push_back(absl::nullopt);
+ smooth_per_pixel.push_back(std::nullopt);
}
if (smooth_per_pixel[*specific_key_index].has_value()) {
@@ -339,7 +339,7 @@
// Traverse from highest pixels value to lowest and propagate smooth=true,
// override smooth=false.
- absl::optional<bool> previous_entry;
+ std::optional<bool> previous_entry;
for (auto it = smooth_per_pixel.rbegin(); it != smooth_per_pixel.rend();
++it) {
if (previous_entry.has_value() && previous_entry.value()) {
@@ -476,7 +476,7 @@
const WebrtcVideoStatsDB::VideoStats& new_stats,
base::OnceClosure save_done_cb,
bool success,
- absl::optional<WebrtcVideoStatsDB::VideoStatsEntry> past_stats) {
+ std::optional<WebrtcVideoStatsDB::VideoStatsEntry> past_stats) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK_EQ(db_init_status_, COMPLETE);
diff --git a/media/mojo/services/webrtc_video_perf_history.h b/media/mojo/services/webrtc_video_perf_history.h
index 5cde43b4..15adbdc 100644
--- a/media/mojo/services/webrtc_video_perf_history.h
+++ b/media/mojo/services/webrtc_video_perf_history.h
@@ -143,7 +143,7 @@
int frames_per_second,
GetPerfInfoCallback got_info_cb,
bool database_success,
- absl::optional<WebrtcVideoStatsDB::VideoStatsCollection> stats);
+ std::optional<WebrtcVideoStatsDB::VideoStatsCollection> stats);
// Internal callback for database queries made from SavePerfRecord(). Compares
// past performance to this latest record as means of "grading" the accuracy
@@ -153,7 +153,7 @@
const WebrtcVideoStatsDB::VideoStats& new_stats,
base::OnceClosure save_done_cb,
bool success,
- absl::optional<WebrtcVideoStatsDB::VideoStatsEntry> past_stats);
+ std::optional<WebrtcVideoStatsDB::VideoStatsEntry> past_stats);
// Internal callback for saving to database. Will run `save_done_cb` if
// nonempty.
diff --git a/media/mojo/services/webrtc_video_perf_history_unittest.cc b/media/mojo/services/webrtc_video_perf_history_unittest.cc
index ca5bdb4..0c762e6f 100644
--- a/media/mojo/services/webrtc_video_perf_history_unittest.cc
+++ b/media/mojo/services/webrtc_video_perf_history_unittest.cc
@@ -95,13 +95,13 @@
GetVideoStatsCB get_stats_cb) override {
if (fail_next_get_) {
fail_next_get_ = false;
- std::move(get_stats_cb).Run(false, absl::nullopt);
+ std::move(get_stats_cb).Run(false, std::nullopt);
return;
}
auto entry_it = entries_.find(key.Serialize());
if (entry_it == entries_.end()) {
- std::move(get_stats_cb).Run(true, absl::nullopt);
+ std::move(get_stats_cb).Run(true, std::nullopt);
} else {
std::move(get_stats_cb).Run(true, entry_it->second);
}
@@ -112,7 +112,7 @@
GetVideoStatsCollectionCB get_stats_cb) override {
if (fail_next_get_) {
fail_next_get_ = false;
- std::move(get_stats_cb).Run(false, absl::nullopt);
+ std::move(get_stats_cb).Run(false, std::nullopt);
return;
}
@@ -120,14 +120,14 @@
std::string key_filter = key.SerializeWithoutPixels();
for (auto const& [str, video_stats_entry] : entries_) {
if (str.rfind(key_filter, 0) == 0) {
- absl::optional<int> pixels = VideoDescKey::ParsePixelsFromKey(str);
+ std::optional<int> pixels = VideoDescKey::ParsePixelsFromKey(str);
if (pixels) {
collection.insert({*pixels, std::move(video_stats_entry)});
}
}
}
if (collection.empty()) {
- std::move(get_stats_cb).Run(true, absl::nullopt);
+ std::move(get_stats_cb).Run(true, std::nullopt);
} else {
std::move(get_stats_cb).Run(true, std::move(collection));
}
diff --git a/media/mojo/test/mojo_video_encode_accelerator_integration_test.cc b/media/mojo/test/mojo_video_encode_accelerator_integration_test.cc
index 679d1f6..dadea48 100644
--- a/media/mojo/test/mojo_video_encode_accelerator_integration_test.cc
+++ b/media/mojo/test/mojo_video_encode_accelerator_integration_test.cc
@@ -332,7 +332,7 @@
const uint32_t kNewFramerate = 321321u;
mojo_vea()->RequestEncodingParametersChange(kNewBitrate, kNewFramerate,
- absl::nullopt);
+ std::nullopt);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(kNewBitrate, fake_vea()->stored_bitrates().back());
EXPECT_TRUE(fake_vea()->stored_frame_sizes().empty());
@@ -360,7 +360,7 @@
}
mojo_vea()->RequestEncodingParametersChange(bitrate_allocation,
- kNewFramerate, absl::nullopt);
+ kNewFramerate, std::nullopt);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(bitrate_allocation,
fake_vea()->stored_bitrate_allocations().back());
@@ -425,7 +425,7 @@
// remote end has been torn down and needs to be re Initialize()d.
mojo_vea()->RequestEncodingParametersChange(
Bitrate::ConstantBitrate(1234u) /* bitrate */, 3321 /* framerate */,
- absl::nullopt);
+ std::nullopt);
base::RunLoop().RunUntilIdle();
}
}
diff --git a/media/muxers/box_byte_stream.h b/media/muxers/box_byte_stream.h
index 5bfb4d6..09a5ae94 100644
--- a/media/muxers/box_byte_stream.h
+++ b/media/muxers/box_byte_stream.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_MUXERS_BOX_BYTE_STREAM_H_
#define MEDIA_MUXERS_BOX_BYTE_STREAM_H_
+#include <optional>
#include <vector>
#include "base/big_endian.h"
@@ -12,7 +13,6 @@
#include "base/containers/stack.h"
#include "media/base/media_export.h"
#include "media/formats/mp4/fourccs.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -89,7 +89,7 @@
size_t position_ = 0;
std::vector<uint8_t> buffer_;
- absl::optional<base::BigEndianWriter> writer_;
+ std::optional<base::BigEndianWriter> writer_;
};
} // namespace media
diff --git a/media/muxers/mp4_box_writer.h b/media/muxers/mp4_box_writer.h
index 81dd6d8..b8da85e 100644
--- a/media/muxers/mp4_box_writer.h
+++ b/media/muxers/mp4_box_writer.h
@@ -6,6 +6,7 @@
#define MEDIA_MUXERS_MP4_BOX_WRITER_H_
#include <memory>
+#include <optional>
#include <vector>
#include "base/memory/raw_ptr_exclusion.h"
@@ -13,7 +14,6 @@
#include "base/sequence_checker.h"
#include "media/base/media_export.h"
#include "media/formats/mp4/fourccs.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/muxers/mp4_muxer.cc b/media/muxers/mp4_muxer.cc
index 53f0f7c..977214a 100644
--- a/media/muxers/mp4_muxer.cc
+++ b/media/muxers/mp4_muxer.cc
@@ -20,7 +20,7 @@
bool has_video,
bool has_audio,
std::unique_ptr<Mp4MuxerDelegateInterface> delegate,
- absl::optional<base::TimeDelta> max_data_output_interval)
+ std::optional<base::TimeDelta> max_data_output_interval)
: mp4_muxer_delegate_(std::move(delegate)),
max_data_output_interval_(
std::max(max_data_output_interval.value_or(base::TimeDelta()),
diff --git a/media/muxers/mp4_muxer.h b/media/muxers/mp4_muxer.h
index c3f4145..26f022c 100644
--- a/media/muxers/mp4_muxer.h
+++ b/media/muxers/mp4_muxer.h
@@ -22,7 +22,7 @@
bool has_video,
bool has_audio,
std::unique_ptr<Mp4MuxerDelegateInterface> delegate,
- absl::optional<base::TimeDelta> max_data_output_interval);
+ std::optional<base::TimeDelta> max_data_output_interval);
Mp4Muxer(const Mp4Muxer&) = delete;
Mp4Muxer& operator=(const Mp4Muxer&) = delete;
diff --git a/media/muxers/mp4_muxer_context.cc b/media/muxers/mp4_muxer_context.cc
index 11d4010..23a0d55f 100644
--- a/media/muxers/mp4_muxer_context.cc
+++ b/media/muxers/mp4_muxer_context.cc
@@ -32,11 +32,11 @@
audio_track_ = track;
}
-absl::optional<Mp4MuxerContext::Track> Mp4MuxerContext::GetVideoTrack() const {
+std::optional<Mp4MuxerContext::Track> Mp4MuxerContext::GetVideoTrack() const {
return video_track_;
}
-absl::optional<Mp4MuxerContext::Track> Mp4MuxerContext::GetAudioTrack() const {
+std::optional<Mp4MuxerContext::Track> Mp4MuxerContext::GetAudioTrack() const {
return audio_track_;
}
diff --git a/media/muxers/mp4_muxer_context.h b/media/muxers/mp4_muxer_context.h
index 75243da..cbd6a00b 100644
--- a/media/muxers/mp4_muxer_context.h
+++ b/media/muxers/mp4_muxer_context.h
@@ -7,10 +7,10 @@
#include <map>
#include <memory>
+#include <optional>
#include "base/sequence_checker.h"
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -42,14 +42,14 @@
void SetVideoTrack(Track track);
void SetAudioTrack(Track track);
- absl::optional<Track> GetVideoTrack() const;
- absl::optional<Track> GetAudioTrack() const;
+ std::optional<Track> GetVideoTrack() const;
+ std::optional<Track> GetAudioTrack() const;
OutputPositionTracker& GetOutputPositionTracker() const;
private:
- absl::optional<Track> video_track_;
- absl::optional<Track> audio_track_;
+ std::optional<Track> video_track_;
+ std::optional<Track> audio_track_;
std::unique_ptr<OutputPositionTracker> output_position_tracker_;
diff --git a/media/muxers/mp4_muxer_delegate.cc b/media/muxers/mp4_muxer_delegate.cc
index d600eb5..10a963f 100644
--- a/media/muxers/mp4_muxer_delegate.cc
+++ b/media/muxers/mp4_muxer_delegate.cc
@@ -339,7 +339,7 @@
void Mp4MuxerDelegate::AddVideoFrame(
const Muxer::VideoParameters& params,
std::string encoded_data,
- absl::optional<VideoEncoder::CodecDescription> codec_description,
+ std::optional<VideoEncoder::CodecDescription> codec_description,
base::TimeTicks timestamp,
bool is_key_frame) {
if (!video_track_index_.has_value()) {
@@ -467,7 +467,7 @@
void Mp4MuxerDelegate::AddAudioFrame(
const AudioParameters& params,
std::string encoded_data,
- absl::optional<AudioEncoder::CodecDescription> codec_description,
+ std::optional<AudioEncoder::CodecDescription> codec_description,
base::TimeTicks timestamp) {
if (!audio_track_index_.has_value()) {
DVLOG(1) << __func__ << ", " << params.AsHumanReadableString();
diff --git a/media/muxers/mp4_muxer_delegate.h b/media/muxers/mp4_muxer_delegate.h
index 2f9e6e5..10ce9ee 100644
--- a/media/muxers/mp4_muxer_delegate.h
+++ b/media/muxers/mp4_muxer_delegate.h
@@ -6,6 +6,7 @@
#define MEDIA_MUXERS_MP4_MUXER_DELEGATE_H_
#include <memory>
+#include <optional>
#include <string>
#include <vector>
@@ -19,7 +20,6 @@
#include "media/formats/mp4/writable_box_definitions.h"
#include "media/muxers/mp4_muxer_context.h"
#include "media/muxers/muxer.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -32,14 +32,14 @@
virtual void AddVideoFrame(
const Muxer::VideoParameters& params,
std::string encoded_data,
- absl::optional<VideoEncoder::CodecDescription> codec_description,
+ std::optional<VideoEncoder::CodecDescription> codec_description,
base::TimeTicks timestamp,
bool is_key_frame) = 0;
virtual void AddAudioFrame(
const AudioParameters& params,
std::string encoded_data,
- absl::optional<AudioEncoder::CodecDescription> codec_description,
+ std::optional<AudioEncoder::CodecDescription> codec_description,
base::TimeTicks timestamp) = 0;
virtual bool Flush() = 0;
@@ -61,14 +61,14 @@
void AddVideoFrame(
const Muxer::VideoParameters& params,
std::string encoded_data,
- absl::optional<VideoEncoder::CodecDescription> codec_description,
+ std::optional<VideoEncoder::CodecDescription> codec_description,
base::TimeTicks timestamp,
bool is_key_frame) override;
void AddAudioFrame(
const AudioParameters& params,
std::string encoded_data,
- absl::optional<AudioEncoder::CodecDescription> codec_description,
+ std::optional<AudioEncoder::CodecDescription> codec_description,
base::TimeTicks timestamp) override;
// Write to the big endian ISO-BMFF boxes and call `write_callback`.
bool Flush() override;
@@ -120,8 +120,8 @@
// video and audio index is a 0 based index that is an item of the container.
// The track id would be plus one on this index value.
- absl::optional<size_t> video_track_index_;
- absl::optional<size_t> audio_track_index_;
+ std::optional<size_t> video_track_index_;
+ std::optional<size_t> audio_track_index_;
int next_track_index_ = 0;
// Duration time delta for the video track.
diff --git a/media/muxers/mp4_muxer_delegate_unittest.cc b/media/muxers/mp4_muxer_delegate_unittest.cc
index 6dd9980..b64c633 100644
--- a/media/muxers/mp4_muxer_delegate_unittest.cc
+++ b/media/muxers/mp4_muxer_delegate_unittest.cc
@@ -192,7 +192,7 @@
base_time_ticks, true);
for (int i = 0; i < 3; ++i) {
delta += base::Milliseconds(kSampleDurations[i]);
- delegate.AddVideoFrame(params, video_stream_2, absl::nullopt,
+ delegate.AddVideoFrame(params, video_stream_2, std::nullopt,
base_time_ticks + delta, false);
}
@@ -201,7 +201,7 @@
base_time_ticks + delta, true);
for (int i = 0; i < 2; ++i) {
delta += base::Milliseconds(kSampleDurations[i]);
- delegate.AddVideoFrame(params, video_stream_2, absl::nullopt,
+ delegate.AddVideoFrame(params, video_stream_2, std::nullopt,
base_time_ticks + delta, false);
}
@@ -505,7 +505,7 @@
constexpr int kAudioAdditionalSampleCount = 29;
for (int i = 0; i < kAudioAdditionalSampleCount; ++i) {
delta += base::Milliseconds(incremental_delta);
- delegate.AddAudioFrame(params, audio_stream, absl::nullopt,
+ delegate.AddAudioFrame(params, audio_stream, std::nullopt,
base_time_ticks + delta);
++incremental_delta;
}
@@ -740,7 +740,7 @@
for (int i = 0; i < kMaxAudioSampleFragment; ++i) {
delta += base::Milliseconds(30);
- delegate.AddAudioFrame(params, audio_stream, absl::nullopt,
+ delegate.AddAudioFrame(params, audio_stream, std::nullopt,
base_time_ticks + delta);
}
@@ -875,7 +875,7 @@
for (int i = 0; i < kMaxAudioSampleFragment; ++i) {
delta += base::Milliseconds(30);
- delegate.AddAudioFrame(params, audio_stream, absl::nullopt,
+ delegate.AddAudioFrame(params, audio_stream, std::nullopt,
base_time_ticks + delta);
}
@@ -890,14 +890,14 @@
base_time_ticks, true);
for (int i = 0; i < kMaxAudioSampleFragment; ++i) {
delta += base::Milliseconds(30);
- delegate.AddAudioFrame(params, audio_stream, absl::nullopt,
+ delegate.AddAudioFrame(params, audio_stream, std::nullopt,
base_time_ticks + delta);
}
// video stream, fourth fragment.
delegate.AddVideoFrame(video_params, video_stream, video_code_description,
base_time_ticks + base::Milliseconds(50), true);
- delegate.AddAudioFrame(params, audio_stream, absl::nullopt,
+ delegate.AddAudioFrame(params, audio_stream, std::nullopt,
base_time_ticks + delta + base::Milliseconds(30));
// Write box data to the callback.
@@ -1089,7 +1089,7 @@
for (int i = 0; i < kMaxAudioSampleFragment; ++i) {
delta += base::Milliseconds(30);
- delegate.AddAudioFrame(params, audio_stream, absl::nullopt,
+ delegate.AddAudioFrame(params, audio_stream, std::nullopt,
base_time_ticks + delta);
}
@@ -1104,14 +1104,14 @@
base_time_ticks, true);
for (int i = 0; i < kMaxAudioSampleFragment; ++i) {
delta += base::Milliseconds(30);
- delegate.AddAudioFrame(params, audio_stream, absl::nullopt,
+ delegate.AddAudioFrame(params, audio_stream, std::nullopt,
base_time_ticks + delta);
}
// video stream, fourth fragment.
delegate.AddVideoFrame(video_params, video_stream, video_codec_description,
base_time_ticks + base::Milliseconds(50), true);
- delegate.AddAudioFrame(params, audio_stream, absl::nullopt,
+ delegate.AddAudioFrame(params, audio_stream, std::nullopt,
base_time_ticks + delta + base::Milliseconds(30));
// Write box data to the callback.
@@ -1270,7 +1270,7 @@
for (int i = 0; i < kMaxAudioSampleFragment; ++i) {
delta += base::Milliseconds(30);
- delegate.AddAudioFrame(params, audio_stream, absl::nullopt,
+ delegate.AddAudioFrame(params, audio_stream, std::nullopt,
base_time_ticks + delta);
}
@@ -1419,15 +1419,15 @@
base_time_ticks);
delegate.AddVideoFrame(video_params, video_stream, video_codec_description,
base_time_ticks, true);
- delegate.AddVideoFrame(video_params, video_stream, absl::nullopt,
+ delegate.AddVideoFrame(video_params, video_stream, std::nullopt,
base_time_ticks + kDelta, false);
// The second fragment; video (1 sample) -> audio (2 samples) track.
delegate.AddVideoFrame(video_params, video_stream, video_codec_description,
base_time_ticks + kDelta * 2, true);
- delegate.AddAudioFrame(params, audio_stream, absl::nullopt,
+ delegate.AddAudioFrame(params, audio_stream, std::nullopt,
base_time_ticks + kDelta);
- delegate.AddAudioFrame(params, audio_stream, absl::nullopt,
+ delegate.AddAudioFrame(params, audio_stream, std::nullopt,
base_time_ticks + kDelta * 2);
// Write box data to the callback.
delegate.Flush();
diff --git a/media/muxers/mp4_muxer_unittest.cc b/media/muxers/mp4_muxer_unittest.cc
index f8c347a7..140c77cd 100644
--- a/media/muxers/mp4_muxer_unittest.cc
+++ b/media/muxers/mp4_muxer_unittest.cc
@@ -54,7 +54,7 @@
AddVideoFrame,
(const Muxer::VideoParameters& params,
std::string encoded_data,
- absl::optional<VideoEncoder::CodecDescription> codec_description,
+ std::optional<VideoEncoder::CodecDescription> codec_description,
base::TimeTicks timestamp,
bool is_key_frame),
(override));
@@ -62,7 +62,7 @@
AddAudioFrame,
(const AudioParameters& params,
std::string encoded_data,
- absl::optional<AudioEncoder::CodecDescription> codec_description,
+ std::optional<AudioEncoder::CodecDescription> codec_description,
base::TimeTicks timestamp),
(override));
MOCK_METHOD(bool, Flush, (), (override));
@@ -89,8 +89,8 @@
delegate_ptr_(delegate_.get()) {}
~Mp4MuxerTest() override { delegate_ptr_ = nullptr; }
- void CreateMuxer(absl::optional<base::TimeDelta> max_data_output_interval =
- absl::nullopt) {
+ void CreateMuxer(
+ std::optional<base::TimeDelta> max_data_output_interval = std::nullopt) {
muxer_ = std::make_unique<Mp4Muxer>(
AudioCodec::kAAC, GetParam().has_video, GetParam().has_audio,
std::move(delegate_), max_data_output_interval);
@@ -127,13 +127,13 @@
StrEq("a1"), Optional(GetAudioCodecDescription(99)),
base::TimeTicks() + base::Milliseconds(10)));
EXPECT_CALL(*delegate_ptr_,
- AddAudioFrame(_, StrEq("a2"), Eq(absl::nullopt),
+ AddAudioFrame(_, StrEq("a2"), Eq(std::nullopt),
base::TimeTicks() + base::Milliseconds(20)));
muxer_->PutFrame(
Muxer::EncodedFrame{audio_params, GetAudioCodecDescription(99), "a1",
std::string(), true},
base::Milliseconds(10));
- muxer_->PutFrame(Muxer::EncodedFrame{audio_params, absl::nullopt, "a2",
+ muxer_->PutFrame(Muxer::EncodedFrame{audio_params, std::nullopt, "a2",
std::string(), true},
base::Milliseconds(20));
}
@@ -149,13 +149,13 @@
base::TimeTicks() + base::Milliseconds(30), true));
EXPECT_CALL(
*delegate_ptr_,
- AddVideoFrame(_, StrEq("v2"), Eq(absl::nullopt),
+ AddVideoFrame(_, StrEq("v2"), Eq(std::nullopt),
base::TimeTicks() + base::Milliseconds(40), false));
muxer_->PutFrame(
Muxer::EncodedFrame{video_params, GetVideoCodecDescription(66), "v1",
std::string(), true},
base::Milliseconds(30));
- muxer_->PutFrame(Muxer::EncodedFrame{video_params, absl::nullopt, "v2",
+ muxer_->PutFrame(Muxer::EncodedFrame{video_params, std::nullopt, "v2",
std::string(), false},
base::Milliseconds(40));
}
@@ -174,7 +174,7 @@
std::string(), true},
base::Milliseconds(0));
task_environment_.AdvanceClock(base::Seconds(1));
- muxer_->PutFrame(Muxer::EncodedFrame{video_params, absl::nullopt, "v2",
+ muxer_->PutFrame(Muxer::EncodedFrame{video_params, std::nullopt, "v2",
std::string(), false},
base::Milliseconds(0));
// Insert a frame just before the duration limit set initially in the test.
@@ -201,7 +201,7 @@
std::string(), true},
base::Milliseconds(0));
task_environment_.AdvanceClock(base::Seconds(1));
- muxer_->PutFrame(Muxer::EncodedFrame{video_params, absl::nullopt, "v2",
+ muxer_->PutFrame(Muxer::EncodedFrame{video_params, std::nullopt, "v2",
std::string(), false},
base::Milliseconds(0));
// Time will advance to the time for the next flush, so expect Flush called
diff --git a/media/muxers/muxer.cc b/media/muxers/muxer.cc
index 61c67ed..2859d63 100644
--- a/media/muxers/muxer.cc
+++ b/media/muxers/muxer.cc
@@ -4,9 +4,10 @@
#include "media/muxers/muxer.h"
+#include <optional>
+
#include "media/base/video_codecs.h"
#include "media/base/video_frame.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/size.h"
@@ -22,7 +23,7 @@
gfx::Size visible_rect_size,
double frame_rate,
VideoCodec codec,
- absl::optional<gfx::ColorSpace> color_space)
+ std::optional<gfx::ColorSpace> color_space)
: visible_rect_size(visible_rect_size),
frame_rate(frame_rate),
codec(codec),
@@ -43,7 +44,7 @@
Muxer::EncodedFrame::EncodedFrame() = default;
Muxer::EncodedFrame::EncodedFrame(
absl::variant<AudioParameters, VideoParameters> params,
- absl::optional<media::AudioEncoder::CodecDescription> codec_description,
+ std::optional<media::AudioEncoder::CodecDescription> codec_description,
std::string data,
std::string alpha_data,
bool is_keyframe)
diff --git a/media/muxers/muxer.h b/media/muxers/muxer.h
index 76f7b8ad..3875975c 100644
--- a/media/muxers/muxer.h
+++ b/media/muxers/muxer.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_MUXERS_MUXER_H_
#define MEDIA_MUXERS_MUXER_H_
+#include <optional>
#include <string>
#include "base/time/time.h"
@@ -13,7 +14,6 @@
#include "media/base/video_codecs.h"
#include "media/base/video_encoder.h"
#include "media/base/video_frame.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/size.h"
@@ -37,7 +37,7 @@
VideoParameters(gfx::Size visible_rect_size,
double frame_rate,
VideoCodec codec,
- absl::optional<gfx::ColorSpace> color_space);
+ std::optional<gfx::ColorSpace> color_space);
VideoParameters(const VideoParameters&);
~VideoParameters();
// Returns a human-readable string describing `*this`.
@@ -47,7 +47,7 @@
gfx::Size visible_rect_size;
double frame_rate;
VideoCodec codec;
- absl::optional<gfx::ColorSpace> color_space;
+ std::optional<gfx::ColorSpace> color_space;
};
// Structure for passing encoded Audio and Video frames.
@@ -55,7 +55,7 @@
EncodedFrame();
EncodedFrame(
absl::variant<AudioParameters, VideoParameters> params,
- absl::optional<media::AudioEncoder::CodecDescription> codec_description,
+ std::optional<media::AudioEncoder::CodecDescription> codec_description,
std::string data,
std::string alpha_data,
bool is_keyframe);
@@ -67,7 +67,7 @@
// below.
absl::variant<AudioParameters, VideoParameters> params;
// Codec description for data.
- absl::optional<media::AudioEncoder::CodecDescription> codec_description;
+ std::optional<media::AudioEncoder::CodecDescription> codec_description;
// Audio or Video frame data.
std::string data;
// Alpha frame data if Video and present, empty otherwise
diff --git a/media/muxers/muxer_timestamp_adapter.cc b/media/muxers/muxer_timestamp_adapter.cc
index 7300702..4d39a61 100644
--- a/media/muxers/muxer_timestamp_adapter.cc
+++ b/media/muxers/muxer_timestamp_adapter.cc
@@ -26,7 +26,7 @@
const Muxer::VideoParameters& params,
std::string encoded_data,
std::string encoded_alpha,
- absl::optional<media::VideoEncoder::CodecDescription> codec_description,
+ std::optional<media::VideoEncoder::CodecDescription> codec_description,
base::TimeTicks timestamp,
bool is_key_frame) {
TRACE_EVENT2("media", __func__, "timestamp", timestamp - base::TimeTicks(),
@@ -62,7 +62,7 @@
bool MuxerTimestampAdapter::OnEncodedAudio(
const AudioParameters& params,
std::string encoded_data,
- absl::optional<media::AudioEncoder::CodecDescription> codec_description,
+ std::optional<media::AudioEncoder::CodecDescription> codec_description,
base::TimeTicks timestamp) {
TRACE_EVENT1("media", __func__, "timestamp", timestamp - base::TimeTicks());
DVLOG(2) << __func__ << " - " << encoded_data.size() << "B ts " << timestamp;
@@ -173,7 +173,7 @@
}
base::TimeTicks MuxerTimestampAdapter::UpdateLastTimestampAndGetNext(
- absl::optional<base::TimeTicks>& last_timestamp,
+ std::optional<base::TimeTicks>& last_timestamp,
base::TimeTicks timestamp) {
if (!last_timestamp.has_value()) {
last_timestamp = timestamp;
diff --git a/media/muxers/muxer_timestamp_adapter.h b/media/muxers/muxer_timestamp_adapter.h
index ba1108e..c7dd16d 100644
--- a/media/muxers/muxer_timestamp_adapter.h
+++ b/media/muxers/muxer_timestamp_adapter.h
@@ -38,13 +38,13 @@
const Muxer::VideoParameters& params,
std::string encoded_data,
std::string encoded_alpha,
- absl::optional<media::VideoEncoder::CodecDescription> codec_description,
+ std::optional<media::VideoEncoder::CodecDescription> codec_description,
base::TimeTicks timestamp,
bool is_key_frame);
bool OnEncodedAudio(
const AudioParameters& params,
std::string encoded_data,
- absl::optional<media::AudioEncoder::CodecDescription> codec_description,
+ std::optional<media::AudioEncoder::CodecDescription> codec_description,
base::TimeTicks timestamp);
// Call to handle mute and tracks getting disabled. If the track is not live
@@ -97,7 +97,7 @@
// Ensures a monotonically increasing timestamp sequence, despite
// incoming non-monotonically increasing timestamps.
base::TimeTicks UpdateLastTimestampAndGetNext(
- absl::optional<base::TimeTicks>& last_timestamp,
+ std::optional<base::TimeTicks>& last_timestamp,
base::TimeTicks incoming_timestamp);
// TODO(ajose): Change these when support is added for multiple tracks.
@@ -108,15 +108,15 @@
bool has_seen_audio_ = false;
std::unique_ptr<Muxer> muxer_;
- absl::optional<base::TimeTicks> last_video_timestamp_;
- absl::optional<base::TimeTicks> last_audio_timestamp_;
+ std::optional<base::TimeTicks> last_video_timestamp_;
+ std::optional<base::TimeTicks> last_audio_timestamp_;
// The timestamp of the lowest timestamp audio or video sample, compensated
// for the total time in pause at the time.
base::TimeTicks first_timestamp_;
// Variables to measure and accumulate, respectively, the time in pause state.
- absl::optional<base::ElapsedTimer> elapsed_time_in_pause_;
+ std::optional<base::ElapsedTimer> elapsed_time_in_pause_;
base::TimeDelta total_time_in_pause_;
// Variables to track live and enabled state of audio and video.
diff --git a/media/muxers/muxer_timestamp_adapter_unittest.cc b/media/muxers/muxer_timestamp_adapter_unittest.cc
index 9515c6b..6d13e5d 100644
--- a/media/muxers/muxer_timestamp_adapter_unittest.cc
+++ b/media/muxers/muxer_timestamp_adapter_unittest.cc
@@ -127,7 +127,7 @@
ChannelLayoutConfig::Mono(),
/*sample_rate=*/48000,
/*frames_per_buffer=*/480);
- return adapter_->OnEncodedAudio(audio_params, frame.data, absl::nullopt,
+ return adapter_->OnEncodedAudio(audio_params, frame.data, std::nullopt,
frame.timestamp);
}
@@ -135,7 +135,7 @@
auto video_params = Muxer::VideoParameters(
*VideoFrame::CreateBlackFrame(gfx::Size(160, 80)));
return adapter_->OnEncodedVideo(video_params, frame.data, frame.alpha_data,
- absl::nullopt, frame.timestamp,
+ std::nullopt, frame.timestamp,
frame.keyframe);
}
diff --git a/media/muxers/webm_muxer.cc b/media/muxers/webm_muxer.cc
index feb661b..7c422209a 100644
--- a/media/muxers/webm_muxer.cc
+++ b/media/muxers/webm_muxer.cc
@@ -8,6 +8,7 @@
#include <cstdint>
#include <cstring>
#include <memory>
+#include <optional>
#include <string>
#include "base/check.h"
@@ -27,7 +28,6 @@
#include "media/base/video_frame.h"
#include "media/formats/common/opus_constants.h"
#include "media/muxers/muxer.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/libwebm/source/mkvmuxer.hpp"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/size.h"
@@ -125,7 +125,7 @@
}
}
-absl::optional<mkvmuxer::Colour> ColorFromColorSpace(
+std::optional<mkvmuxer::Colour> ColorFromColorSpace(
const gfx::ColorSpace& color) {
using mkvmuxer::Colour;
using MatrixID = gfx::ColorSpace::MatrixID;
@@ -142,7 +142,7 @@
matrix_coefficients = Colour::kBt2020NonConstantLuminance;
break;
default:
- return absl::nullopt;
+ return std::nullopt;
}
colour.set_matrix_coefficients(matrix_coefficients);
int range;
@@ -154,7 +154,7 @@
range = Colour::kFullRange;
break;
default:
- return absl::nullopt;
+ return std::nullopt;
}
colour.set_range(range);
int transfer_characteristics;
@@ -169,7 +169,7 @@
transfer_characteristics = Colour::kSmpteSt2084;
break;
default:
- return absl::nullopt;
+ return std::nullopt;
}
colour.set_transfer_characteristics(transfer_characteristics);
int primaries;
@@ -181,7 +181,7 @@
primaries = Colour::kIturBt2020;
break;
default:
- return absl::nullopt;
+ return std::nullopt;
}
colour.set_primaries(primaries);
return colour;
@@ -218,7 +218,7 @@
bool has_video,
bool has_audio,
std::unique_ptr<Delegate> delegate,
- absl::optional<base::TimeDelta> max_data_output_interval)
+ std::optional<base::TimeDelta> max_data_output_interval)
: audio_codec_(audio_codec),
has_video_(has_video),
has_audio_(has_audio),
@@ -254,7 +254,7 @@
void WebmMuxer::AddVideoTrack(
const gfx::Size& frame_size,
double frame_rate,
- const absl::optional<gfx::ColorSpace>& color_space) {
+ const std::optional<gfx::ColorSpace>& color_space) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK_EQ(0u, video_track_index_)
<< "WebmMuxer can only be initialized once.";
diff --git a/media/muxers/webm_muxer.h b/media/muxers/webm_muxer.h
index 8701b76..e4ebad7 100644
--- a/media/muxers/webm_muxer.h
+++ b/media/muxers/webm_muxer.h
@@ -74,7 +74,7 @@
bool has_video_,
bool has_audio_,
std::unique_ptr<Delegate> delegate,
- absl::optional<base::TimeDelta> max_data_output_interval);
+ std::optional<base::TimeDelta> max_data_output_interval);
WebmMuxer(const WebmMuxer&) = delete;
WebmMuxer& operator=(const WebmMuxer&) = delete;
@@ -98,7 +98,7 @@
// frame size.
void AddVideoTrack(const gfx::Size& frame_size,
double frame_rate,
- const absl::optional<gfx::ColorSpace>& color_space);
+ const std::optional<gfx::ColorSpace>& color_space);
void AddAudioTrack(const AudioParameters& params);
bool WriteWebmFrame(EncodedFrame frame, base::TimeDelta relative_timestamp);
diff --git a/media/muxers/webm_muxer_fuzzertest.cc b/media/muxers/webm_muxer_fuzzertest.cc
index 5b507278..8b73a30 100644
--- a/media/muxers/webm_muxer_fuzzertest.cc
+++ b/media/muxers/webm_muxer_fuzzertest.cc
@@ -6,6 +6,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include <random>
#include "base/functional/bind.h"
@@ -18,7 +19,6 @@
#include "media/base/video_frame.h"
#include "media/muxers/live_webm_muxer_delegate.h"
#include "media/muxers/webm_muxer.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
// Min and max number of encodec video/audio packets to send in the WebmMuxer.
const int kMinNumIterations = 1;
@@ -64,7 +64,7 @@
input_type.has_audio,
std::make_unique<media::LiveWebmMuxerDelegate>(
base::BindRepeating(&OnWriteCallback)),
- absl::nullopt);
+ std::nullopt);
base::RunLoop().RunUntilIdle();
int num_iterations = kMinNumIterations + rng() % kMaxNumIterations;
@@ -81,7 +81,7 @@
auto parameters = media::Muxer::VideoParameters(*video_frame);
parameters.codec = video_codec;
muxer.PutFrame(
- media::Muxer::EncodedFrame{parameters, absl::nullopt, str,
+ media::Muxer::EncodedFrame{parameters, std::nullopt, str,
has_alpha_frame ? str : std::string(),
is_key_frame != 0},
base::TimeDelta() + base::Milliseconds(index));
@@ -98,7 +98,7 @@
const media::AudioParameters params(
media::AudioParameters::AUDIO_PCM_LOW_LATENCY, layout, sample_rate,
60 * sample_rate);
- muxer.PutFrame(media::Muxer::EncodedFrame{params, absl::nullopt, str,
+ muxer.PutFrame(media::Muxer::EncodedFrame{params, std::nullopt, str,
std::string(), true},
base::TimeDelta() + base::Milliseconds(index));
base::RunLoop().RunUntilIdle();
diff --git a/media/muxers/webm_muxer_unittest.cc b/media/muxers/webm_muxer_unittest.cc
index fc07709..eaa3558 100644
--- a/media/muxers/webm_muxer_unittest.cc
+++ b/media/muxers/webm_muxer_unittest.cc
@@ -3,11 +3,11 @@
// found in the LICENSE file.
#include "media/muxers/webm_muxer.h"
-#include "base/time/time.h"
#include <cstddef>
#include <cstdint>
#include <memory>
+#include <optional>
#include "base/functional/bind.h"
#include "base/location.h"
@@ -15,6 +15,7 @@
#include "base/memory/ref_counted.h"
#include "base/ranges/algorithm.h"
#include "base/test/task_environment.h"
+#include "base/time/time.h"
#include "media/base/audio_codecs.h"
#include "media/base/audio_parameters.h"
#include "media/base/channel_layout.h"
@@ -29,7 +30,6 @@
#include "media/muxers/live_webm_muxer_delegate.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
using ::testing::_;
using ::testing::AllOf;
@@ -69,7 +69,7 @@
std::make_unique<LiveWebmMuxerDelegate>(
base::BindRepeating(&WebmMuxerTest::WriteCallback,
base::Unretained(this))),
- absl::nullopt)) {
+ std::nullopt)) {
EXPECT_EQ(webm_muxer_->delegate_->Position(), 0);
const mkvmuxer::int64 kRandomNewPosition = 333;
EXPECT_EQ(webm_muxer_->delegate_->Position(kRandomNewPosition), -1);
@@ -115,7 +115,7 @@
void PutAudio(
const AudioParameters& params,
std::string encoded_data,
- absl::optional<media::AudioEncoder::CodecDescription> codec_description) {
+ std::optional<media::AudioEncoder::CodecDescription> codec_description) {
webm_muxer_->PutFrame(
Muxer::EncodedFrame{std::move(params), std::move(codec_description),
std::move(encoded_data), std::string(),
@@ -128,7 +128,7 @@
const Muxer::VideoParameters& params,
std::string encoded_data,
std::string encoded_alpha,
- absl::optional<media::VideoEncoder::CodecDescription> codec_description,
+ std::optional<media::VideoEncoder::CodecDescription> codec_description,
bool is_keyframe) {
webm_muxer_->PutFrame(
Muxer::EncodedFrame{std::move(params), std::move(codec_description),
@@ -172,7 +172,7 @@
.WillRepeatedly(
WithArgs<0>(Invoke(this, &WebmMuxerTest::SaveEncodedDataLen)));
PutVideo(GetVideoParameters(video_frame), encoded_data, std::string(),
- absl::nullopt, /*is_keyframe=*/true);
+ std::nullopt, /*is_keyframe=*/true);
// First time around WriteCallback() is pinged a number of times to write the
// Matroska header, but at the end it dumps |encoded_data|.
@@ -187,7 +187,7 @@
.WillRepeatedly(
WithArgs<0>(Invoke(this, &WebmMuxerTest::SaveEncodedDataLen)));
PutVideo(GetVideoParameters(video_frame), encoded_data, std::string(),
- absl::nullopt, /*is_keyframe=*/false);
+ std::nullopt, /*is_keyframe=*/false);
// The second time around the callbacks should include a SimpleBlock header,
// namely the track index, a timestamp and a flags byte, for a total of 6B.
@@ -217,7 +217,7 @@
.WillRepeatedly(
WithArgs<0>(Invoke(this, &WebmMuxerTest::SaveEncodedDataLen)));
PutVideo(GetVideoParameters(video_frame), encoded_data, alpha_encoded_data,
- absl::nullopt, /*is_keyframe=*/true);
+ std::nullopt, /*is_keyframe=*/true);
EXPECT_EQ(GetWebmMuxerPosition(), accumulated_position_);
EXPECT_GE(GetWebmMuxerPosition(), static_cast<int64_t>(last_encoded_length_));
@@ -229,7 +229,7 @@
.WillRepeatedly(
WithArgs<0>(Invoke(this, &WebmMuxerTest::SaveEncodedDataLen)));
PutVideo(GetVideoParameters(video_frame), encoded_data, alpha_encoded_data,
- absl::nullopt, /*is_keyframe=*/false);
+ std::nullopt, /*is_keyframe=*/false);
EXPECT_EQ(GetWebmMuxerPosition(), accumulated_position_);
// Alpha introduces additional elements to be written, see
@@ -259,7 +259,7 @@
.Times(AtLeast(1))
.WillRepeatedly(
WithArgs<0>(Invoke(this, &WebmMuxerTest::SaveEncodedDataLen)));
- PutAudio(audio_params, encoded_data, absl::nullopt);
+ PutAudio(audio_params, encoded_data, std::nullopt);
// First time around WriteCallback() is pinged a number of times to write the
// Matroska header, but at the end it dumps |encoded_data|.
@@ -273,7 +273,7 @@
.Times(AtLeast(1))
.WillRepeatedly(
WithArgs<0>(Invoke(this, &WebmMuxerTest::SaveEncodedDataLen)));
- PutAudio(audio_params, encoded_data, absl::nullopt);
+ PutAudio(audio_params, encoded_data, std::nullopt);
// The second time around the callbacks should include a SimpleBlock header,
// namely the track index, a timestamp and a flags byte, for a total of 6B.
@@ -288,7 +288,7 @@
TEST_P(WebmMuxerTest, ColorSpaceREC709IsPropagatedToTrack) {
Muxer::VideoParameters params(gfx::Size(1, 1), 0, media::VideoCodec::kVP9,
gfx::ColorSpace::CreateREC709());
- PutVideo(params, "abab", {}, absl::nullopt, true);
+ PutVideo(params, "abab", {}, std::nullopt, true);
mkvmuxer::Colour* colour = GetVideoTrackColor();
EXPECT_EQ(colour->primaries(), mkvmuxer::Colour::kIturBt709P);
EXPECT_EQ(colour->transfer_characteristics(), mkvmuxer::Colour::kIturBt709Tc);
@@ -302,7 +302,7 @@
gfx::ColorSpace(
gfx::ColorSpace::PrimaryID::BT709, gfx::ColorSpace::TransferID::SRGB,
gfx::ColorSpace::MatrixID::BT709, gfx::ColorSpace::RangeID::LIMITED));
- PutVideo(params, "banana", {}, absl::nullopt, true);
+ PutVideo(params, "banana", {}, std::nullopt, true);
mkvmuxer::Colour* colour = GetVideoTrackColor();
EXPECT_EQ(colour->primaries(), mkvmuxer::Colour::kIturBt709P);
EXPECT_EQ(colour->transfer_characteristics(), mkvmuxer::Colour::kIec6196621);
@@ -317,7 +317,7 @@
gfx::ColorSpace::TransferID::PQ,
gfx::ColorSpace::MatrixID::BT2020_NCL,
gfx::ColorSpace::RangeID::LIMITED));
- PutVideo(params, "cafebabe", {}, absl::nullopt, true);
+ PutVideo(params, "cafebabe", {}, std::nullopt, true);
mkvmuxer::Colour* colour = GetVideoTrackColor();
EXPECT_EQ(colour->primaries(), mkvmuxer::Colour::kIturBt2020);
EXPECT_EQ(colour->transfer_characteristics(), mkvmuxer::Colour::kSmpteSt2084);
@@ -333,7 +333,7 @@
gfx::ColorSpace::TransferID::PQ,
gfx::ColorSpace::MatrixID::BT2020_NCL,
gfx::ColorSpace::RangeID::FULL));
- PutVideo(params, "beatles", {}, absl::nullopt, true);
+ PutVideo(params, "beatles", {}, std::nullopt, true);
mkvmuxer::Colour* colour = GetVideoTrackColor();
EXPECT_EQ(colour->range(), mkvmuxer::Colour::kFullRange);
}
@@ -363,10 +363,10 @@
WebmMuxerTestUnparametrized()
: environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {}
- void CreateMuxer(bool has_video,
- bool has_audio,
- absl::optional<base::TimeDelta> max_data_output_interval =
- absl::nullopt) {
+ void CreateMuxer(
+ bool has_video,
+ bool has_audio,
+ std::optional<base::TimeDelta> max_data_output_interval = std::nullopt) {
webm_muxer_ = std::make_unique<WebmMuxer>(
AudioCodec::kOpus, has_video, has_audio,
std::make_unique<LiveWebmMuxerDelegate>(base::BindRepeating(
@@ -415,7 +415,7 @@
Muxer::VideoParameters params(gfx::Size(1, 1), 0, media::VideoCodec::kVP8,
gfx::ColorSpace());
bool result = webm_muxer_->PutFrame(
- Muxer::EncodedFrame{std::move(params), absl::nullopt, "video_at_offset",
+ Muxer::EncodedFrame{std::move(params), std::nullopt, "video_at_offset",
"", is_key_frame},
base::Milliseconds(system_timestamp_offset_ms));
got_video_ = true;
@@ -430,7 +430,7 @@
media::AudioParameters::Format::AUDIO_PCM_LOW_LATENCY,
ChannelLayoutConfig::Mono(), frame_rate_hz, frames_per_buffer);
return webm_muxer_->PutFrame(
- Muxer::EncodedFrame{std::move(audio_params), absl::nullopt,
+ Muxer::EncodedFrame{std::move(audio_params), std::nullopt,
"audio_at_offset", "", true},
base::Milliseconds(system_timestamp_offset_ms));
}
diff --git a/media/remoting/courier_renderer.cc b/media/remoting/courier_renderer.cc
index ccb06d8..a63a677 100644
--- a/media/remoting/courier_renderer.cc
+++ b/media/remoting/courier_renderer.cc
@@ -153,7 +153,7 @@
}
void CourierRenderer::SetLatencyHint(
- absl::optional<base::TimeDelta> latency_hint) {}
+ std::optional<base::TimeDelta> latency_hint) {}
void CourierRenderer::Flush(base::OnceClosure flush_cb) {
DCHECK(media_task_runner_->RunsTasksInCurrentSequence());
@@ -169,10 +169,10 @@
}
state_ = STATE_FLUSHING;
- absl::optional<uint32_t> flush_audio_count;
+ std::optional<uint32_t> flush_audio_count;
if (audio_demuxer_stream_adapter_)
flush_audio_count = audio_demuxer_stream_adapter_->SignalFlush(true);
- absl::optional<uint32_t> flush_video_count;
+ std::optional<uint32_t> flush_video_count;
if (video_demuxer_stream_adapter_)
flush_video_count = video_demuxer_stream_adapter_->SignalFlush(true);
// Makes sure flush count is valid if stream is available or both audio and
@@ -543,7 +543,7 @@
OnFatalError(RPC_INVALID);
return;
}
- absl::optional<BufferingState> state = media::cast::ToMediaBufferingState(
+ std::optional<BufferingState> state = media::cast::ToMediaBufferingState(
message->rendererclient_onbufferingstatechange_rpc().state());
BufferingStateChangeReason reason = BUFFERING_CHANGE_REASON_UNKNOWN;
if (!state.has_value())
diff --git a/media/remoting/courier_renderer.h b/media/remoting/courier_renderer.h
index 4e4e0d4..5dbf5d7 100644
--- a/media/remoting/courier_renderer.h
+++ b/media/remoting/courier_renderer.h
@@ -6,6 +6,7 @@
#define MEDIA_REMOTING_COURIER_RENDERER_H_
#include <memory>
+#include <optional>
#include <tuple>
#include <utility>
@@ -25,7 +26,6 @@
#include "media/remoting/metrics.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/system/data_pipe.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/openscreen/src/cast/streaming/remoting.pb.h"
#include "third_party/openscreen/src/cast/streaming/rpc_messenger.h"
#include "third_party/openscreen/src/util/weak_ptr.h"
@@ -83,7 +83,7 @@
void Initialize(MediaResource* media_resource,
RendererClient* client,
PipelineStatusCallback init_cb) final;
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) final;
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) final;
void Flush(base::OnceClosure flush_cb) final;
void StartPlayingFrom(base::TimeDelta time) final;
void SetPlaybackRate(double playback_rate) final;
diff --git a/media/remoting/courier_renderer_unittest.cc b/media/remoting/courier_renderer_unittest.cc
index be98ada..38b2b1b 100644
--- a/media/remoting/courier_renderer_unittest.cc
+++ b/media/remoting/courier_renderer_unittest.cc
@@ -104,7 +104,7 @@
void OnWaiting(WaitingReason reason) override {}
MOCK_METHOD1(OnVideoNaturalSizeChange, void(const gfx::Size& size));
MOCK_METHOD1(OnVideoOpacityChange, void(bool opaque));
- MOCK_METHOD1(OnVideoFrameRateChange, void(absl::optional<int>));
+ MOCK_METHOD1(OnVideoFrameRateChange, void(std::optional<int>));
MOCK_METHOD1(OnRemotePlayStateChange, void(MediaStatus::State state));
void DelegateOnStatisticsUpdate(const PipelineStatistics& stats) {
@@ -448,8 +448,7 @@
// Issue RPC_RC_ONBUFFERINGSTATECHANGE RPC message.
void IssuesBufferingStateRpc(BufferingState state) {
- absl::optional<
- openscreen::cast::RendererClientOnBufferingStateChange::State>
+ std::optional<openscreen::cast::RendererClientOnBufferingStateChange::State>
pb_state = media::cast::ToProtoMediaBufferingState(state);
if (!pb_state.has_value())
return;
diff --git a/media/remoting/demuxer_stream_adapter.cc b/media/remoting/demuxer_stream_adapter.cc
index 02663a3..4b17a38 100644
--- a/media/remoting/demuxer_stream_adapter.cc
+++ b/media/remoting/demuxer_stream_adapter.cc
@@ -99,13 +99,13 @@
return current_count;
}
-absl::optional<uint32_t> DemuxerStreamAdapter::SignalFlush(bool flushing) {
+std::optional<uint32_t> DemuxerStreamAdapter::SignalFlush(bool flushing) {
DCHECK(media_task_runner_->RunsTasksInCurrentSequence());
DEMUXER_VLOG(2) << "flushing=" << flushing;
// Ignores if |pending_flush_| states is same.
if (pending_flush_ == flushing)
- return absl::nullopt;
+ return std::nullopt;
// Invalidates pending Read() tasks.
request_buffer_weak_factory_.InvalidateWeakPtrs();
diff --git a/media/remoting/demuxer_stream_adapter.h b/media/remoting/demuxer_stream_adapter.h
index c35b5dbe..fb994e9 100644
--- a/media/remoting/demuxer_stream_adapter.h
+++ b/media/remoting/demuxer_stream_adapter.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include <vector>
#include "base/functional/callback_forward.h"
@@ -24,7 +25,6 @@
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "mojo/public/cpp/system/simple_watcher.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/openscreen/src/cast/streaming/rpc_messenger.h"
#include "third_party/openscreen/src/util/weak_ptr.h"
@@ -91,8 +91,8 @@
// signal when flush starts and when is done. During flush operation, all
// fetching data actions will be discarded. The return value indicates frame
// count in order to signal receiver what frames are in flight before flush,
- // or absl::nullopt if the flushing state was unchanged.
- absl::optional<uint32_t> SignalFlush(bool flushing);
+ // or std::nullopt if the flushing state was unchanged.
+ std::optional<uint32_t> SignalFlush(bool flushing);
bool is_processing_read_request() const {
// |read_until_callback_handle_| is set when RPC_DS_READUNTIL message is
diff --git a/media/remoting/end2end_test_renderer.cc b/media/remoting/end2end_test_renderer.cc
index 7e7c1443..ec30d3b 100644
--- a/media/remoting/end2end_test_renderer.cc
+++ b/media/remoting/end2end_test_renderer.cc
@@ -388,7 +388,7 @@
}
void End2EndTestRenderer::SetLatencyHint(
- absl::optional<base::TimeDelta> latency_hint) {
+ std::optional<base::TimeDelta> latency_hint) {
courier_renderer_->SetLatencyHint(latency_hint);
}
diff --git a/media/remoting/end2end_test_renderer.h b/media/remoting/end2end_test_renderer.h
index c9c7290..cf73d49 100644
--- a/media/remoting/end2end_test_renderer.h
+++ b/media/remoting/end2end_test_renderer.h
@@ -37,7 +37,7 @@
void Initialize(MediaResource* media_resource,
RendererClient* client,
PipelineStatusCallback init_cb) override;
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) override;
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) override;
void SetPreservesPitch(bool preserves_pitch) override;
void Flush(base::OnceClosure flush_cb) override;
void StartPlayingFrom(base::TimeDelta time) override;
diff --git a/media/remoting/integration_test.cc b/media/remoting/integration_test.cc
index 70e5ed5b..6b79f83 100644
--- a/media/remoting/integration_test.cc
+++ b/media/remoting/integration_test.cc
@@ -29,7 +29,7 @@
private:
std::unique_ptr<Renderer> CreateEnd2EndTestRenderer(
- absl::optional<RendererType> renderer_type) {
+ std::optional<RendererType> renderer_type) {
return std::make_unique<End2EndTestRenderer>(
this->CreateRendererImpl(renderer_type));
}
diff --git a/media/remoting/metrics.cc b/media/remoting/metrics.cc
index 20fb421..69397ee 100644
--- a/media/remoting/metrics.cc
+++ b/media/remoting/metrics.cc
@@ -117,7 +117,7 @@
// Reset |start_trigger_| since metrics recording of the current remoting
// session has now completed.
- start_trigger_ = absl::nullopt;
+ start_trigger_ = std::nullopt;
}
void SessionMetricsRecorder::OnPipelineMetadataChanged(
diff --git a/media/remoting/metrics.h b/media/remoting/metrics.h
index 73f3648..eb8655c 100644
--- a/media/remoting/metrics.h
+++ b/media/remoting/metrics.h
@@ -5,11 +5,12 @@
#ifndef MEDIA_REMOTING_METRICS_H_
#define MEDIA_REMOTING_METRICS_H_
+#include <optional>
+
#include "base/time/time.h"
#include "media/base/pipeline_metadata.h"
#include "media/mojo/mojom/remoting_common.mojom.h"
#include "media/remoting/triggers.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
@@ -101,7 +102,7 @@
void RecordTrackConfiguration();
// |start_trigger_| is set while a remoting session is active.
- absl::optional<StartTrigger> start_trigger_;
+ std::optional<StartTrigger> start_trigger_;
// When the current (or last) remoting session started.
base::TimeTicks start_time_;
@@ -117,7 +118,7 @@
// Last known disabled playback state. This can change before/after a remoting
// session as well as during one.
- absl::optional<bool> remote_playback_is_disabled_;
+ std::optional<bool> remote_playback_is_disabled_;
bool did_record_pixel_rate_support_ = false;
bool did_record_compatibility_ = false;
diff --git a/media/remoting/receiver.cc b/media/remoting/receiver.cc
index bf55b6c5..2469839 100644
--- a/media/remoting/receiver.cc
+++ b/media/remoting/receiver.cc
@@ -90,7 +90,7 @@
}
// No-op. Controlled by sender via RPC calls instead.
-void Receiver::SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) {}
+void Receiver::SetLatencyHint(std::optional<base::TimeDelta> latency_hint) {}
// No-op. Controlled by sender via RPC calls instead.
void Receiver::Flush(base::OnceClosure flush_cb) {}
@@ -303,7 +303,7 @@
SendRpcMessageOnMainThread(std::move(rpc));
}
-void Receiver::OnVideoFrameRateChange(absl::optional<int>) {}
+void Receiver::OnVideoFrameRateChange(std::optional<int>) {}
} // namespace remoting
} // namespace media
diff --git a/media/remoting/receiver.h b/media/remoting/receiver.h
index 7508f852..900c1c3 100644
--- a/media/remoting/receiver.h
+++ b/media/remoting/receiver.h
@@ -64,7 +64,7 @@
RendererClient* client,
PipelineStatusCallback init_cb) override;
void SetCdm(CdmContext* cdm_context, CdmAttachedCB cdm_attached_cb) override;
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) override;
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) override;
void Flush(base::OnceClosure flush_cb) override;
void StartPlayingFrom(base::TimeDelta time) override;
void SetPlaybackRate(double playback_rate) override;
@@ -84,7 +84,7 @@
void OnVideoConfigChange(const VideoDecoderConfig& config) override;
void OnVideoNaturalSizeChange(const gfx::Size& size) override;
void OnVideoOpacityChange(bool opaque) override;
- void OnVideoFrameRateChange(absl::optional<int>) override;
+ void OnVideoFrameRateChange(std::optional<int>) override;
// Used to set |remote_handle_| after Receiver is created, because the remote
// handle might be received after Receiver is created.
diff --git a/media/remoting/receiver_unittest.cc b/media/remoting/receiver_unittest.cc
index b7338f3..2cc4c6b 100644
--- a/media/remoting/receiver_unittest.cc
+++ b/media/remoting/receiver_unittest.cc
@@ -4,6 +4,7 @@
#include "media/remoting/receiver.h"
+#include <optional>
#include <utility>
#include "base/check.h"
@@ -22,7 +23,6 @@
#include "media/remoting/mock_receiver_controller.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
using base::test::RunOnceCallback;
using openscreen::cast::RpcMessenger;
@@ -82,7 +82,7 @@
break;
}
case openscreen::cast::RpcMessage::RPC_RC_ONBUFFERINGSTATECHANGE: {
- absl::optional<BufferingState> state =
+ std::optional<BufferingState> state =
media::cast::ToMediaBufferingState(
message->rendererclient_onbufferingstatechange_rpc().state());
if (state.has_value())
diff --git a/media/remoting/stream_provider.cc b/media/remoting/stream_provider.cc
index 347b597..678c681 100644
--- a/media/remoting/stream_provider.cc
+++ b/media/remoting/stream_provider.cc
@@ -498,9 +498,9 @@
return 0;
}
-absl::optional<container_names::MediaContainerName>
+std::optional<container_names::MediaContainerName>
StreamProvider::GetContainerForMetrics() const {
- return absl::optional<container_names::MediaContainerName>();
+ return std::optional<container_names::MediaContainerName>();
}
void StreamProvider::OnEnabledAudioTracksChanged(
diff --git a/media/remoting/stream_provider.h b/media/remoting/stream_provider.h
index 5426bd5b..60f6ca6 100644
--- a/media/remoting/stream_provider.h
+++ b/media/remoting/stream_provider.h
@@ -62,7 +62,7 @@
base::TimeDelta GetStartTime() const override;
base::Time GetTimelineOffset() const override;
int64_t GetMemoryUsage() const override;
- absl::optional<container_names::MediaContainerName> GetContainerForMetrics()
+ std::optional<container_names::MediaContainerName> GetContainerForMetrics()
const override;
void OnEnabledAudioTracksChanged(const std::vector<MediaTrack::Id>& track_ids,
base::TimeDelta curr_time,
diff --git a/media/renderers/audio_renderer_impl.cc b/media/renderers/audio_renderer_impl.cc
index 29886c7..d3b51e4 100644
--- a/media/renderers/audio_renderer_impl.cc
+++ b/media/renderers/audio_renderer_impl.cc
@@ -686,7 +686,7 @@
auto params =
(media_client ? media_client->GetAudioRendererAlgorithmParameters(
audio_parameters_)
- : absl::nullopt);
+ : std::nullopt);
if (params && !client_->IsVideoStreamAvailable()) {
algorithm_ =
std::make_unique<AudioRendererAlgorithm>(media_log_, params.value());
@@ -834,7 +834,7 @@
}
void AudioRendererImpl::SetLatencyHint(
- absl::optional<base::TimeDelta> latency_hint) {
+ std::optional<base::TimeDelta> latency_hint) {
base::AutoLock auto_lock(lock_);
latency_hint_ = latency_hint;
diff --git a/media/renderers/audio_renderer_impl.h b/media/renderers/audio_renderer_impl.h
index 4a0168a..579d262 100644
--- a/media/renderers/audio_renderer_impl.h
+++ b/media/renderers/audio_renderer_impl.h
@@ -22,6 +22,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
@@ -40,7 +41,6 @@
#include "media/filters/audio_renderer_algorithm.h"
#include "media/filters/decoder_stream.h"
#include "media/renderers/renderer_impl_factory.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class TickClock;
@@ -106,7 +106,7 @@
void Flush(base::OnceClosure callback) override;
void StartPlaying() override;
void SetVolume(float volume) override;
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) override;
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) override;
void SetPreservesPitch(bool preserves_pitch) override;
void SetWasPlayedWithUserActivation(
bool was_played_with_user_activation) override;
@@ -328,7 +328,7 @@
// Stored value from last call to SetLatencyHint(). Passed to |algorithm_|
// during Initialize().
- absl::optional<base::TimeDelta> latency_hint_;
+ std::optional<base::TimeDelta> latency_hint_;
// Passed to |algorithm_|. Indicates whether |algorithm_| should or should not
// make pitch adjustments at playbacks other than 1.0.
diff --git a/media/renderers/audio_renderer_impl_unittest.cc b/media/renderers/audio_renderer_impl_unittest.cc
index 6160a123..60c66a5 100644
--- a/media/renderers/audio_renderer_impl_unittest.cc
+++ b/media/renderers/audio_renderer_impl_unittest.cc
@@ -248,7 +248,7 @@
MOCK_METHOD1(OnVideoConfigChange, void(const VideoDecoderConfig&));
MOCK_METHOD1(OnVideoNaturalSizeChange, void(const gfx::Size&));
MOCK_METHOD1(OnVideoOpacityChange, void(bool));
- MOCK_METHOD1(OnVideoFrameRateChange, void(absl::optional<int>));
+ MOCK_METHOD1(OnVideoFrameRateChange, void(std::optional<int>));
MOCK_METHOD1(OnDurationChange, void(base::TimeDelta));
MOCK_METHOD1(OnRemotePlayStateChange, void(MediaStatus::State state));
MOCK_METHOD1(TranscribeAudio, void(scoped_refptr<AudioBuffer>));
diff --git a/media/renderers/decrypting_renderer.cc b/media/renderers/decrypting_renderer.cc
index 9e275a7..1fe5a28 100644
--- a/media/renderers/decrypting_renderer.cc
+++ b/media/renderers/decrypting_renderer.cc
@@ -108,7 +108,7 @@
}
void DecryptingRenderer::SetLatencyHint(
- absl::optional<base::TimeDelta> latency_hint) {
+ std::optional<base::TimeDelta> latency_hint) {
renderer_->SetLatencyHint(latency_hint);
}
diff --git a/media/renderers/decrypting_renderer.h b/media/renderers/decrypting_renderer.h
index 678c70a4..44112cd 100644
--- a/media/renderers/decrypting_renderer.h
+++ b/media/renderers/decrypting_renderer.h
@@ -51,7 +51,7 @@
RendererClient* client,
PipelineStatusCallback init_cb) override;
void SetCdm(CdmContext* cdm_context, CdmAttachedCB cdm_attached_cb) override;
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) override;
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) override;
void SetPreservesPitch(bool preserves_pitch) override;
void SetWasPlayedWithUserActivation(
bool was_played_with_user_activation) override;
diff --git a/media/renderers/paint_canvas_video_renderer.h b/media/renderers/paint_canvas_video_renderer.h
index 89742054..ddc4c29 100644
--- a/media/renderers/paint_canvas_video_renderer.h
+++ b/media/renderers/paint_canvas_video_renderer.h
@@ -8,6 +8,8 @@
#include <stddef.h>
#include <stdint.h>
+#include <optional>
+
#include "base/memory/scoped_refptr.h"
#include "base/sequence_checker.h"
#include "base/threading/thread_checker.h"
@@ -22,7 +24,6 @@
#include "media/base/video_frame.h"
#include "media/base/video_transformation.h"
#include "media/renderers/video_frame_yuv_converter.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace gfx {
class RectF;
@@ -280,7 +281,7 @@
bool CacheBackingWrapsTexture() const;
- absl::optional<Cache> cache_;
+ std::optional<Cache> cache_;
// If |cache_| is not used for a while, it's deleted to save memory.
base::DelayTimer cache_deleting_timer_;
diff --git a/media/renderers/paint_canvas_video_renderer_unittest.cc b/media/renderers/paint_canvas_video_renderer_unittest.cc
index 71982f1..dec650c 100644
--- a/media/renderers/paint_canvas_video_renderer_unittest.cc
+++ b/media/renderers/paint_canvas_video_renderer_unittest.cc
@@ -1233,7 +1233,7 @@
scoped_refptr<VideoFrame> cropped_frame() { return cropped_frame_; }
protected:
- absl::optional<gl::DisableNullDrawGLBindings> enable_pixels_;
+ std::optional<gl::DisableNullDrawGLBindings> enable_pixels_;
scoped_refptr<viz::TestInProcessContextProvider> media_context_;
scoped_refptr<viz::TestInProcessContextProvider> gles2_context_;
scoped_refptr<viz::TestInProcessContextProvider> destination_context_;
diff --git a/media/renderers/renderer_impl.cc b/media/renderers/renderer_impl.cc
index 464a6d6..4221f4a2 100644
--- a/media/renderers/renderer_impl.cc
+++ b/media/renderers/renderer_impl.cc
@@ -70,7 +70,7 @@
DCHECK(type_ == DemuxerStream::VIDEO);
renderer_->OnVideoOpacityChange(opaque);
}
- void OnVideoFrameRateChange(absl::optional<int> fps) override {
+ void OnVideoFrameRateChange(std::optional<int> fps) override {
DCHECK(type_ == DemuxerStream::VIDEO);
renderer_->OnVideoFrameRateChange(fps);
}
@@ -183,8 +183,7 @@
InitializeAudioRenderer();
}
-void RendererImpl::SetLatencyHint(
- absl::optional<base::TimeDelta> latency_hint) {
+void RendererImpl::SetLatencyHint(std::optional<base::TimeDelta> latency_hint) {
DVLOG(1) << __func__;
DCHECK(!latency_hint || (*latency_hint >= base::TimeDelta()));
DCHECK(task_runner_->RunsTasksInCurrentSequence());
@@ -973,7 +972,7 @@
client_->OnVideoOpacityChange(opaque);
}
-void RendererImpl::OnVideoFrameRateChange(absl::optional<int> fps) {
+void RendererImpl::OnVideoFrameRateChange(std::optional<int> fps) {
DCHECK(task_runner_->RunsTasksInCurrentSequence());
client_->OnVideoFrameRateChange(fps);
}
diff --git a/media/renderers/renderer_impl.h b/media/renderers/renderer_impl.h
index 3a0d09b..8dd6ffe 100644
--- a/media/renderers/renderer_impl.h
+++ b/media/renderers/renderer_impl.h
@@ -57,7 +57,7 @@
RendererClient* client,
PipelineStatusCallback init_cb) final;
void SetCdm(CdmContext* cdm_context, CdmAttachedCB cdm_attached_cb) final;
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) final;
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) final;
void SetPreservesPitch(bool preserves_pitch) final;
void SetWasPlayedWithUserActivation(
bool was_played_with_user_activation) final;
@@ -204,7 +204,7 @@
void OnAudioConfigChange(const AudioDecoderConfig& config);
void OnVideoConfigChange(const VideoDecoderConfig& config);
void OnVideoOpacityChange(bool opaque);
- void OnVideoFrameRateChange(absl::optional<int> fps);
+ void OnVideoFrameRateChange(std::optional<int> fps);
void OnStreamRestartCompleted();
diff --git a/media/renderers/renderer_impl_unittest.cc b/media/renderers/renderer_impl_unittest.cc
index f4542ca6..327969f 100644
--- a/media/renderers/renderer_impl_unittest.cc
+++ b/media/renderers/renderer_impl_unittest.cc
@@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "media/renderers/renderer_impl.h"
+
#include <stdint.h>
#include <memory>
+#include <optional>
#include <vector>
#include "base/functional/bind.h"
@@ -20,9 +23,7 @@
#include "base/time/time.h"
#include "media/base/mock_filters.h"
#include "media/base/test_helpers.h"
-#include "media/renderers/renderer_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
using ::base::test::RunCallback;
using ::base::test::RunClosure;
diff --git a/media/renderers/video_frame_yuv_converter.cc b/media/renderers/video_frame_yuv_converter.cc
index 1db9ded7..4ca4bf3f 100644
--- a/media/renderers/video_frame_yuv_converter.cc
+++ b/media/renderers/video_frame_yuv_converter.cc
@@ -110,7 +110,7 @@
const VideoFrame* video_frame,
viz::RasterContextProvider* raster_context_provider,
const gpu::MailboxHolder& dest_mailbox_holder,
- absl::optional<GrParams> gr_params) {
+ std::optional<GrParams> gr_params) {
VideoFrameYUVConverter converter;
return converter.ConvertYUVVideoFrame(video_frame, raster_context_provider,
dest_mailbox_holder, gr_params);
@@ -120,7 +120,7 @@
const VideoFrame* video_frame,
viz::RasterContextProvider* raster_context_provider,
const gpu::MailboxHolder& dest_mailbox_holder,
- absl::optional<GrParams> gr_params) {
+ std::optional<GrParams> gr_params) {
DCHECK(video_frame);
DCHECK(IsVideoFrameFormatSupported(*video_frame))
<< "VideoFrame has an unsupported YUV format " << video_frame->format();
diff --git a/media/renderers/video_frame_yuv_converter.h b/media/renderers/video_frame_yuv_converter.h
index 47b9107e..cb460c716f 100644
--- a/media/renderers/video_frame_yuv_converter.h
+++ b/media/renderers/video_frame_yuv_converter.h
@@ -55,11 +55,11 @@
const VideoFrame* video_frame,
viz::RasterContextProvider* raster_context_provider,
const gpu::MailboxHolder& dest_mailbox_holder,
- absl::optional<GrParams> gr_params = absl::nullopt);
+ std::optional<GrParams> gr_params = std::nullopt);
bool ConvertYUVVideoFrame(const VideoFrame* video_frame,
viz::RasterContextProvider* raster_context_provider,
const gpu::MailboxHolder& dest_mailbox_holder,
- absl::optional<GrParams> gr_params = absl::nullopt);
+ std::optional<GrParams> gr_params = std::nullopt);
void ReleaseCachedData();
private:
diff --git a/media/renderers/video_renderer_impl.cc b/media/renderers/video_renderer_impl.cc
index 362a782..6d2e171c 100644
--- a/media/renderers/video_renderer_impl.cc
+++ b/media/renderers/video_renderer_impl.cc
@@ -478,7 +478,7 @@
}
void VideoRendererImpl::SetLatencyHint(
- absl::optional<base::TimeDelta> latency_hint) {
+ std::optional<base::TimeDelta> latency_hint) {
base::AutoLock auto_lock(lock_);
latency_hint_ = latency_hint;
@@ -855,7 +855,7 @@
DCHECK(task_runner_->RunsTasksInCurrentSequence());
lock_.AssertAcquired();
- absl::optional<int> current_fps = fps_estimator_.ComputeFPS();
+ std::optional<int> current_fps = fps_estimator_.ComputeFPS();
if (last_reported_fps_ && current_fps &&
*last_reported_fps_ == *current_fps) {
// Reported an FPS before, and it hasn't changed.
diff --git a/media/renderers/video_renderer_impl.h b/media/renderers/video_renderer_impl.h
index 9c54eafad..f699455 100644
--- a/media/renderers/video_renderer_impl.h
+++ b/media/renderers/video_renderer_impl.h
@@ -80,7 +80,7 @@
void StartPlayingFrom(base::TimeDelta timestamp) override;
void OnTimeProgressing() override;
void OnTimeStopped() override;
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) override;
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) override;
void SetTickClockForTesting(const base::TickClock* tick_clock);
size_t frames_queued_for_testing() const {
@@ -366,11 +366,11 @@
FrameRateEstimator fps_estimator_;
// Last FPS, if any, reported to the client.
- absl::optional<int> last_reported_fps_;
+ std::optional<int> last_reported_fps_;
// Value saved from last call to SetLatencyHint(). Used to recompute buffering
// limits as framerate fluctuates.
- absl::optional<base::TimeDelta> latency_hint_;
+ std::optional<base::TimeDelta> latency_hint_;
// When latency_hint_ > 0, we make regular adjustments to buffering caps as
// |algorithm_->average_frame_duration()| fluctuates, but we only want to emit
diff --git a/media/renderers/video_renderer_impl_unittest.cc b/media/renderers/video_renderer_impl_unittest.cc
index cb68d60..88e6dd3c 100644
--- a/media/renderers/video_renderer_impl_unittest.cc
+++ b/media/renderers/video_renderer_impl_unittest.cc
@@ -476,7 +476,7 @@
EXPECT_CALL(mock_cb_, OnStatisticsUpdate(_)).Times(AnyNumber());
EXPECT_CALL(mock_cb_, OnVideoNaturalSizeChange(_)).Times(1);
EXPECT_CALL(mock_cb_, OnVideoOpacityChange(_)).Times(1);
- EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(absl::optional<int>(100)));
+ EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(std::optional<int>(100)));
StartPlayingFrom(10);
Destroy();
}
@@ -695,7 +695,7 @@
EXPECT_CALL(mock_cb_, OnStatisticsUpdate(_)).Times(AnyNumber());
EXPECT_CALL(mock_cb_, OnVideoNaturalSizeChange(_)).Times(1);
EXPECT_CALL(mock_cb_, OnVideoOpacityChange(_)).Times(1);
- EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(absl::optional<int>(100)));
+ EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(std::optional<int>(100)));
StartPlayingFrom(59);
Destroy();
}
@@ -709,7 +709,7 @@
EXPECT_CALL(mock_cb_, OnStatisticsUpdate(_)).Times(AnyNumber());
EXPECT_CALL(mock_cb_, OnVideoNaturalSizeChange(_)).Times(1);
EXPECT_CALL(mock_cb_, OnVideoOpacityChange(_)).Times(1);
- EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(absl::optional<int>(100)));
+ EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(std::optional<int>(100)));
StartPlayingFrom(61);
Destroy();
}
@@ -1238,12 +1238,12 @@
EXPECT_CALL(mock_cb_, OnVideoOpacityChange(_)).Times(1);
// Send 50fps frames first.
- EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(absl::optional<int>(50)));
+ EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(std::optional<int>(50)));
QueueFrames("0 20 40 60 80 100 120 140 160 180 200");
QueueFrames("220 240 260 280 300 320 340 360 380 400");
// Also queue some frames that aren't at 50fps, so that we get an unknown fps.
- EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(absl::optional<int>()));
+ EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(std::optional<int>()));
QueueFrames("500 600");
// Drain everything.
@@ -1467,7 +1467,7 @@
// the have enough state.
case UnderflowTestType::NORMAL:
QueueFrames("80 100 120 140 160");
- EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(absl::optional<int>(50)));
+ EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(std::optional<int>(50)));
break;
// In either of these modes the HAVE_ENOUGH transition should still
// occur with a single frame.
@@ -1574,7 +1574,7 @@
EXPECT_EQ(renderer_->frames_queued_for_testing(), 4u);
// Unset latencyHint, to verify default behavior.
- renderer_->SetLatencyHint(absl::nullopt);
+ renderer_->SetLatencyHint(std::nullopt);
// Flush to return to clean slate.
EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING, _));
@@ -1609,7 +1609,7 @@
// Queue 12 frames, each 30 ms apart. At this framerate, 400ms rounds to 13
// frames, so 12 frames should be 1 shy of the HaveEnough threshold.
- EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(absl::optional<int>(33)));
+ EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(std::optional<int>(33)));
EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH, _))
.Times(0);
QueueFrames("0 30 60 90 120 150 180 210 240 270 300 330");
@@ -1629,7 +1629,7 @@
Mock::VerifyAndClearExpectations(&mock_cb_);
// Unset latencyHint, to verify default behavior.
- renderer_->SetLatencyHint(absl::nullopt);
+ renderer_->SetLatencyHint(std::nullopt);
// Flush to return to clean slate.
EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING, _));
@@ -1665,7 +1665,7 @@
EXPECT_CALL(mock_cb_, OnVideoNaturalSizeChange(_)).Times(1);
EXPECT_CALL(mock_cb_, OnVideoOpacityChange(_)).Times(1);
EXPECT_CALL(mock_cb_, OnStatisticsUpdate(_)).Times(AnyNumber());
- EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(absl::optional<int>(33)));
+ EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(std::optional<int>(33)));
EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH, _));
QueueFrames("0 30 60 90 120 150 180");
StartPlayingFrom(0);
@@ -1725,7 +1725,7 @@
// 7 frames, so 6 frames should be 1 shy of the HaveEnough threshold. Verify
// that HAVE_ENOUGH is not triggered in spite of being initialized with low
// delay mode.
- EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(absl::optional<int>(33)));
+ EXPECT_CALL(mock_cb_, OnVideoFrameRateChange(std::optional<int>(33)));
EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH, _))
.Times(0);
QueueFrames("0 30 60 90 120 150");
@@ -1745,7 +1745,7 @@
// Unset latencyHint, to verify default behavior. NOTE: low delay mode is not
// restored when latency hint unset.
- renderer_->SetLatencyHint(absl::nullopt);
+ renderer_->SetLatencyHint(std::nullopt);
// Flush to return to clean slate.
EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING, _));
@@ -1802,7 +1802,7 @@
Mock::VerifyAndClearExpectations(&mock_cb_);
// Unset latency hint to verify 1-frame HAVE_ENOUGH threshold is maintained.
- renderer_->SetLatencyHint(absl::nullopt);
+ renderer_->SetLatencyHint(std::nullopt);
// Flush to return to clean slate.
EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING, _));
diff --git a/media/renderers/video_resource_updater.cc b/media/renderers/video_resource_updater.cc
index 51546f5..c29a655 100644
--- a/media/renderers/video_resource_updater.cc
+++ b/media/renderers/video_resource_updater.cc
@@ -89,7 +89,7 @@
DCHECK(target == 0 || target == GL_TEXTURE_EXTERNAL_OES)
<< "Unsupported target " << gl::GLEnums::GetStringEnum(target);
DCHECK_EQ(num_textures, 1u);
- absl::optional<gfx::BufferFormat> buffer_format =
+ std::optional<gfx::BufferFormat> buffer_format =
VideoPixelFormatToGfxBufferFormat(format);
DCHECK(buffer_format.has_value());
if (frame.shared_image_format_type() == SharedImageFormatType::kLegacy) {
@@ -749,7 +749,7 @@
gfx::Rect quad_rect,
gfx::Rect visible_quad_rect,
const gfx::MaskFilterInfo& mask_filter_info,
- absl::optional<gfx::Rect> clip_rect,
+ std::optional<gfx::Rect> clip_rect,
bool contents_opaque,
float draw_opacity,
int sorting_context_id) {
diff --git a/media/renderers/video_resource_updater.h b/media/renderers/video_resource_updater.h
index 4162e3b..01117a9 100644
--- a/media/renderers/video_resource_updater.h
+++ b/media/renderers/video_resource_updater.h
@@ -120,7 +120,7 @@
gfx::Rect quad_rect,
gfx::Rect visible_quad_rect,
const gfx::MaskFilterInfo& mask_filter_info,
- absl::optional<gfx::Rect> clip_rect,
+ std::optional<gfx::Rect> clip_rect,
bool context_opaque,
float draw_opacity,
int sorting_context_id);
diff --git a/media/renderers/video_resource_updater_unittest.cc b/media/renderers/video_resource_updater_unittest.cc
index a08f95a6..0f79790 100644
--- a/media/renderers/video_resource_updater_unittest.cc
+++ b/media/renderers/video_resource_updater_unittest.cc
@@ -962,7 +962,7 @@
/*transform=*/gfx::Transform(),
/*quad_rect=*/gfx::Rect(video_frame->coded_size()),
/*visible_quad_rect=*/gfx::Rect(video_frame->coded_size()),
- gfx::MaskFilterInfo(), /*clip_rect=*/absl::nullopt,
+ gfx::MaskFilterInfo(), /*clip_rect=*/std::nullopt,
/*context_opaque=*/true, /*draw_opacity=*/1.0,
/*sorting_context_id=*/0);
diff --git a/media/renderers/win/media_foundation_renderer.cc b/media/renderers/win/media_foundation_renderer.cc
index 601ded9..c185fbd 100644
--- a/media/renderers/win/media_foundation_renderer.cc
+++ b/media/renderers/win/media_foundation_renderer.cc
@@ -489,7 +489,7 @@
}
void MediaFoundationRenderer::SetLatencyHint(
- absl::optional<base::TimeDelta> /*latency_hint*/) {
+ std::optional<base::TimeDelta> /*latency_hint*/) {
// TODO(frankli): Ensure MFMediaEngine rendering pipeine is in real time mode.
NOTIMPLEMENTED() << "We do not use the latency hint today";
}
diff --git a/media/renderers/win/media_foundation_renderer.h b/media/renderers/win/media_foundation_renderer.h
index 79deb5b..fc0fa73 100644
--- a/media/renderers/win/media_foundation_renderer.h
+++ b/media/renderers/win/media_foundation_renderer.h
@@ -86,7 +86,7 @@
RendererClient* client,
PipelineStatusCallback init_cb) override;
void SetCdm(CdmContext* cdm_context, CdmAttachedCB cdm_attached_cb) override;
- void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) override;
+ void SetLatencyHint(std::optional<base::TimeDelta> latency_hint) override;
void Flush(base::OnceClosure flush_cb) override;
void StartPlayingFrom(base::TimeDelta time) override;
void SetPlaybackRate(double playback_rate) override;
diff --git a/media/renderers/win/media_foundation_renderer_integration_test.cc b/media/renderers/win/media_foundation_renderer_integration_test.cc
index 43cbdec..f8b024b 100644
--- a/media/renderers/win/media_foundation_renderer_integration_test.cc
+++ b/media/renderers/win/media_foundation_renderer_integration_test.cc
@@ -75,7 +75,7 @@
private:
std::unique_ptr<Renderer> CreateMediaFoundationRenderer(
- absl::optional<RendererType> /*renderer_type*/) {
+ std::optional<RendererType> /*renderer_type*/) {
LUID empty_luid{0, 0};
auto renderer = std::make_unique<MediaFoundationRenderer>(
task_environment_.GetMainThreadTaskRunner(),
diff --git a/media/renderers/win/media_foundation_stream_wrapper.h b/media/renderers/win/media_foundation_stream_wrapper.h
index 9dffd74..3b1bfed4 100644
--- a/media/renderers/win/media_foundation_stream_wrapper.h
+++ b/media/renderers/win/media_foundation_stream_wrapper.h
@@ -10,6 +10,7 @@
#include <wrl.h>
#include <memory>
+#include <optional>
#include <queue>
#include "base/memory/raw_ptr.h"
@@ -20,7 +21,6 @@
#include "media/base/decoder_buffer.h"
#include "media/base/demuxer_stream.h"
#include "media/base/media_log.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc
index 95d4f5bf..7d6e427 100644
--- a/media/test/pipeline_integration_test.cc
+++ b/media/test/pipeline_integration_test.cc
@@ -398,7 +398,7 @@
}
void OnSelectedVideoTrackChanged(
- absl::optional<MediaTrack::Id> selected_track_id) {
+ std::optional<MediaTrack::Id> selected_track_id) {
base::RunLoop run_loop;
pipeline_->OnSelectedVideoTrackChanged(selected_track_id,
run_loop.QuitClosure());
@@ -780,7 +780,7 @@
ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed | kNoClockless));
// Disable video.
- OnSelectedVideoTrackChanged(absl::nullopt);
+ OnSelectedVideoTrackChanged(std::nullopt);
// Seek to flush the pipeline and ensure there's no prerolled video data.
ASSERT_TRUE(Seek(base::TimeDelta()));
@@ -817,7 +817,7 @@
TEST_F(PipelineIntegrationTest, TrackStatusChangesBeforePipelineStarted) {
std::vector<MediaTrack::Id> empty_track_ids;
OnEnabledAudioTracksChanged(empty_track_ids);
- OnSelectedVideoTrackChanged(absl::nullopt);
+ OnSelectedVideoTrackChanged(std::nullopt);
}
TEST_F(PipelineIntegrationTest, TrackStatusChangesAfterPipelineEnded) {
@@ -831,7 +831,7 @@
track_ids.push_back(MediaTrack::Id("2"));
OnEnabledAudioTracksChanged(track_ids);
// Disable video track.
- OnSelectedVideoTrackChanged(absl::nullopt);
+ OnSelectedVideoTrackChanged(std::nullopt);
// Re-enable video track.
OnSelectedVideoTrackChanged(MediaTrack::Id("1"));
}
@@ -871,7 +871,7 @@
ASSERT_TRUE(Suspend());
// Disable video track.
- OnSelectedVideoTrackChanged(absl::nullopt);
+ OnSelectedVideoTrackChanged(std::nullopt);
ASSERT_TRUE(Resume(TimestampMs(300)));
ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(400)));
ASSERT_TRUE(Suspend());
@@ -918,7 +918,7 @@
EXPECT_CALL(*this, OnVideoOpacityChange(true)).Times(AnyNumber());
// Disable the video track.
- OnSelectedVideoTrackChanged(absl::nullopt);
+ OnSelectedVideoTrackChanged(std::nullopt);
// pipeline.Suspend() releases renderers and pipeline.Resume() recreates and
// reinitializes renderers while the video track is disabled.
ASSERT_TRUE(Suspend());
@@ -952,7 +952,7 @@
// Disable video track first, to re-enable it later and stop the pipeline
// (which destroys the media renderer) while video restart is pending.
- OnSelectedVideoTrackChanged(absl::nullopt);
+ OnSelectedVideoTrackChanged(std::nullopt);
ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(200)));
OnSelectedVideoTrackChanged(MediaTrack::Id("1"));
@@ -1631,7 +1631,7 @@
// Disable the video track and start playback. Renderer won't read from the
// disabled video stream, so the video stream read position should be 0.
- OnSelectedVideoTrackChanged(absl::nullopt);
+ OnSelectedVideoTrackChanged(std::nullopt);
Play();
// Wait until audio playback advances past 2 seconds and call MSE GC algorithm
diff --git a/media/test/pipeline_integration_test_base.cc b/media/test/pipeline_integration_test_base.cc
index 7399c22..8f34d55 100644
--- a/media/test/pipeline_integration_test_base.cc
+++ b/media/test/pipeline_integration_test_base.cc
@@ -558,7 +558,7 @@
}
std::unique_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer(
- absl::optional<RendererType> renderer_type) {
+ std::optional<RendererType> renderer_type) {
if (create_renderer_cb_)
return create_renderer_cb_.Run(renderer_type);
@@ -566,7 +566,7 @@
}
std::unique_ptr<Renderer> PipelineIntegrationTestBase::CreateRendererImpl(
- absl::optional<RendererType> renderer_type) {
+ std::optional<RendererType> renderer_type) {
if (renderer_type && *renderer_type != RendererType::kRendererImpl) {
DVLOG(1) << __func__ << ": renderer_type not supported";
return nullptr;
diff --git a/media/test/pipeline_integration_test_base.h b/media/test/pipeline_integration_test_base.h
index 18429ef..587077e 100644
--- a/media/test/pipeline_integration_test_base.h
+++ b/media/test/pipeline_integration_test_base.h
@@ -142,7 +142,7 @@
}
std::unique_ptr<Renderer> CreateRenderer(
- absl::optional<RendererType> renderer_type);
+ std::optional<RendererType> renderer_type);
protected:
NiceMock<MockMediaLog> media_log_;
@@ -177,11 +177,11 @@
// if |create_renderer_cb_| is set, it'll be used to create the Renderer
// instead.
using CreateRendererCB = base::RepeatingCallback<std::unique_ptr<Renderer>(
- absl::optional<RendererType> renderer_type)>;
+ std::optional<RendererType> renderer_type)>;
CreateRendererCB create_renderer_cb_;
std::unique_ptr<Renderer> CreateRendererImpl(
- absl::optional<RendererType> renderer_type);
+ std::optional<RendererType> renderer_type);
// Sets |create_renderer_cb_| which will be used to wrap the Renderer created
// by CreateRendererImpl().
@@ -256,7 +256,7 @@
MOCK_METHOD1(OnVideoConfigChange, void(const VideoDecoderConfig&));
MOCK_METHOD1(OnAudioConfigChange, void(const AudioDecoderConfig&));
MOCK_METHOD1(OnVideoOpacityChange, void(bool));
- MOCK_METHOD1(OnVideoFrameRateChange, void(absl::optional<int>));
+ MOCK_METHOD1(OnVideoFrameRateChange, void(std::optional<int>));
MOCK_METHOD0(OnVideoAverageKeyframeDistanceUpdate, void());
MOCK_METHOD1(OnAudioPipelineInfoChange, void(const AudioPipelineInfo&));
MOCK_METHOD1(OnVideoPipelineInfoChange, void(const VideoPipelineInfo&));
@@ -283,7 +283,7 @@
CreateAudioDecodersCB prepend_audio_decoders_cb_;
// First buffering state we get from the pipeline.
- absl::optional<BufferingState> buffering_state_;
+ std::optional<BufferingState> buffering_state_;
base::OnceClosure on_ended_closure_;
base::OnceClosure on_error_closure_;
diff --git a/media/video/alpha_video_encoder_wrapper.cc b/media/video/alpha_video_encoder_wrapper.cc
index 82d69ed..890794a 100644
--- a/media/video/alpha_video_encoder_wrapper.cc
+++ b/media/video/alpha_video_encoder_wrapper.cc
@@ -197,7 +197,7 @@
void AlphaVideoEncoderWrapper::YuvOutputCallback(
VideoEncoderOutput output,
- absl::optional<CodecDescription> desc) {
+ std::optional<CodecDescription> desc) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (desc.has_value()) {
NOTREACHED()
@@ -208,7 +208,7 @@
}
void AlphaVideoEncoderWrapper::AlphaOutputCallback(
VideoEncoderOutput output,
- absl::optional<CodecDescription> desc) {
+ std::optional<CodecDescription> desc) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (desc.has_value()) {
NOTREACHED()
diff --git a/media/video/alpha_video_encoder_wrapper.h b/media/video/alpha_video_encoder_wrapper.h
index d27e3edc..1d0eba90 100644
--- a/media/video/alpha_video_encoder_wrapper.h
+++ b/media/video/alpha_video_encoder_wrapper.h
@@ -46,16 +46,16 @@
private:
void YuvOutputCallback(VideoEncoderOutput output,
- absl::optional<CodecDescription> desc);
+ std::optional<CodecDescription> desc);
void AlphaOutputCallback(VideoEncoderOutput output,
- absl::optional<CodecDescription> desc);
+ std::optional<CodecDescription> desc);
std::unique_ptr<VideoEncoder> yuv_encoder_;
std::unique_ptr<VideoEncoder> alpha_encoder_;
- absl::optional<VideoEncoderOutput> yuv_output_;
- absl::optional<VideoEncoderOutput> alpha_output_;
- absl::optional<EncoderStatus> init_status_;
- absl::optional<EncoderStatus> encode_status_;
+ std::optional<VideoEncoderOutput> yuv_output_;
+ std::optional<VideoEncoderOutput> alpha_output_;
+ std::optional<EncoderStatus> init_status_;
+ std::optional<EncoderStatus> encode_status_;
std::vector<uint8_t> dummy_uv_planes_;
diff --git a/media/video/alpha_video_encoder_wrapper_unittest.cc b/media/video/alpha_video_encoder_wrapper_unittest.cc
index a8bd94a..35ca7d33 100644
--- a/media/video/alpha_video_encoder_wrapper_unittest.cc
+++ b/media/video/alpha_video_encoder_wrapper_unittest.cc
@@ -162,7 +162,7 @@
options.frame_size = gfx::Size(640, 480);
bool output_called = false;
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
- [&](VideoEncoderOutput, absl::optional<VideoEncoder::CodecDescription>) {
+ [&](VideoEncoderOutput, std::optional<VideoEncoder::CodecDescription>) {
output_called = true;
});
@@ -185,7 +185,7 @@
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
EXPECT_TRUE(output.key_frame);
outputs_count++;
});
@@ -222,7 +222,7 @@
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
EXPECT_NE(output.data, nullptr);
EXPECT_GT(output.size, 0u);
EXPECT_NE(output.alpha_data, nullptr);
@@ -264,7 +264,7 @@
VideoEncoder::OutputCB encoder_output_cb = base::BindLambdaForTesting(
[&, this](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
auto buffer =
DecoderBuffer::FromArray(std::move(output.data), output.size);
buffer->set_timestamp(output.timestamp);
diff --git a/media/video/av1_video_encoder.cc b/media/video/av1_video_encoder.cc
index bd2ebc7..be461d9 100644
--- a/media/video/av1_video_encoder.cc
+++ b/media/video/av1_video_encoder.cc
@@ -36,9 +36,9 @@
// If conversion is needed for given profile and frame, returns the destination
// pixel format. If no conversion is needed returns nullopt.
-absl::optional<VideoPixelFormat> GetConversionFormat(VideoCodecProfile profile,
- VideoPixelFormat format,
- bool needs_resize) {
+std::optional<VideoPixelFormat> GetConversionFormat(VideoCodecProfile profile,
+ VideoPixelFormat format,
+ bool needs_resize) {
switch (profile) {
case AV1PROFILE_PROFILE_MAIN:
if ((format != PIXEL_FORMAT_NV12 && format != PIXEL_FORMAT_I420) ||
@@ -56,7 +56,7 @@
NOTREACHED(); // Checked during Initialize().
}
- return absl::nullopt;
+ return std::nullopt;
}
aom_img_fmt GetAomImgFormat(VideoPixelFormat format) {
diff --git a/media/video/fake_gpu_memory_buffer.cc b/media/video/fake_gpu_memory_buffer.cc
index 89b4ca0f..a1d4739 100644
--- a/media/video/fake_gpu_memory_buffer.cc
+++ b/media/video/fake_gpu_memory_buffer.cc
@@ -63,7 +63,7 @@
gfx::BufferFormat format,
uint64_t modifier)
: size_(size), format_(format) {
- absl::optional<VideoPixelFormat> video_pixel_format =
+ std::optional<VideoPixelFormat> video_pixel_format =
GfxBufferFormatToVideoPixelFormat(format);
CHECK(video_pixel_format);
video_pixel_format_ = *video_pixel_format;
diff --git a/media/video/fake_video_encode_accelerator.cc b/media/video/fake_video_encode_accelerator.cc
index bbb2211..94779fe 100644
--- a/media/video/fake_video_encode_accelerator.cc
+++ b/media/video/fake_video_encode_accelerator.cc
@@ -90,7 +90,7 @@
void FakeVideoEncodeAccelerator::RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
// Reject bitrate mode changes.
if (stored_bitrates_.empty() ||
stored_bitrates_.back().mode() == bitrate.mode()) {
@@ -104,7 +104,7 @@
void FakeVideoEncodeAccelerator::RequestEncodingParametersChange(
const VideoBitrateAllocation& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
stored_bitrate_allocations_.push_back(bitrate);
if (size.has_value()) {
UpdateOutputFrameSize(size.value());
diff --git a/media/video/fake_video_encode_accelerator.h b/media/video/fake_video_encode_accelerator.h
index d8fd8027..7818a45 100644
--- a/media/video/fake_video_encode_accelerator.h
+++ b/media/video/fake_video_encode_accelerator.h
@@ -49,11 +49,11 @@
void RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
void RequestEncodingParametersChange(
const VideoBitrateAllocation& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) override;
+ const std::optional<gfx::Size>& size) override;
bool IsGpuFrameResizeSupported() override;
void Destroy() override;
diff --git a/media/video/gpu_memory_buffer_video_frame_pool.cc b/media/video/gpu_memory_buffer_video_frame_pool.cc
index c1e6322..92b0d80 100644
--- a/media/video/gpu_memory_buffer_video_frame_pool.cc
+++ b/media/video/gpu_memory_buffer_video_frame_pool.cc
@@ -212,7 +212,7 @@
const gfx::ColorSpace& color_space,
base::TimeDelta timestamp,
bool video_frame_allow_overlay,
- const absl::optional<gpu::VulkanYCbCrInfo>& ycbcr_info);
+ const std::optional<gpu::VulkanYCbCrInfo>& ycbcr_info);
// Return true if |resources| can be used to represent a frame for
// specific |format| and |size|.
@@ -1240,7 +1240,7 @@
const gfx::ColorSpace& color_space,
base::TimeDelta timestamp,
bool video_frame_allow_overlay,
- const absl::optional<gpu::VulkanYCbCrInfo>& ycbcr_info) {
+ const std::optional<gpu::VulkanYCbCrInfo>& ycbcr_info) {
DCHECK(media_task_runner_->RunsTasksInCurrentSequence());
gpu::SharedImageInterface* sii = gpu_factories_->SharedImageInterface();
if (!sii) {
diff --git a/media/video/gpu_video_accelerator_factories.h b/media/video/gpu_video_accelerator_factories.h
index 2c50eab..19678e7 100644
--- a/media/video/gpu_video_accelerator_factories.h
+++ b/media/video/gpu_video_accelerator_factories.h
@@ -9,6 +9,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include <vector>
#include "base/memory/scoped_refptr.h"
@@ -24,7 +25,6 @@
#include "media/base/video_decoder.h"
#include "media/base/video_types.h"
#include "media/video/video_encode_accelerator.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/gpu_memory_buffer.h"
namespace base {
@@ -145,7 +145,7 @@
//
// TODO(sandersd): Remove Optional if/when all clients check
// IsEncoderSupportKnown().
- virtual absl::optional<VideoEncodeAccelerator::SupportedProfiles>
+ virtual std::optional<VideoEncodeAccelerator::SupportedProfiles>
GetVideoEncodeAcceleratorSupportedProfiles() = 0;
// Returns true if GetVideoEncodeAcceleratorSupportedProfiles() is populated.
diff --git a/media/video/h264_level_limits.cc b/media/video/h264_level_limits.cc
index d973158..e12f771e 100644
--- a/media/video/h264_level_limits.cc
+++ b/media/video/h264_level_limits.cc
@@ -142,10 +142,10 @@
return true;
}
-absl::optional<uint8_t> FindValidH264Level(VideoCodecProfile profile,
- uint32_t bitrate,
- uint32_t framerate,
- uint32_t framesize_in_mbs) {
+std::optional<uint8_t> FindValidH264Level(VideoCodecProfile profile,
+ uint32_t bitrate,
+ uint32_t framerate,
+ uint32_t framesize_in_mbs) {
constexpr uint8_t kH264Levels[] = {
H264SPS::kLevelIDC1p0, H264SPS::kLevelIDC1B, H264SPS::kLevelIDC1p1,
H264SPS::kLevelIDC1p2, H264SPS::kLevelIDC1p3, H264SPS::kLevelIDC2p0,
@@ -162,7 +162,7 @@
return level;
}
}
- return absl::nullopt;
+ return std::nullopt;
}
} // namespace media
diff --git a/media/video/h264_level_limits.h b/media/video/h264_level_limits.h
index b769e79..ab01917 100644
--- a/media/video/h264_level_limits.h
+++ b/media/video/h264_level_limits.h
@@ -7,9 +7,10 @@
#include <stddef.h>
+#include <optional>
+
#include "media/base/media_export.h"
#include "media/base/video_codecs.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -40,8 +41,8 @@
// Return a minimum level that comforts Table A-1 in spec with |profile|,
// |bitrate|, |framerate| and |framesize_in_mbs|. If there is no proper level,
-// returns absl::nullopt.
-absl::optional<uint8_t> MEDIA_EXPORT
+// returns std::nullopt.
+std::optional<uint8_t> MEDIA_EXPORT
FindValidH264Level(VideoCodecProfile profile,
uint32_t bitrate,
uint32_t framerate,
diff --git a/media/video/h264_parser.cc b/media/video/h264_parser.cc
index 12206e4..9d2d460 100644
--- a/media/video/h264_parser.cc
+++ b/media/video/h264_parser.cc
@@ -70,7 +70,7 @@
// Based on T-REC-H.264 7.4.2.1.1, "Sequence parameter set data semantics",
// available from http://www.itu.int/rec/T-REC-H.264.
-absl::optional<gfx::Size> H264SPS::GetCodedSize() const {
+std::optional<gfx::Size> H264SPS::GetCodedSize() const {
// Interlaced frames are twice the height of each field.
const int mb_unit = 16;
int map_unit = frame_mbs_only_flag ? 16 : 32;
@@ -84,7 +84,7 @@
if (pic_width_in_mbs_minus1 > max_mb_minus1 ||
pic_height_in_map_units_minus1 > max_map_units_minus1) {
DVLOG(1) << "Coded size is too large.";
- return absl::nullopt;
+ return std::nullopt;
}
return gfx::Size(mb_unit * (pic_width_in_mbs_minus1 + 1),
@@ -92,10 +92,10 @@
}
// Also based on section 7.4.2.1.1.
-absl::optional<gfx::Rect> H264SPS::GetVisibleRect() const {
- absl::optional<gfx::Size> coded_size = GetCodedSize();
+std::optional<gfx::Rect> H264SPS::GetVisibleRect() const {
+ std::optional<gfx::Size> coded_size = GetCodedSize();
if (!coded_size)
- return absl::nullopt;
+ return std::nullopt;
if (!frame_cropping_flag)
return gfx::Rect(coded_size.value());
@@ -124,7 +124,7 @@
coded_size->height() / crop_unit_y < frame_crop_top_offset ||
coded_size->height() / crop_unit_y < frame_crop_bottom_offset) {
DVLOG(1) << "Frame cropping exceeds coded size.";
- return absl::nullopt;
+ return std::nullopt;
}
int crop_left = crop_unit_x * frame_crop_left_offset;
int crop_right = crop_unit_x * frame_crop_right_offset;
@@ -137,7 +137,7 @@
if (coded_size->width() - crop_left <= crop_right ||
coded_size->height() - crop_top <= crop_bottom) {
DVLOG(1) << "Frame cropping excludes entire frame.";
- return absl::nullopt;
+ return std::nullopt;
}
return gfx::Rect(crop_left, crop_top,
diff --git a/media/video/h264_parser.h b/media/video/h264_parser.h
index f927ade..98d9d98 100644
--- a/media/video/h264_parser.h
+++ b/media/video/h264_parser.h
@@ -13,6 +13,7 @@
#include <map>
#include <memory>
+#include <optional>
#include <vector>
#include "media/base/media_export.h"
@@ -21,7 +22,6 @@
#include "media/base/video_color_space.h"
#include "media/base/video_types.h"
#include "media/video/h264_bit_reader.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace gfx {
class Rect;
@@ -216,10 +216,10 @@
bool* constraint_set3_flag);
// Helpers to compute frequently-used values. These methods return
- // absl::nullopt if they encounter integer overflow. They do not verify that
+ // std::nullopt if they encounter integer overflow. They do not verify that
// the results are in-spec for the given profile or level.
- absl::optional<gfx::Size> GetCodedSize() const;
- absl::optional<gfx::Rect> GetVisibleRect() const;
+ std::optional<gfx::Size> GetCodedSize() const;
+ std::optional<gfx::Rect> GetVisibleRect() const;
VideoColorSpace GetColorSpace() const;
VideoChromaSampling GetChromaSampling() const;
diff --git a/media/video/h264_parser_fuzzertest.cc b/media/video/h264_parser_fuzzertest.cc
index b87aaad..01c53664 100644
--- a/media/video/h264_parser_fuzzertest.cc
+++ b/media/video/h264_parser_fuzzertest.cc
@@ -4,9 +4,10 @@
#include <stddef.h>
+#include <optional>
+
#include "base/numerics/safe_conversions.h"
#include "media/video/h264_parser.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -46,9 +47,9 @@
break;
// Also test the SPS helper methods. We make sure that the results are
// used so that the calls are not optimized away.
- absl::optional<gfx::Size> coded_size = sps->GetCodedSize();
+ std::optional<gfx::Size> coded_size = sps->GetCodedSize();
volatile_sink = coded_size.value_or(gfx::Size()).ToString().length();
- absl::optional<gfx::Rect> visible_rect = sps->GetVisibleRect();
+ std::optional<gfx::Rect> visible_rect = sps->GetVisibleRect();
volatile_sink = visible_rect.value_or(gfx::Rect()).ToString().length();
break;
}
diff --git a/media/video/h264_parser_unittest.cc b/media/video/h264_parser_unittest.cc
index 23eb0d9..f97abf2 100644
--- a/media/video/h264_parser_unittest.cc
+++ b/media/video/h264_parser_unittest.cc
@@ -6,6 +6,7 @@
#include <limits>
#include <memory>
+#include <optional>
#include <vector>
#include "base/command_line.h"
@@ -15,7 +16,6 @@
#include "media/base/subsample_entry.h"
#include "media/base/test_data_util.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -62,7 +62,7 @@
// Overflow.
sps->pic_width_in_mbs_minus1 = std::numeric_limits<int>::max();
- EXPECT_EQ(absl::nullopt, sps->GetCodedSize());
+ EXPECT_EQ(std::nullopt, sps->GetCodedSize());
}
TEST_F(H264SPSTest, GetVisibleRect) {
@@ -89,14 +89,14 @@
sps->frame_crop_right_offset = 1;
sps->frame_crop_top_offset = 0;
sps->frame_crop_bottom_offset = 0;
- EXPECT_EQ(absl::nullopt, sps->GetVisibleRect());
+ EXPECT_EQ(std::nullopt, sps->GetVisibleRect());
// Overflow.
sps->frame_crop_left_offset = std::numeric_limits<int>::max() / 2 + 1;
sps->frame_crop_right_offset = 0;
sps->frame_crop_top_offset = 0;
sps->frame_crop_bottom_offset = 0;
- EXPECT_EQ(absl::nullopt, sps->GetVisibleRect());
+ EXPECT_EQ(std::nullopt, sps->GetVisibleRect());
}
TEST(H264ParserTest, StreamFileParsing) {
diff --git a/media/video/h264_poc.cc b/media/video/h264_poc.cc
index faa702b..d520dc5 100644
--- a/media/video/h264_poc.cc
+++ b/media/video/h264_poc.cc
@@ -57,12 +57,12 @@
pending_mmco5_ = false;
}
-absl::optional<int32_t> H264POC::ComputePicOrderCnt(
+std::optional<int32_t> H264POC::ComputePicOrderCnt(
const H264SPS* sps,
const H264SliceHeader& slice_hdr) {
if (slice_hdr.field_pic_flag) {
DLOG(ERROR) << "Interlaced frames are not supported";
- return absl::nullopt;
+ return std::nullopt;
}
int32_t pic_order_cnt = 0;
@@ -166,7 +166,7 @@
// Moved inside 8-9 to avoid division when this check is not done.
if (sps->num_ref_frames_in_pic_order_cnt_cycle == 0) {
DLOG(ERROR) << "Invalid num_ref_frames_in_pic_order_cnt_cycle";
- return absl::nullopt;
+ return std::nullopt;
}
// H264Parser checks that num_ref_frames_in_pic_order_cnt_cycle < 255.
@@ -246,7 +246,7 @@
default:
DLOG(ERROR) << "Invalid pic_order_cnt_type: " << sps->pic_order_cnt_type;
- return absl::nullopt;
+ return std::nullopt;
}
return pic_order_cnt;
diff --git a/media/video/h264_poc.h b/media/video/h264_poc.h
index fef8011..ec3c0f0 100644
--- a/media/video/h264_poc.h
+++ b/media/video/h264_poc.h
@@ -7,8 +7,9 @@
#include <stdint.h>
+#include <optional>
+
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -25,8 +26,8 @@
~H264POC();
// Returns the picture order count for a slice.
- absl::optional<int32_t> ComputePicOrderCnt(const H264SPS* sps,
- const H264SliceHeader& slice_hdr);
+ std::optional<int32_t> ComputePicOrderCnt(const H264SPS* sps,
+ const H264SliceHeader& slice_hdr);
// As specified, the POC of a frame with MMCO5 changes (to zero) after
// decoding. We instead return 0 immediately, and flag that this has occurred
diff --git a/media/video/h264_poc_unittest.cc b/media/video/h264_poc_unittest.cc
index 1f32141..901f256 100644
--- a/media/video/h264_poc_unittest.cc
+++ b/media/video/h264_poc_unittest.cc
@@ -45,7 +45,7 @@
slice_hdr_.ref_pic_marking[2].memory_mgmnt_control_operation = 0;
}
- absl::optional<int32_t> poc_;
+ std::optional<int32_t> poc_;
H264SPS sps_;
H264SliceHeader slice_hdr_;
diff --git a/media/video/h265_poc.h b/media/video/h265_poc.h
index 625f2588..3e8cfcc 100644
--- a/media/video/h265_poc.h
+++ b/media/video/h265_poc.h
@@ -7,8 +7,9 @@
#include <stdint.h>
+#include <optional>
+
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/video/h266_parser.h b/media/video/h266_parser.h
index 4c784ebb..8bb0889 100644
--- a/media/video/h266_parser.h
+++ b/media/video/h266_parser.h
@@ -12,6 +12,7 @@
#include <stdint.h>
#include <sys/types.h>
+#include <optional>
#include <variant>
#include <vector>
@@ -23,7 +24,6 @@
#include "media/video/h264_bit_reader.h"
#include "media/video/h264_parser.h"
#include "media/video/h266_nalu_parser.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
@@ -928,8 +928,8 @@
// 8.1.1 Below two are not parsed from bitstream. They
// are knobs provided to decoder to explicitly control
// whether we handle CRA and GDR as CLVS start, and
- absl::optional<bool> handle_cra_as_clvs_start_flag;
- absl::optional<bool> handle_gdr_as_clvs_start_flag;
+ std::optional<bool> handle_cra_as_clvs_start_flag;
+ std::optional<bool> handle_gdr_as_clvs_start_flag;
// Actual used flags by parser.
bool cra_as_clvs_start_flag;
bool gdr_as_clvs_start_flag;
diff --git a/media/video/h266_poc.h b/media/video/h266_poc.h
index 1a3e151..27cc006 100644
--- a/media/video/h266_poc.h
+++ b/media/video/h266_poc.h
@@ -7,10 +7,10 @@
#include <stdint.h>
+#include <optional>
#include <vector>
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
diff --git a/media/video/mock_gpu_video_accelerator_factories.h b/media/video/mock_gpu_video_accelerator_factories.h
index 7317457..e2136edf 100644
--- a/media/video/mock_gpu_video_accelerator_factories.h
+++ b/media/video/mock_gpu_video_accelerator_factories.h
@@ -49,7 +49,7 @@
RequestOverlayInfoCB));
MOCK_METHOD0(GetVideoEncodeAcceleratorSupportedProfiles,
- absl::optional<VideoEncodeAccelerator::SupportedProfiles>());
+ std::optional<VideoEncodeAccelerator::SupportedProfiles>());
MOCK_METHOD0(IsEncoderSupportKnown, bool());
MOCK_METHOD1(NotifyEncoderSupportKnown, void(base::OnceClosure));
// CreateVideoEncodeAccelerator returns scoped_ptr, which the mocking
diff --git a/media/video/mock_video_encode_accelerator.h b/media/video/mock_video_encode_accelerator.h
index c034374..d86b241 100644
--- a/media/video/mock_video_encode_accelerator.h
+++ b/media/video/mock_video_encode_accelerator.h
@@ -34,7 +34,7 @@
MOCK_METHOD3(RequestEncodingParametersChange,
void(const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size));
+ const std::optional<gfx::Size>& size));
MOCK_METHOD0(Destroy, void());
private:
diff --git a/media/video/offloading_video_encoder_unittest.cc b/media/video/offloading_video_encoder_unittest.cc
index e0d19f2..a4f7b103 100644
--- a/media/video/offloading_video_encoder_unittest.cc
+++ b/media/video/offloading_video_encoder_unittest.cc
@@ -66,7 +66,7 @@
called_info = true;
});
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
- [&](VideoEncoderOutput, absl::optional<VideoEncoder::CodecDescription>) {
+ [&](VideoEncoderOutput, std::optional<VideoEncoder::CodecDescription>) {
EXPECT_TRUE(callback_runner_->RunsTasksInCurrentSequence());
called_output = true;
});
@@ -127,8 +127,7 @@
});
VideoEncoder::OutputCB output_cb = base::BindRepeating(
- [](VideoEncoderOutput, absl::optional<VideoEncoder::CodecDescription>) {
- });
+ [](VideoEncoderOutput, std::optional<VideoEncoder::CodecDescription>) {});
EXPECT_CALL(*mock_video_encoder_, ChangeOptions(_, _, _))
.WillOnce(Invoke([this](const VideoEncoder::Options& options,
diff --git a/media/video/openh264_video_encoder.cc b/media/video/openh264_video_encoder.cc
index 438b5b9..695086c 100644
--- a/media/video/openh264_video_encoder.cc
+++ b/media/video/openh264_video_encoder.cc
@@ -298,7 +298,7 @@
if (!h264_converter_) {
result.size = total_chunk_size;
- output_cb_.Run(std::move(result), absl::optional<CodecDescription>());
+ output_cb_.Run(std::move(result), std::optional<CodecDescription>());
return EncoderStatus::Codes::kOk;
}
@@ -315,7 +315,7 @@
result.size = converted_output_size;
- absl::optional<CodecDescription> desc;
+ std::optional<CodecDescription> desc;
if (config_changed) {
const auto& config = h264_converter_->GetCurrentConfig();
desc = CodecDescription();
diff --git a/media/video/picture.h b/media/video/picture.h
index f97a0a1..90648b7 100644
--- a/media/video/picture.h
+++ b/media/video/picture.h
@@ -128,11 +128,11 @@
// Returns the color space of the picture.
const gfx::ColorSpace& color_space() const { return color_space_; }
- const absl::optional<gfx::HDRMetadata>& hdr_metadata() const {
+ const std::optional<gfx::HDRMetadata>& hdr_metadata() const {
return hdr_metadata_;
}
- void set_hdr_metadata(const absl::optional<gfx::HDRMetadata>& hdr_metadata) {
+ void set_hdr_metadata(const std::optional<gfx::HDRMetadata>& hdr_metadata) {
hdr_metadata_ = hdr_metadata;
}
@@ -199,7 +199,7 @@
int32_t bitstream_buffer_id_;
gfx::Rect visible_rect_;
gfx::ColorSpace color_space_;
- absl::optional<gfx::HDRMetadata> hdr_metadata_;
+ std::optional<gfx::HDRMetadata> hdr_metadata_;
bool allow_overlay_;
bool read_lock_fences_enabled_;
bool size_changed_;
diff --git a/media/video/software_video_encoder_test.cc b/media/video/software_video_encoder_test.cc
index eebbcf1a..c3066b2 100644
--- a/media/video/software_video_encoder_test.cc
+++ b/media/video/software_video_encoder_test.cc
@@ -65,7 +65,7 @@
VideoCodec codec;
VideoCodecProfile profile;
VideoPixelFormat pixel_format;
- absl::optional<SVCScalabilityMode> scalability_mode;
+ std::optional<SVCScalabilityMode> scalability_mode;
};
class SoftwareVideoEncoderTest
@@ -126,7 +126,7 @@
gfx::Size size,
VideoPixelFormat format,
base::TimeDelta timestamp,
- absl::optional<uint32_t> xor_mask = absl::nullopt) {
+ std::optional<uint32_t> xor_mask = std::nullopt) {
if (xor_mask) {
auto frame = frame_pool_.CreateFrame(format, size, gfx::Rect(size), size,
timestamp);
@@ -356,7 +356,7 @@
options.frame_size = gfx::Size(640, 480);
bool output_called = false;
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
- [&](VideoEncoderOutput, absl::optional<VideoEncoder::CodecDescription>) {
+ [&](VideoEncoderOutput, std::optional<VideoEncoder::CodecDescription>) {
output_called = true;
});
@@ -377,7 +377,7 @@
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
EXPECT_TRUE(output.key_frame);
outputs_count++;
});
@@ -407,7 +407,7 @@
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
outputs_count++;
});
@@ -444,7 +444,7 @@
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
EXPECT_NE(output.data, nullptr);
EXPECT_EQ(output.timestamp, frame_duration * outputs_count);
outputs_count++;
@@ -482,7 +482,7 @@
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
EXPECT_NE(output.data, nullptr);
outputs_count++;
});
@@ -524,7 +524,7 @@
VideoEncoder::OutputCB encoder_output_cb = base::BindLambdaForTesting(
[&, this](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
auto buffer =
DecoderBuffer::FromArray(std::move(output.data), output.size);
buffer->set_timestamp(output.timestamp);
@@ -592,7 +592,7 @@
VideoEncoder::OutputCB encoder_output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
chunks.push_back(std::move(output));
});
@@ -682,7 +682,7 @@
VideoEncoder::OutputCB encoder_output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
chunks.push_back(std::move(output));
});
@@ -726,7 +726,7 @@
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
outputs_count++;
});
@@ -800,7 +800,7 @@
VideoEncoder::OutputCB encoder_output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
auto buffer =
DecoderBuffer::FromArray(std::move(output.data), output.size);
buffer->set_timestamp(output.timestamp);
@@ -869,7 +869,7 @@
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
switch (outputs_count) {
case 0: {
// First frame should have extra_data
@@ -931,7 +931,7 @@
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
EXPECT_FALSE(desc.has_value());
EXPECT_NE(output.data, nullptr);
@@ -979,7 +979,7 @@
options.avc.produce_annexb = false;
struct ChunkWithConfig {
VideoEncoderOutput output;
- absl::optional<VideoEncoder::CodecDescription> desc;
+ std::optional<VideoEncoder::CodecDescription> desc;
};
std::vector<scoped_refptr<VideoFrame>> frames_to_encode;
std::vector<scoped_refptr<VideoFrame>> decoded_frames;
@@ -989,7 +989,7 @@
VideoEncoder::OutputCB encoder_output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription> desc) {
+ std::optional<VideoEncoder::CodecDescription> desc) {
chunks.push_back({std::move(output), std::move(desc)});
});
@@ -1071,7 +1071,7 @@
PrintTestParams);
SwVideoTestParams kH264SVCParams[] = {
- {VideoCodec::kH264, H264PROFILE_BASELINE, PIXEL_FORMAT_I420, absl::nullopt},
+ {VideoCodec::kH264, H264PROFILE_BASELINE, PIXEL_FORMAT_I420, std::nullopt},
{VideoCodec::kH264, H264PROFILE_BASELINE, PIXEL_FORMAT_I420,
SVCScalabilityMode::kL1T1},
{VideoCodec::kH264, H264PROFILE_BASELINE, PIXEL_FORMAT_I420,
@@ -1112,14 +1112,14 @@
PrintTestParams);
SwVideoTestParams kVpxSVCParams[] = {
- {VideoCodec::kVP9, VP9PROFILE_PROFILE0, PIXEL_FORMAT_I420, absl::nullopt},
+ {VideoCodec::kVP9, VP9PROFILE_PROFILE0, PIXEL_FORMAT_I420, std::nullopt},
{VideoCodec::kVP9, VP9PROFILE_PROFILE0, PIXEL_FORMAT_I420,
SVCScalabilityMode::kL1T1},
{VideoCodec::kVP9, VP9PROFILE_PROFILE0, PIXEL_FORMAT_I420,
SVCScalabilityMode::kL1T2},
{VideoCodec::kVP9, VP9PROFILE_PROFILE0, PIXEL_FORMAT_I420,
SVCScalabilityMode::kL1T3},
- {VideoCodec::kVP8, VP8PROFILE_ANY, PIXEL_FORMAT_I420, absl::nullopt},
+ {VideoCodec::kVP8, VP8PROFILE_ANY, PIXEL_FORMAT_I420, std::nullopt},
{VideoCodec::kVP8, VP8PROFILE_ANY, PIXEL_FORMAT_I420,
SVCScalabilityMode::kL1T1},
{VideoCodec::kVP8, VP8PROFILE_ANY, PIXEL_FORMAT_I420,
@@ -1153,7 +1153,7 @@
SwVideoTestParams kAv1SVCParams[] = {
{VideoCodec::kAV1, AV1PROFILE_PROFILE_MAIN, PIXEL_FORMAT_I420,
- absl::nullopt},
+ std::nullopt},
{VideoCodec::kAV1, AV1PROFILE_PROFILE_MAIN, PIXEL_FORMAT_I420,
SVCScalabilityMode::kL1T1},
{VideoCodec::kAV1, AV1PROFILE_PROFILE_MAIN, PIXEL_FORMAT_I420,
diff --git a/media/video/video_decode_accelerator.h b/media/video/video_decode_accelerator.h
index f077803..32db4a5 100644
--- a/media/video/video_decode_accelerator.h
+++ b/media/video/video_decode_accelerator.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include <vector>
#include "base/memory/scoped_refptr.h"
@@ -21,7 +22,6 @@
#include "media/base/overlay_info.h"
#include "media/base/video_decoder_config.h"
#include "media/video/picture.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_memory_buffer.h"
@@ -154,7 +154,7 @@
// The CDM that the VDA should use to decode encrypted streams. Must be
// set to a valid ID if |is_encrypted|.
- absl::optional<base::UnguessableToken> cdm_id;
+ std::optional<base::UnguessableToken> cdm_id;
// Whether the client supports deferred initialization.
bool is_deferred_initialization_allowed = false;
@@ -183,7 +183,7 @@
gfx::ColorSpace target_color_space;
// HDR metadata specified by the container.
- absl::optional<gfx::HDRMetadata> hdr_metadata;
+ std::optional<gfx::HDRMetadata> hdr_metadata;
};
// Interface for collaborating with picture interface to provide memory for
diff --git a/media/video/video_encode_accelerator.cc b/media/video/video_encode_accelerator.cc
index dee221d..77a1794c 100644
--- a/media/video/video_encode_accelerator.cc
+++ b/media/video/video_encode_accelerator.cc
@@ -44,11 +44,11 @@
BitstreamBufferMetadata::~BitstreamBufferMetadata() = default;
-absl::optional<uint8_t> BitstreamBufferMetadata::spatial_idx() const {
+std::optional<uint8_t> BitstreamBufferMetadata::spatial_idx() const {
if (vp9) {
return vp9->spatial_idx;
}
- return absl::nullopt;
+ return std::nullopt;
}
VideoEncodeAccelerator::Config::Config()
@@ -213,7 +213,7 @@
void VideoEncodeAccelerator::RequestEncodingParametersChange(
const VideoBitrateAllocation& bitrate_allocation,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) {
+ const std::optional<gfx::Size>& size) {
RequestEncodingParametersChange(
Bitrate::ConstantBitrate(bitrate_allocation.GetSumBps()), framerate,
size);
diff --git a/media/video/video_encode_accelerator.h b/media/video/video_encode_accelerator.h
index 56d2dfb2..97dd70d 100644
--- a/media/video/video_encode_accelerator.h
+++ b/media/video/video_encode_accelerator.h
@@ -9,6 +9,7 @@
#include <stdint.h>
#include <memory>
+#include <optional>
#include <vector>
#include "base/functional/callback_forward.h"
@@ -23,7 +24,6 @@
#include "media/base/video_encoder.h"
#include "media/base/video_types.h"
#include "media/video/video_encoder_info.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_space.h"
namespace media {
@@ -143,22 +143,22 @@
bool end_of_picture = true;
bool dropped_frame() const;
- absl::optional<uint8_t> spatial_idx() const;
+ std::optional<uint8_t> spatial_idx() const;
// |h264|, |vp8| or |vp9| may be set, but not multiple of them. Presumably,
// it's also possible for none of them to be set.
- absl::optional<H264Metadata> h264;
- absl::optional<Vp8Metadata> vp8;
- absl::optional<Vp9Metadata> vp9;
- absl::optional<Av1Metadata> av1;
- absl::optional<H265Metadata> h265;
+ std::optional<H264Metadata> h264;
+ std::optional<Vp8Metadata> vp8;
+ std::optional<Vp9Metadata> vp9;
+ std::optional<Av1Metadata> av1;
+ std::optional<H265Metadata> h265;
// Some platforms may adjust the encoding size to meet hardware requirements.
// If not set, the encoded size is the same as configured.
- absl::optional<gfx::Size> encoded_size;
+ std::optional<gfx::Size> encoded_size;
// Some platforms may adjust the color space.
- absl::optional<gfx::ColorSpace> encoded_color_space;
+ std::optional<gfx::ColorSpace> encoded_color_space;
};
// Video encoder interface.
@@ -263,18 +263,18 @@
// Initial encoding framerate in frames per second. This is optional and
// VideoEncodeAccelerator should use |kDefaultFramerate| if not given.
- absl::optional<uint32_t> initial_framerate =
+ std::optional<uint32_t> initial_framerate =
VideoEncodeAccelerator::kDefaultFramerate;
// Group of picture length for encoded output stream, indicates the
// distance between two key frames, i.e. IPPPIPPP would be represent as 4.
- absl::optional<uint32_t> gop_length;
+ std::optional<uint32_t> gop_length;
// Codec level of encoded output stream for H264 only. This value should
// be aligned to the H264 standard definition of SPS.level_idc.
// If this is not given, VideoEncodeAccelerator selects one of proper H.264
// levels for |input_visible_size| and |initial_framerate|.
- absl::optional<uint8_t> h264_output_level;
+ std::optional<uint8_t> h264_output_level;
// Indicates baseline profile or constrained baseline profile for H264 only.
bool is_constrained_h264 = false;
@@ -284,7 +284,7 @@
// Encode().
// This is kShmem iff a video frame is mapped in user space.
// This is kDmabuf iff a video frame has dmabuf.
- absl::optional<StorageType> storage_type;
+ std::optional<StorageType> storage_type;
// Indicates captured video (from a camera) or generated (screen grabber).
// Screen content has a number of special properties such as lack of noise,
@@ -429,7 +429,7 @@
virtual void RequestEncodingParametersChange(
const Bitrate& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size) = 0;
+ const std::optional<gfx::Size>& size) = 0;
// Request a change to the encoding parameters. If not implemented, default
// behavior is to get the sum over layers and pass to version with bitrate
@@ -448,7 +448,7 @@
virtual void RequestEncodingParametersChange(
const VideoBitrateAllocation& bitrate,
uint32_t framerate,
- const absl::optional<gfx::Size>& size);
+ const std::optional<gfx::Size>& size);
// Destroys the encoder: all pending inputs and outputs are dropped
// immediately and the component is freed. This call may asynchronously free
diff --git a/media/video/video_encode_accelerator_adapter.cc b/media/video/video_encode_accelerator_adapter.cc
index 6014bd66..65503ea 100644
--- a/media/video/video_encode_accelerator_adapter.cc
+++ b/media/video/video_encode_accelerator_adapter.cc
@@ -61,7 +61,7 @@
}
Bitrate CreateBitrate(
- const absl::optional<Bitrate>& requested_bitrate,
+ const std::optional<Bitrate>& requested_bitrate,
const gfx::Size& frame_size,
VideoEncodeAccelerator::SupportedRateControlMode supported_rc_modes) {
uint32_t default_bitrate = ComputeCheckedDefaultBitrate(frame_size);
@@ -89,7 +89,7 @@
VideoFrame::StorageType storage_type,
VideoEncodeAccelerator::SupportedRateControlMode supported_rc_modes,
VideoEncodeAccelerator::Config::EncoderType required_encoder_type) {
- absl::optional<uint32_t> initial_framerate;
+ std::optional<uint32_t> initial_framerate;
if (opts.framerate.has_value())
initial_framerate = static_cast<uint32_t>(opts.framerate.value());
@@ -620,7 +620,7 @@
return;
}
- absl::optional<gfx::Size> new_frame_size;
+ std::optional<gfx::Size> new_frame_size;
if (options.frame_size != options_.frame_size) {
if (supports_frame_size_change_) {
input_pool_.reset();
@@ -771,7 +771,7 @@
void VideoEncodeAcceleratorAdapter::BitstreamBufferReady(
int32_t buffer_id,
const BitstreamBufferMetadata& metadata) {
- absl::optional<CodecDescription> desc;
+ std::optional<CodecDescription> desc;
VideoEncoderOutput result;
result.key_frame = metadata.key_frame;
result.timestamp = metadata.timestamp;
diff --git a/media/video/video_encode_accelerator_adapter.h b/media/video/video_encode_accelerator_adapter.h
index a760800..276b1a70 100644
--- a/media/video/video_encode_accelerator_adapter.h
+++ b/media/video/video_encode_accelerator_adapter.h
@@ -6,6 +6,7 @@
#define MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_ADAPTER_H_
#include <memory>
+#include <optional>
#include "base/containers/circular_deque.h"
#include "base/containers/queue.h"
@@ -21,7 +22,6 @@
#include "media/base/video_frame_converter.h"
#include "media/media_buildflags.h"
#include "media/video/video_encode_accelerator.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/size.h"
@@ -172,7 +172,7 @@
scoped_refptr<base::SequencedTaskRunner> callback_task_runner_;
State state_ = State::kNotInitialized;
- absl::optional<bool> flush_support_;
+ std::optional<bool> flush_support_;
// True if underlying instance of VEA can handle GPU backed frames with a
// size different from what VEA was configured for.
diff --git a/media/video/video_encode_accelerator_adapter_test.cc b/media/video/video_encode_accelerator_adapter_test.cc
index 23bd1ca6..f07ae2d 100644
--- a/media/video/video_encode_accelerator_adapter_test.cc
+++ b/media/video/video_encode_accelerator_adapter_test.cc
@@ -246,7 +246,7 @@
int outputs_count = 0;
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription>) {
+ std::optional<VideoEncoder::CodecDescription>) {
EXPECT_EQ(output.color_space, expected_color_space);
outputs_count++;
});
@@ -283,7 +283,7 @@
ExpectedColorSpace(pixel_format, pixel_format);
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription>) {
+ std::optional<VideoEncoder::CodecDescription>) {
if (output.timestamp == base::Milliseconds(1))
EXPECT_EQ(output.temporal_id, 1);
else if (output.timestamp == base::Milliseconds(2))
@@ -360,7 +360,7 @@
ExpectedColorSpace(pixel_format, pixel_format);
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription>) {
+ std::optional<VideoEncoder::CodecDescription>) {
EXPECT_EQ(output.color_space, expected_color_space);
outputs_count++;
});
@@ -392,7 +392,7 @@
int outputs_count = 0;
auto pixel_format = PIXEL_FORMAT_I420;
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
- [&](VideoEncoderOutput, absl::optional<VideoEncoder::CodecDescription>) {
+ [&](VideoEncoderOutput, std::optional<VideoEncoder::CodecDescription>) {
outputs_count++;
});
@@ -425,7 +425,7 @@
int outputs_count = 0;
auto pixel_format = PIXEL_FORMAT_I420;
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
- [&](VideoEncoderOutput, absl::optional<VideoEncoder::CodecDescription>) {
+ [&](VideoEncoderOutput, std::optional<VideoEncoder::CodecDescription>) {
outputs_count++;
});
@@ -467,7 +467,7 @@
ExpectedColorSpace(pixel_format, expected_input_format);
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription>) {
+ std::optional<VideoEncoder::CodecDescription>) {
EXPECT_EQ(output.color_space, expected_color_space);
outputs_count++;
});
@@ -499,7 +499,7 @@
ExpectedColorSpace(pixel_format, pixel_format);
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription>) {
+ std::optional<VideoEncoder::CodecDescription>) {
EXPECT_EQ(output.color_space, expected_color_space);
outputs_count++;
});
@@ -558,7 +558,7 @@
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription>) {
+ std::optional<VideoEncoder::CodecDescription>) {
VideoPixelFormat source_frame_format = get_source_format(outputs_count);
const gfx::ColorSpace expected_color_space =
ExpectedColorSpace(source_frame_format, expected_input_format);
@@ -605,7 +605,7 @@
ExpectedColorSpace(pixel_format, pixel_format);
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription>) {
+ std::optional<VideoEncoder::CodecDescription>) {
EXPECT_EQ(output.color_space, expected_color_space);
output_timestamps.push_back(output.timestamp);
});
@@ -648,13 +648,13 @@
ExpectedColorSpace(pixel_format, pixel_format);
VideoEncoder::OutputCB first_output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription>) {
+ std::optional<VideoEncoder::CodecDescription>) {
EXPECT_EQ(output.color_space, expected_color_space);
output_count_before_change++;
});
VideoEncoder::OutputCB second_output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription>) {
+ std::optional<VideoEncoder::CodecDescription>) {
EXPECT_EQ(output.color_space, expected_color_space);
output_count_after_change++;
});
@@ -702,13 +702,13 @@
VideoEncoder::OutputCB first_output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription>) {
+ std::optional<VideoEncoder::CodecDescription>) {
EXPECT_EQ(output.encoded_size, first_frame_size);
output_count_before_change++;
});
VideoEncoder::OutputCB second_output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription>) {
+ std::optional<VideoEncoder::CodecDescription>) {
EXPECT_EQ(output.encoded_size, second_frame_size);
output_count_after_change++;
});
@@ -750,13 +750,13 @@
VideoEncoder::OutputCB first_output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription>) {
+ std::optional<VideoEncoder::CodecDescription>) {
EXPECT_EQ(output.encoded_size, first_frame_size);
output_count_before_change++;
});
VideoEncoder::OutputCB second_output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
- absl::optional<VideoEncoder::CodecDescription>) {
+ std::optional<VideoEncoder::CodecDescription>) {
EXPECT_EQ(output.encoded_size, second_frame_size);
output_count_after_change++;
});
diff --git a/media/video/video_encoder_fallback.cc b/media/video/video_encoder_fallback.cc
index 921b2d4..ef30efb 100644
--- a/media/video/video_encoder_fallback.cc
+++ b/media/video/video_encoder_fallback.cc
@@ -197,7 +197,7 @@
}
void VideoEncoderFallback::CallOutput(VideoEncoderOutput output,
- absl::optional<CodecDescription> desc) {
+ std::optional<CodecDescription> desc) {
output_cb_.Run(std::move(output), std::move(desc));
}
diff --git a/media/video/video_encoder_fallback.h b/media/video/video_encoder_fallback.h
index 83a6ae98..a0f4317 100644
--- a/media/video/video_encoder_fallback.h
+++ b/media/video/video_encoder_fallback.h
@@ -52,7 +52,7 @@
EncoderStatusCB done_cb);
void CallInfo(const VideoEncoderInfo& info);
void CallOutput(VideoEncoderOutput output,
- absl::optional<CodecDescription> desc);
+ std::optional<CodecDescription> desc);
std::unique_ptr<VideoEncoder> encoder_;
diff --git a/media/video/video_encoder_fallback_test.cc b/media/video/video_encoder_fallback_test.cc
index 5e876af..3826673 100644
--- a/media/video/video_encoder_fallback_test.cc
+++ b/media/video/video_encoder_fallback_test.cc
@@ -102,7 +102,7 @@
VideoEncoder::OutputCB output_cb =
base::BindPostTaskToCurrentDefault(base::BindLambdaForTesting(
[&](VideoEncoderOutput,
- absl::optional<VideoEncoder::CodecDescription>) { outputs++; }));
+ std::optional<VideoEncoder::CodecDescription>) { outputs++; }));
VideoEncoder::OutputCB saved_output_cb;
EXPECT_CALL(*main_video_encoder_, Initialize(_, _, _, _, _))
@@ -159,7 +159,7 @@
VideoEncoder::OutputCB output_cb =
base::BindPostTaskToCurrentDefault(base::BindLambdaForTesting(
[&](VideoEncoderOutput,
- absl::optional<VideoEncoder::CodecDescription>) { outputs++; }));
+ std::optional<VideoEncoder::CodecDescription>) { outputs++; }));
VideoEncoder::OutputCB saved_output_cb;
// Initialize() on the main encoder should fail
@@ -231,7 +231,7 @@
VideoEncoder::OutputCB output_cb =
base::BindPostTaskToCurrentDefault(base::BindLambdaForTesting(
[&](VideoEncoderOutput,
- absl::optional<VideoEncoder::CodecDescription>) { outputs++; }));
+ std::optional<VideoEncoder::CodecDescription>) { outputs++; }));
VideoEncoder::OutputCB primary_output_cb;
VideoEncoder::OutputCB secondary_output_cb;
@@ -383,7 +383,7 @@
VideoEncoder::OutputCB output_cb =
base::BindPostTaskToCurrentDefault(base::BindLambdaForTesting(
[&](VideoEncoderOutput,
- absl::optional<VideoEncoder::CodecDescription>) { outputs++; }));
+ std::optional<VideoEncoder::CodecDescription>) { outputs++; }));
VideoEncoder::OutputCB primary_output_cb;
VideoEncoder::OutputCB secondary_output_cb;
@@ -484,7 +484,7 @@
VideoEncoder::OutputCB output_cb =
base::BindPostTaskToCurrentDefault(base::BindLambdaForTesting(
[&](VideoEncoderOutput,
- absl::optional<VideoEncoder::CodecDescription>) { outputs++; }));
+ std::optional<VideoEncoder::CodecDescription>) { outputs++; }));
VideoEncoder::OutputCB primary_output_cb;
// Initialize() on the main encoder should succeed
diff --git a/media/video/video_encoder_info.h b/media/video/video_encoder_info.h
index 796b5b82..39b6d7d7 100644
--- a/media/video/video_encoder_info.h
+++ b/media/video/video_encoder_info.h
@@ -8,11 +8,11 @@
#include <stdint.h>
#include <array>
+#include <optional>
#include <string>
#include <vector>
#include "media/base/media_export.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace media {
@@ -52,13 +52,13 @@
// compression window. Equal to 0 if the encoder can produce a chunk of
// output just from the frame submitted last.
// If absent, the encoder client will assume some default value.
- absl::optional<int> frame_delay;
+ std::optional<int> frame_delay;
// The number of input frames the encoder can queue internally. Once this
// number is reached, further encode requests can block until some output has
// been produced.
// If absent, the encoder client will assume some default value.
- absl::optional<int> input_capacity;
+ std::optional<int> input_capacity;
bool supports_native_handle = true;
bool has_trusted_rate_controller = false;
diff --git a/media/video/vpx_video_encoder.cc b/media/video/vpx_video_encoder.cc
index 8ff78d3..666948d 100644
--- a/media/video/vpx_video_encoder.cc
+++ b/media/video/vpx_video_encoder.cc
@@ -5,6 +5,7 @@
#include "media/video/vpx_video_encoder.h"
#include <algorithm>
+#include <optional>
#include "base/logging.h"
#include "base/numerics/checked_math.h"
@@ -231,9 +232,9 @@
// If conversion is needed for given profile and frame, returns the destination
// pixel format. If no conversion is needed returns nullopt.
-absl::optional<VideoPixelFormat> GetConversionFormat(VideoCodecProfile profile,
- VideoPixelFormat format,
- bool needs_resize) {
+std::optional<VideoPixelFormat> GetConversionFormat(VideoCodecProfile profile,
+ VideoPixelFormat format,
+ bool needs_resize) {
switch (profile) {
case VP8PROFILE_ANY:
case VP9PROFILE_PROFILE0:
@@ -265,7 +266,7 @@
NOTREACHED(); // Checked during Initialize().
}
- return absl::nullopt;
+ return std::nullopt;
}
// Sets up a standard 3-plane vpx_image_t from `frame`.
diff --git a/media/webrtc/audio_processor.cc b/media/webrtc/audio_processor.cc
index 2a99cc1..dc7d58e 100644
--- a/media/webrtc/audio_processor.cc
+++ b/media/webrtc/audio_processor.cc
@@ -11,6 +11,7 @@
#include <array>
#include <limits>
#include <memory>
+#include <optional>
#include <utility>
#include "base/feature_list.h"
@@ -30,7 +31,6 @@
#include "media/webrtc/constants.h"
#include "media/webrtc/helpers.h"
#include "media/webrtc/webrtc_features.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/webrtc/modules/audio_processing/include/audio_processing.h"
#include "third_party/webrtc_overrides/task_queue_factory.h"
@@ -347,7 +347,7 @@
while (capture_fifo_->Consume(&process_bus, &capture_delay)) {
// Use the process bus directly if audio processing is disabled.
AudioProcessorCaptureBus* output_bus = process_bus;
- absl::optional<double> new_volume;
+ std::optional<double> new_volume;
if (webrtc_audio_processing_) {
output_bus = output_bus_.get();
new_volume =
@@ -469,7 +469,7 @@
return webrtc_audio_processing_->GetStatistics();
}
-absl::optional<double> AudioProcessor::ProcessData(
+std::optional<double> AudioProcessor::ProcessData(
const float* const* process_ptrs,
int process_frames,
base::TimeDelta capture_delay,
@@ -569,7 +569,7 @@
const int recommended_analog_gain_level =
ap->recommended_stream_analog_level();
if (recommended_analog_gain_level == current_analog_gain_level) {
- return absl::nullopt;
+ return std::nullopt;
} else {
return static_cast<double>(recommended_analog_gain_level) /
media::MaxWebRtcAnalogGainLevel();
@@ -583,7 +583,7 @@
reinterpret_cast<uintptr_t>(this)));
}
-absl::optional<AudioParameters> AudioProcessor::ComputeInputFormat(
+std::optional<AudioParameters> AudioProcessor::ComputeInputFormat(
const AudioParameters& device_format,
const AudioProcessingSettings& audio_processing_settings) {
const ChannelLayout channel_layout = device_format.channel_layout();
@@ -592,7 +592,7 @@
if (channel_layout != CHANNEL_LAYOUT_MONO &&
channel_layout != CHANNEL_LAYOUT_STEREO &&
channel_layout != CHANNEL_LAYOUT_DISCRETE) {
- return absl::nullopt;
+ return std::nullopt;
}
AudioParameters params(
diff --git a/media/webrtc/audio_processor.h b/media/webrtc/audio_processor.h
index 9672340..a023cd9 100644
--- a/media/webrtc/audio_processor.h
+++ b/media/webrtc/audio_processor.h
@@ -6,6 +6,7 @@
#define MEDIA_WEBRTC_AUDIO_PROCESSOR_H_
#include <memory>
+#include <optional>
#include "base/component_export.h"
#include "base/files/file.h"
@@ -19,7 +20,6 @@
#include "media/base/audio_push_fifo.h"
#include "media/webrtc/audio_delay_stats_reporter.h"
#include "media/webrtc/webrtc_features.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/webrtc/api/task_queue/task_queue_base.h"
#include "third_party/webrtc/modules/audio_processing/include/audio_processing.h"
#include "third_party/webrtc/modules/audio_processing/include/audio_processing_statistics.h"
@@ -56,7 +56,7 @@
using DeliverProcessedAudioCallback =
base::RepeatingCallback<void(const media::AudioBus& audio_bus,
base::TimeTicks audio_capture_time,
- absl::optional<double> new_volume)>;
+ std::optional<double> new_volume)>;
using LogCallback = base::RepeatingCallback<void(base::StringPiece)>;
@@ -138,12 +138,12 @@
// May be called on any thread.
webrtc::AudioProcessingStats GetStats();
- absl::optional<webrtc::AudioProcessing::Config>
+ std::optional<webrtc::AudioProcessing::Config>
GetAudioProcessingModuleConfigForTesting() const {
if (webrtc_audio_processing_) {
return webrtc_audio_processing_->GetConfig();
}
- return absl::nullopt;
+ return std::nullopt;
}
// The format of audio input to and output from the processor; constant
@@ -154,7 +154,7 @@
// Returns an input format compatible with the specified audio processing
// settings and device parameters. Returns nullopt if no compatible format can
// be produced.
- static absl::optional<AudioParameters> ComputeInputFormat(
+ static std::optional<AudioParameters> ComputeInputFormat(
const AudioParameters& device_format,
const AudioProcessingSettings& settings);
@@ -181,13 +181,13 @@
// to the highest observed value of num_preferred_channels as long as it does
// not exceed the number of channels of the output format.
// Called on the capture thread.
- absl::optional<double> ProcessData(const float* const* process_ptrs,
- int process_frames,
- base::TimeDelta capture_delay,
- double volume,
- bool key_pressed,
- int num_preferred_channels,
- float* const* output_ptrs);
+ std::optional<double> ProcessData(const float* const* process_ptrs,
+ int process_frames,
+ base::TimeDelta capture_delay,
+ double volume,
+ bool key_pressed,
+ int num_preferred_channels,
+ float* const* output_ptrs);
// Used as callback from |playout_fifo_| in OnPlayoutData().
// Called on the playout thread.
@@ -265,7 +265,7 @@
base::TimeDelta unbuffered_playout_delay_ = base::TimeDelta();
// The sample rate of incoming playout audio.
- absl::optional<int> playout_sample_rate_hz_ = absl::nullopt;
+ std::optional<int> playout_sample_rate_hz_ = std::nullopt;
// Counters to avoid excessively logging errors on a real-time thread.
size_t apm_playout_error_code_log_count_ = 0;
diff --git a/media/webrtc/audio_processor_test.cc b/media/webrtc/audio_processor_test.cc
index 8aefa28..b75e8649 100644
--- a/media/webrtc/audio_processor_test.cc
+++ b/media/webrtc/audio_processor_test.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <optional>
#include <string>
#include "base/files/file_path.h"
@@ -28,7 +29,6 @@
#include "media/webrtc/constants.h"
#include "media/webrtc/webrtc_features.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/webrtc/api/make_ref_counted.h"
#include "third_party/webrtc/modules/audio_processing/include/mock_audio_processing.h"
@@ -47,7 +47,7 @@
using MockProcessedCaptureCallback =
base::MockRepeatingCallback<void(const media::AudioBus& audio_bus,
base::TimeTicks audio_capture_time,
- absl::optional<double> new_volume)>;
+ std::optional<double> new_volume)>;
AudioProcessor::LogCallback LogCallbackForTesting() {
return base::BindRepeating(
@@ -131,7 +131,7 @@
EXPECT_CALL(mock_capture_callback, Run(_, _, _))
.WillRepeatedly([&](const media::AudioBus& processed_audio,
base::TimeTicks audio_capture_time,
- absl::optional<double> new_volume) {
+ std::optional<double> new_volume) {
EXPECT_EQ(processed_audio.channels(), output_params.channels());
EXPECT_EQ(processed_audio.frames(),
output_params.frames_per_buffer());
@@ -413,7 +413,7 @@
EXPECT_CALL(mock_capture_callback_, Run(_, _, _))
.WillRepeatedly([&](const media::AudioBus& processed_audio,
base::TimeTicks audio_capture_time,
- absl::optional<double> new_volume) {
+ std::optional<double> new_volume) {
EXPECT_EQ(audio_capture_time, pushed_capture_time);
if (!use_apm) {
EXPECT_FALSE(new_volume.has_value());
@@ -606,7 +606,7 @@
data_bus->Zero();
auto check_audio_length = [&](const media::AudioBus& processed_audio,
- base::TimeTicks, absl::optional<double>) {
+ base::TimeTicks, std::optional<double>) {
EXPECT_EQ(processed_audio.frames(), output_sample_rate * 10 / 1000);
};
@@ -656,7 +656,7 @@
data_bus->Zero();
auto check_audio_length = [&](const media::AudioBus& processed_audio,
- base::TimeTicks, absl::optional<double>) {
+ base::TimeTicks, std::optional<double>) {
EXPECT_EQ(processed_audio.frames(), output_sample_rate * 10 / 1000);
};
@@ -696,7 +696,7 @@
data_bus->Zero();
auto check_audio_length = [&](const media::AudioBus& processed_audio,
- base::TimeTicks, absl::optional<double>) {
+ base::TimeTicks, std::optional<double>) {
EXPECT_EQ(processed_audio.frames(), output_sample_rate * 4 / 1000);
};
@@ -733,7 +733,7 @@
data_bus->Zero();
auto check_audio_length = [&](const media::AudioBus& processed_audio,
- base::TimeTicks, absl::optional<double>) {
+ base::TimeTicks, std::optional<double>) {
EXPECT_EQ(processed_audio.frames(), output_sample_rate * 10 / 1000);
};
diff --git a/media/webrtc/helpers.h b/media/webrtc/helpers.h
index 951c704..4721194 100644
--- a/media/webrtc/helpers.h
+++ b/media/webrtc/helpers.h
@@ -5,13 +5,14 @@
#ifndef MEDIA_WEBRTC_HELPERS_H_
#define MEDIA_WEBRTC_HELPERS_H_
+#include <optional>
+
#include "base/component_export.h"
#include "base/files/file.h"
#include "build/build_config.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_parameters.h"
#include "media/base/audio_processing.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/webrtc/api/task_queue/task_queue_base.h"
#include "third_party/webrtc/modules/audio_processing/include/audio_processing.h"