Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LiveServerMediaSubsession* LiveServerMediaSubsession::createNew( UsageEnvironment& env )
- {
- return new LiveServerMediaSubsession( env );
- }
- LiveServerMediaSubsession::LiveServerMediaSubsession( UsageEnvironment& env )
- : OnDemandServerMediaSubsession( env, True /* reuseFirstSource */ )
- {
- }
- LiveServerMediaSubsession::~LiveServerMediaSubsession()
- {
- }
- FramedSource* LiveServerMediaSubsession::createNewStreamSource( unsigned clientSessionId, unsigned& estBitrate )
- {
- // Get the existing singleton instance
- auto src = V4l2MJPEGSource::createNew( envir( ) );
- if ( src == nullptr ) {
- envir( ) << "Failed to create V4l2MJPEGSource\n";
- return nullptr;
- }
- // Estimate bitrate based on typical MJPEG compression ratio
- // Assuming 1920x1080 at 90fps with ~1:10 compression ratio
- estBitrate = 1920 * 1080 * 90 * 3 / 10; // Rough estimate in bits per second
- return src;
- }
- RTPSink* LiveServerMediaSubsession::createNewRTPSink( Groupsock* rtpGroupsock,
- unsigned char rtpPayloadTypeIfDynamic,
- FramedSource* inputSource )
- {
- if ( rtpGroupsock == nullptr ) {
- envir( ) << "Invalid RTP groupsock\n";
- return nullptr;
- }
- // Create JPEG RTP sink with specific parameters
- auto sink = JPEGVideoRTPSink::createNew( envir( ), rtpGroupsock );
- if ( sink == nullptr ) {
- envir( ) << "Failed to create JPEG RTP sink\n";
- return nullptr;
- }
- // Set maximum packet size to avoid fragmentation
- sink->setPacketSizes(1000, 1448);
- return sink;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement