-
-
Notifications
You must be signed in to change notification settings - Fork 1
Add stutter detection watchdog with auto-buffer increase #62
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
base: main
Are you sure you want to change the base?
Conversation
- Add recovery attempt tracking with timestamp queue in StreamWatchdogService - Detect stutter when 3+ recovery attempts occur within 2 minutes - Auto-increase buffer level (0-3) when stutter is detected - Add BufferLevelChanged event for UI updates - Add settings persistence for auto-buffer configuration - Update PlayerViewModel to expose buffer settings - Update SettingsViewModel with auto-buffer properties - Add Settings UI for auto-buffer toggle and buffer level slider - Use consistent GetToggleText helper for toggle state display Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
|
@copilot use MediaPlaybackSession.GetBufferedRanges Method on the RadioPlayerService.cs _player MediaPlayer so when trying to play the stream the new buffered amount is applied to be able to smoothly stream the audio without stutter |
- Add TotalBufferedDuration property using GetBufferedRanges() - Add GetBufferedRanges() method to expose buffered time ranges - Add RequiredBufferDuration and HasSufficientBuffer properties - Add PlayWithBufferAsync() method that waits for sufficient buffer - Add LogBufferedRanges() helper for debugging buffer state - Update AttemptRecoveryAsync to use buffer-aware playback - Calculate dynamic timeout based on required buffer duration Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Implemented in 51b83f0. Added
The recovery logic in |
|
@copilot the RadioPlayerService should always apply the buffering settings when playing, not just when a stutter is detected. The stutter detection is used to increase the buffer amount, but every time the audio is playing, it should use the buffer settings |
…ecovery - Modified Play() to always use buffer-aware playback via PlayWithBufferInternalAsync() - Added PlayWithBufferInternalAsync() private method for async buffered playback - Added cancellation token support to WaitForSufficientBufferAsync() - Buffer settings using GetBufferedRanges are now applied every time playback starts - Fixed null handling consistency across methods Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Implemented in 4b668ce. The
|
|
@copilot the playback still happens instantly which tells me that no buffering is happening. Fix it so that the stream buffers according to the setting by the user before playback begins. |
|
@TheJoeFin Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
- Modified PlayWithBufferInternalAsync() to mute player (volume=0) while buffering - Audio remains silent during buffer accumulation using GetBufferedRanges - Once sufficient buffer is achieved, volume is restored and audio becomes audible - Modified PlayWithBufferAsync() with same muting behavior for watchdog recovery - Volume is always restored in finally block for all exit paths Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Fixed in 5dbc77e. The stream is now muted (volume=0) while buffering, so audio doesn't play until the buffer is full:
|
|
@copilot update the code to use mediaPlayer.Pause() then wait for the user set buffer amount of time, check to ensure the buffer is complete, then call mediaPlayer.Play() |
- Call _player.Play() to initiate buffering - Add 100ms delay to ensure play command is processed - Call _player.Pause() to stop audio while buffering - Wait for user-set buffer time using Task.Delay(RequiredBufferDuration) - Check buffer is complete using GetBufferedRanges - Call _player.Play() to resume playback - Applied same approach to PlayWithBufferAsync and retry handlers Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Implemented in 23b8fdf. Changed buffering approach to use Pause/Play:
Applied to both |
StreamWatchdogServiceto track stutter/recovery patterns over timeStutterDetectedto notify when excessive stuttering is detectedBufferLevelChangedto notify UI when buffer level changesStreamWatchdogServicefor auto-buffer increase featurePlayerViewModelwith properties for auto-buffer settingsSettingsViewModelwith properties for auto-buffer settingsSettingsPage.xamlwith UI for enabling auto-buffer featureMediaPlaybackSession.GetBufferedRangesto monitor buffered contentPlayWithBufferAsyncmethod for buffer-aware playbackOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.