-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a8008c0
commit 86f2afb
Showing
193 changed files
with
12,087 additions
and
4,591 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// Copyright © 2025 Stream.io Inc. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import StreamWebRTC | ||
|
||
/// Represents different audio codecs. | ||
public enum AudioCodec: String, CustomStringConvertible, Sendable { | ||
case opus | ||
case red | ||
case unknown | ||
|
||
/// Returns the raw value of the codec, which corresponds to its name. | ||
public var description: String { | ||
rawValue | ||
} | ||
|
||
/// Initializes an `AudioCodec` instance from WebRTC codec parameters. | ||
/// | ||
/// This initializer maps a WebRTC codec (`RTCRtpCodecParameters`) to the | ||
/// corresponding `AudioCodec` value. If the codec name matches `opus` or | ||
/// `red`, the respective case is assigned; otherwise, it defaults to | ||
/// `.unknown`. | ||
/// | ||
/// - Parameter source: The `RTCRtpCodecParameters` object containing codec | ||
/// details such as the codec name. | ||
init(_ source: RTCRtpCodecParameters) { | ||
switch source.name.lowercased() { | ||
case AudioCodec.opus.rawValue: | ||
self = .opus | ||
case AudioCodec.red.rawValue: | ||
self = .red | ||
default: | ||
self = .unknown | ||
} | ||
} | ||
|
||
/// Initializes an `AudioCodec` instance from SFU codec model parameters. | ||
/// | ||
/// This initializer maps an SFU codec model (`Stream_Video_Sfu_Models_Codec`) | ||
/// to the corresponding `AudioCodec` value. If the codec name matches `opus` | ||
/// or `red`, the respective case is assigned; otherwise, it defaults to | ||
/// `.unknown`. | ||
/// | ||
/// - Parameter source: The `Stream_Video_Sfu_Models_Codec` object containing | ||
/// codec details such as the codec name. | ||
init(_ source: Stream_Video_Sfu_Models_Codec) { | ||
switch source.name.lowercased() { | ||
case AudioCodec.opus.rawValue: | ||
self = .opus | ||
case AudioCodec.red.rawValue: | ||
self = .red | ||
default: | ||
self = .unknown | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.