mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 13:50:40 +01:00
Replace rtc::Optional with absl::optional in test and rtc_tools
This is a no-op change because rtc::Optional is an alias to absl::optional This CL generated by running script with parameters 'test rtc_tools' find $@ -type f \( -name \*.h -o -name \*.cc \) \ -exec sed -i 's|rtc::Optional|absl::optional|g' {} \+ \ -exec sed -i 's|rtc::nullopt|absl::nullopt|g' {} \+ \ -exec sed -i 's|#include "api/optional.h"|#include "absl/types/optional.h"|' {} \+ find $@ -type f -name BUILD.gn \ -exec sed -r -i 's|"(../)*api:optional"|"//third_party/abseil-cpp/absl/types:optional"|' {} \+; git cl format Bug: webrtc:9078 Change-Id: Ibb43c737f4c45fe300736382b0dd2d8ab32c6377 Reviewed-on: https://webrtc-review.googlesource.com/83944 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23642}
This commit is contained in:
parent
9bf31584d1
commit
431abd989b
25 changed files with 116 additions and 116 deletions
|
@ -130,7 +130,7 @@ int64_t WrappingDifference(uint32_t later, uint32_t earlier, int64_t modulus) {
|
||||||
|
|
||||||
// This is much more reliable for outgoing streams than for incoming streams.
|
// This is much more reliable for outgoing streams than for incoming streams.
|
||||||
template <typename RtpPacketContainer>
|
template <typename RtpPacketContainer>
|
||||||
rtc::Optional<uint32_t> EstimateRtpClockFrequency(
|
absl::optional<uint32_t> EstimateRtpClockFrequency(
|
||||||
const RtpPacketContainer& packets,
|
const RtpPacketContainer& packets,
|
||||||
int64_t end_time_us) {
|
int64_t end_time_us) {
|
||||||
RTC_CHECK(packets.size() >= 2);
|
RTC_CHECK(packets.size() >= 2);
|
||||||
|
@ -151,7 +151,7 @@ rtc::Optional<uint32_t> EstimateRtpClockFrequency(
|
||||||
<< "Failed to estimate RTP clock frequency: Stream too short. ("
|
<< "Failed to estimate RTP clock frequency: Stream too short. ("
|
||||||
<< packets.size() << " packets, "
|
<< packets.size() << " packets, "
|
||||||
<< last_log_timestamp - first_log_timestamp << " us)";
|
<< last_log_timestamp - first_log_timestamp << " us)";
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
double duration =
|
double duration =
|
||||||
static_cast<double>(last_log_timestamp - first_log_timestamp) /
|
static_cast<double>(last_log_timestamp - first_log_timestamp) /
|
||||||
|
@ -166,7 +166,7 @@ rtc::Optional<uint32_t> EstimateRtpClockFrequency(
|
||||||
RTC_LOG(LS_WARNING) << "Failed to estimate RTP clock frequency: Estimate "
|
RTC_LOG(LS_WARNING) << "Failed to estimate RTP clock frequency: Estimate "
|
||||||
<< estimated_frequency
|
<< estimated_frequency
|
||||||
<< "not close to any stardard RTP frequency.";
|
<< "not close to any stardard RTP frequency.";
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr float kLeftMargin = 0.01f;
|
constexpr float kLeftMargin = 0.01f;
|
||||||
|
@ -174,7 +174,7 @@ constexpr float kRightMargin = 0.02f;
|
||||||
constexpr float kBottomMargin = 0.02f;
|
constexpr float kBottomMargin = 0.02f;
|
||||||
constexpr float kTopMargin = 0.05f;
|
constexpr float kTopMargin = 0.05f;
|
||||||
|
|
||||||
rtc::Optional<double> NetworkDelayDiff_AbsSendTime(
|
absl::optional<double> NetworkDelayDiff_AbsSendTime(
|
||||||
const LoggedRtpPacket& old_packet,
|
const LoggedRtpPacket& old_packet,
|
||||||
const LoggedRtpPacket& new_packet) {
|
const LoggedRtpPacket& new_packet) {
|
||||||
if (old_packet.header.extension.hasAbsoluteSendTime &&
|
if (old_packet.header.extension.hasAbsoluteSendTime &&
|
||||||
|
@ -188,11 +188,11 @@ rtc::Optional<double> NetworkDelayDiff_AbsSendTime(
|
||||||
recv_time_diff - AbsSendTimeToMicroseconds(send_time_diff);
|
recv_time_diff - AbsSendTimeToMicroseconds(send_time_diff);
|
||||||
return delay_change_us / 1000;
|
return delay_change_us / 1000;
|
||||||
} else {
|
} else {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<double> NetworkDelayDiff_CaptureTime(
|
absl::optional<double> NetworkDelayDiff_CaptureTime(
|
||||||
const LoggedRtpPacket& old_packet,
|
const LoggedRtpPacket& old_packet,
|
||||||
const LoggedRtpPacket& new_packet) {
|
const LoggedRtpPacket& new_packet) {
|
||||||
int64_t send_time_diff = WrappingDifference(
|
int64_t send_time_diff = WrappingDifference(
|
||||||
|
@ -230,13 +230,13 @@ rtc::Optional<double> NetworkDelayDiff_CaptureTime(
|
||||||
// store the result in a TimeSeries.
|
// store the result in a TimeSeries.
|
||||||
template <typename DataType, typename IterableType>
|
template <typename DataType, typename IterableType>
|
||||||
void ProcessPoints(rtc::FunctionView<float(const DataType&)> fx,
|
void ProcessPoints(rtc::FunctionView<float(const DataType&)> fx,
|
||||||
rtc::FunctionView<rtc::Optional<float>(const DataType&)> fy,
|
rtc::FunctionView<absl::optional<float>(const DataType&)> fy,
|
||||||
const IterableType& data_view,
|
const IterableType& data_view,
|
||||||
TimeSeries* result) {
|
TimeSeries* result) {
|
||||||
for (size_t i = 0; i < data_view.size(); i++) {
|
for (size_t i = 0; i < data_view.size(); i++) {
|
||||||
const DataType& elem = data_view[i];
|
const DataType& elem = data_view[i];
|
||||||
float x = fx(elem);
|
float x = fx(elem);
|
||||||
rtc::Optional<float> y = fy(elem);
|
absl::optional<float> y = fy(elem);
|
||||||
if (y)
|
if (y)
|
||||||
result->points.emplace_back(x, *y);
|
result->points.emplace_back(x, *y);
|
||||||
}
|
}
|
||||||
|
@ -248,13 +248,13 @@ void ProcessPoints(rtc::FunctionView<float(const DataType&)> fx,
|
||||||
template <typename DataType, typename ResultType, typename IterableType>
|
template <typename DataType, typename ResultType, typename IterableType>
|
||||||
void ProcessPairs(
|
void ProcessPairs(
|
||||||
rtc::FunctionView<float(const DataType&)> fx,
|
rtc::FunctionView<float(const DataType&)> fx,
|
||||||
rtc::FunctionView<rtc::Optional<ResultType>(const DataType&,
|
rtc::FunctionView<absl::optional<ResultType>(const DataType&,
|
||||||
const DataType&)> fy,
|
const DataType&)> fy,
|
||||||
const IterableType& data,
|
const IterableType& data,
|
||||||
TimeSeries* result) {
|
TimeSeries* result) {
|
||||||
for (size_t i = 1; i < data.size(); i++) {
|
for (size_t i = 1; i < data.size(); i++) {
|
||||||
float x = fx(data[i]);
|
float x = fx(data[i]);
|
||||||
rtc::Optional<ResultType> y = fy(data[i - 1], data[i]);
|
absl::optional<ResultType> y = fy(data[i - 1], data[i]);
|
||||||
if (y)
|
if (y)
|
||||||
result->points.emplace_back(x, static_cast<float>(*y));
|
result->points.emplace_back(x, static_cast<float>(*y));
|
||||||
}
|
}
|
||||||
|
@ -266,14 +266,14 @@ void ProcessPairs(
|
||||||
template <typename DataType, typename ResultType, typename IterableType>
|
template <typename DataType, typename ResultType, typename IterableType>
|
||||||
void AccumulatePairs(
|
void AccumulatePairs(
|
||||||
rtc::FunctionView<float(const DataType&)> fx,
|
rtc::FunctionView<float(const DataType&)> fx,
|
||||||
rtc::FunctionView<rtc::Optional<ResultType>(const DataType&,
|
rtc::FunctionView<absl::optional<ResultType>(const DataType&,
|
||||||
const DataType&)> fy,
|
const DataType&)> fy,
|
||||||
const IterableType& data,
|
const IterableType& data,
|
||||||
TimeSeries* result) {
|
TimeSeries* result) {
|
||||||
ResultType sum = 0;
|
ResultType sum = 0;
|
||||||
for (size_t i = 1; i < data.size(); i++) {
|
for (size_t i = 1; i < data.size(); i++) {
|
||||||
float x = fx(data[i]);
|
float x = fx(data[i]);
|
||||||
rtc::Optional<ResultType> y = fy(data[i - 1], data[i]);
|
absl::optional<ResultType> y = fy(data[i - 1], data[i]);
|
||||||
if (y)
|
if (y)
|
||||||
sum += *y;
|
sum += *y;
|
||||||
result->points.emplace_back(x, static_cast<float>(sum));
|
result->points.emplace_back(x, static_cast<float>(sum));
|
||||||
|
@ -287,7 +287,7 @@ void AccumulatePairs(
|
||||||
template <typename DataType, typename ResultType, typename IterableType>
|
template <typename DataType, typename ResultType, typename IterableType>
|
||||||
void MovingAverage(
|
void MovingAverage(
|
||||||
rtc::FunctionView<float(int64_t)> fx,
|
rtc::FunctionView<float(int64_t)> fx,
|
||||||
rtc::FunctionView<rtc::Optional<ResultType>(const DataType&)> fy,
|
rtc::FunctionView<absl::optional<ResultType>(const DataType&)> fy,
|
||||||
const IterableType& data_view,
|
const IterableType& data_view,
|
||||||
int64_t begin_time,
|
int64_t begin_time,
|
||||||
int64_t end_time,
|
int64_t end_time,
|
||||||
|
@ -301,7 +301,7 @@ void MovingAverage(
|
||||||
for (int64_t t = begin_time; t < end_time + step; t += step) {
|
for (int64_t t = begin_time; t < end_time + step; t += step) {
|
||||||
while (window_index_end < data_view.size() &&
|
while (window_index_end < data_view.size() &&
|
||||||
data_view[window_index_end].log_time_us() < t) {
|
data_view[window_index_end].log_time_us() < t) {
|
||||||
rtc::Optional<ResultType> value = fy(data_view[window_index_end]);
|
absl::optional<ResultType> value = fy(data_view[window_index_end]);
|
||||||
if (value)
|
if (value)
|
||||||
sum_in_window += *value;
|
sum_in_window += *value;
|
||||||
++window_index_end;
|
++window_index_end;
|
||||||
|
@ -309,7 +309,7 @@ void MovingAverage(
|
||||||
while (window_index_begin < data_view.size() &&
|
while (window_index_begin < data_view.size() &&
|
||||||
data_view[window_index_begin].log_time_us() <
|
data_view[window_index_begin].log_time_us() <
|
||||||
t - window_duration_us) {
|
t - window_duration_us) {
|
||||||
rtc::Optional<ResultType> value = fy(data_view[window_index_begin]);
|
absl::optional<ResultType> value = fy(data_view[window_index_begin]);
|
||||||
if (value)
|
if (value)
|
||||||
sum_in_window -= *value;
|
sum_in_window -= *value;
|
||||||
++window_index_begin;
|
++window_index_begin;
|
||||||
|
@ -465,7 +465,7 @@ EventLogAnalyzer::EventLogAnalyzer(const ParsedRtcEventLogNew& log,
|
||||||
while (start_iter != log_start_events.end()) {
|
while (start_iter != log_start_events.end()) {
|
||||||
int64_t start = start_iter->log_time_us();
|
int64_t start = start_iter->log_time_us();
|
||||||
++start_iter;
|
++start_iter;
|
||||||
rtc::Optional<int64_t> next_start;
|
absl::optional<int64_t> next_start;
|
||||||
if (start_iter != log_start_events.end())
|
if (start_iter != log_start_events.end())
|
||||||
next_start.emplace(start_iter->log_time_us());
|
next_start.emplace(start_iter->log_time_us());
|
||||||
if (end_iter != log_end_events.end() &&
|
if (end_iter != log_end_events.end() &&
|
||||||
|
@ -537,7 +537,7 @@ void EventLogAnalyzer::CreatePacketGraph(PacketDirection direction,
|
||||||
TimeSeries time_series(GetStreamName(direction, stream.ssrc),
|
TimeSeries time_series(GetStreamName(direction, stream.ssrc),
|
||||||
LineStyle::kBar);
|
LineStyle::kBar);
|
||||||
auto GetPacketSize = [](const LoggedRtpPacket& packet) {
|
auto GetPacketSize = [](const LoggedRtpPacket& packet) {
|
||||||
return rtc::Optional<float>(packet.total_length);
|
return absl::optional<float>(packet.total_length);
|
||||||
};
|
};
|
||||||
auto ToCallTime = [this](const LoggedRtpPacket& packet) {
|
auto ToCallTime = [this](const LoggedRtpPacket& packet) {
|
||||||
return this->ToCallTimeSec(packet.log_time_us());
|
return this->ToCallTimeSec(packet.log_time_us());
|
||||||
|
@ -599,7 +599,7 @@ void EventLogAnalyzer::CreatePlayoutGraph(Plot* plot) {
|
||||||
uint32_t ssrc = playout_stream.first;
|
uint32_t ssrc = playout_stream.first;
|
||||||
if (!MatchingSsrc(ssrc, desired_ssrc_))
|
if (!MatchingSsrc(ssrc, desired_ssrc_))
|
||||||
continue;
|
continue;
|
||||||
rtc::Optional<int64_t> last_playout_ms;
|
absl::optional<int64_t> last_playout_ms;
|
||||||
TimeSeries time_series(SsrcToString(ssrc), LineStyle::kBar);
|
TimeSeries time_series(SsrcToString(ssrc), LineStyle::kBar);
|
||||||
for (const auto& playout_event : playout_stream.second) {
|
for (const auto& playout_event : playout_stream.second) {
|
||||||
float x = ToCallTimeSec(playout_event.log_time_us());
|
float x = ToCallTimeSec(playout_event.log_time_us());
|
||||||
|
@ -1139,7 +1139,7 @@ void EventLogAnalyzer::CreateSendSideBweSimulationGraph(Plot* plot) {
|
||||||
cc.OnTransportFeedback(rtcp_iterator->transport_feedback);
|
cc.OnTransportFeedback(rtcp_iterator->transport_feedback);
|
||||||
std::vector<PacketFeedback> feedback = cc.GetTransportFeedbackVector();
|
std::vector<PacketFeedback> feedback = cc.GetTransportFeedbackVector();
|
||||||
SortPacketFeedbackVector(&feedback);
|
SortPacketFeedbackVector(&feedback);
|
||||||
rtc::Optional<uint32_t> bitrate_bps;
|
absl::optional<uint32_t> bitrate_bps;
|
||||||
if (!feedback.empty()) {
|
if (!feedback.empty()) {
|
||||||
#if !(BWE_TEST_LOGGING_COMPILE_TIME_ENABLE)
|
#if !(BWE_TEST_LOGGING_COMPILE_TIME_ENABLE)
|
||||||
acknowledged_bitrate_estimator.IncomingPacketFeedbackVector(feedback);
|
acknowledged_bitrate_estimator.IncomingPacketFeedbackVector(feedback);
|
||||||
|
@ -1251,7 +1251,7 @@ void EventLogAnalyzer::CreateReceiveSideBweSimulationGraph(Plot* plot) {
|
||||||
clock.TimeInMicroseconds());
|
clock.TimeInMicroseconds());
|
||||||
rscc.OnReceivedPacket(arrival_time_ms, payload, packet.rtp.header);
|
rscc.OnReceivedPacket(arrival_time_ms, payload, packet.rtp.header);
|
||||||
acked_bitrate.Update(payload, arrival_time_ms);
|
acked_bitrate.Update(payload, arrival_time_ms);
|
||||||
rtc::Optional<uint32_t> bitrate_bps = acked_bitrate.Rate(arrival_time_ms);
|
absl::optional<uint32_t> bitrate_bps = acked_bitrate.Rate(arrival_time_ms);
|
||||||
if (bitrate_bps) {
|
if (bitrate_bps) {
|
||||||
uint32_t y = *bitrate_bps / 1000;
|
uint32_t y = *bitrate_bps / 1000;
|
||||||
float x = ToCallTimeSec(clock.TimeInMicroseconds());
|
float x = ToCallTimeSec(clock.TimeInMicroseconds());
|
||||||
|
@ -1383,7 +1383,7 @@ void EventLogAnalyzer::CreatePacerDelayGraph(Plot* plot) {
|
||||||
int64_t end_time_us = log_segments_.empty()
|
int64_t end_time_us = log_segments_.empty()
|
||||||
? std::numeric_limits<int64_t>::max()
|
? std::numeric_limits<int64_t>::max()
|
||||||
: log_segments_.front().second;
|
: log_segments_.front().second;
|
||||||
rtc::Optional<uint32_t> estimated_frequency =
|
absl::optional<uint32_t> estimated_frequency =
|
||||||
EstimateRtpClockFrequency(packets, end_time_us);
|
EstimateRtpClockFrequency(packets, end_time_us);
|
||||||
if (!estimated_frequency)
|
if (!estimated_frequency)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1463,11 +1463,11 @@ void EventLogAnalyzer::CreateAudioEncoderTargetBitrateGraph(Plot* plot) {
|
||||||
TimeSeries time_series("Audio encoder target bitrate", LineStyle::kLine,
|
TimeSeries time_series("Audio encoder target bitrate", LineStyle::kLine,
|
||||||
PointStyle::kHighlight);
|
PointStyle::kHighlight);
|
||||||
auto GetAnaBitrateBps = [](const LoggedAudioNetworkAdaptationEvent& ana_event)
|
auto GetAnaBitrateBps = [](const LoggedAudioNetworkAdaptationEvent& ana_event)
|
||||||
-> rtc::Optional<float> {
|
-> absl::optional<float> {
|
||||||
if (ana_event.config.bitrate_bps)
|
if (ana_event.config.bitrate_bps)
|
||||||
return rtc::Optional<float>(
|
return absl::optional<float>(
|
||||||
static_cast<float>(*ana_event.config.bitrate_bps));
|
static_cast<float>(*ana_event.config.bitrate_bps));
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
};
|
};
|
||||||
auto ToCallTime = [this](const LoggedAudioNetworkAdaptationEvent& packet) {
|
auto ToCallTime = [this](const LoggedAudioNetworkAdaptationEvent& packet) {
|
||||||
return this->ToCallTimeSec(packet.log_time_us());
|
return this->ToCallTimeSec(packet.log_time_us());
|
||||||
|
@ -1488,9 +1488,9 @@ void EventLogAnalyzer::CreateAudioEncoderFrameLengthGraph(Plot* plot) {
|
||||||
auto GetAnaFrameLengthMs =
|
auto GetAnaFrameLengthMs =
|
||||||
[](const LoggedAudioNetworkAdaptationEvent& ana_event) {
|
[](const LoggedAudioNetworkAdaptationEvent& ana_event) {
|
||||||
if (ana_event.config.frame_length_ms)
|
if (ana_event.config.frame_length_ms)
|
||||||
return rtc::Optional<float>(
|
return absl::optional<float>(
|
||||||
static_cast<float>(*ana_event.config.frame_length_ms));
|
static_cast<float>(*ana_event.config.frame_length_ms));
|
||||||
return rtc::Optional<float>();
|
return absl::optional<float>();
|
||||||
};
|
};
|
||||||
auto ToCallTime = [this](const LoggedAudioNetworkAdaptationEvent& packet) {
|
auto ToCallTime = [this](const LoggedAudioNetworkAdaptationEvent& packet) {
|
||||||
return this->ToCallTimeSec(packet.log_time_us());
|
return this->ToCallTimeSec(packet.log_time_us());
|
||||||
|
@ -1511,9 +1511,9 @@ void EventLogAnalyzer::CreateAudioEncoderPacketLossGraph(Plot* plot) {
|
||||||
auto GetAnaPacketLoss =
|
auto GetAnaPacketLoss =
|
||||||
[](const LoggedAudioNetworkAdaptationEvent& ana_event) {
|
[](const LoggedAudioNetworkAdaptationEvent& ana_event) {
|
||||||
if (ana_event.config.uplink_packet_loss_fraction)
|
if (ana_event.config.uplink_packet_loss_fraction)
|
||||||
return rtc::Optional<float>(static_cast<float>(
|
return absl::optional<float>(static_cast<float>(
|
||||||
*ana_event.config.uplink_packet_loss_fraction));
|
*ana_event.config.uplink_packet_loss_fraction));
|
||||||
return rtc::Optional<float>();
|
return absl::optional<float>();
|
||||||
};
|
};
|
||||||
auto ToCallTime = [this](const LoggedAudioNetworkAdaptationEvent& packet) {
|
auto ToCallTime = [this](const LoggedAudioNetworkAdaptationEvent& packet) {
|
||||||
return this->ToCallTimeSec(packet.log_time_us());
|
return this->ToCallTimeSec(packet.log_time_us());
|
||||||
|
@ -1535,9 +1535,9 @@ void EventLogAnalyzer::CreateAudioEncoderEnableFecGraph(Plot* plot) {
|
||||||
auto GetAnaFecEnabled =
|
auto GetAnaFecEnabled =
|
||||||
[](const LoggedAudioNetworkAdaptationEvent& ana_event) {
|
[](const LoggedAudioNetworkAdaptationEvent& ana_event) {
|
||||||
if (ana_event.config.enable_fec)
|
if (ana_event.config.enable_fec)
|
||||||
return rtc::Optional<float>(
|
return absl::optional<float>(
|
||||||
static_cast<float>(*ana_event.config.enable_fec));
|
static_cast<float>(*ana_event.config.enable_fec));
|
||||||
return rtc::Optional<float>();
|
return absl::optional<float>();
|
||||||
};
|
};
|
||||||
auto ToCallTime = [this](const LoggedAudioNetworkAdaptationEvent& packet) {
|
auto ToCallTime = [this](const LoggedAudioNetworkAdaptationEvent& packet) {
|
||||||
return this->ToCallTimeSec(packet.log_time_us());
|
return this->ToCallTimeSec(packet.log_time_us());
|
||||||
|
@ -1558,9 +1558,9 @@ void EventLogAnalyzer::CreateAudioEncoderEnableDtxGraph(Plot* plot) {
|
||||||
auto GetAnaDtxEnabled =
|
auto GetAnaDtxEnabled =
|
||||||
[](const LoggedAudioNetworkAdaptationEvent& ana_event) {
|
[](const LoggedAudioNetworkAdaptationEvent& ana_event) {
|
||||||
if (ana_event.config.enable_dtx)
|
if (ana_event.config.enable_dtx)
|
||||||
return rtc::Optional<float>(
|
return absl::optional<float>(
|
||||||
static_cast<float>(*ana_event.config.enable_dtx));
|
static_cast<float>(*ana_event.config.enable_dtx));
|
||||||
return rtc::Optional<float>();
|
return absl::optional<float>();
|
||||||
};
|
};
|
||||||
auto ToCallTime = [this](const LoggedAudioNetworkAdaptationEvent& packet) {
|
auto ToCallTime = [this](const LoggedAudioNetworkAdaptationEvent& packet) {
|
||||||
return this->ToCallTimeSec(packet.log_time_us());
|
return this->ToCallTimeSec(packet.log_time_us());
|
||||||
|
@ -1581,9 +1581,9 @@ void EventLogAnalyzer::CreateAudioEncoderNumChannelsGraph(Plot* plot) {
|
||||||
auto GetAnaNumChannels =
|
auto GetAnaNumChannels =
|
||||||
[](const LoggedAudioNetworkAdaptationEvent& ana_event) {
|
[](const LoggedAudioNetworkAdaptationEvent& ana_event) {
|
||||||
if (ana_event.config.num_channels)
|
if (ana_event.config.num_channels)
|
||||||
return rtc::Optional<float>(
|
return absl::optional<float>(
|
||||||
static_cast<float>(*ana_event.config.num_channels));
|
static_cast<float>(*ana_event.config.num_channels));
|
||||||
return rtc::Optional<float>();
|
return absl::optional<float>();
|
||||||
};
|
};
|
||||||
auto ToCallTime = [this](const LoggedAudioNetworkAdaptationEvent& packet) {
|
auto ToCallTime = [this](const LoggedAudioNetworkAdaptationEvent& packet) {
|
||||||
return this->ToCallTimeSec(packet.log_time_us());
|
return this->ToCallTimeSec(packet.log_time_us());
|
||||||
|
@ -1605,7 +1605,7 @@ class NetEqStreamInput : public test::NetEqInput {
|
||||||
// that outlive the one constructed.
|
// that outlive the one constructed.
|
||||||
NetEqStreamInput(const std::vector<LoggedRtpPacketIncoming>* packet_stream,
|
NetEqStreamInput(const std::vector<LoggedRtpPacketIncoming>* packet_stream,
|
||||||
const std::vector<LoggedAudioPlayoutEvent>* output_events,
|
const std::vector<LoggedAudioPlayoutEvent>* output_events,
|
||||||
rtc::Optional<int64_t> end_time_ms)
|
absl::optional<int64_t> end_time_ms)
|
||||||
: packet_stream_(*packet_stream),
|
: packet_stream_(*packet_stream),
|
||||||
packet_stream_it_(packet_stream_.begin()),
|
packet_stream_it_(packet_stream_.begin()),
|
||||||
output_events_it_(output_events->begin()),
|
output_events_it_(output_events->begin()),
|
||||||
|
@ -1615,22 +1615,22 @@ class NetEqStreamInput : public test::NetEqInput {
|
||||||
RTC_DCHECK(output_events);
|
RTC_DCHECK(output_events);
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<int64_t> NextPacketTime() const override {
|
absl::optional<int64_t> NextPacketTime() const override {
|
||||||
if (packet_stream_it_ == packet_stream_.end()) {
|
if (packet_stream_it_ == packet_stream_.end()) {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
if (end_time_ms_ && packet_stream_it_->rtp.log_time_ms() > *end_time_ms_) {
|
if (end_time_ms_ && packet_stream_it_->rtp.log_time_ms() > *end_time_ms_) {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
return packet_stream_it_->rtp.log_time_ms();
|
return packet_stream_it_->rtp.log_time_ms();
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<int64_t> NextOutputEventTime() const override {
|
absl::optional<int64_t> NextOutputEventTime() const override {
|
||||||
if (output_events_it_ == output_events_end_) {
|
if (output_events_it_ == output_events_end_) {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
if (end_time_ms_ && output_events_it_->log_time_ms() > *end_time_ms_) {
|
if (end_time_ms_ && output_events_it_->log_time_ms() > *end_time_ms_) {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
return output_events_it_->log_time_ms();
|
return output_events_it_->log_time_ms();
|
||||||
}
|
}
|
||||||
|
@ -1661,9 +1661,9 @@ class NetEqStreamInput : public test::NetEqInput {
|
||||||
|
|
||||||
bool ended() const override { return !NextEventTime(); }
|
bool ended() const override { return !NextEventTime(); }
|
||||||
|
|
||||||
rtc::Optional<RTPHeader> NextHeader() const override {
|
absl::optional<RTPHeader> NextHeader() const override {
|
||||||
if (packet_stream_it_ == packet_stream_.end()) {
|
if (packet_stream_it_ == packet_stream_.end()) {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
return packet_stream_it_->rtp.header;
|
return packet_stream_it_->rtp.header;
|
||||||
}
|
}
|
||||||
|
@ -1673,7 +1673,7 @@ class NetEqStreamInput : public test::NetEqInput {
|
||||||
std::vector<LoggedRtpPacketIncoming>::const_iterator packet_stream_it_;
|
std::vector<LoggedRtpPacketIncoming>::const_iterator packet_stream_it_;
|
||||||
std::vector<LoggedAudioPlayoutEvent>::const_iterator output_events_it_;
|
std::vector<LoggedAudioPlayoutEvent>::const_iterator output_events_it_;
|
||||||
const std::vector<LoggedAudioPlayoutEvent>::const_iterator output_events_end_;
|
const std::vector<LoggedAudioPlayoutEvent>::const_iterator output_events_end_;
|
||||||
const rtc::Optional<int64_t> end_time_ms_;
|
const absl::optional<int64_t> end_time_ms_;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -1683,7 +1683,7 @@ namespace {
|
||||||
std::unique_ptr<test::NetEqStatsGetter> CreateNetEqTestAndRun(
|
std::unique_ptr<test::NetEqStatsGetter> CreateNetEqTestAndRun(
|
||||||
const std::vector<LoggedRtpPacketIncoming>* packet_stream,
|
const std::vector<LoggedRtpPacketIncoming>* packet_stream,
|
||||||
const std::vector<LoggedAudioPlayoutEvent>* output_events,
|
const std::vector<LoggedAudioPlayoutEvent>* output_events,
|
||||||
rtc::Optional<int64_t> end_time_ms,
|
absl::optional<int64_t> end_time_ms,
|
||||||
const std::string& replacement_file_name,
|
const std::string& replacement_file_name,
|
||||||
int file_sample_rate_hz) {
|
int file_sample_rate_hz) {
|
||||||
std::unique_ptr<test::NetEqInput> input(
|
std::unique_ptr<test::NetEqInput> input(
|
||||||
|
@ -1759,10 +1759,10 @@ EventLogAnalyzer::NetEqStatsGetterMap EventLogAnalyzer::SimulateNetEq(
|
||||||
output_events_it = parsed_log_.audio_playout_events().cbegin();
|
output_events_it = parsed_log_.audio_playout_events().cbegin();
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<int64_t> end_time_ms =
|
absl::optional<int64_t> end_time_ms =
|
||||||
log_segments_.empty()
|
log_segments_.empty()
|
||||||
? rtc::nullopt
|
? absl::nullopt
|
||||||
: rtc::Optional<int64_t>(log_segments_.front().second / 1000);
|
: absl::optional<int64_t>(log_segments_.front().second / 1000);
|
||||||
|
|
||||||
neteq_stats[ssrc] = CreateNetEqTestAndRun(
|
neteq_stats[ssrc] = CreateNetEqTestAndRun(
|
||||||
audio_packets, &output_events_it->second, end_time_ms,
|
audio_packets, &output_events_it->second, end_time_ms,
|
||||||
|
@ -1786,8 +1786,8 @@ void EventLogAnalyzer::CreateAudioJitterBufferGraph(
|
||||||
std::vector<float> send_times_s;
|
std::vector<float> send_times_s;
|
||||||
std::vector<float> arrival_delay_ms;
|
std::vector<float> arrival_delay_ms;
|
||||||
std::vector<float> corrected_arrival_delay_ms;
|
std::vector<float> corrected_arrival_delay_ms;
|
||||||
std::vector<rtc::Optional<float>> playout_delay_ms;
|
std::vector<absl::optional<float>> playout_delay_ms;
|
||||||
std::vector<rtc::Optional<float>> target_delay_ms;
|
std::vector<absl::optional<float>> target_delay_ms;
|
||||||
neteq_stats.at(ssrc)->delay_analyzer()->CreateGraphs(
|
neteq_stats.at(ssrc)->delay_analyzer()->CreateGraphs(
|
||||||
&send_times_s, &arrival_delay_ms, &corrected_arrival_delay_ms,
|
&send_times_s, &arrival_delay_ms, &corrected_arrival_delay_ms,
|
||||||
&playout_delay_ms, &target_delay_ms);
|
&playout_delay_ms, &target_delay_ms);
|
||||||
|
@ -2014,9 +2014,9 @@ void EventLogAnalyzer::CreateStreamGapAlerts(PacketDirection direction) {
|
||||||
: log_segments_.front().second;
|
: log_segments_.front().second;
|
||||||
|
|
||||||
SeqNumUnwrapper<uint16_t> seq_num_unwrapper;
|
SeqNumUnwrapper<uint16_t> seq_num_unwrapper;
|
||||||
rtc::Optional<int64_t> last_seq_num;
|
absl::optional<int64_t> last_seq_num;
|
||||||
SeqNumUnwrapper<uint32_t> capture_time_unwrapper;
|
SeqNumUnwrapper<uint32_t> capture_time_unwrapper;
|
||||||
rtc::Optional<int64_t> last_capture_time;
|
absl::optional<int64_t> last_capture_time;
|
||||||
// Check for gaps in sequence numbers and capture timestamps.
|
// Check for gaps in sequence numbers and capture timestamps.
|
||||||
for (const auto& stream : parsed_log_.rtp_packets_by_ssrc(direction)) {
|
for (const auto& stream : parsed_log_.rtp_packets_by_ssrc(direction)) {
|
||||||
for (const auto& packet : stream.packet_view) {
|
for (const auto& packet : stream.packet_view) {
|
||||||
|
@ -2060,7 +2060,7 @@ void EventLogAnalyzer::CreateTransmissionGapAlerts(PacketDirection direction) {
|
||||||
for (const LoggedRtpPacket& rtp_packet : stream.packet_view)
|
for (const LoggedRtpPacket& rtp_packet : stream.packet_view)
|
||||||
rtp_in_direction.emplace(rtp_packet.log_time_us(), &rtp_packet);
|
rtp_in_direction.emplace(rtp_packet.log_time_us(), &rtp_packet);
|
||||||
}
|
}
|
||||||
rtc::Optional<int64_t> last_rtp_time;
|
absl::optional<int64_t> last_rtp_time;
|
||||||
for (const auto& kv : rtp_in_direction) {
|
for (const auto& kv : rtp_in_direction) {
|
||||||
int64_t timestamp = kv.first;
|
int64_t timestamp = kv.first;
|
||||||
if (timestamp > end_time_us) {
|
if (timestamp > end_time_us) {
|
||||||
|
@ -2075,7 +2075,7 @@ void EventLogAnalyzer::CreateTransmissionGapAlerts(PacketDirection direction) {
|
||||||
last_rtp_time.emplace(timestamp);
|
last_rtp_time.emplace(timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<int64_t> last_rtcp_time;
|
absl::optional<int64_t> last_rtcp_time;
|
||||||
if (direction == kIncomingPacket) {
|
if (direction == kIncomingPacket) {
|
||||||
for (const auto& rtcp : parsed_log_.incoming_rtcp_packets()) {
|
for (const auto& rtcp : parsed_log_.incoming_rtcp_packets()) {
|
||||||
if (rtcp.log_time_us() > end_time_us) {
|
if (rtcp.log_time_us() > end_time_us) {
|
||||||
|
|
|
@ -41,13 +41,13 @@ if (rtc_enable_protobuf) {
|
||||||
deps = [
|
deps = [
|
||||||
":network_tester_config_proto",
|
":network_tester_config_proto",
|
||||||
":network_tester_packet_proto",
|
":network_tester_packet_proto",
|
||||||
"../../api:optional",
|
|
||||||
"../../p2p",
|
"../../p2p",
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:protobuf_utils",
|
"../../rtc_base:protobuf_utils",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../../rtc_base:rtc_task_queue",
|
"../../rtc_base:rtc_task_queue",
|
||||||
"../../rtc_base:sequenced_task_checker",
|
"../../rtc_base:sequenced_task_checker",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (!build_with_chromium && is_clang) {
|
if (!build_with_chromium && is_clang) {
|
||||||
|
|
|
@ -31,10 +31,10 @@ ConfigReader::ConfigReader(const std::string& config_file_path)
|
||||||
|
|
||||||
ConfigReader::~ConfigReader() = default;
|
ConfigReader::~ConfigReader() = default;
|
||||||
|
|
||||||
rtc::Optional<ConfigReader::Config> ConfigReader::GetNextConfig() {
|
absl::optional<ConfigReader::Config> ConfigReader::GetNextConfig() {
|
||||||
#ifdef WEBRTC_NETWORK_TESTER_PROTO
|
#ifdef WEBRTC_NETWORK_TESTER_PROTO
|
||||||
if (proto_config_index_ >= proto_all_configs_.configs_size())
|
if (proto_config_index_ >= proto_all_configs_.configs_size())
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
auto proto_config = proto_all_configs_.configs(proto_config_index_++);
|
auto proto_config = proto_all_configs_.configs(proto_config_index_++);
|
||||||
RTC_DCHECK(proto_config.has_packet_send_interval_ms());
|
RTC_DCHECK(proto_config.has_packet_send_interval_ms());
|
||||||
RTC_DCHECK(proto_config.has_packet_size());
|
RTC_DCHECK(proto_config.has_packet_size());
|
||||||
|
@ -45,7 +45,7 @@ rtc::Optional<ConfigReader::Config> ConfigReader::GetNextConfig() {
|
||||||
config.execution_time_ms = proto_config.execution_time_ms();
|
config.execution_time_ms = proto_config.execution_time_ms();
|
||||||
return config;
|
return config;
|
||||||
#else
|
#else
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
#endif // WEBRTC_NETWORK_TESTER_PROTO
|
#endif // WEBRTC_NETWORK_TESTER_PROTO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "rtc_base/constructormagic.h"
|
#include "rtc_base/constructormagic.h"
|
||||||
|
|
||||||
#include "rtc_base/ignore_wundef.h"
|
#include "rtc_base/ignore_wundef.h"
|
||||||
|
@ -40,7 +40,7 @@ class ConfigReader {
|
||||||
explicit ConfigReader(const std::string& config_file_path);
|
explicit ConfigReader(const std::string& config_file_path);
|
||||||
~ConfigReader();
|
~ConfigReader();
|
||||||
|
|
||||||
rtc::Optional<Config> GetNextConfig();
|
absl::optional<Config> GetNextConfig();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NetworkTesterAllConfigs proto_all_configs_;
|
NetworkTesterAllConfigs proto_all_configs_;
|
||||||
|
|
|
@ -37,7 +37,7 @@ void TestController::SendConnectTo(const std::string& hostname, int port) {
|
||||||
udp_transport_->SetRemoteAddress(rtc::SocketAddress(hostname, port));
|
udp_transport_->SetRemoteAddress(rtc::SocketAddress(hostname, port));
|
||||||
NetworkTesterPacket packet;
|
NetworkTesterPacket packet;
|
||||||
packet.set_type(NetworkTesterPacket::HAND_SHAKING);
|
packet.set_type(NetworkTesterPacket::HAND_SHAKING);
|
||||||
SendData(packet, rtc::nullopt);
|
SendData(packet, absl::nullopt);
|
||||||
rtc::CritScope scoped_lock(&local_test_done_lock_);
|
rtc::CritScope scoped_lock(&local_test_done_lock_);
|
||||||
local_test_done_ = false;
|
local_test_done_ = false;
|
||||||
remote_test_done_ = false;
|
remote_test_done_ = false;
|
||||||
|
@ -49,7 +49,7 @@ void TestController::Run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestController::SendData(const NetworkTesterPacket& packet,
|
void TestController::SendData(const NetworkTesterPacket& packet,
|
||||||
rtc::Optional<size_t> data_size) {
|
absl::optional<size_t> data_size) {
|
||||||
// Can be call from packet_sender or from test_controller thread.
|
// Can be call from packet_sender or from test_controller thread.
|
||||||
size_t packet_size = packet.ByteSizeLong();
|
size_t packet_size = packet.ByteSizeLong();
|
||||||
send_data_[0] = packet_size;
|
send_data_[0] = packet_size;
|
||||||
|
@ -65,7 +65,7 @@ void TestController::OnTestDone() {
|
||||||
RTC_DCHECK_CALLED_SEQUENTIALLY(&packet_sender_checker_);
|
RTC_DCHECK_CALLED_SEQUENTIALLY(&packet_sender_checker_);
|
||||||
NetworkTesterPacket packet;
|
NetworkTesterPacket packet;
|
||||||
packet.set_type(NetworkTesterPacket::TEST_DONE);
|
packet.set_type(NetworkTesterPacket::TEST_DONE);
|
||||||
SendData(packet, rtc::nullopt);
|
SendData(packet, absl::nullopt);
|
||||||
rtc::CritScope scoped_lock(&local_test_done_lock_);
|
rtc::CritScope scoped_lock(&local_test_done_lock_);
|
||||||
local_test_done_ = true;
|
local_test_done_ = true;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ void TestController::OnReadPacket(rtc::AsyncPacketSocket* socket,
|
||||||
NetworkTesterPacket packet;
|
NetworkTesterPacket packet;
|
||||||
packet.set_type(NetworkTesterPacket::TEST_START);
|
packet.set_type(NetworkTesterPacket::TEST_START);
|
||||||
udp_transport_->SetRemoteAddress(remote_addr);
|
udp_transport_->SetRemoteAddress(remote_addr);
|
||||||
SendData(packet, rtc::nullopt);
|
SendData(packet, absl::nullopt);
|
||||||
packet_sender_.reset(new PacketSender(this, config_file_path_));
|
packet_sender_.reset(new PacketSender(this, config_file_path_));
|
||||||
packet_sender_->StartSending();
|
packet_sender_->StartSending();
|
||||||
rtc::CritScope scoped_lock(&local_test_done_lock_);
|
rtc::CritScope scoped_lock(&local_test_done_lock_);
|
||||||
|
|
|
@ -49,7 +49,7 @@ class TestController : public sigslot::has_slots<> {
|
||||||
void SendConnectTo(const std::string& hostname, int port);
|
void SendConnectTo(const std::string& hostname, int port);
|
||||||
|
|
||||||
void SendData(const NetworkTesterPacket& packet,
|
void SendData(const NetworkTesterPacket& packet,
|
||||||
rtc::Optional<size_t> data_size);
|
absl::optional<size_t> data_size);
|
||||||
|
|
||||||
void OnTestDone();
|
void OnTestDone();
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,6 @@ rtc_source_set("video_test_common") {
|
||||||
"..:webrtc_common",
|
"..:webrtc_common",
|
||||||
"../:typedefs",
|
"../:typedefs",
|
||||||
"../api:libjingle_peerconnection_api",
|
"../api:libjingle_peerconnection_api",
|
||||||
"../api:optional",
|
|
||||||
"../api/video:video_frame",
|
"../api/video:video_frame",
|
||||||
"../api/video:video_frame_i420",
|
"../api/video:video_frame_i420",
|
||||||
"../api/video_codecs:video_codecs_api",
|
"../api/video_codecs:video_codecs_api",
|
||||||
|
@ -75,6 +74,7 @@ rtc_source_set("video_test_common") {
|
||||||
"../rtc_base:rtc_base",
|
"../rtc_base:rtc_base",
|
||||||
"../rtc_base:rtc_task_queue",
|
"../rtc_base:rtc_task_queue",
|
||||||
"../system_wrappers",
|
"../system_wrappers",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,9 +389,9 @@ rtc_source_set("fileutils") {
|
||||||
deps = [
|
deps = [
|
||||||
"..:webrtc_common",
|
"..:webrtc_common",
|
||||||
"../:typedefs",
|
"../:typedefs",
|
||||||
"../api:optional",
|
|
||||||
"../rtc_base:checks",
|
"../rtc_base:checks",
|
||||||
"../rtc_base:rtc_base_approved",
|
"../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
if (is_ios) {
|
if (is_ios) {
|
||||||
deps += [ ":fileutils_objc" ]
|
deps += [ ":fileutils_objc" ]
|
||||||
|
@ -453,10 +453,10 @@ rtc_source_set("fileutils_unittests") {
|
||||||
deps = [
|
deps = [
|
||||||
":fileutils",
|
":fileutils",
|
||||||
":test_support",
|
":test_support",
|
||||||
"../api:optional",
|
|
||||||
"../rtc_base:checks",
|
"../rtc_base:checks",
|
||||||
"../rtc_base:rtc_base_approved",
|
"../rtc_base:rtc_base_approved",
|
||||||
"//testing/gtest",
|
"//testing/gtest",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,7 @@ void CallTest::CreateFrameGeneratorCapturerWithDrift(Clock* clock,
|
||||||
int width,
|
int width,
|
||||||
int height) {
|
int height) {
|
||||||
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
|
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
|
||||||
width, height, rtc::nullopt, rtc::nullopt, framerate * speed, clock));
|
width, height, absl::nullopt, absl::nullopt, framerate * speed, clock));
|
||||||
video_send_stream_->SetSource(frame_generator_capturer_.get(),
|
video_send_stream_->SetSource(frame_generator_capturer_.get(),
|
||||||
DegradationPreference::MAINTAIN_FRAMERATE);
|
DegradationPreference::MAINTAIN_FRAMERATE);
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,7 @@ void CallTest::CreateFrameGeneratorCapturer(int framerate,
|
||||||
int width,
|
int width,
|
||||||
int height) {
|
int height) {
|
||||||
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
|
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
|
||||||
width, height, rtc::nullopt, rtc::nullopt, framerate, clock_));
|
width, height, absl::nullopt, absl::nullopt, framerate, clock_));
|
||||||
video_send_stream_->SetSource(frame_generator_capturer_.get(),
|
video_send_stream_->SetSource(frame_generator_capturer_.get(),
|
||||||
DegradationPreference::MAINTAIN_FRAMERATE);
|
DegradationPreference::MAINTAIN_FRAMERATE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -402,7 +402,7 @@ class ScrollingImageFrameGenerator : public FrameGenerator {
|
||||||
|
|
||||||
size_t current_frame_num_;
|
size_t current_frame_num_;
|
||||||
VideoFrame* current_source_frame_;
|
VideoFrame* current_source_frame_;
|
||||||
rtc::Optional<VideoFrame> current_frame_;
|
absl::optional<VideoFrame> current_frame_;
|
||||||
YuvFileGenerator file_generator_;
|
YuvFileGenerator file_generator_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -444,8 +444,8 @@ bool FrameForwarder::has_sinks() const {
|
||||||
std::unique_ptr<FrameGenerator> FrameGenerator::CreateSquareGenerator(
|
std::unique_ptr<FrameGenerator> FrameGenerator::CreateSquareGenerator(
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
rtc::Optional<OutputType> type,
|
absl::optional<OutputType> type,
|
||||||
rtc::Optional<int> num_squares) {
|
absl::optional<int> num_squares) {
|
||||||
return std::unique_ptr<FrameGenerator>(
|
return std::unique_ptr<FrameGenerator>(
|
||||||
new SquareGenerator(width, height, type.value_or(OutputType::I420),
|
new SquareGenerator(width, height, type.value_or(OutputType::I420),
|
||||||
num_squares.value_or(10)));
|
num_squares.value_or(10)));
|
||||||
|
|
|
@ -67,8 +67,8 @@ class FrameGenerator {
|
||||||
static std::unique_ptr<FrameGenerator> CreateSquareGenerator(
|
static std::unique_ptr<FrameGenerator> CreateSquareGenerator(
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
rtc::Optional<OutputType> type,
|
absl::optional<OutputType> type,
|
||||||
rtc::Optional<int> num_squares);
|
absl::optional<int> num_squares);
|
||||||
|
|
||||||
// Creates a frame generator that repeatedly plays a set of yuv files.
|
// Creates a frame generator that repeatedly plays a set of yuv files.
|
||||||
// The frame_repeat_count determines how many times each frame is shown,
|
// The frame_repeat_count determines how many times each frame is shown,
|
||||||
|
|
|
@ -87,8 +87,8 @@ class FrameGeneratorCapturer::InsertFrameTask : public rtc::QueuedTask {
|
||||||
FrameGeneratorCapturer* FrameGeneratorCapturer::Create(
|
FrameGeneratorCapturer* FrameGeneratorCapturer::Create(
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
rtc::Optional<FrameGenerator::OutputType> type,
|
absl::optional<FrameGenerator::OutputType> type,
|
||||||
rtc::Optional<int> num_squares,
|
absl::optional<int> num_squares,
|
||||||
int target_fps,
|
int target_fps,
|
||||||
Clock* clock) {
|
Clock* clock) {
|
||||||
std::unique_ptr<FrameGeneratorCapturer> capturer(new FrameGeneratorCapturer(
|
std::unique_ptr<FrameGeneratorCapturer> capturer(new FrameGeneratorCapturer(
|
||||||
|
@ -187,7 +187,7 @@ void FrameGeneratorCapturer::InsertFrame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sink_) {
|
if (sink_) {
|
||||||
rtc::Optional<VideoFrame> out_frame = AdaptFrame(*frame);
|
absl::optional<VideoFrame> out_frame = AdaptFrame(*frame);
|
||||||
if (out_frame)
|
if (out_frame)
|
||||||
sink_->OnFrame(*out_frame);
|
sink_->OnFrame(*out_frame);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,8 @@ class FrameGeneratorCapturer : public VideoCapturer {
|
||||||
static FrameGeneratorCapturer* Create(
|
static FrameGeneratorCapturer* Create(
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
rtc::Optional<FrameGenerator::OutputType> type,
|
absl::optional<FrameGenerator::OutputType> type,
|
||||||
rtc::Optional<int> num_squares,
|
absl::optional<int> num_squares,
|
||||||
int target_fps,
|
int target_fps,
|
||||||
Clock* clock);
|
Clock* clock);
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class FrameGeneratorCapturer : public VideoCapturer {
|
||||||
std::unique_ptr<FrameGenerator> frame_generator_;
|
std::unique_ptr<FrameGenerator> frame_generator_;
|
||||||
|
|
||||||
int target_fps_ RTC_GUARDED_BY(&lock_);
|
int target_fps_ RTC_GUARDED_BY(&lock_);
|
||||||
rtc::Optional<int> wanted_fps_ RTC_GUARDED_BY(&lock_);
|
absl::optional<int> wanted_fps_ RTC_GUARDED_BY(&lock_);
|
||||||
VideoRotation fake_rotation_ = kVideoRotation_0;
|
VideoRotation fake_rotation_ = kVideoRotation_0;
|
||||||
|
|
||||||
int64_t first_frame_capture_time_;
|
int64_t first_frame_capture_time_;
|
||||||
|
|
|
@ -260,11 +260,11 @@ rtc_static_library("audio_decoder_fuzzer") {
|
||||||
deps = [
|
deps = [
|
||||||
"../..:webrtc_common",
|
"../..:webrtc_common",
|
||||||
"../../:typedefs",
|
"../../:typedefs",
|
||||||
"../../api:optional",
|
|
||||||
"../../api/audio_codecs:audio_codecs_api",
|
"../../api/audio_codecs:audio_codecs_api",
|
||||||
"../../modules/rtp_rtcp:rtp_rtcp_format",
|
"../../modules/rtp_rtcp:rtp_rtcp_format",
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,11 +454,11 @@ rtc_static_library("audio_processing_fuzzer_helper") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
":fuzz_data_helper",
|
":fuzz_data_helper",
|
||||||
"../../api:optional",
|
|
||||||
"../../api/audio:audio_frame_api",
|
"../../api/audio:audio_frame_api",
|
||||||
"../../modules/audio_processing",
|
"../../modules/audio_processing",
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_decoder.h"
|
#include "api/audio_codecs/audio_decoder.h"
|
||||||
#include "api/optional.h"
|
|
||||||
#include "modules/rtp_rtcp/source/byte_io.h"
|
#include "modules/rtp_rtcp/source/byte_io.h"
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
|
|
||||||
|
|
|
@ -65,11 +65,11 @@ class FuzzRtpInput : public NetEqInput {
|
||||||
FuzzHeader();
|
FuzzHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<int64_t> NextPacketTime() const override {
|
absl::optional<int64_t> NextPacketTime() const override {
|
||||||
return packet_->time_ms;
|
return packet_->time_ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<int64_t> NextOutputEventTime() const override {
|
absl::optional<int64_t> NextOutputEventTime() const override {
|
||||||
return input_->NextOutputEventTime();
|
return input_->NextOutputEventTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class FuzzRtpInput : public NetEqInput {
|
||||||
|
|
||||||
bool ended() const override { return ended_; }
|
bool ended() const override { return ended_; }
|
||||||
|
|
||||||
rtc::Optional<RTPHeader> NextHeader() const override {
|
absl::optional<RTPHeader> NextHeader() const override {
|
||||||
RTC_DCHECK(packet_);
|
RTC_DCHECK(packet_);
|
||||||
return packet_->header;
|
return packet_->header;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,11 +88,11 @@ class FuzzSignalInput : public NetEqInput {
|
||||||
output_event_period_ms_ = fuzz_data_.SelectOneOf(output_event_periods);
|
output_event_period_ms_ = fuzz_data_.SelectOneOf(output_event_periods);
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<int64_t> NextPacketTime() const override {
|
absl::optional<int64_t> NextPacketTime() const override {
|
||||||
return packet_->time_ms;
|
return packet_->time_ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<int64_t> NextOutputEventTime() const override {
|
absl::optional<int64_t> NextOutputEventTime() const override {
|
||||||
return next_output_event_ms_;
|
return next_output_event_ms_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ class FuzzSignalInput : public NetEqInput {
|
||||||
|
|
||||||
bool ended() const override { return ended_; }
|
bool ended() const override { return ended_; }
|
||||||
|
|
||||||
rtc::Optional<RTPHeader> NextHeader() const override {
|
absl::optional<RTPHeader> NextHeader() const override {
|
||||||
RTC_DCHECK(packet_);
|
RTC_DCHECK(packet_);
|
||||||
return packet_->header;
|
return packet_->header;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,14 +28,14 @@ class MockAudioDecoderFactory : public AudioDecoderFactory {
|
||||||
MOCK_METHOD1(IsSupportedDecoder, bool(const SdpAudioFormat&));
|
MOCK_METHOD1(IsSupportedDecoder, bool(const SdpAudioFormat&));
|
||||||
std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
const SdpAudioFormat& format,
|
const SdpAudioFormat& format,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id) {
|
absl::optional<AudioCodecPairId> codec_pair_id) {
|
||||||
std::unique_ptr<AudioDecoder> return_value;
|
std::unique_ptr<AudioDecoder> return_value;
|
||||||
MakeAudioDecoderMock(format, codec_pair_id, &return_value);
|
MakeAudioDecoderMock(format, codec_pair_id, &return_value);
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
MOCK_METHOD3(MakeAudioDecoderMock,
|
MOCK_METHOD3(MakeAudioDecoderMock,
|
||||||
void(const SdpAudioFormat& format,
|
void(const SdpAudioFormat& format,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id,
|
absl::optional<AudioCodecPairId> codec_pair_id,
|
||||||
std::unique_ptr<AudioDecoder>* return_value));
|
std::unique_ptr<AudioDecoder>* return_value));
|
||||||
|
|
||||||
// Creates a MockAudioDecoderFactory with no formats and that may not be
|
// Creates a MockAudioDecoderFactory with no formats and that may not be
|
||||||
|
|
|
@ -43,7 +43,7 @@ class MockAudioEncoder : public AudioEncoder {
|
||||||
MOCK_METHOD1(SetMaxPayloadSize, void(int max_payload_size_bytes));
|
MOCK_METHOD1(SetMaxPayloadSize, void(int max_payload_size_bytes));
|
||||||
MOCK_METHOD2(OnReceivedUplinkBandwidth,
|
MOCK_METHOD2(OnReceivedUplinkBandwidth,
|
||||||
void(int target_audio_bitrate_bps,
|
void(int target_audio_bitrate_bps,
|
||||||
rtc::Optional<int64_t> probing_interval_ms));
|
absl::optional<int64_t> probing_interval_ms));
|
||||||
MOCK_METHOD1(OnReceivedUplinkPacketLossFraction,
|
MOCK_METHOD1(OnReceivedUplinkPacketLossFraction,
|
||||||
void(float uplink_packet_loss_fraction));
|
void(float uplink_packet_loss_fraction));
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,12 @@ class MockAudioEncoderFactory : public testing::NiceMock<AudioEncoderFactory> {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD0(GetSupportedEncoders, std::vector<AudioCodecSpec>());
|
MOCK_METHOD0(GetSupportedEncoders, std::vector<AudioCodecSpec>());
|
||||||
MOCK_METHOD1(QueryAudioEncoder,
|
MOCK_METHOD1(QueryAudioEncoder,
|
||||||
rtc::Optional<AudioCodecInfo>(const SdpAudioFormat& format));
|
absl::optional<AudioCodecInfo>(const SdpAudioFormat& format));
|
||||||
|
|
||||||
std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||||
int payload_type,
|
int payload_type,
|
||||||
const SdpAudioFormat& format,
|
const SdpAudioFormat& format,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id) {
|
absl::optional<AudioCodecPairId> codec_pair_id) {
|
||||||
std::unique_ptr<AudioEncoder> return_value;
|
std::unique_ptr<AudioEncoder> return_value;
|
||||||
MakeAudioEncoderMock(payload_type, format, codec_pair_id, &return_value);
|
MakeAudioEncoderMock(payload_type, format, codec_pair_id, &return_value);
|
||||||
return return_value;
|
return return_value;
|
||||||
|
@ -38,7 +38,7 @@ class MockAudioEncoderFactory : public testing::NiceMock<AudioEncoderFactory> {
|
||||||
MOCK_METHOD4(MakeAudioEncoderMock,
|
MOCK_METHOD4(MakeAudioEncoderMock,
|
||||||
void(int payload_type,
|
void(int payload_type,
|
||||||
const SdpAudioFormat& format,
|
const SdpAudioFormat& format,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id,
|
absl::optional<AudioCodecPairId> codec_pair_id,
|
||||||
std::unique_ptr<AudioEncoder>* return_value));
|
std::unique_ptr<AudioEncoder>* return_value));
|
||||||
|
|
||||||
// Creates a MockAudioEncoderFactory with no formats and that may not be
|
// Creates a MockAudioEncoderFactory with no formats and that may not be
|
||||||
|
@ -55,7 +55,7 @@ class MockAudioEncoderFactory : public testing::NiceMock<AudioEncoderFactory> {
|
||||||
ON_CALL(*factory.get(), GetSupportedEncoders())
|
ON_CALL(*factory.get(), GetSupportedEncoders())
|
||||||
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>()));
|
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>()));
|
||||||
ON_CALL(*factory.get(), QueryAudioEncoder(_))
|
ON_CALL(*factory.get(), QueryAudioEncoder(_))
|
||||||
.WillByDefault(Return(rtc::nullopt));
|
.WillByDefault(Return(absl::nullopt));
|
||||||
|
|
||||||
EXPECT_CALL(*factory.get(), GetSupportedEncoders()).Times(AnyNumber());
|
EXPECT_CALL(*factory.get(), GetSupportedEncoders()).Times(AnyNumber());
|
||||||
EXPECT_CALL(*factory.get(), QueryAudioEncoder(_)).Times(AnyNumber());
|
EXPECT_CALL(*factory.get(), QueryAudioEncoder(_)).Times(AnyNumber());
|
||||||
|
@ -78,7 +78,7 @@ class MockAudioEncoderFactory : public testing::NiceMock<AudioEncoderFactory> {
|
||||||
ON_CALL(*factory.get(), GetSupportedEncoders())
|
ON_CALL(*factory.get(), GetSupportedEncoders())
|
||||||
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>()));
|
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>()));
|
||||||
ON_CALL(*factory.get(), QueryAudioEncoder(_))
|
ON_CALL(*factory.get(), QueryAudioEncoder(_))
|
||||||
.WillByDefault(Return(rtc::nullopt));
|
.WillByDefault(Return(absl::nullopt));
|
||||||
ON_CALL(*factory.get(), MakeAudioEncoderMock(_, _, _, _))
|
ON_CALL(*factory.get(), MakeAudioEncoderMock(_, _, _, _))
|
||||||
.WillByDefault(SetArgPointee<3>(nullptr));
|
.WillByDefault(SetArgPointee<3>(nullptr));
|
||||||
|
|
||||||
|
|
|
@ -223,9 +223,9 @@ std::string GenerateTempFilename(const std::string& dir,
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<std::vector<std::string>> ReadDirectory(std::string path) {
|
absl::optional<std::vector<std::string>> ReadDirectory(std::string path) {
|
||||||
if (path.length() == 0)
|
if (path.length() == 0)
|
||||||
return rtc::Optional<std::vector<std::string>>();
|
return absl::optional<std::vector<std::string>>();
|
||||||
|
|
||||||
#if defined(WEBRTC_WIN)
|
#if defined(WEBRTC_WIN)
|
||||||
// Append separator character if needed.
|
// Append separator character if needed.
|
||||||
|
@ -236,7 +236,7 @@ rtc::Optional<std::vector<std::string>> ReadDirectory(std::string path) {
|
||||||
WIN32_FIND_DATA data;
|
WIN32_FIND_DATA data;
|
||||||
HANDLE handle = ::FindFirstFile(rtc::ToUtf16(path + '*').c_str(), &data);
|
HANDLE handle = ::FindFirstFile(rtc::ToUtf16(path + '*').c_str(), &data);
|
||||||
if (handle == INVALID_HANDLE_VALUE)
|
if (handle == INVALID_HANDLE_VALUE)
|
||||||
return rtc::Optional<std::vector<std::string>>();
|
return absl::optional<std::vector<std::string>>();
|
||||||
|
|
||||||
// Populate output.
|
// Populate output.
|
||||||
std::vector<std::string> found_entries;
|
std::vector<std::string> found_entries;
|
||||||
|
@ -257,7 +257,7 @@ rtc::Optional<std::vector<std::string>> ReadDirectory(std::string path) {
|
||||||
// Init.
|
// Init.
|
||||||
DIR* dir = ::opendir(path.c_str());
|
DIR* dir = ::opendir(path.c_str());
|
||||||
if (dir == nullptr)
|
if (dir == nullptr)
|
||||||
return rtc::Optional<std::vector<std::string>>();
|
return absl::optional<std::vector<std::string>>();
|
||||||
|
|
||||||
// Populate output.
|
// Populate output.
|
||||||
std::vector<std::string> found_entries;
|
std::vector<std::string> found_entries;
|
||||||
|
@ -271,7 +271,7 @@ rtc::Optional<std::vector<std::string>> ReadDirectory(std::string path) {
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return rtc::Optional<std::vector<std::string>>(std::move(found_entries));
|
return absl::optional<std::vector<std::string>>(std::move(found_entries));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreateDir(const std::string& directory_name) {
|
bool CreateDir(const std::string& directory_name) {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
@ -81,7 +81,7 @@ std::string WorkingDir();
|
||||||
// of strings with one element for each found file or directory. Each element is
|
// of strings with one element for each found file or directory. Each element is
|
||||||
// a path created by prepending |dir| to the file/directory name. "." and ".."
|
// a path created by prepending |dir| to the file/directory name. "." and ".."
|
||||||
// are never added in the returned vector.
|
// are never added in the returned vector.
|
||||||
rtc::Optional<std::vector<std::string>> ReadDirectory(std::string path);
|
absl::optional<std::vector<std::string>> ReadDirectory(std::string path);
|
||||||
|
|
||||||
// Creates a directory if it not already exists.
|
// Creates a directory if it not already exists.
|
||||||
// Returns true if successful. Will print an error message to stderr and return
|
// Returns true if successful. Will print an error message to stderr and return
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
#include "test/gtest.h"
|
#include "test/gtest.h"
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace {
|
||||||
void CleanDir(const std::string& dir, size_t* num_deleted_entries) {
|
void CleanDir(const std::string& dir, size_t* num_deleted_entries) {
|
||||||
RTC_DCHECK(num_deleted_entries);
|
RTC_DCHECK(num_deleted_entries);
|
||||||
*num_deleted_entries = 0;
|
*num_deleted_entries = 0;
|
||||||
rtc::Optional<std::vector<std::string>> dir_content = ReadDirectory(dir);
|
absl::optional<std::vector<std::string>> dir_content = ReadDirectory(dir);
|
||||||
EXPECT_TRUE(dir_content);
|
EXPECT_TRUE(dir_content);
|
||||||
for (const auto& entry : *dir_content) {
|
for (const auto& entry : *dir_content) {
|
||||||
if (DirExists(entry)) {
|
if (DirExists(entry)) {
|
||||||
|
@ -238,7 +238,7 @@ TEST_F(FileUtilsTest, WriteReadDeleteFilesAndDirs) {
|
||||||
EXPECT_TRUE(DirExists(temp_subdir));
|
EXPECT_TRUE(DirExists(temp_subdir));
|
||||||
|
|
||||||
// Checks.
|
// Checks.
|
||||||
rtc::Optional<std::vector<std::string>> dir_content =
|
absl::optional<std::vector<std::string>> dir_content =
|
||||||
ReadDirectory(temp_directory);
|
ReadDirectory(temp_directory);
|
||||||
EXPECT_TRUE(dir_content);
|
EXPECT_TRUE(dir_content);
|
||||||
EXPECT_EQ(2u, dir_content->size());
|
EXPECT_EQ(2u, dir_content->size());
|
||||||
|
|
|
@ -108,7 +108,7 @@ VcmCapturer::~VcmCapturer() { Destroy(); }
|
||||||
void VcmCapturer::OnFrame(const VideoFrame& frame) {
|
void VcmCapturer::OnFrame(const VideoFrame& frame) {
|
||||||
rtc::CritScope lock(&crit_);
|
rtc::CritScope lock(&crit_);
|
||||||
if (started_ && sink_) {
|
if (started_ && sink_) {
|
||||||
rtc::Optional<VideoFrame> out_frame = AdaptFrame(frame);
|
absl::optional<VideoFrame> out_frame = AdaptFrame(frame);
|
||||||
if (out_frame)
|
if (out_frame)
|
||||||
sink_->OnFrame(*out_frame);
|
sink_->OnFrame(*out_frame);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace test {
|
||||||
VideoCapturer::VideoCapturer() : video_adapter_(new cricket::VideoAdapter()) {}
|
VideoCapturer::VideoCapturer() : video_adapter_(new cricket::VideoAdapter()) {}
|
||||||
VideoCapturer::~VideoCapturer() {}
|
VideoCapturer::~VideoCapturer() {}
|
||||||
|
|
||||||
rtc::Optional<VideoFrame> VideoCapturer::AdaptFrame(const VideoFrame& frame) {
|
absl::optional<VideoFrame> VideoCapturer::AdaptFrame(const VideoFrame& frame) {
|
||||||
int cropped_width = 0;
|
int cropped_width = 0;
|
||||||
int cropped_height = 0;
|
int cropped_height = 0;
|
||||||
int out_width = 0;
|
int out_width = 0;
|
||||||
|
@ -27,10 +27,10 @@ rtc::Optional<VideoFrame> VideoCapturer::AdaptFrame(const VideoFrame& frame) {
|
||||||
frame.width(), frame.height(), frame.timestamp_us() * 1000,
|
frame.width(), frame.height(), frame.timestamp_us() * 1000,
|
||||||
&cropped_width, &cropped_height, &out_width, &out_height)) {
|
&cropped_width, &cropped_height, &out_width, &out_height)) {
|
||||||
// Drop frame in order to respect frame rate constraint.
|
// Drop frame in order to respect frame rate constraint.
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<VideoFrame> out_frame;
|
absl::optional<VideoFrame> out_frame;
|
||||||
if (out_height != frame.height() || out_width != frame.width()) {
|
if (out_height != frame.height() || out_width != frame.width()) {
|
||||||
// Video adapter has requested a down-scale. Allocate a new buffer and
|
// Video adapter has requested a down-scale. Allocate a new buffer and
|
||||||
// return scaled version.
|
// return scaled version.
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/video/i420_buffer.h"
|
#include "api/video/i420_buffer.h"
|
||||||
#include "api/video/video_frame.h"
|
#include "api/video/video_frame.h"
|
||||||
#include "api/video/video_source_interface.h"
|
#include "api/video/video_source_interface.h"
|
||||||
|
@ -41,7 +41,7 @@ class VideoCapturer : public rtc::VideoSourceInterface<VideoFrame> {
|
||||||
const rtc::VideoSinkWants& wants) override;
|
const rtc::VideoSinkWants& wants) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
rtc::Optional<VideoFrame> AdaptFrame(const VideoFrame& frame);
|
absl::optional<VideoFrame> AdaptFrame(const VideoFrame& frame);
|
||||||
rtc::VideoSinkWants GetSinkWants();
|
rtc::VideoSinkWants GetSinkWants();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue