From bfd64bc67a42592c0f176563d06530e25258047f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20Stenstr=C3=B6m?= Date: Tue, 28 Dec 2021 22:06:05 +0100 Subject: [PATCH] Removed method StreamPlayer.getPositionByte() The method was used in a unit test, as a means to test the StreamPlayer.seekTo() method, but it never worked. The StreamPlayer.getPositionByte() didn't seem to work. There are no other callers of getPositionByte() method in this codebase. It is not used by XR3Player. It seems safe to remove it. If the method really worked (which I doubt), then this is a non-backwards-compatible change. This change is a part of an effort to make all unit tests pass, by either updating the production code, the tests, or remove the failing tests. --- .../streamplayer/stream/StreamPlayer.java | 15 --------------- .../stream/StreamPlayerInterface.java | 5 ----- .../StreamPlayerFutureImprovementTest.java | 17 ----------------- .../stream/StreamPlayerMethodsTest.java | 7 ------- 4 files changed, 44 deletions(-) diff --git a/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java b/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java index de5f041..57fb1b1 100644 --- a/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java +++ b/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java @@ -1174,21 +1174,6 @@ public long getTotalBytes() { return encodedAudioLength; } - /** - * @return BytePosition - */ - @Override - public int getPositionByte() { - final int positionByte = AudioSystem.NOT_SPECIFIED; - if (audioProperties != null) { - if (audioProperties.containsKey("mp3.position.byte")) - return (Integer) audioProperties.get("mp3.position.byte"); - if (audioProperties.containsKey("ogg.position.byte")) - return (Integer) audioProperties.get("ogg.position.byte"); - } - return positionByte; - } - /** The source data line. */ public Outlet getOutlet() { return outlet; diff --git a/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayerInterface.java b/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayerInterface.java index db81dd0..3d09aa1 100644 --- a/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayerInterface.java +++ b/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayerInterface.java @@ -230,11 +230,6 @@ public interface StreamPlayerInterface { */ long getTotalBytes(); - /** - * @return BytePosition - */ - int getPositionByte(); - /** * Gets the source data line. * diff --git a/src/test/java/com/goxr3plus/streamplayer/stream/StreamPlayerFutureImprovementTest.java b/src/test/java/com/goxr3plus/streamplayer/stream/StreamPlayerFutureImprovementTest.java index 4a6c452..093ed5b 100644 --- a/src/test/java/com/goxr3plus/streamplayer/stream/StreamPlayerFutureImprovementTest.java +++ b/src/test/java/com/goxr3plus/streamplayer/stream/StreamPlayerFutureImprovementTest.java @@ -53,21 +53,4 @@ void playingUnopenedSourceThrowsException() { assertThrows(Exception.class, () -> player.play()); } - @Test - void seekBytes() throws StreamPlayerException { - player.open(audioFile); - player.play(); - int positionByte1 = player.getPositionByte(); - - player.seekBytes(100); - int positionByte2 = player.getPositionByte(); - - assertTrue( positionByte2 > positionByte1); - - // TODO: It seems that getPositionByte doesn't work. - // It isn't called from within this project, except for in this test. - // It is however called by XR3Player. If XR3Player needs this method, it must be tested - // within this project. The method relies on a map, which doesn't seem to be updated by play() - } - } diff --git a/src/test/java/com/goxr3plus/streamplayer/stream/StreamPlayerMethodsTest.java b/src/test/java/com/goxr3plus/streamplayer/stream/StreamPlayerMethodsTest.java index 1239ce4..c4b3e12 100644 --- a/src/test/java/com/goxr3plus/streamplayer/stream/StreamPlayerMethodsTest.java +++ b/src/test/java/com/goxr3plus/streamplayer/stream/StreamPlayerMethodsTest.java @@ -540,13 +540,6 @@ void minimumGain() { fail("Test not done"); } - @Test - void positionByte() { - player.getPositionByte(); - - fail("Test not done"); - } - @Test void precision() throws StreamPlayerException { assertEquals(0f, player.getPrecision());