Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: when setPreviewSurfaces is not called startEncoding gives a null Pointer #3125

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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