Skip to content

Conversation

@tobbee
Copy link
Collaborator

@tobbee tobbee commented Jul 18, 2025

Added

  • Non-robust seamless track switching functionality in mlmsub using -switch-tracks option
  • SUBSCRIBE_UPDATE mechanism for optimal track transitions using largest_group_id from SUBSCRIBE_OK
  • Staircase switching pattern for automated testing (video: 400kbps→600kbps→900kbps→600kbps→400kbps, audio: monotonic→scale→monotonic→scale)
  • Duplicate detection and handling during track switching
  • Modular architecture for mlmsub with separate SubscriptionManager, MediaRouter, MediaPipeline, and TrackSwitcher components
  • MediaObject struct-based communication between components via Go channels

Changed

  • Refactored mlmsub handler to modular component-based architecture
  • Improved separation of concerns between control plane, media routing, and output processing
  • Enhanced error handling and logging throughout the subscription pipeline
  • Changed moqtransport version

tobbee and others added 9 commits July 18, 2025 10:44
- Add Location struct and GetLargestObject function with comprehensive tests
- Calculates the largest object location based on current time
- Add TrackPublisher interface with MediaType alignment (VIDEO/AUDIO)
- Implement MediaSyncer for media-type group synchronization ensuring video tracks share group timing, audio tracks share separate timing
- Create ConcreteTrackPublisher with enhanced subscription state supporting SUBSCRIBE_UPDATE
- Add PublisherManager coordinating all track publishers with unified group generation
- Integrate new architecture into mlmpub with -new flag for backward compatibility
- Establish foundation for seamless same-media-type track switching at group boundarie
- Object (G, 0) available at G seconds + sampleOffset + objectDuration
- Object (G, N) available N*objectDuration later
- Video has sampleOffset = 0
- Audio has sampleOffset depenging on loop wrap start
- Enhanced subscriber error handling with aggressive disconnect detection
- Add multiple subscription state checks during publishing lifecycle
- Mark removed subscriptions as failed immediately to prevent error spam
- Add early termination checks at OpenSubgroup, WriteMoQGroup, and Close operations
- Prevent publishing goroutines from continuing when subscription is removed
- Reduce repeated error logging when mlmsub clients disconnect from mlmpub
- Use client-provided request IDs and add structured subscription logging
- Add structured logging for subscription messages in handler
  - Log requestID, track, namespace, filterType, and subscriberPriority
  - Improves debugging and monitoring of subscription requests
- Add SUBSCRIBE_UPDATE message handling in mlmpub handler
- Implement HandleSubscribeUpdate method in PublisherManager
- Support end_group parameter for clean subscription termination
- Implement SUBSCRIBE_DONE message transmission using Publisher.CloseWithError
- Add structured logging for SUBSCRIBE_UPDATE messages
- Check for stale subscriptions
- Add -end-after flag to mlmsub for automatic subscription termination
  after X groups.
Standardize logging across mlmpub and mlmsub clients with consistent slog usage:
- Add centralized log level parsing with ParseLogLevel function
- Replace direct slog calls with logger instances for better control
- Update subscription handling to use structured logging
- Improve error tracking and debug information in track switching
- Maintain logging consistency across publisher and subscriber components

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add new modular architecture with clean separation of control plane and media transport
- Implement channel-based MediaObject communication between components
- Add SubscriptionManager for control plane operations (subscriptions, updates)
- Add MediaRouter for object routing with duplicate detection and new track preference
- Add MediaPipeline for output handling (mux, video, audio) with proper init segment handling
- Add SimpleClient demonstrating new architecture usage
- Maintain full compatibility with existing seamless track switching functionality
- Fix init segment handling: catalog initData written first, then media objects processed
- Support all output modes: muxout, videoout, audioout with proper CMAF multiplexing
- Use moqtransport LargestLocation API for immediate SUBSCRIBE_UPDATE
- Calculate firstNewGroup as largestGroup+1 from SUBSCRIBE_OK response
- Send SUBSCRIBE_UPDATE immediately after subscription confirmation
- Eliminate wait for first object arrival during track switching
- Improve switching performance and reduce transition latency
- Document new modular mlmsub architecture with separated concerns
- Explain SubscriptionManager, MediaRouter, MediaPipeline, TrackSwitcher components
- Add track switching examples and debugging guidance
- Include staircase switching pattern documentation
- Provide troubleshooting guide for common issues

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants