Skip to content

Commit

Permalink
m120.6099.1 に対応する
Browse files Browse the repository at this point in the history
  • Loading branch information
melpon committed Jan 23, 2024
1 parent a3d4cf6 commit 5da5938
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 95 deletions.
1 change: 1 addition & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ def get_depot_tools(source_dir, fetch=False):
'005-h264.patch',
'006-logging.patch',
'007-internal-error.patch',
'008-streamer.patch',
]
WINUWP_ADDITIONAL_DIRS = [
['modules', 'audio_device', 'winuwp'],
Expand Down
11 changes: 3 additions & 8 deletions winuwp/001-audio.patch
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ index d441479b33..2925586b0e 100644
# Required for the built-in WASAPI AEC.
"dmoguids.lib",
diff --git a/modules/audio_device/audio_device_impl.cc b/modules/audio_device/audio_device_impl.cc
index 01a8a25c06..98eba26d0e 100644
index 80ed928933..50bf744032 100644
--- a/modules/audio_device/audio_device_impl.cc
+++ b/modules/audio_device/audio_device_impl.cc
@@ -22,8 +22,12 @@
Expand All @@ -65,12 +65,12 @@ index 01a8a25c06..98eba26d0e 100644
+#endif
#elif defined(WEBRTC_ANDROID)
#include <stdlib.h>
#if defined(WEBRTC_AUDIO_DEVICE_INCLUDE_ANDROID_AAUDIO)
#include "sdk/android/native_api/audio_device_module/audio_device_android.h"
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn
index 1e76a54cc..b254b3ac8 100644
--- a/build/config/win/BUILD.gn
+++ b/build/config/win/BUILD.gn
@@ -245,7 +245,16 @@ config("runtime_library") {
@@ -245,7 +245,11 @@ config("runtime_library") {
} else {
defines += [ "WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP" ]
}
Expand All @@ -80,11 +80,6 @@ index 1e76a54cc..b254b3ac8 100644
+ "/await",
+ "/EHsc", # Required for having a wrapper using the WinRT/C++ projection.
+ ]
+ if (is_clang) {
+ cflags += [
+ "-Wno-microsoft-template", # The audio module uses some templates Microsoft style.
+ ]
+ }

# This warning is given because the linker cannot tell the difference
# between consuming WinRT APIs versus authoring WinRT within static
46 changes: 26 additions & 20 deletions winuwp/002-capturer.patch
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ index 63534600a9..7d9a0a83aa 100644
}
bool operator==(const VideoCaptureCapability& other) const {
diff --git a/modules/video_capture/video_capture_impl.cc b/modules/video_capture/video_capture_impl.cc
index d539b38264..390fa4c123 100644
index 428253bf23..eea8ebd2a9 100644
--- a/modules/video_capture/video_capture_impl.cc
+++ b/modules/video_capture/video_capture_impl.cc
@@ -14,6 +14,7 @@
Expand All @@ -238,7 +238,7 @@ index d539b38264..390fa4c123 100644
#include "api/video/video_frame_buffer.h"
#include "common_video/libyuv/include/webrtc_libyuv.h"
#include "modules/video_capture/video_capture_config.h"
@@ -133,9 +134,17 @@ void VideoCaptureImpl::DeliverRawFrame(uint8_t* videoFrame,
@@ -139,9 +139,17 @@ void VideoCaptureImpl::DeliverRawFrame(uint8_t* videoFrame,
}

int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
Expand All @@ -253,19 +253,25 @@ index d539b38264..390fa4c123 100644
+ return IncomingFrameNV12(videoFrame, stride_y, plane_uv, stride_uv, videoFrameLength, frameInfo, captureTime);
+ }
+
RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
MutexLock lock(&api_lock_);

const int32_t width = frameInfo.width;
@@ -148,16 +156,8 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
@@ -155,22 +163,8 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
return 0;
}

- // Not encoded, convert to I420.
- if (frameInfo.videoType != VideoType::kMJPEG &&
- CalcBufferSize(frameInfo.videoType, width, abs(height)) !=
- videoFrameLength) {
- RTC_LOG(LS_ERROR) << "Wrong incoming frame length.";
- return -1;
- if (frameInfo.videoType != VideoType::kMJPEG) {
- // Allow buffers larger than expected. On linux gstreamer allocates buffers
- // page-aligned and v4l2loopback passes us the buffer size verbatim which
- // for most cases is larger than expected.
- // See https://github.com/umlaeute/v4l2loopback/issues/190.
- if (auto size = CalcBufferSize(frameInfo.videoType, width, abs(height));
- videoFrameLength < size) {
- RTC_LOG(LS_ERROR) << "Wrong incoming frame length. Expected " << size
- << ", Got " << videoFrameLength << ".";
- return -1;
- }
- }
-
- int stride_y = width;
Expand All @@ -275,16 +281,16 @@ index d539b38264..390fa4c123 100644
int target_width = width;
int target_height = abs(height);

@@ -177,7 +177,7 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
@@ -187,7 +181,7 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
// In Windows, the image starts bottom left, instead of top left.
// Setting a negative source height, inverts the image (within LibYuv).
rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create(
- target_width, target_height, stride_y, stride_uv, stride_uv);
+ target_width, target_height, dst_stride_y, dst_stride_uv, dst_stride_uv);

