From d59dcc0d8ac1e84afd2f96fadbba502d3023d6cb Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Tue, 22 Apr 2025 15:58:18 -0800 Subject: [PATCH 01/97] ci: build sample apps on latest macOS image and Xcode version (#5105) --- .github/workflows/build.yml | 35 +++++------------------------------ scripts/ci-select-xcode.sh | 3 +-- 2 files changed, 6 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc0b9ef7356..e2e13e51bce 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,10 +29,10 @@ jobs: # With this we catch potential issues already in the PR. ios-swift-release: name: Release Build of iOS Swift - runs-on: macos-14 + runs-on: macos-15 steps: - uses: actions/checkout@v4 - - run: ./scripts/ci-select-xcode.sh 16.2 + - run: ./scripts/ci-select-xcode.sh 16.3 - uses: ruby/setup-ruby@v1 with: bundler-cache: true @@ -50,47 +50,22 @@ jobs: build-sample: name: Sample ${{ matrix.scheme }} - runs-on: ${{ matrix.runs-on }} + runs-on: macos-15 strategy: fail-fast: false matrix: # other sample projects are built in ui-tests include: - scheme: macOS-Swift - xcode: 15.4 - runs-on: macos-14 - scheme: iOS13-Swift - xcode: 15.4 - runs-on: macos-14 - scheme: watchOS-Swift WatchKit App - xcode: 15.4 - runs-on: macos-14 - # Only compiles on Xcode 16+ - scheme: macOS-SwiftUI - xcode: 16.2 - runs-on: macos-15 - - scheme: SessionReplay-CameraTest - xcode: 16.2 - runs-on: macos-15 - - # We have to compile on Xcode 16.3 because compiling on Xcode 16.2 fails with - # Data+SentryTracing.swift:21:62: error: 'ReadingOptions' aliases 'Foundation.ReadingOptions' - # and cannot be used here because C++ types from imported module 'Foundation' do not support - # library evolution; this is an error in the Swift 6 language mode - scheme: visionOS-Swift - xcode: 16.3 - runs-on: macos-15 steps: - uses: actions/checkout@v4 - - run: ./scripts/ci-select-xcode.sh ${{ matrix.xcode }} - - - name: List Xcode Build Schemes - run: >- - xcodebuild - -workspace Sentry.xcworkspace - -list + - run: ./scripts/ci-select-xcode.sh 16.3 # Note: Due to complexity in implementing the CODE_SIGNING_ALLOWED flag in the sentry-xcodebuild.sh script, # we did not yet migrate this step to use the script yet. @@ -107,7 +82,7 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ failure() || cancelled() }} with: - name: raw-build-output-os-${{matrix.runs-on}}-xcode-${{matrix.xcode}}-scheme-${{matrix.scheme}} + name: raw-build-output-scheme-${{matrix.scheme}} path: | raw-build-output.log diff --git a/scripts/ci-select-xcode.sh b/scripts/ci-select-xcode.sh index 1021fd01340..ad6b81715d1 100755 --- a/scripts/ci-select-xcode.sh +++ b/scripts/ci-select-xcode.sh @@ -7,8 +7,7 @@ set -euo pipefail -# 14.3 is the default -XCODE_VERSION="${1:-14.3}" +XCODE_VERSION="${1}" # We prefer this over calling `sudo xcode-select` because it will fail if the Xcode version # is not installed. Also xcodes is preinstalled on the GH runners. From 554bebe30ae1876684a180543bfd1e9aa305505d Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Wed, 23 Apr 2025 09:34:52 +0200 Subject: [PATCH 02/97] chore: remove nvm setup from make init (#5123) --- Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Makefile b/Makefile index a0d69fda3df..82fe2502bbc 100644 --- a/Makefile +++ b/Makefile @@ -7,10 +7,6 @@ init: rbenv exec gem update bundler rbenv exec bundle install ./scripts/update-tooling-versions.sh - - # The node version manager is optional, so we don't fail if it's not installed. - if [ -n "$NVM_DIR" ] && [ -d "$NVM_DIR" ]; then nvm use; fi - yarn install # installs the tools needed to run CI test tasks locally From 10e6d39cc9a8bad9457f1630cfc1d15c73539f24 Mon Sep 17 00:00:00 2001 From: Karl Heinz Struggl Date: Wed, 23 Apr 2025 02:25:52 -0700 Subject: [PATCH 03/97] Update release-comment-issues.yml (#5127) fix build fail caused by ubuntu-20.04 retirement --- .github/workflows/release-comment-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-comment-issues.yml b/.github/workflows/release-comment-issues.yml index 49f023f9efe..2ae584f6f57 100644 --- a/.github/workflows/release-comment-issues.yml +++ b/.github/workflows/release-comment-issues.yml @@ -12,7 +12,7 @@ on: # This workflow is triggered when a release is published jobs: release-comment-issues: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 name: Notify issues steps: - name: Get version From f7ce2566ca48e5e4ad13a6e7ade958edc7da58b0 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Wed, 23 Apr 2025 13:31:00 +0200 Subject: [PATCH 04/97] fix: change identifier iOS-SwiftUITests to iOS-Swift-UITests (#5126) --- .../iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index d53ec1d7c95..14ff56f1cf2 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -742,7 +742,7 @@ name = "iOS-Swift-UITests"; packageProductDependencies = ( ); - productName = "iOS-SwiftUITests"; + productName = "iOS-Swift-UITests"; productReference = 7B64386826A6C544000D0F65 /* iOS-Swift-UITests.xctest */; productType = "com.apple.product-type.bundle.ui-testing"; }; @@ -761,7 +761,7 @@ 848A2563286E3351008A8858 /* PBXTargetDependency */, ); name = PerformanceBenchmarks; - productName = "iOS-SwiftUITests"; + productName = "iOS-Swift-UITests"; productReference = 848A2573286E3351008A8858 /* PerformanceBenchmarks.xctest */; productType = "com.apple.product-type.bundle.ui-testing"; }; @@ -1563,7 +1563,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.iOS-Swift-UITests"; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match Development io.sentry.iOS-SwiftUITests.xctrunner"; + PROVISIONING_PROFILE_SPECIFIER = "match Development io.sentry.iOS-Swift-UITests.xctrunner"; "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "SENTRY_UI_TEST $(inherited)"; SWIFT_VERSION = 5.0; @@ -1588,7 +1588,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.iOS-Swift-UITests"; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match AppStore io.sentry.iOS-SwiftUITests.xctrunner"; + PROVISIONING_PROFILE_SPECIFIER = "match AppStore io.sentry.iOS-Swift-UITests.xctrunner"; "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "SENTRY_UI_TEST $(inherited)"; SWIFT_VERSION = 5.0; @@ -1755,7 +1755,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.iOS-Swift-UITests"; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match Development io.sentry.iOS-SwiftUITests.xctrunner"; + PROVISIONING_PROFILE_SPECIFIER = "match Development io.sentry.iOS-Swift-UITests.xctrunner"; "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "SENTRY_UI_TEST $(inherited)"; SWIFT_VERSION = 5.0; @@ -1995,7 +1995,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.iOS-Swift-UITests"; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match Development io.sentry.iOS-SwiftUITests.xctrunner"; + PROVISIONING_PROFILE_SPECIFIER = "match Development io.sentry.iOS-Swift-UITests.xctrunner"; "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "SENTRY_UI_TEST $(inherited)"; SWIFT_VERSION = 5.0; From 9e745c10f8ff378602454a68fcc57cadd3d28dd2 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Thu, 24 Apr 2025 16:18:35 +0200 Subject: [PATCH 05/97] fix(session-replay): Use wider compatible video encoding options (#5134) --- CHANGELOG.md | 6 ++ .../SessionReplay/SentryOnDemandReplay.swift | 50 ++++++++++++++- .../SentryOnDemandReplayTests.swift | 62 ++++++++++++++++++- 3 files changed, 115 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46fc26417d1..e837ddae0c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Improvements + +- Use wider compatible video encoding options for Session Replay (#5134) + ## 8.49.1 ### Fixes diff --git a/Sources/Swift/Integrations/SessionReplay/SentryOnDemandReplay.swift b/Sources/Swift/Integrations/SessionReplay/SentryOnDemandReplay.swift index d6b7cf7e35c..7bba26b5be2 100644 --- a/Sources/Swift/Integrations/SessionReplay/SentryOnDemandReplay.swift +++ b/Sources/Swift/Integrations/SessionReplay/SentryOnDemandReplay.swift @@ -244,14 +244,60 @@ class SentryOnDemandReplay: NSObject, SentryReplayVideoMaker { return frames } - private func createVideoSettings(width: CGFloat, height: CGFloat) -> [String: Any] { + internal func createVideoSettings(width: CGFloat, height: CGFloat) -> [String: Any] { return [ + // The codec type for the video. H.264 (AVC) is the most widely supported codec across platforms, + // including web browsers, QuickTime, VLC, and mobile devices. AVVideoCodecKey: AVVideoCodecType.h264, + + // The dimensions of the video frame in pixels. AVVideoWidthKey: width, AVVideoHeightKey: height, + + // AVVideoCompressionPropertiesKey contains advanced compression settings. AVVideoCompressionPropertiesKey: [ + // Specifies the average bit rate used for encoding. A higher bit rate increases visual quality + // at the cost of file size. Choose a value appropriate for your resolution (e.g., 1 Mbps for 720p). AVVideoAverageBitRateKey: bitRate, - AVVideoProfileLevelKey: AVVideoProfileLevelH264BaselineAutoLevel + + // Selects the H.264 Main profile with an automatic level. + // This avoids using the Baseline profile, which lacks key features like CABAC entropy coding + // and causes issues in decoders like VideoToolbox, especially at non-standard frame rates (1 FPS). + // The Main profile is well supported by both hardware and software decoders. + AVVideoProfileLevelKey: AVVideoProfileLevelH264MainAutoLevel, + + // Prevents the use of B-frames (bidirectional predicted frames). + // B-frames reference both past and future frames, which can break compatibility + // with certain hardware decoders and make accurate seeking harder, especially in timelapse videos + // where each frame is independent and must be decodable on its own. + AVVideoAllowFrameReorderingKey: false, + + // Ensures that every frame is a keyframe (also called an I-frame). + // This is crucial in a 1 FPS timelapse context because: + // 1. It guarantees that every frame can be displayed without relying on previous frames. + // 2. It enables precise seeking and smooth scrubbing across all video players. + AVVideoMaxKeyFrameIntervalKey: frameRate // e.g., 1 for 1 FPS + ] as [String: Any], + + // Explicitly sets the video color space to ITU-R BT.709 (the standard for HD video). + // This improves color accuracy and ensures consistent rendering across platforms and browsers, + // especially when the source content is rendered using UIKit/AppKit (e.g., UIColor, UIImage, UIView). + // Without these, decoders may guess or default to BT.601, resulting in incorrect gamma or saturation. + AVVideoColorPropertiesKey: [ + // Specifies the color primaries — i.e., the chromaticities of red, green, and blue. + // BT.709 is the standard for HD content and matches sRGB color primaries, + // ensuring accurate color reproduction when rendered on most displays. + AVVideoColorPrimariesKey: AVVideoColorPrimaries_ITU_R_709_2, + + // Defines the transfer function (optical-electrical transfer function). + // BT.709 matches sRGB gamma (~2.2) and ensures that brightness/contrast levels + // look correct on most screens and in browsers using HTML5