Skip to content

Commit

Permalink
Simplify decision tree
Browse files Browse the repository at this point in the history
While reading this part of the code I was wondering why it wasn't made somewhat easier.
Why do we return an empty string for Video, and default for Audio to AAC ?
  • Loading branch information
dagwieers authored and peak3d committed May 11, 2019
1 parent 1139876 commit d029148
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/parser/HLSTree.cpp
Expand Up @@ -56,16 +56,16 @@ static void parseResolution(std::uint16_t &width, std::uint16_t &height, const s

static std::string getVideoCodec(const std::string &codecs)
{
if (codecs.empty() || codecs.find("avc1.") != std::string::npos)
if (codecs.empty())
return "h264";
else if (!codecs.empty())
{
if (codecs.find("hvc1.") != std::string::npos)
return "hvc1";
else if (codecs.find("hev1.") != std::string::npos)
return "hev1";
}
return "";
else if (codecs.find("avc1.") != std::string::npos)
return "h264";
else if (codecs.find("hvc1.") != std::string::npos)
return "hvc1";
else if (codecs.find("hev1.") != std::string::npos)
return "hev1";
else
return "";
}

static std::string getAudioCodec(const std::string &codecs)
Expand All @@ -75,7 +75,7 @@ static std::string getAudioCodec(const std::string &codecs)
else if (codecs.find("ac-3") != std::string::npos)
return "ac-3";
else
return "aac";
return "aac";
}

HLSTree::~HLSTree()
Expand Down

0 comments on commit d029148

Please sign in to comment.