This is actually similar to how it works for traditional TV and Radio Broadcast in copyright societies:
(Total revenue of license period x peak/non peak weighting x duration of song played) / total music duration for license period.
This is something YouTube vehemently fought against. At least in the original 2014 contract with PRS for music.
IIRC YouTube would never send cue sheets (list of included tracks per video) in the usage reporting data. It was just the video title. That was the old deal though - I left before the new deal was signed with ICE services.
Edit: oh, and sampling has its own process. The content creator has to negotiate with each individual rights holder as to the splits when the song is registered.