优化不必要的调用

This commit is contained in:
nilaoda 2022-10-31 02:44:52 +08:00
parent b04dc0f43c
commit b46db566a5
1 changed files with 2 additions and 3 deletions

View File

@ -127,19 +127,18 @@ namespace N_m3u8DL_RE.DownloadManager
useAACFilter = true; useAACFilter = true;
} }
if (mediainfos.All(m => m.Type == "Audio")) if (mediainfos.All(m => m.Type == "Audio") && streamSpec.MediaType != MediaType.AUDIO)
{ {
var lastKey = streamSpec.ToShortString(); var lastKey = streamSpec.ToShortString();
streamSpec.MediaType = MediaType.AUDIO; streamSpec.MediaType = MediaType.AUDIO;
var newKey = streamSpec.ToShortString(); var newKey = streamSpec.ToShortString();
//需要同步修改Dictionary中的Key //需要同步修改Dictionary中的Key
if (LastFileNameDic.Remove(lastKey, out var lastValue1)) if (LastFileNameDic.Remove(lastKey, out var lastValue1))
LastFileNameDic[newKey] = lastValue1!; LastFileNameDic[newKey] = lastValue1!;
if (DateTimeDic.Remove(lastKey, out var lastValue2)) if (DateTimeDic.Remove(lastKey, out var lastValue2))
DateTimeDic[newKey] = lastValue2; DateTimeDic[newKey] = lastValue2;
} }
else if (mediainfos.All(m => m.Type == "Subtitle")) else if (mediainfos.All(m => m.Type == "Subtitle") && streamSpec.MediaType != MediaType.SUBTITLES)
{ {
var lastKey = streamSpec.ToShortString(); var lastKey = streamSpec.ToShortString();
streamSpec.MediaType = MediaType.SUBTITLES; streamSpec.MediaType = MediaType.SUBTITLES;