Skip to content

Commit

Permalink
m127 に対応する
Browse files Browse the repository at this point in the history
  • Loading branch information
melpon committed Aug 26, 2024
1 parent d0568be commit cf9fe03
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 206 deletions.
48 changes: 34 additions & 14 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ def get_depot_tools(source_dir, fetch=False):
"007-internal-error.patch",
"008-streamer.patch",
"009-remove-dotprod.patch",
"010-remove-perfetto.patch",
]
WINUWP_ADDITIONAL_DIRS = [
["modules", "audio_device", "winuwp"],
Expand Down Expand Up @@ -393,9 +394,15 @@ def apply_patch(patch, dir, depth):


def _deps_dirs(src_dir):
cap = cmdcap(["gclient", "recurse", "-j1", "pwd"])
if platform.system() == "Windows":
cap = cmdcap(["gclient", "recurse", "-j1", "cd"])
else:
cap = cmdcap(["gclient", "recurse", "-j1", "pwd"])
abs_dirs = cap.split("\n")
rel_dirs = [os.path.relpath(abs_dir, src_dir) for abs_dir in abs_dirs]
# Updating depot_tools という行があったりするので、存在してるディレクトリのみを取り出して相対パスにする
rel_dirs = [
os.path.relpath(abs_dir, src_dir) for abs_dir in abs_dirs if os.path.exists(abs_dir)
]
return rel_dirs


Expand Down Expand Up @@ -426,6 +433,31 @@ def apply_patches(target, patch_dir, src_dir, patch_until, commit_patch):
if patch == patch_until and commit_patch:
break

if target == "windows_hololens2":
winuwp_dir = os.path.join(BASE_DIR, "winuwp")
# 追加ファイルのコピー
for dir in WINUWP_ADDITIONAL_DIRS:
srcdir = os.path.join(winuwp_dir, *dir)
dstdir = os.path.join(src_dir, *dir)
rm_rf(dstdir)
shutil.copytree(srcdir, dstdir)
# 追加パッチの適用
for patch in WINUWP_ADDITIONAL_PATCHES:
apply_patch(os.path.join(winuwp_dir, patch), src_dir, 1)

cmd(["gclient", "recurse", "git", "add", "--", ":!*.orig", ":!*.rej"])
cmd(
[
"gclient",
"recurse",
"git",
"commit",
"--allow-empty",
"-am",
"[shiguredo-patch] Apply winuwp patches",
]
)


# 時雨堂パッチが当たっていない最新のコミットを取得する
def get_base_commit(n=30):
Expand Down Expand Up @@ -523,18 +555,6 @@ def diff_webrtc(source_dir, webrtc_source_dir):
]
)

if target == "windows_hololens2":
winuwp_dir = os.path.join(BASE_DIR, "winuwp")
# 追加ファイルのコピー
for dir in WINUWP_ADDITIONAL_DIRS:
srcdir = os.path.join(winuwp_dir, *dir)
dstdir = os.path.join(src_dir, *dir)
rm_rf(dstdir)
shutil.copytree(srcdir, dstdir)
# 追加パッチの適用
for patch in WINUWP_ADDITIONAL_PATCHES:
apply_patch(os.path.join(winuwp_dir, patch), src_dir, 1)


def git_get_url_and_revision(dir):
with cd(dir):
Expand Down
9 changes: 5 additions & 4 deletions winuwp/001-audio.patch
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ index b6874dc6b..7e9e7993a 100644

tool("cc") {
diff --git a/BUILD.gn b/BUILD.gn
index 9c55478c25..6512ee25ea 100644
index d5e7d91eb4..1a2dc46027 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -517,7 +517,6 @@ if (!build_with_chromium) {
@@ -565,7 +565,6 @@ if (!build_with_chromium) {
"pc:rtc_pc",
"sdk",
"video",
- "modules/audio_device:audio_device_module_from_input_and_output",
"//third_party/zlib",
"rtc_base:log_sinks",
"media:rtc_simulcast_encoder_adapter",
"rtc_base:socket_adapters",
diff --git a/modules/audio_device/BUILD.gn b/modules/audio_device/BUILD.gn
index d441479b33..2925586b0e 100644
--- a/modules/audio_device/BUILD.gn
Expand Down Expand Up @@ -70,7 +70,7 @@ 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,11 @@ config("runtime_library") {
@@ -245,7 +245,12 @@ config("runtime_library") {
} else {
defines += [ "WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP" ]
}
Expand All @@ -79,6 +79,7 @@ index 1e76a54cc..b254b3ac8 100644
+ "/std:c++20", # Required for having a wrapper using the WinRT/C++ projection.
+ "/await",
+ "/EHsc", # Required for having a wrapper using the WinRT/C++ projection.
+ "/Zc:__cplusplus",
+ ]

# This warning is given because the linker cannot tell the difference
Expand Down
10 changes: 5 additions & 5 deletions winuwp/002-capturer.patch
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,13 @@ index 481326c1d2..d299c7e175 100644
return nullptr;
}
diff --git a/webrtc.gni b/webrtc.gni
index 173d66c791..f101888462 100644
index 992c75c0e2..f89c4dd550 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -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)
@@ -268,6 +268,15 @@ declare_args() {

# When true, include the Perfetto library.
rtc_use_perfetto = false
+
+ # Defines which API should be used by the video capture module on Windows.
+ # The following are the current options:
Expand Down
38 changes: 19 additions & 19 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 4b63ebefb3..03bf130079 100644
index 33e9c7666e..dcd0da8650 100644
--- a/call/rtp_payload_params.cc
+++ b/call/rtp_payload_params.cc
@@ -310,7 +310,7 @@ void RtpPayloadParams::SetGeneric(const CodecSpecificInfo* codec_specific_info,
@@ -316,7 +316,7 @@ void RtpPayloadParams::SetGeneric(const CodecSpecificInfo* codec_specific_info,
chains_calculator_.Reset(
codec_specific_info->generic_frame_info->part_of_chain);
}
Expand All @@ -11,43 +11,43 @@ index 4b63ebefb3..03bf130079 100644
*codec_specific_info->generic_frame_info, frame_id);
return;
}
@@ -417,7 +417,7 @@ void RtpPayloadParams::GenericToGeneric(int64_t shared_frame_id,
@@ -420,7 +420,7 @@ void RtpPayloadParams::GenericToGeneric(int64_t frame_id,
bool is_keyframe,
RTPVideoHeader* rtp_video_header) {
RTPVideoHeader::GenericDescriptorInfo& generic =
- rtp_video_header->generic.emplace();
+ rtp_video_header->generic_.emplace();

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

RTPVideoHeader::GenericDescriptorInfo& generic =
- rtp_video_header->generic.emplace();
+ rtp_video_header->generic_.emplace();
generic.frame_id = shared_frame_id;

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

RTPVideoHeader::GenericDescriptorInfo& generic =
- rtp_video_header->generic.emplace();
+ rtp_video_header->generic_.emplace();

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

RTPVideoHeader::GenericDescriptorInfo& result =
- rtp_video_header.generic.emplace();
+ rtp_video_header.generic_.emplace();

result.frame_id = shared_frame_id;
result.frame_id = frame_id;
result.spatial_index = spatial_index;
@@ -641,7 +641,7 @@ void RtpPayloadParams::Vp9ToGeneric(const CodecSpecificInfoVP9& vp9_info,
@@ -643,7 +643,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.
Expand Down Expand Up @@ -262,19 +262,19 @@ index a44b76bf15..695e161ba6 100644

switch (frame->codec_type()) {
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index 3a3e89572e..75a2d4075f 100644
index e875a5e109..fffcf92bcb 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -391,7 +391,7 @@ RtpVideoStreamReceiver2::ParseGenericDependenciesExtension(
@@ -433,7 +433,7 @@ RtpVideoStreamReceiver2::ParseGenericDependenciesExtension(
video_header->is_last_packet_in_frame =
dependency_descriptor.last_packet_in_frame;

int64_t frame_id =
frame_id_unwrapper_.Unwrap(dependency_descriptor.frame_number);
- auto& generic_descriptor_info = video_header->generic.emplace();
+ auto& generic_descriptor_info = video_header->generic_.emplace();
generic_descriptor_info.frame_id = frame_id;
generic_descriptor_info.spatial_index =
dependency_descriptor.frame_dependencies.spatial_id;
@@ -448,7 +448,7 @@ RtpVideoStreamReceiver2::ParseGenericDependenciesExtension(
@@ -490,7 +490,7 @@ RtpVideoStreamReceiver2::ParseGenericDependenciesExtension(
? VideoFrameType::kVideoFrameKey
: VideoFrameType::kVideoFrameDelta;

Expand All @@ -283,7 +283,7 @@ index 3a3e89572e..75a2d4075f 100644
int64_t frame_id =
frame_id_unwrapper_.Unwrap(generic_frame_descriptor.FrameId());
generic_descriptor_info.frame_id = frame_id;
@@ -552,12 +552,12 @@ void RtpVideoStreamReceiver2::OnReceivedPayloadData(
@@ -620,12 +620,12 @@ bool RtpVideoStreamReceiver2::OnReceivedPayloadData(
"frame descriptor, but it is missing.";
} else {
if (video_header.is_first_packet_in_frame) {
Expand All @@ -299,7 +299,7 @@ index 3a3e89572e..75a2d4075f 100644
loss_notification_controller_->OnReceivedPacket(
rtp_packet.SequenceNumber(), &frame);
} else {
@@ -789,7 +789,7 @@ void RtpVideoStreamReceiver2::OnAssembledFrame(
@@ -838,7 +838,7 @@ void RtpVideoStreamReceiver2::OnAssembledFrame(
RTC_DCHECK(frame);

const absl::optional<RTPVideoHeader::GenericDescriptorInfo>& descriptor =
Expand Down
8 changes: 4 additions & 4 deletions winuwp/005-h264.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn
index acec4570a3..5a8080c6ee 100644
index fa93a07447..054dd48915 100644
--- a/modules/video_coding/BUILD.gn
+++ b/modules/video_coding/BUILD.gn
@@ -472,15 +472,46 @@ rtc_library("webrtc_h264") {
@@ -447,15 +447,46 @@ rtc_library("webrtc_h264") {
visibility = [ "*" ]
sources = [
"codecs/h264/h264.cc",
Expand Down Expand Up @@ -51,10 +51,10 @@ index acec4570a3..5a8080c6ee 100644
+ "mfuuid.lib",
+ ]
+ }
+
+
defines = []
deps = [
":video_codec_interface",
":codec_globals_headers",
diff --git a/webrtc.gni b/webrtc.gni
index 71cfcabd02..421fd64344 100644
--- a/webrtc.gni
Expand Down
Loading

0 comments on commit cf9fe03

Please sign in to comment.