@@ -177,7 +177,7 @@ private async Task<bool> DownloadStreamAsync(StreamSpec streamSpec, ProgressTask
177177 // 从文件读取KEY
178178 await SearchKeyAsync ( currentKID ) ;
179179 // 实时解密
180- if ( DownloaderConfig . MyOptions . MP4RealTimeDecryption && ! string . IsNullOrEmpty ( currentKID ) && StreamExtractor . ExtractorType != ExtractorType . MSS )
180+ if ( streamSpec . Playlist . MediaInit . IsEncrypted && DownloaderConfig . MyOptions . MP4RealTimeDecryption && ! string . IsNullOrEmpty ( currentKID ) && StreamExtractor . ExtractorType != ExtractorType . MSS )
181181 {
182182 var enc = result . ActualFilePath ;
183183 var dec = Path . Combine ( Path . GetDirectoryName ( enc ) ! , Path . GetFileNameWithoutExtension ( enc ) + "_dec" + Path . GetExtension ( enc ) ) ;
@@ -225,7 +225,7 @@ private async Task<bool> DownloadStreamAsync(StreamSpec streamSpec, ProgressTask
225225 var processor = new MSSMoovProcessor ( streamSpec ) ;
226226 var header = processor . GenHeader ( File . ReadAllBytes ( result . ActualFilePath ) ) ;
227227 await File . WriteAllBytesAsync ( FileDic [ streamSpec . Playlist ! . MediaInit ! ] ! . ActualFilePath , header ) ;
228- if ( DownloaderConfig . MyOptions . MP4RealTimeDecryption && ! string . IsNullOrEmpty ( currentKID ) )
228+ if ( seg . IsEncrypted && DownloaderConfig . MyOptions . MP4RealTimeDecryption && ! string . IsNullOrEmpty ( currentKID ) )
229229 {
230230 // 需要重新解密init
231231 var enc = FileDic [ streamSpec . Playlist ! . MediaInit ! ] ! . ActualFilePath ;
@@ -249,7 +249,7 @@ private async Task<bool> DownloadStreamAsync(StreamSpec streamSpec, ProgressTask
249249 // 从文件读取KEY
250250 await SearchKeyAsync ( currentKID ) ;
251251 // 实时解密
252- if ( DownloaderConfig . MyOptions . MP4RealTimeDecryption && ! string . IsNullOrEmpty ( currentKID ) )
252+ if ( seg . IsEncrypted && DownloaderConfig . MyOptions . MP4RealTimeDecryption && ! string . IsNullOrEmpty ( currentKID ) )
253253 {
254254 var enc = result . ActualFilePath ;
255255 var dec = Path . Combine ( Path . GetDirectoryName ( enc ) ! , Path . GetFileNameWithoutExtension ( enc ) + "_dec" + Path . GetExtension ( enc ) ) ;
@@ -287,7 +287,7 @@ await Parallel.ForEachAsync(segments, options, async (seg, _) =>
287287 if ( result != null && result . Success )
288288 task . Increment ( 1 ) ;
289289 // 实时解密
290- if ( DownloaderConfig . MyOptions . MP4RealTimeDecryption && result != null && result . Success && ! string . IsNullOrEmpty ( currentKID ) )
290+ if ( seg . IsEncrypted && DownloaderConfig . MyOptions . MP4RealTimeDecryption && result != null && result . Success && ! string . IsNullOrEmpty ( currentKID ) )
291291 {
292292 var enc = result . ActualFilePath ;
293293 var dec = Path . Combine ( Path . GetDirectoryName ( enc ) ! , Path . GetFileNameWithoutExtension ( enc ) + "_dec" + Path . GetExtension ( enc ) ) ;
0 commit comments