Skip to content

Commit

Permalink
playlist: remove duplicate stream qualities if any exist
Browse files Browse the repository at this point in the history
I saw this happen on a stream that had 720p (source) and transcoded
720p, there's no way to choose between them so just remove the
duplicate.
  • Loading branch information
2bc4 committed Feb 19, 2024
1 parent c265389 commit 2037f09
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/hls/playlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ pub struct VariantPlaylist {
name: String,
}

impl PartialEq for VariantPlaylist {
fn eq(&self, other: &Self) -> bool {
self.name == other.name
}
}

pub struct MasterPlaylist {
variant_playlists: Vec<VariantPlaylist>,
}
Expand Down Expand Up @@ -52,7 +58,7 @@ impl MasterPlaylist {
pub fn new(args: &Args, agent: &Agent) -> Result<Self> {
info!("Fetching playlist for channel {}", args.channel);
let low_latency = !args.no_low_latency;
let master_playlist = if let Some(ref servers) = args.servers {
let mut master_playlist = if let Some(ref servers) = args.servers {
Self::fetch_proxy_playlist(low_latency, servers, &args.codecs, &args.channel, agent)?
} else {
Self::fetch_twitch_playlist(
Expand All @@ -70,6 +76,7 @@ impl MasterPlaylist {
"No variant playlists found"
);

master_playlist.variant_playlists.dedup();
Ok(master_playlist)
}

Expand Down

0 comments on commit 2037f09

Please sign in to comment.