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

Reconnection from WiFi to 4G always results in lower transfer speed #1291

Open
mkrn opened this issue Sep 12, 2023 · 1 comment
Open

Reconnection from WiFi to 4G always results in lower transfer speed #1291

mkrn opened this issue Sep 12, 2023 · 1 comment

Comments

@mkrn
Copy link

mkrn commented Sep 12, 2023

Describe the bug

I tested these scenarios:

  • Streaming on WiFi. Disconnect Wifi. Connect Wifi. ✅
  • Streaming on 4G/5G. Disconnect 4G/5G. Connect 4G/5G. ✅
  • Streaming on 4G/5G. Connect WiFi. Disconnect 4G/5G. ✅
  • Streaming on 4G/5G. Go to notification center. Return ✅
  • Streaming on WiFi with good signal. Connect 4G/5G. Disconnect WiFi. => Connection falters, then speed stays very low.

To Reproduce

In SwiftUI Example app.

  1. Increase video bitrate to 3000kbps (Slider max)
  2. Use remote RTMP in Preferences
  3. Display currentBytesOutPerSecond (see delegate)
  4. Start streaming with WiFi AND 4G on
  5. Disconnect WiFi
  6. Watch app reconnect and currentBytesOutPerSecond stay low

(Same issue if you walk out of WiFi range)

Delegate to debug:

extension ViewModel : RTMPConnectionDelegate {
    // MARK: RTMPStreamDelegate
    func connection(_ connection: HaishinKit.RTMPConnection, publishInsufficientBWOccured stream: HaishinKit.RTMPStream) {
        print("insufficientBW", stream.videoSettings.bitRate,  stream.audioSettings.bitRate, connection.currentBytesOutPerSecond * 8)
 
    }
    
    func connection(_ connection: HaishinKit.RTMPConnection, publishSufficientBWOccured stream: HaishinKit.RTMPStream) {
        print("sufficientBW",  stream.videoSettings.bitRate, stream.audioSettings.bitRate, connection.currentBytesOutPerSecond * 8)
 
    }
     
    
    
    func connection(_ connection: HaishinKit.RTMPConnection, updateStats stream: HaishinKit.RTMPStream) {
        let curFps = stream.currentFPS
        
        let currentBitsPerSecond = connection.currentBytesOutPerSecond * 8;
        let currentMbps = String(format: "%.1f", Double(currentBitsPerSecond) / 1000.0 / 1000.0);
        let fpsStr = "\(max(curFps, 30)) fps   \(currentMbps)Mb/s";
        DispatchQueue.main.async {
            self.fps = fpsStr
        }
     
}

Expected behavior

After switching or loosing WiFi app should reconnect just as well

Version

main

Smartphone info.

iPhone 13 Pro
iOS 16, 17

Additional context

No response

Screenshots

No response

Relevant log output

No response

@shogo4405
Copy link
Owner

Unfortunately, I couldn't reproduce it in my environment, so I'm having difficulty finding a solution. I'm considering trying it in a different environment. How about others?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants