Skip to content

Commit 3e6888e

Browse files
committed
Do not return info on failed media file parse
If the media file failed to parse, returning a structure with only contains nulls is not helpful, as it is assumed a non-null structure represents a file.
1 parent b25e546 commit 3e6888e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

app/src/main/java/protect/videotranscoder/FFmpegUtil.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,14 @@ static MediaInfo parseMediaInfo(File mediaFile, String mediaDetailsJsonStr)
535535
}
536536
}
537537

538-
MediaInfo info = new MediaInfo(mediaFile, durationMs, container, videoCodec, videoResolution,
539-
videoBitrateK, videoFramerate, audioCodec, audioSampleRate, audioBitrateK, audioChannels);
538+
MediaInfo info = null;
539+
540+
if(container != null && (videoCodec != null || audioCodec != null))
541+
{
542+
info = new MediaInfo(mediaFile, durationMs, container, videoCodec, videoResolution,
543+
videoBitrateK, videoFramerate, audioCodec, audioSampleRate, audioBitrateK, audioChannels);
544+
}
545+
540546
return info;
541547
}
542548

0 commit comments

Comments
 (0)