Skip to content

Commit

Permalink
Some miscellaneous fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TacoTheDank committed Sep 4, 2022
1 parent 6f6a9d1 commit 1e01861
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,25 @@ private AudioTrack createAudioTrack(int channelConfig, int sampleRate, int buffe
.setChannelMask(channelConfig)
.build();

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
// Use FLAG_LOW_LATENCY on L through N
if (lowLatency) {
attributesBuilder.setFlags(AudioAttributes.FLAG_LOW_LATENCY);
}
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
AudioTrack.Builder trackBuilder = new AudioTrack.Builder()
.setAudioFormat(format)
.setAudioAttributes(attributesBuilder.build())
.setTransferMode(AudioTrack.MODE_STREAM)
.setBufferSizeInBytes(bufferSize);

// Use PERFORMANCE_MODE_LOW_LATENCY on O and later
if (lowLatency) {
trackBuilder.setPerformanceMode(AudioTrack.PERFORMANCE_MODE_LOW_LATENCY);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
&& Build.VERSION.SDK_INT < Build.VERSION_CODES.O
) {
// Use FLAG_LOW_LATENCY on N through N_MR1
attributesBuilder.setFlags(AudioAttributes.FLAG_LOW_LATENCY);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Use PERFORMANCE_MODE_LOW_LATENCY on O and later
trackBuilder.setPerformanceMode(AudioTrack.PERFORMANCE_MODE_LOW_LATENCY);
}
}

trackBuilder.setAudioAttributes(attributesBuilder.build());
return trackBuilder.build();
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class GenericGridAdapter<T> extends BaseAdapter {
this.context = context;
this.layoutId = layoutId;

this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.inflater = LayoutInflater.from(context);
}

void setLayoutId(int layoutId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.util.LruCache;

import androidx.core.graphics.BitmapCompat;

import com.limelight.LimeLog;

import java.lang.ref.SoftReference;
Expand All @@ -13,7 +15,7 @@ public class MemoryAssetLoader {
@Override
protected int sizeOf(String key, ScaledBitmap bitmap) {
// Sizeof returns kilobytes
return bitmap.bitmap.getByteCount() / 1024;
return BitmapCompat.getAllocationByteCount(bitmap.bitmap) / 1024;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/limelight/utils/TvChannelHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void createTvChannel(ComputerDetails computer) {

@TargetApi(Build.VERSION_CODES.O)
private void updateChannelIcon(long channelId) {
Bitmap logo = drawableToBitmap(context.getResources().getDrawable(R.drawable.ic_channel));
Bitmap logo = drawableToBitmap(context.getDrawable(R.drawable.ic_channel));
try {
Uri localUri = TvContract.buildChannelLogoUri(channelId);
try (OutputStream outputStream = context.getContentResolver().openOutputStream(localUri)) {
Expand Down

0 comments on commit 1e01861

Please sign in to comment.