libyuv::RotationMode rotation_mode = libyuv::kRotate0;
if (apply_rotation) {
@@ -198,10 +198,11 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
if (apply_rotation_) {
@@ -208,10 +202,11 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
}

const int conversionResult = libyuv::ConvertToI420(
Expand All @@ -299,8 +305,8 @@ index d539b38264..390fa4c123 100644
+ 0, // No Cropping
width, height, target_width, target_height, rotation_mode,
ConvertVideoType(frameInfo.videoType));
if (conversionResult < 0) {
@@ -224,6 +225,40 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
if (conversionResult != 0) {
@@ -234,6 +229,40 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
return 0;
}

Expand Down Expand Up @@ -340,7 +346,7 @@ index d539b38264..390fa4c123 100644
+
int32_t VideoCaptureImpl::StartCapture(
const VideoCaptureCapability& capability) {
_requestedCapability = capability;
RTC_DCHECK_RUN_ON(&api_checker_);
diff --git a/modules/video_capture/video_capture_impl.h b/modules/video_capture/video_capture_impl.h
index 1f7aa89883..c186806ae5 100644
--- a/modules/video_capture/video_capture_impl.h
Expand Down Expand Up @@ -424,13 +430,13 @@ index 481326c1d2..d299c7e175 100644
return nullptr;
}
diff --git a/webrtc.gni b/webrtc.gni
index 6e81fc4285..eb89c658fe 100644
index 173d66c791..f101888462 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -240,6 +240,15 @@ declare_args() {
# "warn": RTC_LOGs a message with LS_WARNING severity if the field trial
# hasn't been registered.
rtc_strict_field_trials = ""
@@ -260,6 +260,15 @@ declare_args() {
# WebRTC does not declare its public dependencies. See webrtc:8603. Instead
# WebRTC is using a global common dependencies.
rtc_common_public_deps = [] # no-presubmit-check TODO(webrtc:8603)
+
+ # Defines which API should be used by the video capture module on Windows.
+ # The following are the current options:
Expand Down
71 changes: 25 additions & 46 deletions winuwp/003-build.patch
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,6 @@ index d5289b85d7..f5be6ebfbd 100644
"api/video_codecs:video_encoder_factory_template_libvpx_vp8_adapter",
"api/video_codecs:video_encoder_factory_template_libvpx_vp9_adapter",
"api/video_codecs:video_encoder_factory_template_open_h264_adapter",
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index e74b85fcbf..dec9736fe5 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -1039,6 +1039,13 @@ if (is_win) {
"win32_window.h",
]

+ if (current_os == "winuwp") {
+ sources -= [
+ "win32_window.cc",
+ "win32_window.h",
+ ]
+ }
+
deps = [
":byte_order",
":checks",
diff --git a/rtc_base/file_rotating_stream.cc b/rtc_base/file_rotating_stream.cc
index c529b5b1b4..515646b03b 100644
--- a/rtc_base/file_rotating_stream.cc
Expand Down Expand Up @@ -98,19 +80,6 @@ index fe8ec1afdc..403c8a0de2 100644
#define WEBRTC_DENORMAL_DISABLER_SUPPORTED
#endif

diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
index efcbdf378b6..c0f70952bd5 100644
--- a/third_party/boringssl/BUILD.gn
+++ b/third_party/boringssl/BUILD.gn
@@ -96,7 +96,7 @@ if (is_win && !is_msan && current_cpu != "arm64") {
sources += crypto_sources_linux_aarch64
} else if (is_apple) {
sources += crypto_sources_apple_aarch64
- } else if (is_win) {
+ } else if (is_win && current_os != "winuwp") {
sources += crypto_sources_win_aarch64
} else {
public_configs = [ ":no_asm_config" ]
diff --git a/third_party/crc32c/BUILD.gn b/third_party/crc32c/BUILD.gn
index 38024bbd8d0..a40772c21e1 100644
--- a/third_party/crc32c/BUILD.gn
Expand Down Expand Up @@ -146,22 +115,32 @@ index 758aca15407..60ef0074839 100644
} else { # This should only match windows.
os_category = current_os
}
diff --git a/third_party/libvpx/source/libvpx/vpx_dsp/arm/fdct4x4_neon.c b/third_party/libvpx/source/libvpx/vpx_dsp/arm/fdct4x4_neon.c
index 3b9196fae..a53c0f672 100644
--- a/third_party/libvpx/source/libvpx/vpx_dsp/arm/fdct4x4_neon.c
+++ b/third_party/libvpx/source/libvpx/vpx_dsp/arm/fdct4x4_neon.c
@@ -52,7 +52,11 @@ void vpx_fdct4x4_neon(const int16_t *input, tran_low_t *final_output,

void vpx_highbd_fdct4x4_neon(const int16_t *input, tran_low_t *final_output,
int stride) {
+#if defined(_WIN32)
+ const int32x4_t const_1000 = { .n128_u32 = {1, 0, 0, 0} };
+#else
static const int32x4_t const_1000 = { 1, 0, 0, 0 };
+#endif
const int32x4_t const_one = vdupq_n_s32(1);
@@ -506,8 +508,10 @@ static_library("libvpx") {
deps += [ ":libvpx_intrinsics_neon" ]
}
if (current_cpu == "arm64") {
- deps += [ ":libvpx_intrinsics_neon_dotprod" ]
- deps += [ ":libvpx_intrinsics_neon_i8mm" ]
+ if (current_os != "winuwp") {
+ deps += [ ":libvpx_intrinsics_neon_dotprod" ]
+ deps += [ ":libvpx_intrinsics_neon_i8mm" ]
+ }
}
if (is_android) {
deps += [ "//third_party/cpu_features:ndk_compat" ]
diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
index 321a2dc2eb3..5b2045d8875 100644
--- a/third_party/boringssl/BUILD.gn
+++ b/third_party/boringssl/BUILD.gn
@@ -118,7 +118,7 @@ if (enable_rust_boringssl) {
}
}

// input[M * stride] * 16
-if (is_msan) {
+if (is_msan || current_os == "winuwp") {
# MSan instrumentation is incompatible with assembly optimizations.
# BoringSSL's GAS-compatible assembly knows how to detect MSan, but the NASM
# assembly does not, so we check for MSan explicitly.
diff --git a/third_party/pffft/BUILD.gn b/third_party/pffft/BUILD.gn
index 0a1cf7a1f5e..7c32b610ffe 100644
--- a/third_party/pffft/BUILD.gn
Expand Down
41 changes: 25 additions & 16 deletions winuwp/004-nogeneric.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/call/rtp_payload_params.cc b/call/rtp_payload_params.cc
index 5eff91fa5c..c036d27e78 100644
index 4b63ebefb3..03bf130079 100644
--- a/call/rtp_payload_params.cc
+++ b/call/rtp_payload_params.cc
@@ -262,7 +262,7 @@ void RtpPayloadParams::SetGeneric(const CodecSpecificInfo* codec_specific_info,
@@ -310,7 +310,7 @@ void RtpPayloadParams::SetGeneric(const CodecSpecificInfo* codec_specific_info,
chains_calculator_.Reset(
codec_specific_info->generic_frame_info->part_of_chain);
}
Expand All @@ -11,7 +11,7 @@ index 5eff91fa5c..c036d27e78 100644
*codec_specific_info->generic_frame_info, frame_id);
return;
}
@@ -302,7 +302,7 @@ void RtpPayloadParams::GenericToGeneric(int64_t shared_frame_id,
@@ -417,7 +417,7 @@ void RtpPayloadParams::GenericToGeneric(int64_t shared_frame_id,
bool is_keyframe,
RTPVideoHeader* rtp_video_header) {
RTPVideoHeader::GenericDescriptorInfo& generic =
Expand All @@ -20,7 +20,7 @@ index 5eff91fa5c..c036d27e78 100644

generic.frame_id = shared_frame_id;
generic.decode_target_indications.push_back(DecodeTargetIndication::kSwitch);
@@ -335,7 +335,7 @@ void RtpPayloadParams::H264ToGeneric(const CodecSpecificInfoH264& h264_info,
@@ -450,7 +450,7 @@ void RtpPayloadParams::H264ToGeneric(const CodecSpecificInfoH264& h264_info,
}

RTPVideoHeader::GenericDescriptorInfo& generic =
Expand All @@ -29,7 +29,7 @@ index 5eff91fa5c..c036d27e78 100644

generic.frame_id = shared_frame_id;
generic.temporal_index = temporal_index;
@@ -392,7 +392,7 @@ void RtpPayloadParams::Vp8ToGeneric(const CodecSpecificInfoVP8& vp8_info,
@@ -507,7 +507,7 @@ void RtpPayloadParams::Vp8ToGeneric(const CodecSpecificInfoVP8& vp8_info,
}

RTPVideoHeader::GenericDescriptorInfo& generic =
Expand All @@ -38,7 +38,7 @@ index 5eff91fa5c..c036d27e78 100644

generic.frame_id = shared_frame_id;
generic.spatial_index = spatial_index;
@@ -465,7 +465,7 @@ void RtpPayloadParams::Vp9ToGeneric(const CodecSpecificInfoVP9& vp9_info,
@@ -576,7 +576,7 @@ void RtpPayloadParams::Vp9ToGeneric(const CodecSpecificInfoVP9& vp9_info,
}

RTPVideoHeader::GenericDescriptorInfo& result =
Expand All @@ -47,6 +47,15 @@ index 5eff91fa5c..c036d27e78 100644

result.frame_id = shared_frame_id;
result.spatial_index = spatial_index;
@@ -641,7 +641,7 @@ void RtpPayloadParams::Vp9ToGeneric(const CodecSpecificInfoVP9& vp9_info,
// non-layerd streams.
if (spatial_index > 0 || temporal_index > 0) {
// Prefer to generate no generic layering than an inconsistent one.
- rtp_video_header.generic.reset();
+ rtp_video_header.generic_.reset();
return;
}

diff --git a/modules/rtp_rtcp/source/rtp_descriptor_authentication.cc b/modules/rtp_rtcp/source/rtp_descriptor_authentication.cc
index f4525f0db1..eadbae52eb 100644
--- a/modules/rtp_rtcp/source/rtp_descriptor_authentication.cc
Expand All @@ -66,11 +75,11 @@ index f4525f0db1..eadbae52eb 100644
if (descriptor.spatial_index < 0 || descriptor.temporal_index < 0 ||
descriptor.spatial_index >=
diff --git a/modules/rtp_rtcp/source/rtp_sender_video.cc b/modules/rtp_rtcp/source/rtp_sender_video.cc
index c863db4ccf..a3fcb32ad2 100644
index ebca7aaa75..ce5e224a9f 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video.cc
@@ -130,9 +130,9 @@ absl::optional<VideoPlayoutDelay> LoadVideoPlayoutDelayOverride(
bool PacketWillLikelyBeRequestedForRestransmitionIfLost(
@@ -121,9 +121,9 @@ absl::optional<VideoPlayoutDelay> LoadVideoPlayoutDelayOverride(
bool PacketWillLikelyBeRequestedForRestransmissionIfLost(
const RTPVideoHeader& video_header) {
return IsBaseLayer(video_header) &&
- !(video_header.generic.has_value()
Expand All @@ -81,7 +90,7 @@ index c863db4ccf..a3fcb32ad2 100644
DecodeTargetIndication::kDiscardable)
: false);
}
@@ -365,26 +365,26 @@ void RTPSenderVideo::AddRtpHeaderExtensions(const RTPVideoHeader& video_header,
@@ -358,26 +358,26 @@ void RTPSenderVideo::AddRtpHeaderExtensions(const RTPVideoHeader& video_header,
*video_header.absolute_capture_time);
}

Expand Down Expand Up @@ -116,7 +125,7 @@ index c863db4ccf..a3fcb32ad2 100644
RTC_DCHECK_EQ(
descriptor.frame_dependencies.decode_target_indications.size(),
video_structure_->num_decode_targets);
@@ -399,7 +399,7 @@ void RTPSenderVideo::AddRtpHeaderExtensions(const RTPVideoHeader& video_header,
@@ -392,7 +392,7 @@ void RTPSenderVideo::AddRtpHeaderExtensions(const RTPVideoHeader& video_header,
// layers when inter layer dependency is not used, i.e. S structures.
// Distinguish these two cases by checking if there are any dependencies.
if (video_header.frame_type == VideoFrameType::kVideoFrameKey &&
Expand All @@ -125,7 +134,7 @@ index c863db4ccf..a3fcb32ad2 100644
// To avoid extra structure copy, temporary share ownership of the
// video_structure with the dependency descriptor.
descriptor.attached_structure =
@@ -422,17 +422,17 @@ void RTPSenderVideo::AddRtpHeaderExtensions(const RTPVideoHeader& video_header,
@@ -415,17 +415,17 @@ void RTPSenderVideo::AddRtpHeaderExtensions(const RTPVideoHeader& video_header,

if (first_packet) {
generic_descriptor.SetFrameId(
Expand All @@ -138,17 +147,17 @@ index c863db4ccf..a3fcb32ad2 100644
+ video_header.generic_->frame_id - dep);
}

- uint8_t spatial_bimask = 1 << video_header.generic->spatial_index;
+ uint8_t spatial_bimask = 1 << video_header.generic_->spatial_index;
generic_descriptor.SetSpatialLayersBitmask(spatial_bimask);
- uint8_t spatial_bitmask = 1 << video_header.generic->spatial_index;
+ uint8_t spatial_bitmask = 1 << video_header.generic_->spatial_index;
generic_descriptor.SetSpatialLayersBitmask(spatial_bitmask);

generic_descriptor.SetTemporalLayer(
- video_header.generic->temporal_index);
+ video_header.generic_->temporal_index);

if (video_header.frame_type == VideoFrameType::kVideoFrameKey) {
generic_descriptor.SetResolution(video_header.width,
@@ -523,12 +523,12 @@ bool RTPSenderVideo::SendVideo(
@@ -504,12 +504,12 @@ bool RTPSenderVideo::SendVideo(int payload_type,
}
}

Expand Down
Loading

0 comments on commit 5da5938

Please sign in to comment.