Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIOS-6232: maxBitrate, forcePlayoutDelayMin & forcePlayoutDelayMax #201

Merged
merged 19 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ public actor SubscriptionManager: ObservableObject {
let clientOptions = MCClientOptions()
clientOptions.jitterMinimumDelayMs = Int32(configuration.jitterMinimumDelayMs)
clientOptions.statsDelayMs = Int32(configuration.statsDelayMs)
if configuration.maxBitrate > 0 {
clientOptions.maximumBitrate = NSNumber(value: configuration.maxBitrate)
aravind-raveendran marked this conversation as resolved.
Show resolved Hide resolved
}
if let rtcEventLogOutputPath = configuration.rtcEventLogPath {
clientOptions.rtcEventLogOutputPath = rtcEventLogOutputPath
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public struct SubscriptionConfiguration {
public static let autoReconnect = true
public static let jitterMinimumDelayMs: UInt = 20
public static let statsDelayMs: UInt = 1000
public static let maxBitrate: UInt = 0
public static let disableAudio = false
public static let enableStats = true
public static let playoutDelay: MCForcePlayoutDelay? = nil
Expand All @@ -21,6 +22,7 @@ public struct SubscriptionConfiguration {
public let autoReconnect: Bool
public let jitterMinimumDelayMs: UInt
public let statsDelayMs: UInt
public let maxBitrate: UInt
public let disableAudio: Bool
public let rtcEventLogPath: String?
public let sdkLogPath: String?
Expand All @@ -32,16 +34,18 @@ public struct SubscriptionConfiguration {
autoReconnect: Bool = Constants.autoReconnect,
jitterMinimumDelayMs: UInt = Constants.jitterMinimumDelayMs,
statsDelayMs: UInt = Constants.statsDelayMs,
maxBitrate: UInt = Constants.maxBitrate,
disableAudio: Bool = Constants.disableAudio,
rtcEventLogPath: String? = nil,
sdkLogPath: String? = nil,
enableStats: Bool = Constants.enableStats,
playoutDelay: MCForcePlayoutDelay? = Constants.playoutDelay
) {
playoutDelay: MCForcePlayoutDelay? = Constants.playoutDelay)
{
sheiladoherty-dolby marked this conversation as resolved.
Show resolved Hide resolved
self.subscribeAPI = subscribeAPI
self.autoReconnect = autoReconnect
self.jitterMinimumDelayMs = jitterMinimumDelayMs
self.statsDelayMs = statsDelayMs
self.maxBitrate = maxBitrate
self.disableAudio = disableAudio
self.rtcEventLogPath = rtcEventLogPath
self.sdkLogPath = sdkLogPath
Expand Down
1 change: 1 addition & 0 deletions interactive-player/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
.DS_Store

## User settings
xcuserdata/
Expand Down
7 changes: 5 additions & 2 deletions interactive-player/Interactive Viewer/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"stream-detail-input.minimum-playout-delay-placeholder-label" = "Minimum Playout Delay";
"stream-detail-input.maximum-playout-delay-placeholder-label" = "Maximum Playout Delay";
"stream-detail-input.primary-video-quality-label" = "Primary video quality:";
"stream-detail-input.set-max-bitrate-label" = "Set Maximum Bitrate";
"stream-detail-input.max-bitrate-label" = "Maxium Bitrate (kbps):";
"stream-detail-server-url-label" = "Server URL";

/** App configuration Screen */
Expand All @@ -42,8 +44,9 @@
"recent-streams.account-id.title.label" = "ID:";
"recent-streams.server-url.label" = "Server URL:";
"recent-streams.video-jitter-buffer.label" = "Video Jitter buffer in ms:";
"recent-streams.min-playout-delay.label" = "Min Playout delay:";
"recent-streams.max-playout-delay.label" = "Max Playout delay:";
"recent-streams.min-playout-delay.label" = "Min Playout Delay:";
"recent-streams.max-playout-delay.label" = "Max Playout Delay:";
"recent-streams.max-bitrate.label" = "Maxium Bitrate:";
"recent-streams.disable-audio.label" = "Disable Audio:";
"recent-streams.primary-video-quality.label" = "Primary video quality:";
"recent-streams.save-logs.label" = "Save Logs:";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="22522" systemVersion="23F79" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="22758" systemVersion="23F79" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="StreamDetailManagedObject" representedClassName="StreamDetailManagedObject" syncable="YES" codeGenerationType="class">
<attribute name="accountID" attributeType="String"/>
<attribute name="disableAudio" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="lastUsedDate" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="maxBitrate" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO"/>
<attribute name="maxPlayoutDelay" optional="YES" attributeType="Integer 32" usesScalarValueType="NO"/>
<attribute name="minPlayoutDelay" optional="YES" attributeType="Integer 32" usesScalarValueType="NO"/>
<attribute name="primaryVideoQuality" attributeType="String"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ protocol StreamDataManagerProtocol: AnyObject {
}

final class StreamDataManager: NSObject, StreamDataManagerProtocol {

enum StreamDataManagerType {
case `default`, testing
}
Expand Down Expand Up @@ -55,10 +54,10 @@ final class StreamDataManager: NSObject, StreamDataManagerProtocol {
}
self.dateProvider = dateProvider

streamDetailFetchResultsController = NSFetchedResultsController(fetchRequest: Self.recentStreamsFetchRequest,
managedObjectContext: managedObjectContext,
sectionNameKeyPath: nil,
cacheName: nil)
self.streamDetailFetchResultsController = NSFetchedResultsController(fetchRequest: Self.recentStreamsFetchRequest,
managedObjectContext: managedObjectContext,
sectionNameKeyPath: nil,
cacheName: nil)
sheiladoherty-dolby marked this conversation as resolved.
Show resolved Hide resolved

super.init()

Expand Down Expand Up @@ -139,13 +138,14 @@ final class StreamDataManager: NSObject, StreamDataManagerProtocol {
streamDetailToSave.maxPlayoutDelay = streamDetail.maxPlayoutDelay.map { NSNumber(value: $0) }
streamDetailToSave.disableAudio = streamDetail.disableAudio
streamDetailToSave.primaryVideoQuality = streamDetail.primaryVideoQuality.rawValue
streamDetailToSave.maxBitrate = streamDetail.maxBitrate.map { NSNumber(value: $0) }
streamDetailToSave.saveLogs = streamDetail.saveLogs

// Delete streams that are older and exceeding the maximum allowed count
let request: NSFetchRequest<StreamDetailManagedObject> = Self.recentStreamsFetchRequest
let updatedResults = try coreDataManager.context.fetch(request)
if updatedResults.count > Constants.maximumAllowedStreams {
let streamsToDelete = updatedResults[(Constants.maximumAllowedStreams)..<updatedResults.count]
let streamsToDelete = updatedResults[(Constants.maximumAllowedStreams) ..< updatedResults.count]
streamsToDelete.forEach(coreDataManager.context.delete)
}
coreDataManager.saveContext()
Expand All @@ -167,7 +167,6 @@ final class StreamDataManager: NSObject, StreamDataManagerProtocol {
}

extension StreamDataManager: NSFetchedResultsControllerDelegate {

func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
if let newStreamDetails = controller.fetchedObjects as? [StreamDetailManagedObject] {
let streamDetails = newStreamDetails.compactMap { SavedStreamDetail(managedObject: $0) }
Expand Down
Loading
Loading