diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c
index 759bd7dde3d5b206aa6497c5510d63416edd5e6e..6c4432f6b40777409431c3ae1cabf7977eaa65a6 100644
--- a/src/sdl/mixer_sound.c
+++ b/src/sdl/mixer_sound.c
@@ -438,6 +438,13 @@ void I_SetSfxVolume(UINT8 volume)
 // Music
 //
 
+static void count_music_bytes(int chan, void *stream, int len, void *udata)
+{
+	if(midimode || !music)
+		return;
+	music_bytes += len;
+}
+
 // Music hooks
 static void music_loop(void)
 {
@@ -448,14 +455,12 @@ static void music_loop(void)
 		music_bytes = loop_point/1000.0L*44100.0L*4; //assume 44.1khz, 4-byte length (see I_GetMusicPosition)
 	}
 	else
-		music_bytes = 0;
-}
-
-static void count_music_bytes(int chan, void *stream, int len, void *udata)
-{
-	if(midimode || !music)
-		return;
-	music_bytes += len;
+	{
+		Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes);
+		music_bytes = 0; 
+			// be consistent with FMOD, otherwise I'd prefer to freeze music_bytes
+			// since the other flags indicate music is still playing.
+	}
 }
 
 #ifdef HAVE_LIBGME