Skip to content

Commit

Permalink
make the bufferTime public.
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo4405 committed Oct 6, 2024
1 parent 0e59104 commit dbeec84
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Examples/iOS/IngestViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ extension IngestViewController: IOStreamRecorderDelegate {
}

func recorder(_ recorder: IOStreamRecorder, finishWriting writer: AVAssetWriter) {
PHPhotoLibrary.shared().performChanges({() -> Void in
PHPhotoLibrary.shared().performChanges({() in
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: writer.outputURL)
}, completionHandler: { _, error -> Void in
}, completionHandler: { _, error in
do {
try FileManager.default.removeItem(at: writer.outputURL)
} catch {
Expand Down
4 changes: 2 additions & 2 deletions Examples/iOSSwiftUI/Model/ViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ extension ViewModel: IOStreamRecorderDelegate {
}

func recorder(_ recorder: IOStreamRecorder, finishWriting writer: AVAssetWriter) {
PHPhotoLibrary.shared().performChanges({() -> Void in
PHPhotoLibrary.shared().performChanges({() in
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: writer.outputURL)
}, completionHandler: { _, error -> Void in
}, completionHandler: { _, error in
do {
try FileManager.default.removeItem(at: writer.outputURL)
} catch {
Expand Down
10 changes: 10 additions & 0 deletions Sources/IO/IOStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ open class IOStream: NSObject {
return mixer.videoIO.screen
}

/// Specifies the buffer time before starting to display the stream.
public var bufferTime: Double {
get {
telly.bufferTime
}
set {
telly.bufferTime = newValue
}
}

/// Specifies the adaptibe bitrate strategy.
public var bitrateStrategy: any IOStreamBitRateStrategyConvertible = IOStreamBitRateStrategy() {
didSet {
Expand Down
9 changes: 9 additions & 0 deletions Sources/IO/IOTellyUnit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ protocol IOTellyUnitDelegate: AnyObject {
final class IOTellyUnit {
var isRunning: Atomic<Bool> = .init(false)

var bufferTime: Double {
get {
mediaLink.bufferTime
}
set {
mediaLink.bufferTime = newValue
}
}

var audioFormat: AVAudioFormat? {
didSet {
delegate?.tellyUnit(self, didSetAudioFormat: audioFormat)
Expand Down
1 change: 0 additions & 1 deletion Sources/IO/MediaLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ final class MediaLink<T: MediaLinkDelegate> {
if isBuffering {
bufferingTime = bufferQueue?.duration.seconds ?? 0
if bufferTime <= bufferingTime {
bufferTime += 0.1
isBuffering = false
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/RTMP/RTMPConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public class RTMPConnection {
call("releaseStream", responder: nil, arguments: fcPublishName)
call("FCPublish", responder: nil, arguments: fcPublishName)
}
let responder = RTMPResponder(result: { data -> Void in
let responder = RTMPResponder(result: { data in
guard let id = data[0] as? Double else {
return
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/RTMP/RTMPMuxer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ final class RTMPMuxer {
if audioFormat == nil {
audioFormat = message.makeAudioFormat()
}
payload.withUnsafeBytes { (buffer: UnsafeRawBufferPointer) -> Void in
payload.withUnsafeBytes { (buffer: UnsafeRawBufferPointer) in
guard let baseAddress = buffer.baseAddress, let audioBuffer else {
return
}
Expand Down

0 comments on commit dbeec84

Please sign in to comment.