Skip to content

Commit

Permalink
Trust audio descryption from manifest / stream could be wrong ([enca]
Browse files Browse the repository at this point in the history
  • Loading branch information
peak3d committed May 10, 2018
1 parent a2ec568 commit 9bd5bdd
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,16 @@ class CodecHandler
AP4_GenericAudioSampleDescription* asd(nullptr);
if (sample_description && (asd = dynamic_cast<AP4_GenericAudioSampleDescription*>(sample_description)))
{
if (asd->GetChannelCount() != info.m_Channels
|| asd->GetSampleRate() != info.m_SampleRate
|| asd->GetSampleSize() != info.m_BitsPerSample)
if ((!info.m_Channels && asd->GetChannelCount() != info.m_Channels)
|| (!info.m_SampleRate && asd->GetSampleRate() != info.m_SampleRate)
|| (!info.m_BitsPerSample && asd->GetSampleSize() != info.m_BitsPerSample))
{
info.m_Channels = asd->GetChannelCount();
info.m_SampleRate = asd->GetSampleRate();
info.m_BitsPerSample = asd->GetSampleSize();
if (!info.m_Channels)
info.m_Channels = asd->GetChannelCount();
if (!info.m_SampleRate)
info.m_SampleRate = asd->GetSampleRate();
if (!info.m_BitsPerSample)
info.m_BitsPerSample = asd->GetSampleSize();
return true;
}
}
Expand Down

0 comments on commit 9bd5bdd

Please sign in to comment.