From 9d3024e13e422349af9c90cb2337768dfba57144 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lukas=20D=C3=BCrrenberger?= <eXpl0it3r@sfml-dev.org>
Date: Thu, 12 Mar 2015 11:29:43 +0100
Subject: [PATCH] Fixed the issue where trying to open a stream didin't reset
 the stream first.

---
 src/SFML/Audio/SoundFileFactory.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/SFML/Audio/SoundFileFactory.cpp b/src/SFML/Audio/SoundFileFactory.cpp
index f773e26a..02d4c99c 100644
--- a/src/SFML/Audio/SoundFileFactory.cpp
+++ b/src/SFML/Audio/SoundFileFactory.cpp
@@ -95,7 +95,7 @@ SoundFileReader* SoundFileFactory::createReaderFromMemory(const void* data, std:
     MemoryInputStream stream;
     stream.open(data, sizeInBytes);
 
-    // Test the filename in all the registered factories
+    // Test the stream for all the registered factories
     for (ReaderFactoryArray::const_iterator it = s_readers.begin(); it != s_readers.end(); ++it)
     {
         stream.seek(0);
@@ -114,9 +114,10 @@ SoundFileReader* SoundFileFactory::createReaderFromStream(InputStream& stream)
     // Register the built-in readers/writers on first call
     ensureDefaultReadersWritersRegistered();
 
-    // Test the filename in all the registered factories
+    // Test the stream for all the registered factories
     for (ReaderFactoryArray::const_iterator it = s_readers.begin(); it != s_readers.end(); ++it)
     {
+        stream.seek(0);
         if (it->check(stream))
             return it->create();
     }