Skip to content

Commit

Permalink
fix: when setPreviewSurfaces is not called startEncoding gives a null…
Browse files Browse the repository at this point in the history
… pointer (#3125)

Co-authored-by: Thomas Leing <bluezebragames@gmail.com>
  • Loading branch information
jffp113 and tjleing authored Feb 16, 2023
1 parent 8ff0fb8 commit 14d7a3d
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package com.amazonaws.mobileconnectors.kinesisvideo.mediasource.android;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

import android.content.Context;
Expand Down Expand Up @@ -73,7 +74,7 @@ public class AndroidCameraMediaSource implements MediaSource {

private CameraFramesSource mCameraFramesSource;
private EncodingCancellationToken mEncodingCancellationToken;
private List<Surface> mPreivewSurfaces;
private List<Surface> mPreviewSurfaces;

private MediaSourceState mMediaSourceState;
private CameraMediaSourceConfiguration mMediaSourceConfiguration;
Expand All @@ -93,10 +94,11 @@ public AndroidCameraMediaSource(final String streamName, final Context context)
mContext = context;
mStreamName = streamName;
mEncodingCancellationToken = new EncodingCancellationToken();
mPreviewSurfaces = new LinkedList<>();
}

public void setPreviewSurfaces(final Surface ... surfaces) {
mPreivewSurfaces = Arrays.asList(surfaces);
mPreviewSurfaces = Arrays.asList(surfaces);
}

private CameraFramesSource createFramesSource(final ImageReader imageReader) {
Expand Down Expand Up @@ -223,7 +225,7 @@ private void startEncoding() {

mCameraFramesSource.startEncoding(
mContext,
mPreivewSurfaces,
mPreviewSurfaces,
mMediaSourceConfiguration.getCameraId());
}

Expand Down

0 comments on commit 14d7a3d

Please sign in to comment.