Skip to content

Commit

Permalink
Add AudioProcessor.AudioFormat equals method.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 483983486
  • Loading branch information
Samrobbo authored and microkatz committed Oct 31, 2022
1 parent 8181b3c commit c9585d0
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
*/
package androidx.media3.common.audio;

import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.util.Util;
import com.google.common.base.Objects;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
Expand Down Expand Up @@ -69,6 +71,25 @@ public String toString() {
+ encoding
+ ']';
}

@Override
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
if (!(o instanceof AudioFormat)) {
return false;
}
AudioFormat that = (AudioFormat) o;
return sampleRate == that.sampleRate
&& channelCount == that.channelCount
&& encoding == that.encoding;
}

@Override
public int hashCode() {
return Objects.hashCode(sampleRate, channelCount, encoding);
}
}

/** Exception thrown when a processor can't be configured for a given input audio format. */
Expand Down

0 comments on commit c9585d0

Please sign in to comment.