Skip to content

Commit

Permalink
Merge pull request #1232 from shogo4405/feature/video-codec-delegate
Browse files Browse the repository at this point in the history
Invoke delegate the stream(_ stream: NetStream, didOutput video: CMSa…
  • Loading branch information
shogo4405 committed Jul 11, 2023
2 parents 9b4bb11 + 4a94f6d commit a1cc00f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Examples/iOS/PlaybackViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ final class PlaybackViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
rtmpStream = RTMPStream(connection: rtmpConnection)
rtmpStream.delegate = self
}

override func viewWillAppear(_ animated: Bool) {
Expand Down Expand Up @@ -119,3 +120,31 @@ extension PlaybackViewController: AVPictureInPictureSampleBufferPlaybackDelegate
completionHandler()
}
}

extension PlaybackViewController: NetStreamDelegate {
// MARK: NetStreamDelegate
func stream(_ stream: NetStream, didOutput audio: AVAudioBuffer, presentationTimeStamp: CMTime) {
}

func stream(_ stream: NetStream, didOutput video: CMSampleBuffer) {
}

func stream(_ stream: NetStream, sessionWasInterrupted session: AVCaptureSession, reason: AVCaptureSession.InterruptionReason) {
}

func stream(_ stream: NetStream, sessionInterruptionEnded session: AVCaptureSession, reason: AVCaptureSession.InterruptionReason) {
}

func stream(_ stream: NetStream, videoCodecErrorOccurred error: VideoCodec.Error) {
}

func stream(_ stream: NetStream, audioCodecErrorOccurred error: HaishinKit.AudioCodec.Error) {
}

func streamWillDropFrame(_ stream: NetStream) -> Bool {
return false
}

func streamDidOpen(_ stream: NetStream) {
}
}
1 change: 1 addition & 0 deletions Sources/Media/IOMixer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ extension IOMixer: IOUnitDecoding {
extension IOMixer: MediaLinkDelegate {
// MARK: MediaLinkDelegate
func mediaLink(_ mediaLink: MediaLink, dequeue sampleBuffer: CMSampleBuffer) {
delegate?.mixer(self, didOutput: sampleBuffer)
drawable?.enqueue(sampleBuffer)
}

Expand Down

0 comments on commit a1cc00f

Please sign in to comment.