瀏覽代碼

LibAudio: Use an existing file stream when parsing a FLAC header

Before this change the file stream was generated two times:
one time in the parse_header(), and another time for the whole class
in the constructor.

The previous commit moved the m_stream initialization before
executing the parse_header function, so we can now reuse that here.
Karol Kosek 4 年之前
父節點
當前提交
e500b39e47
共有 1 個文件被更改,包括 1 次插入3 次删除
  1. 1 3
      Userland/Libraries/LibAudio/FlacLoader.cpp

+ 1 - 3
Userland/Libraries/LibAudio/FlacLoader.cpp

@@ -69,13 +69,11 @@ bool FlacLoaderPlugin::sniff()
 
 bool FlacLoaderPlugin::parse_header()
 {
-    Optional<Core::InputFileStream> fis;
     bool ok = true;
 
     InputBitStream bit_input = [&]() -> InputBitStream {
         if (m_file) {
-            fis = Core::InputFileStream(*m_file);
-            return InputBitStream(*fis);
+            return InputBitStream(m_stream->get<Core::InputFileStream>());
         }
         return InputBitStream(m_stream->get<InputMemoryStream>());
     }();