Skip to content

Commit

Permalink
Fix start recording after app in background for 20 seconds failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
eerimoq committed Apr 17, 2024
1 parent 4197df1 commit 7d35b0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"location" : "https://github.com/eerimoq/HaishinKit.swift",
"state" : {
"branch" : "main",
"revision" : "1d08dafabe4a3ce4ac5a20535965bf2c036a7eb1"
"revision" : "b20851ebaac86dc4a5aaa3d6bae69af3404a6d30"
}
},
{
Expand Down
17 changes: 5 additions & 12 deletions Moblin/RtmpServer/RtmpServerChunkStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -394,25 +394,18 @@ class RtmpServerChunkStream: VideoCodecDelegate {
guard let audioDecoder, let pcmAudioFormat else {
return
}
var error: NSError?
guard let outputBuffer = AVAudioPCMBuffer(pcmFormat: pcmAudioFormat, frameCapacity: 1024) else {
return
}
let outputStatus = audioDecoder.convert(to: outputBuffer, error: &error) { _, inputStatus in
var error: NSError?
audioDecoder.convert(to: outputBuffer, error: &error) { _, inputStatus in
inputStatus.pointee = .haveData
return self.audioBuffer
}
switch outputStatus {
case .haveData:
if let error {
logger.info("rtmp-server: client: Error \(error)")
} else {
client?.handleAudioBuffer(audioBuffer: outputBuffer)
case .error:
if let error {
logger.info("rtmp-server: client: Error \(error)")
} else {
logger.info("rtmp-server: client: Unknown error")
}
default:
logger.info("rtmp-server: client: Output status \(outputStatus.rawValue)")
}
}

Expand Down

0 comments on commit 7d35b0e

Please sign in to comment.