mirror of https://github.com/procxx/kepka.git
				
				
				
			Fix streaming receivedTill reporting.
It was incorrect in case audio and video had different durations.
This commit is contained in:
		
							parent
							
								
									a0b3b1affd
								
							
						
					
					
						commit
						d1cf43f9a4
					
				| 
						 | 
					@ -805,10 +805,15 @@ Media::Player::TrackState Player::prepareLegacyState() const {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
crl::time Player::getCurrentReceivedTill(crl::time duration) const {
 | 
					crl::time Player::getCurrentReceivedTill(crl::time duration) const {
 | 
				
			||||||
 | 
						const auto forTrack = [&](const TrackState &state) {
 | 
				
			||||||
 | 
							return (state.duration > 0 && state.receivedTill == state.duration)
 | 
				
			||||||
 | 
								? std::max(state.receivedTill, duration)
 | 
				
			||||||
 | 
								: state.receivedTill;
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
	const auto previous = std::max(_previousReceivedTill, crl::time(0));
 | 
						const auto previous = std::max(_previousReceivedTill, crl::time(0));
 | 
				
			||||||
	const auto result = std::min(
 | 
						const auto result = std::min(
 | 
				
			||||||
		std::max(_information.audio.state.receivedTill, previous),
 | 
							std::max(forTrack(_information.audio.state), previous),
 | 
				
			||||||
		std::max(_information.video.state.receivedTill, previous));
 | 
							std::max(forTrack(_information.video.state), previous));
 | 
				
			||||||
	return (result >= 0 && duration > 1 && _options.loop)
 | 
						return (result >= 0 && duration > 1 && _options.loop)
 | 
				
			||||||
		? (result % duration)
 | 
							? (result % duration)
 | 
				
			||||||
		: result;
 | 
							: result;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue