diag: add stop-time tracks check to detect HLS variant switching
This commit is contained in:
parent
1eff22a1ad
commit
4ba3ccde21
@ -582,6 +582,36 @@ final class PlayerRecorder: NSObject {
|
||||
statsSnapshot.videoFrames, statsSnapshot.processCallCount, statsSnapshot.appendCount,
|
||||
statsSnapshot.peakAmplitude, statsSnapshot.activeCallCount, statsSnapshot.silentCallCount)
|
||||
|
||||
// 诊断:检查录制结束时 tracks 是否变化
|
||||
if let pi = currentPlayerItem, let boundID = tapContext?.mixTrackID {
|
||||
let currentTracks = pi.tracks
|
||||
NSLog("[Recorder:DIAG] Stop-time tracks: count=%d", currentTracks.count)
|
||||
var stopLog = "\n=== Stop-time tracks check ===\n"
|
||||
stopLog += "Bound trackID: \(boundID)\n"
|
||||
stopLog += "Current tracks count: \(currentTracks.count)\n"
|
||||
var foundBoundTrack = false
|
||||
for (i, t) in currentTracks.enumerated() {
|
||||
let tid = t.assetTrack?.trackID ?? -1
|
||||
let mtype = t.assetTrack?.mediaType.rawValue ?? "?"
|
||||
NSLog("[Recorder:DIAG] stopTrack[%d]: trackID=%d mediaType=%@ enabled=%d", i, tid, mtype, t.isEnabled)
|
||||
stopLog += " track[\(i)]: trackID=\(tid) mediaType=\(mtype) enabled=\(t.isEnabled)\n"
|
||||
if tid == boundID {
|
||||
foundBoundTrack = true
|
||||
}
|
||||
}
|
||||
stopLog += "Bound trackID \(boundID) still exists: \(foundBoundTrack)\n"
|
||||
NSLog("[Recorder:DIAG] Bound trackID=%d still exists: %d", boundID, foundBoundTrack)
|
||||
// 追加到日志文件
|
||||
if let moviesDir = FileManager.default.urls(for: .moviesDirectory, in: .userDomainMask).first {
|
||||
let logPath = moviesDir.appendingPathComponent("MiniPlayer/tap_install_log.txt")
|
||||
if let handle = try? FileHandle(forWritingTo: logPath) {
|
||||
handle.seekToEndOfFile()
|
||||
handle.write(stopLog.data(using: .utf8)!)
|
||||
handle.closeFile()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
currentPlayerItem = nil
|
||||
|
||||
videoInput?.markAsFinished()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user