Skip to content

Commit

Permalink
Fix build issues after merging changes for low latency mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
jianjunz committed Dec 12, 2022
1 parent e32b58c commit 5b3e694
Show file tree
Hide file tree
Showing 67 changed files with 147 additions and 2,717 deletions.
8 changes: 2 additions & 6 deletions BUILD.gn
Expand Up @@ -62,7 +62,7 @@ if (!build_with_chromium) {
"modules/audio_processing:audio_processing_tests",
"modules/remote_bitrate_estimator:rtp_to_text",
"modules/rtp_rtcp:test_packet_masks_metrics",
"modules/video_capture:video_capture",
"modules/video_capture:video_capture_internal_impl",
"net/dcsctp:dcsctp_unittests",
"pc:peerconnection_unittests",
"pc:rtc_pc_unittests",
Expand Down Expand Up @@ -293,10 +293,6 @@ config("common_config") {
defines += [ "WEBRTC_ENABLE_PROTOBUF=0" ]
}

if (owt_use_gpra) {
defines += [ "INTEL_GPRA" ]
}

if (rtc_include_internal_audio_device) {
defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ]
}
Expand Down Expand Up @@ -517,7 +513,7 @@ if (!build_with_chromium) {
"logging:rtc_event_log_api",
"media",
"modules",
"modules/video_capture:video_capture",
"modules/video_capture:video_capture_internal_impl",
"p2p:rtc_p2p",
"pc:libjingle_peerconnection",
"pc:rtc_pc",
Expand Down
2 changes: 1 addition & 1 deletion api/audio_codecs/opus/audio_decoder_opus.cc
Expand Up @@ -44,7 +44,7 @@ absl::optional<AudioDecoderOpus::Config> AudioDecoderOpus::SdpToConfig(
return absl::nullopt; // Bad stereo parameter.
}
}
return 2; // Default to mono.
return 1; // Default to mono.
}();
if (absl::EqualsIgnoreCase(format.name, "opus") &&
format.clockrate_hz == 48000 && format.num_channels == 2 &&
Expand Down
5 changes: 1 addition & 4 deletions api/stats/rtc_stats_report.h
Expand Up @@ -23,7 +23,6 @@
#include "api/ref_counted_base.h"
#include "api/scoped_refptr.h"
#include "api/stats/rtc_stats.h"
#include "rtc_base/constructor_magic.h"
// TODO(tommi): Remove this include after fixing iwyu issue in chromium.
// See: third_party/blink/renderer/platform/peerconnection/rtc_stats.cc
#include "rtc_base/ref_counted_object.h"
Expand Down Expand Up @@ -58,15 +57,14 @@ class RTC_EXPORT RTCStatsReport final
// Reference report to make sure it is kept alive.
rtc::scoped_refptr<const RTCStatsReport> report_;
StatsMap::const_iterator it_;
RTC_DISALLOW_COPY_AND_ASSIGN(ConstIterator);
};

// TODO(hbos): Remove "= 0" once Chromium unittest has been updated to call
// with a parameter. crbug.com/627816
static rtc::scoped_refptr<RTCStatsReport> Create(int64_t timestamp_us = 0);

explicit RTCStatsReport(int64_t timestamp_us);
//RTCStatsReport(const RTCStatsReport& other) = delete;
RTCStatsReport(const RTCStatsReport& other) = delete;
rtc::scoped_refptr<RTCStatsReport> Copy() const;

int64_t timestamp_us() const { return timestamp_us_; }
Expand Down Expand Up @@ -132,7 +130,6 @@ class RTC_EXPORT RTCStatsReport final
private:
int64_t timestamp_us_;
StatsMap stats_;
RTC_DISALLOW_COPY_AND_ASSIGN(RTCStatsReport);
};

} // namespace webrtc
Expand Down
2 changes: 1 addition & 1 deletion api/transport/bitrate_settings.h
Expand Up @@ -42,7 +42,7 @@ struct BitrateConstraints {
int max_bitrate_bps = -1;

private:
static constexpr int kDefaultStartBitrateBps = 5000000; // Update from 300k to 5MB for low latency mode
static constexpr int kDefaultStartBitrateBps = 300000;
};

} // namespace webrtc
Expand Down
16 changes: 0 additions & 16 deletions api/video_codecs/video_codec.cc
Expand Up @@ -53,7 +53,6 @@ bool VideoCodecH264::operator==(const VideoCodecH264& other) const {
numberOfTemporalLayers == other.numberOfTemporalLayers);
}

#ifndef DISABLE_H265
bool VideoCodecH265::operator==(const VideoCodecH265& other) const {
return (frameDroppingOn == other.frameDroppingOn &&
keyFrameInterval == other.keyFrameInterval &&
Expand All @@ -62,18 +61,6 @@ bool VideoCodecH265::operator==(const VideoCodecH265& other) const {
(spsLen == 0 || memcmp(spsData, other.spsData, spsLen) == 0) &&
(ppsLen == 0 || memcmp(ppsData, other.ppsData, ppsLen) == 0));
}
#endif

#ifdef WEBRTC_USE_H265
bool VideoCodecH265::operator==(const VideoCodecH265& other) const {
return (frameDroppingOn == other.frameDroppingOn &&
keyFrameInterval == other.keyFrameInterval &&
vpsLen == other.vpsLen && spsLen == other.spsLen &&
ppsLen == other.ppsLen &&
(spsLen == 0 || memcmp(spsData, other.spsData, spsLen) == 0) &&
(ppsLen == 0 || memcmp(ppsData, other.ppsData, ppsLen) == 0));
}
#endif

VideoCodec::VideoCodec()
: codecType(kVideoCodecGeneric),
Expand Down Expand Up @@ -134,7 +121,6 @@ const VideoCodecH265& VideoCodec::H265() const {
RTC_DCHECK_EQ(codecType, kVideoCodecH265);
return codec_specific_.H265;
}
#endif

const char* CodecTypeToPayloadString(VideoCodecType type) {
switch (type) {
Expand All @@ -148,7 +134,6 @@ const char* CodecTypeToPayloadString(VideoCodecType type) {
return kPayloadNameH264;
case kVideoCodecH265:
return kPayloadNameH265;
#endif
case kVideoCodecMultiplex:
return kPayloadNameMultiplex;
case kVideoCodecGeneric:
Expand All @@ -172,7 +157,6 @@ VideoCodecType PayloadStringToCodecType(const std::string& name) {
return kVideoCodecMultiplex;
if (absl::EqualsIgnoreCase(name, kPayloadNameH265))
return kVideoCodecH265;
#endif
return kVideoCodecGeneric;
}

Expand Down
19 changes: 0 additions & 19 deletions api/video_codecs/video_codec.h
Expand Up @@ -112,23 +112,6 @@ struct VideoCodecH265 {
size_t ppsLen;
};

#ifndef DISABLE_H265
struct VideoCodecH265 {
bool operator==(const VideoCodecH265& other) const;
bool operator!=(const VideoCodecH265& other) const {
return !(*this == other);
}
bool frameDroppingOn;
int keyFrameInterval;
const uint8_t* vpsData;
size_t vpsLen;
const uint8_t* spsData;
size_t spsLen;
const uint8_t* ppsData;
size_t ppsLen;
};
#endif

// Translates from name of codec to codec type and vice versa.
RTC_EXPORT const char* CodecTypeToPayloadString(VideoCodecType type);
RTC_EXPORT VideoCodecType PayloadStringToCodecType(const std::string& name);
Expand All @@ -137,9 +120,7 @@ union VideoCodecUnion {
VideoCodecVP8 VP8;
VideoCodecVP9 VP9;
VideoCodecH264 H264;
#ifndef DISABLE_H265
VideoCodecH265 H265;
#endif
};

enum class VideoCodecMode { kRealtimeVideo, kScreensharing };
Expand Down
1 change: 0 additions & 1 deletion call/call_config.h
Expand Up @@ -38,7 +38,6 @@ struct CallConfig {
RtpTransportConfig ExtractTransportConfig() const;
~CallConfig();

RTC_DEPRECATED static constexpr int kDefaultStartBitrateBps = 300000;
// Bitrate config used until valid bitrate estimates are calculated. Also
// used to cap total bitrate used. This comes from the remote connection.
BitrateConstraints bitrate_config;
Expand Down
21 changes: 4 additions & 17 deletions call/rtp_payload_params.cc
Expand Up @@ -19,9 +19,7 @@
#include "absl/types/variant.h"
#include "api/video/video_timing.h"
#include "modules/video_coding/codecs/h264/include/h264_globals.h"
#ifndef DISABLE_H265
#include "modules/video_coding/codecs/h265/include/h265_globals.h"
#endif
#include "modules/video_coding/codecs/interface/common_constants.h"
#include "modules/video_coding/codecs/vp8/include/vp8_globals.h"
#include "modules/video_coding/codecs/vp9/include/vp9_globals.h"
Expand Down Expand Up @@ -317,32 +315,25 @@ void RtpPayloadParams::SetGeneric(const CodecSpecificInfo* codec_specific_info,
int64_t frame_id,
bool is_keyframe,
RTPVideoHeader* rtp_video_header) {

#ifdef WEBRTC_USE_H265
if (codec_specific_info->codecType == webrtc::kVideoCodecH265 &&
codec_specific_info->codecSpecific.H265.picture_id > 0) {
// H265ToGeneric implementation. Only set it when picture id is valid.
rtp_video_header->generic->frame_id =
codec_specific_info->codecSpecific.H265.picture_id;
rtp_video_header->generic->discardable =
codec_specific_info->codecSpecific.H265.discardable;
rtp_video_header->generic->spatial_index = 0; // Not enabled at present.
rtp_video_header->generic->spatial_index = 0; // Not enabled at present.
rtp_video_header->generic->temporal_index = 0; // Not enabled at present.
for (int dep_idx = 0; dep_idx < 5; dep_idx++) {
if (codec_specific_info->codecSpecific.H265.dependencies[dep_idx] <= 0)
break;
rtp_video_header->generic->dependencies[dep_idx] =
codec_specific_info->codecSpecific.H265.dependencies[dep_idx];
}
// Not filling DTIs at present.
rtp_video_header->generic->discardable =
codec_specific_info->codecSpecific.H265.discardable;
return;
}
#else
if (codec_specific_info && codec_specific_info->generic_frame_info &&
if (codec_specific_info && codec_specific_info->generic_frame_info &&
!codec_specific_info->generic_frame_info->encoder_buffers.empty()) {
// If generic frame info is provided for other codecs, use generic frame info.
// If generic frame info is provided for other codecs, use generic frame
// info.
if (is_keyframe) {
// Key frame resets all chains it is in.
chains_calculator_.Reset(
Expand All @@ -352,8 +343,6 @@ void RtpPayloadParams::SetGeneric(const CodecSpecificInfo* codec_specific_info,
*codec_specific_info->generic_frame_info, frame_id);
return;
}
#endif


switch (rtp_video_header->codec) {
case VideoCodecType::kVideoCodecGeneric:
Expand All @@ -380,10 +369,8 @@ void RtpPayloadParams::SetGeneric(const CodecSpecificInfo* codec_specific_info,
is_keyframe, rtp_video_header);
}
return;
#ifndef DISABLE_H265
// No further special handling for H.265
case VideoCodecType::kVideoCodecH265:
#endif
case VideoCodecType::kVideoCodecMultiplex:
return;
}
Expand Down
6 changes: 0 additions & 6 deletions call/rtp_transport_controller_send.cc
Expand Up @@ -36,7 +36,6 @@ static const int64_t kRetransmitWindowSizeMs = 500;
static const size_t kMaxOverheadBytes = 500;

constexpr TimeDelta kPacerQueueUpdateInterval = TimeDelta::Millis(25);
const char kLowLatencyStreaming[] = "OWT-LowLatencyMode";

TargetRateConstraints ConvertConstraints(int min_bitrate_bps,
int max_bitrate_bps,
Expand All @@ -55,11 +54,6 @@ TargetRateConstraints ConvertConstraints(int min_bitrate_bps,
return msg;
}

bool LowLatencyStreamingEnabled() {
std::string trial = webrtc::field_trial::FindFullName(kLowLatencyStreaming);
return trial.find("Enabled") == 0;
}

TargetRateConstraints ConvertConstraints(const BitrateConstraints& contraints,
Clock* clock) {
return ConvertConstraints(contraints.min_bitrate_bps,
Expand Down
10 changes: 3 additions & 7 deletions call/rtp_video_sender.cc
Expand Up @@ -613,17 +613,13 @@ EncodedImageCallback::Result RtpVideoSender::OnEncodedImage(
codec_specific_info->codecSpecific.H264.last_fragment_in_frame)
absl::get<RTPVideoHeaderH264>(rtp_video_header.video_type_header)
.has_last_fragement = true;
#ifndef DISABLE_H265
else if (codec_specific_info->codecType ==
kVideoCodecH265 && codec_specific_info->codecSpecific.H265
.last_fragment_in_frame)
else if (codec_specific_info->codecType == kVideoCodecH265 &&
codec_specific_info->codecSpecific.H265.last_fragment_in_frame)
absl::get<RTPVideoHeaderH265>(rtp_video_header.video_type_header)
.has_last_fragement = true;
#endif
bool send_result = rtp_streams_[stream_index].sender_video->SendEncodedImage(
rtp_config_.payload_type, codec_type_, rtp_timestamp, encoded_image,
rtp_video_header,
expected_retransmission_time_ms);
rtp_video_header, expected_retransmission_time_ms);
if (frame_count_observer_) {
FrameCounts& counts = frame_counts_[stream_index];
if (encoded_image._frameType == VideoFrameType::kVideoFrameKey) {
Expand Down
2 changes: 1 addition & 1 deletion media/BUILD.gn
Expand Up @@ -357,7 +357,7 @@ rtc_library("rtc_audio_video") {
public_configs = []
if (!build_with_chromium) {
public_configs += [ ":rtc_media_defines_config" ]
deps += [ "../modules/video_capture:video_capture" ]
deps += [ "../modules/video_capture:video_capture_internal_impl" ]
}
if (rtc_enable_protobuf) {
deps += [
Expand Down
3 changes: 0 additions & 3 deletions media/base/media_constants.cc
Expand Up @@ -105,9 +105,7 @@ const char kVp8CodecName[] = "VP8";
const char kVp9CodecName[] = "VP9";
const char kAv1CodecName[] = "AV1";
const char kH264CodecName[] = "H264";
#ifdef WEBRTC_USE_H265
const char kH265CodecName[] = "H265";
#endif

// RFC 6184 RTP Payload Format for H.264 video
const char kH264FmtpProfileLevelId[] = "profile-level-id";
Expand All @@ -122,7 +120,6 @@ const char kH265FmtpProfileSpace[] = "profile-space";
const char kH265FmtpProfileId[] = "profile-id";
const char kH265FmtpTierFlag[] = "tier-flag";
const char kH265FmtpLevelId[] = "level-id";
#endif

const char kVP9ProfileId[] = "profile-id";

Expand Down
2 changes: 0 additions & 2 deletions media/base/media_constants.h
Expand Up @@ -127,9 +127,7 @@ RTC_EXPORT extern const char kVp8CodecName[];
RTC_EXPORT extern const char kVp9CodecName[];
RTC_EXPORT extern const char kAv1CodecName[];
RTC_EXPORT extern const char kH264CodecName[];
#ifdef WEBRTC_USE_H265
RTC_EXPORT extern const char kH265CodecName[];
#endif

// RFC 6184 RTP Payload Format for H.264 video
RTC_EXPORT extern const char kH264FmtpProfileLevelId[];
Expand Down
2 changes: 0 additions & 2 deletions media/engine/encoder_simulcast_proxy.h
Expand Up @@ -25,7 +25,6 @@
#include "api/video_codecs/video_encoder.h"
#include "api/video_codecs/video_encoder_factory.h"
#include "modules/video_coding/include/video_codec_interface.h"
#include "rtc_base/constructor_magic.h"
#include "rtc_base/system/rtc_export.h"

namespace webrtc {
Expand Down Expand Up @@ -58,7 +57,6 @@ class RTC_EXPORT EncoderSimulcastProxy : public VideoEncoder {
SdpVideoFormat video_format_;
std::unique_ptr<VideoEncoder> encoder_;
EncodedImageCallback* callback_;
RTC_DISALLOW_COPY_AND_ASSIGN(EncoderSimulcastProxy);
};

} // namespace webrtc
Expand Down
19 changes: 4 additions & 15 deletions media/engine/webrtc_video_engine.cc
Expand Up @@ -40,8 +40,7 @@
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/time_utils.h"
#include "rtc_base/trace_event.h"

static const int kRtpBufferSizeIncreased = 4 * 1024 * 1024;
#include "system_wrappers/include/field_trial.h"

namespace cricket {

Expand All @@ -68,15 +67,6 @@ const char* StreamTypeToString(
}
return nullptr;
}
// If this field trial is enabled, the "flexfec-03" codec will be advertised
// as being supported. This means that "flexfec-03" will appear in the default
// SDP offer, and we therefore need to be ready to receive FlexFEC packets from
// the remote. It also means that FlexFEC SSRCs will be generated by
// MediaSession and added as "a=ssrc:" and "a=ssrc-group:" lines in the local
// SDP.
bool IsFlexfecAdvertisedFieldTrialEnabled() {
return webrtc::field_trial::IsEnabled("OWT-FlexFEC");
}

bool IsEnabled(const webrtc::FieldTrialsView& trials, absl::string_view name) {
return absl::StartsWith(trials.Lookup(name), "Enabled");
Expand All @@ -102,11 +92,10 @@ void AddDefaultFeedbackParams(VideoCodec* codec,
codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamPli));
codec->AddFeedbackParam(
FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamRpsi));
if ((codec->name == kVp8CodecName || codec->name == kH264CodecName
|| codec->name == kH265CodecName
) &&
if ((codec->name == kVp8CodecName || codec->name == kH264CodecName ||
codec->name == kH265CodecName) &&
(webrtc::field_trial::IsEnabled("WebRTC-RtcpLossNotification") ||
(webrtc::field_trial::IsEnabled("OWT-LowLatencyMode")))) {
(webrtc::field_trial::IsEnabled("OWT-LowLatencyMode")))) {
codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamLntf, kParamValueEmpty));
}
}
Expand Down
3 changes: 1 addition & 2 deletions media/engine/webrtc_voice_engine.cc
Expand Up @@ -52,6 +52,7 @@
#include "rtc_base/third_party/base64/base64.h"
#include "rtc_base/trace_event.h"
#include "system_wrappers/include/metrics.h"
#include "system_wrappers/include/field_trial.h"

#if WEBRTC_ENABLE_PROTOBUF
RTC_PUSH_IGNORING_WUNDEF()
Expand Down Expand Up @@ -403,8 +404,6 @@ void WebRtcVoiceEngine::Init() {
options.auto_gain_control = false;
options.noise_suppression = false;
options.highpass_filter = false;
options.typing_detection = false;
options.residual_echo_detector = false;
}
ApplyOptions(options);
}
Expand Down

0 comments on commit 5b3e694

Please sign in to comment.