Skip to content

Commit

Permalink
Rename CMAudioSampleBufferUtil to CMAudioSampleBufferFactory.
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo4405 committed Sep 10, 2023
1 parent 2513a60 commit 16d6576
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions HaishinKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@
BC7C56CD29A786AE00C41A9B /* ADTS.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC7C56CC29A786AE00C41A9B /* ADTS.swift */; };
BC7C56D129A78D4F00C41A9B /* ADTSHeaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC7C56D029A78D4F00C41A9B /* ADTSHeaderTests.swift */; };
BC83A4732403D83B006BDE06 /* VTCompressionSession+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC83A4722403D83B006BDE06 /* VTCompressionSession+Extension.swift */; };
BC8446052A30BE1600609FFD /* CMAudioSampleBufferUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC8446042A30BE1600609FFD /* CMAudioSampleBufferUtil.swift */; };
BC8446092A30BFC800609FFD /* CMAudioSampleBufferUtilTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC8446082A30BFC800609FFD /* CMAudioSampleBufferUtilTests.swift */; };
BC8446052A30BE1600609FFD /* CMAudioSampleBufferFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC8446042A30BE1600609FFD /* CMAudioSampleBufferFactory.swift */; };
BC8446092A30BFC800609FFD /* CMAudioSampleBufferFactoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC8446082A30BFC800609FFD /* CMAudioSampleBufferFactoryTests.swift */; };
BC8A29902AA63D9E00F6D27F /* HaishinKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2945CBBD1B4BE66000104112 /* HaishinKit.framework */; };
BC8A29912AA63D9E00F6D27F /* HaishinKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 2945CBBD1B4BE66000104112 /* HaishinKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BC8A29942AA63DA300F6D27F /* HaishinKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2945CBBD1B4BE66000104112 /* HaishinKit.framework */; };
Expand Down Expand Up @@ -604,8 +604,8 @@
BC7C56CC29A786AE00C41A9B /* ADTS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ADTS.swift; sourceTree = "<group>"; };
BC7C56D029A78D4F00C41A9B /* ADTSHeaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ADTSHeaderTests.swift; sourceTree = "<group>"; };
BC83A4722403D83B006BDE06 /* VTCompressionSession+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "VTCompressionSession+Extension.swift"; sourceTree = "<group>"; };
BC8446042A30BE1600609FFD /* CMAudioSampleBufferUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CMAudioSampleBufferUtil.swift; sourceTree = "<group>"; };
BC8446082A30BFC800609FFD /* CMAudioSampleBufferUtilTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CMAudioSampleBufferUtilTests.swift; sourceTree = "<group>"; };
BC8446042A30BE1600609FFD /* CMAudioSampleBufferFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CMAudioSampleBufferFactory.swift; sourceTree = "<group>"; };
BC8446082A30BFC800609FFD /* CMAudioSampleBufferFactoryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CMAudioSampleBufferFactoryTests.swift; sourceTree = "<group>"; };
BC959EEE296EE4190067BA97 /* ImageTransform.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageTransform.swift; sourceTree = "<group>"; };
BC959F0D29705B1B0067BA97 /* SCStreamPublishViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SCStreamPublishViewController.swift; sourceTree = "<group>"; };
BC959F1129717EDB0067BA97 /* PreferenceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferenceViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -764,7 +764,7 @@
298BCF321DD4C44A007FF86A /* AnyUtil.swift */,
29DC17B221D0CC0600E26CED /* Atomic.swift */,
29B876B81CD70B3900FC07DA /* ByteArray.swift */,
BC8446042A30BE1600609FFD /* CMAudioSampleBufferUtil.swift */,
BC8446042A30BE1600609FFD /* CMAudioSampleBufferFactory.swift */,
29B876631CD70AB300FC07DA /* Constants.swift */,
BC0D236C26331BAB001DDA0C /* DataBuffer.swift */,
29B876671CD70AB300FC07DA /* DataConvertible.swift */,
Expand Down Expand Up @@ -811,7 +811,7 @@
isa = PBXGroup;
children = (
290EA8A41DFB61E700053022 /* ByteArrayTests.swift */,
BC8446082A30BFC800609FFD /* CMAudioSampleBufferUtilTests.swift */,
BC8446082A30BFC800609FFD /* CMAudioSampleBufferFactoryTests.swift */,
290EA8A51DFB61E700053022 /* CRC32Tests.swift */,
BCC9E9082636FF7400948774 /* DataBufferTests.swift */,
290EA8A61DFB61E700053022 /* EventDispatcherTests.swift */,
Expand Down Expand Up @@ -1732,7 +1732,7 @@
BC44A1A923D31E92002D4297 /* AudioCodecRingBuffer.swift in Sources */,
BC20DF38250377A3007BC608 /* IOUIScreenCaptureUnit.swift in Sources */,
29B876AF1CD70B2800FC07DA /* RTMPChunk.swift in Sources */,
BC8446052A30BE1600609FFD /* CMAudioSampleBufferUtil.swift in Sources */,
BC8446052A30BE1600609FFD /* CMAudioSampleBufferFactory.swift in Sources */,
29B876841CD70AE800FC07DA /* AVCDecoderConfigurationRecord.swift in Sources */,
296242621D8DB86500C451A3 /* TSWriter.swift in Sources */,
BC9CFA9323BDE8B700917EEF /* NetStreamDrawable.swift in Sources */,
Expand Down Expand Up @@ -1843,7 +1843,7 @@
295018201FFA1BD700358E10 /* AudioCodecTests.swift in Sources */,
290EA8AC1DFB61E700053022 /* MD5Tests.swift in Sources */,
290EA8A01DFB61B100053022 /* AMFFoundationTests.swift in Sources */,
BC8446092A30BFC800609FFD /* CMAudioSampleBufferUtilTests.swift in Sources */,
BC8446092A30BFC800609FFD /* CMAudioSampleBufferFactoryTests.swift in Sources */,
BC7C56892995082700C41A9B /* NetStreamTests.swift in Sources */,
2917CB662104CA2800F6823A /* AudioSpecificConfigTests.swift in Sources */,
290EA8AB1DFB61E700053022 /* EventDispatcherTests.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Sources/Media/IOAudioUnit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ final class IOAudioUnit: NSObject, IOUnit {
var gapPresentationTimeStamp = presentationTimeStamp
for i in 0 ... numSampleBuffers {
let numSamples = numSampleBuffers == i ? numGapSamples % sampleBuffer.numSamples : sampleBuffer.numSamples
guard let gapSampleBuffer = CMAudioSampleBufferUtil.makeSampleBuffer(sampleBuffer, numSamples: numSamples, presentationTimeStamp: gapPresentationTimeStamp) else {
guard let gapSampleBuffer = CMAudioSampleBufferFactory.makeSampleBuffer(sampleBuffer, numSamples: numSamples, presentationTimeStamp: gapPresentationTimeStamp) else {
continue
}
mixer?.recorder.appendSampleBuffer(gapSampleBuffer)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CoreMedia
import Foundation

enum CMAudioSampleBufferUtil {
enum CMAudioSampleBufferFactory {
static func makeSampleBuffer(_ buffer: CMSampleBuffer, numSamples: Int, presentationTimeStamp: CMTime) -> CMSampleBuffer? {
guard 0 < numSamples, let formatDescription = buffer.formatDescription, let streamBasicDescription = formatDescription.streamBasicDescription else {
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CoreMedia

@testable import HaishinKit

final class CMAudioSampleBufferUtilTests: XCTestCase {
final class CMAudioSampleBufferFactoryTests: XCTestCase {
func test48000_2chTest() {
let streamBasicDescription = AudioStreamBasicDescription(
mSampleRate: 48000.0,
Expand All @@ -18,7 +18,7 @@ final class CMAudioSampleBufferUtilTests: XCTestCase {
mReserved: 0
)
if let buffer = makeSampleBuffer(streamBasicDescription) {
XCTAssertNotNil(CMAudioSampleBufferUtil.makeSampleBuffer(buffer, numSamples: 1024, presentationTimeStamp: .zero))
XCTAssertNotNil(CMAudioSampleBufferFactory.makeSampleBuffer(buffer, numSamples: 1024, presentationTimeStamp: .zero))
} else {
XCTFail()
}
Expand All @@ -37,7 +37,7 @@ final class CMAudioSampleBufferUtilTests: XCTestCase {
mReserved: 0
)
if let buffer = makeSampleBuffer(streamBasicDescription) {
XCTAssertNotNil(CMAudioSampleBufferUtil.makeSampleBuffer(buffer, numSamples: 1024, presentationTimeStamp: .zero))
XCTAssertNotNil(CMAudioSampleBufferFactory.makeSampleBuffer(buffer, numSamples: 1024, presentationTimeStamp: .zero))
} else {
XCTFail()
}
Expand All @@ -56,7 +56,7 @@ final class CMAudioSampleBufferUtilTests: XCTestCase {
mReserved: 0
)
if let buffer = makeSampleBuffer(streamBasicDescription) {
XCTAssertNotNil(CMAudioSampleBufferUtil.makeSampleBuffer(buffer, numSamples: 1024, presentationTimeStamp: .zero))
XCTAssertNotNil(CMAudioSampleBufferFactory.makeSampleBuffer(buffer, numSamples: 1024, presentationTimeStamp: .zero))
} else {
XCTFail()
}
Expand All @@ -75,7 +75,7 @@ final class CMAudioSampleBufferUtilTests: XCTestCase {
mReserved: 0
)
if let buffer = makeSampleBuffer(streamBasicDescription) {
XCTAssertNotNil(CMAudioSampleBufferUtil.makeSampleBuffer(buffer, numSamples: 1024, presentationTimeStamp: .zero))
XCTAssertNotNil(CMAudioSampleBufferFactory.makeSampleBuffer(buffer, numSamples: 1024, presentationTimeStamp: .zero))
} else {
XCTFail()
}
Expand Down

0 comments on commit 16d6576

Please sign in to comment.