Skip to content

Commit 47d7ec8

Browse files
committed
fixes
audio fixes to reduce skipping, ui fixes using nesting in hstack vstack instead of custom constraints, increasing ui speed reducing constraint glitches, flatter layout, some buttons removed. - Audio pipeline (Sources/AudioStreamer/AudioStreamer.m, HermesTests/AudioStreamerRetryTests.m, docs): removed the legacy state-controller glue, made the state controller mandatory, added ADTS fallback, startup buffering, and strict content-length handling so retries happen before Core Audio plays truncated data. Tests were updated to cover the retry bookkeeping. - UI/layout (Resources/Base.lproj/MainMenu.xib): rewrote the playback view using nested NSStackViews, removed the ad-hoc fixed widths that caused constraint spam, added explicit widths/minimums for the playback stack/history pane, wrapped the album art so it stays square, and anchored the station list/history stacks so they don’t resize when cover art loads. - Hover fields (Sources/Views/LabelHoverShowFieldCell.m): fixed the custom cell to only subtract the hover overlay’s width when it’s visible, so artist/title/album labels no longer clip to a single word. Put together, this commit keeps Auto Layout stable (no more “Unable to satisfy constraints” flurries), the hover labels show full text, the history view shows complete rows, and AudioStreamer handles corrupted AAC chunks by buffering/retrying instead of glitching. AudioStreamer: remove legacy glue, add ADTS fallback & startup buffer UI: rebuilt playback pane with stack views, fixed hover labels, stabilize album art
1 parent 1a93026 commit 47d7ec8

File tree

10 files changed

+597
-326
lines changed

10 files changed

+597
-326
lines changed

Documentation/AudioStreamerStateControllerRefactor.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ The XCTest coverage for the controller lives in `Sources/AudioStreamer/AudioStre
88

99
### Migration notes
1010

11-
- `AudioStreamer` now instantiates `AudioStreamerStateController` but retains the legacy logic as a fallback (`legacyTransitionToState:` and `handleFailureSynchronouslyWithCode:`) to guarantee behaviour matches older builds even if the controller is unavailable. This preserves backwards compatibility and makes reversion simple.
11+
- `AudioStreamer` now instantiates `AudioStreamerStateController` and requires it for all state transitions. Retry bookkeeping (like clearing transient counters) still lives in `AudioStreamer`, but the controller owns notification fan-out and thread hopping so there is only one codepath to audit.
1212
- `failWithErrorCode:` routes through the controller for thread-hopping but the error-code gating still occurs inside `AudioStreamer`, which keeps existing error semantics intact.
1313
- Tests sit alongside the production sources because the sandbox prevented creating a dedicated `Tests/` directory. They can be moved into a formal test target as part of integration.
1414

1515
### Reverting
1616

17-
To revert the change, remove `AudioStreamerStateController.{h,m}` and the associated test file, delete the helper import/property from `AudioStreamer.m`, and restore the original `setState:` and `failWithErrorCode:` implementations (now preserved in `legacyTransitionToState:` and `handleFailureSynchronouslyWithCode:`). The project file entries for the controller can then be dropped to return to the prior build graph.
18-
17+
To revert the change, remove `AudioStreamerStateController.{h,m}` and the associated test file, delete the helper import/property from `AudioStreamer.m`, and restore the original `setState:` and `failWithErrorCode:` implementations that used to live inline (including the notification/distributed notification plumbing). The project file entries for the controller can then be dropped to return to the prior build graph.

Hermes.xcodeproj/project.pbxproj

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@
628628
attributes = {
629629
BuildIndependentTargetsInParallel = YES;
630630
LastSwiftUpdateCheck = 1640;
631-
LastUpgradeCheck = 1610;
631+
LastUpgradeCheck = 1640;
632632
TargetAttributes = {
633633
0F795D212EB6F1870009B05D = {
634634
CreatedOnToolsVersion = 16.4;
@@ -809,7 +809,6 @@
809809
CODE_SIGN_STYLE = Automatic;
810810
CURRENT_PROJECT_VERSION = 1;
811811
DEBUG_INFORMATION_FORMAT = dwarf;
812-
DEVELOPMENT_TEAM = GHTQCRGWTR;
813812
GCC_C_LANGUAGE_STANDARD = gnu17;
814813
GCC_DYNAMIC_NO_PIC = NO;
815814
GCC_PREPROCESSOR_DEFINITIONS = (
@@ -820,7 +819,7 @@
820819
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
821820
GENERATE_INFOPLIST_FILE = YES;
822821
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
823-
MACOSX_DEPLOYMENT_TARGET = 11.5;
822+
MACOSX_DEPLOYMENT_TARGET = 11.0;
824823
MARKETING_VERSION = 1.0;
825824
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
826825
MTL_FAST_MATH = YES;
@@ -852,14 +851,13 @@
852851
CODE_SIGN_STYLE = Automatic;
853852
CURRENT_PROJECT_VERSION = 1;
854853
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
855-
DEVELOPMENT_TEAM = GHTQCRGWTR;
856854
ENABLE_NS_ASSERTIONS = NO;
857855
GCC_C_LANGUAGE_STANDARD = gnu17;
858856
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
859857
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
860858
GENERATE_INFOPLIST_FILE = YES;
861859
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
862-
MACOSX_DEPLOYMENT_TARGET = 11.5;
860+
MACOSX_DEPLOYMENT_TARGET = 11.0;
863861
MARKETING_VERSION = 1.0;
864862
MTL_ENABLE_DEBUG_INFO = NO;
865863
MTL_FAST_MATH = YES;
@@ -884,7 +882,6 @@
884882
CODE_SIGN_STYLE = Automatic;
885883
COMBINE_HIDPI_IMAGES = YES;
886884
DEAD_CODE_STRIPPING = YES;
887-
DEVELOPMENT_TEAM = GHTQCRGWTR;
888885
ENABLE_HARDENED_RUNTIME = YES;
889886
ENABLE_PREVIEWS = YES;
890887
FRAMEWORK_SEARCH_PATHS = (
@@ -908,7 +905,7 @@
908905
);
909906
LLVM_LTO = YES_THIN;
910907
MACOSX_DEPLOYMENT_TARGET = 11.0;
911-
MARKETING_VERSION = 2.0.0b1;
908+
MARKETING_VERSION = 2.0.0b2;
912909
ONLY_ACTIVE_ARCH = YES;
913910
PRODUCT_BUNDLE_IDENTIFIER = "com.alexcrichton.$(PRODUCT_NAME:rfc1034identifier)";
914911
PRODUCT_NAME = Hermes;
@@ -935,7 +932,6 @@
935932
COMBINE_HIDPI_IMAGES = YES;
936933
DEAD_CODE_STRIPPING = YES;
937934
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
938-
DEVELOPMENT_TEAM = GHTQCRGWTR;
939935
ENABLE_HARDENED_RUNTIME = YES;
940936
ENABLE_PREVIEWS = YES;
941937
ENABLE_TESTABILITY = YES;
@@ -961,7 +957,7 @@
961957
);
962958
LLVM_LTO = YES_THIN;
963959
MACOSX_DEPLOYMENT_TARGET = 11.0;
964-
MARKETING_VERSION = 2.0.0b1;
960+
MARKETING_VERSION = 2.0.0b2;
965961
ONLY_ACTIVE_ARCH = YES;
966962
PRODUCT_BUNDLE_IDENTIFIER = "com.alexcrichton.$(PRODUCT_NAME:rfc1034identifier)";
967963
PRODUCT_NAME = Hermes;
@@ -1004,6 +1000,7 @@
10041000
COPY_PHASE_STRIP = NO;
10051001
CURRENT_PROJECT_VERSION = 2059;
10061002
DEAD_CODE_STRIPPING = YES;
1003+
DEVELOPMENT_TEAM = GHTQCRGWTR;
10071004
ENABLE_STRICT_OBJC_MSGSEND = YES;
10081005
ENABLE_TESTABILITY = YES;
10091006
ENABLE_USER_SCRIPT_SANDBOXING = YES;
@@ -1056,6 +1053,7 @@
10561053
COPY_PHASE_STRIP = NO;
10571054
CURRENT_PROJECT_VERSION = 2059;
10581055
DEAD_CODE_STRIPPING = YES;
1056+
DEVELOPMENT_TEAM = GHTQCRGWTR;
10591057
ENABLE_STRICT_OBJC_MSGSEND = YES;
10601058
ENABLE_USER_SCRIPT_SANDBOXING = YES;
10611059
EXCLUDED_ARCHS = "";
@@ -1073,6 +1071,7 @@
10731071
MACOSX_DEPLOYMENT_TARGET = 11.5;
10741072
ONLY_ACTIVE_ARCH = YES;
10751073
SDKROOT = macosx;
1074+
SWIFT_COMPILATION_MODE = wholemodule;
10761075
VERSIONING_SYSTEM = "apple-generic";
10771076
WARNING_CFLAGS = "-Wall";
10781077
};

Hermes.xcodeproj/xcshareddata/xcschemes/Archive Hermes.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1610"
3+
LastUpgradeVersion = "1640"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Hermes.xcodeproj/xcshareddata/xcschemes/Hermes (Release — media keys enabled).xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1610"
3+
LastUpgradeVersion = "1640"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Hermes.xcodeproj/xcshareddata/xcschemes/Hermes.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1610"
3+
LastUpgradeVersion = "1640"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Hermes.xcodeproj/xcshareddata/xcschemes/Upload Hermes Release.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1610"
3+
LastUpgradeVersion = "1640"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

HermesTests/AudioStreamerRetryTests.m

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,27 @@ - (void)testRetryExhaustionTriggersFinalFailure {
9191
XCTAssertEqual(streamer.startInvocationCount, 2U);
9292
}
9393

94+
- (void)testStateTransitionsResetRetryBookkeeping {
95+
TestRetryAudioStreamer *streamer = [[TestRetryAudioStreamer alloc] init];
96+
[streamer setValue:@3 forKey:@"retryAttemptCount"];
97+
[streamer setValue:@YES forKey:@"retryScheduled"];
98+
[streamer setValue:@(12.5) forKey:@"retryResumeTime"];
99+
[streamer setValue:@(AS_WAITING_FOR_DATA) forKey:@"state_"];
100+
101+
SEL setStateSEL = NSSelectorFromString(@"setState:");
102+
((void (*)(id, SEL, AudioStreamerState))objc_msgSend)(streamer, setStateSEL, AS_PLAYING);
103+
104+
XCTAssertEqual(streamer.retryAttemptCount, 0U);
105+
XCTAssertFalse(streamer.retryScheduled);
106+
XCTAssertEqual(streamer.retryResumeTime, 0.0);
107+
108+
[streamer setValue:@YES forKey:@"retryScheduled"];
109+
[streamer setValue:@(8.0) forKey:@"retryResumeTime"];
110+
111+
((void (*)(id, SEL, AudioStreamerState))objc_msgSend)(streamer, setStateSEL, AS_STOPPED);
112+
113+
XCTAssertFalse(streamer.retryScheduled);
114+
XCTAssertEqual(streamer.retryResumeTime, 0.0);
115+
}
116+
94117
@end

0 commit comments

Comments
 (0)