c43dd3ca4a
A native iOS receiver so an iPhone can act as the second receiver, speaking the existing signaling + RTP protocol (no C++ changes) and mirroring the Android receiver (Phase 8) source-to-source. - RTP core (header/packet, jitter buffer, H.264 depacketizer) ported from the Android receiver - BSD-socket signaling server (dual-stack, most-recent-peer, never-throwing sends) + NSBonjourServices - VideoToolbox H.264 decode (in-band SPS/PPS, real-time, rebuilds on size change) -> AVSampleBufferDisplayLayer - PLI keyframe recovery (500 ms) + pendingOffer for late surface attach - XcodeGen project + bootstrap.sh; XCTest port of the Android suite + new coverage - .gitignore for generated artifacts; CHANGELOG; PHASES + MEMORY updated Status: authored; on-device validation pending a Mac + Xcode 26 + iPhone 16.
25 lines
936 B
Swift
25 lines
936 B
Swift
import XCTest
|
|
@testable import Receiver
|
|
|
|
final class NalExtractorTests: XCTestCase {
|
|
func testExtractsSpsAndPps() {
|
|
// Annex-B: SPS (type 7), PPS (type 8), slice (type 5).
|
|
let annexB: [UInt8] = [0, 0, 1, 0x67, 0xAA, 0, 0, 1, 0x68, 0xBB, 0, 0, 1, 0x41, 0x01]
|
|
let sets = NalExtractor.parameterSets(annexB)
|
|
XCTAssertEqual(sets?.sps, [0x67, 0xAA])
|
|
XCTAssertEqual(sets?.pps, [0x68, 0xBB])
|
|
}
|
|
|
|
func testReturnsNilWithoutBoth() {
|
|
let annexB: [UInt8] = [0, 0, 1, 0x67, 0xAA, 0, 0, 1, 0x41, 0x01] // SPS but no PPS
|
|
XCTAssertNil(NalExtractor.parameterSets(annexB))
|
|
}
|
|
|
|
func testPicksFirstOfEach() {
|
|
let annexB: [UInt8] = [0, 0, 1, 0x67, 0x11, 0, 0, 1, 0x68, 0x22, 0, 0, 1, 0x67, 0x33, 0, 0, 1, 0x68, 0x44]
|
|
let sets = NalExtractor.parameterSets(annexB)
|
|
XCTAssertEqual(sets?.sps, [0x67, 0x11])
|
|
XCTAssertEqual(sets?.pps, [0x68, 0x22])
|
|
}
|
|
}
|