begeekmyfriend / yasea

RTMP live streaming client for Android
MIT License
4.88k stars 1.32k forks source link

change resolution on fly #840

Closed thegobot closed 3 years ago

thegobot commented 3 years ago

It is also necessary to send the SPS\PPS along with the keyframe, in addition to the AVCSequenceHeader

Now all players do not freeze and change resolution anywhere in the stream! Tested: PotPlayer, MPC (hard accel\soft), Chrome, Forefox, FFplay (also with h264_qsv decoder)

See https://github.com/begeekmyfriend/yasea/issues/832

begeekmyfriend commented 3 years ago

You have solved the issue you shot on your own. Trust you!

thegobot commented 3 years ago

How correct is it also to send an AVCSequenceHeader before a NAL (SPS\PPS\IDR) in the middle of a stream? There are no errors, moreover, the SRS server updates it and at the beginning of the stream (new client) sends the current AVCSequenceHeader to the client. This helps to quickly start the stream and not send SPS\PPS together with IDR every time.

My other implementation of encoder (webrtc -> rtmp -> SRS -> HttpFLV ) sends with IDR every time SPS\PPS. but does not send AVCSequenceHeader in the middle stream. Therefore, the client has to wait for the IDR from the SPS. Yes, you can cache GOP on the server side,, but it also slows down playback at the beginning.