Skip to content

Commit

Permalink
Merge branch 'main' into feature/google_maps_flutter_web_marker_clust…
Browse files Browse the repository at this point in the history
…ering
  • Loading branch information
jokerttu committed Apr 11, 2024
2 parents 7fb62b1 + e98839a commit 5bbb35d
Show file tree
Hide file tree
Showing 205 changed files with 15,017 additions and 4,600 deletions.
2 changes: 1 addition & 1 deletion .ci/flutter_master.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a418568a64985c5dfc16a7073688bd5865e85cdd
97cd47a02e60a31741a163794120f63a568c0f9f
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
# because there doesn't appear to be anything to wait for. To avoid that,
# explicitly wait for one LUCI test by name first.
- name: Wait for test check-in
uses: lewagon/wait-on-check-action@595dabb3acf442d47e29c9ec9ba44db0c6bdd18f
uses: lewagon/wait-on-check-action@ccfb013c15c8afb7bf2b7c028fb74dc5a068cccc
with:
ref: ${{ github.sha }}
check-name: 'Linux ci_yaml packages roller'
Expand All @@ -68,7 +68,7 @@ jobs:

# This workflow should be the last to run. So wait for all the other tests to succeed.
- name: Wait on all tests
uses: lewagon/wait-on-check-action@595dabb3acf442d47e29c9ec9ba44db0c6bdd18f
uses: lewagon/wait-on-check-action@ccfb013c15c8afb7bf2b7c028fb74dc5a068cccc
with:
ref: ${{ github.sha }}
running-workflow-name: 'release'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecards-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v1.0.26
uses: github/codeql-action/upload-sarif@4355270be187e1b672a7a1c7c7bae5afdc1ab94a # v1.0.26
with:
sarif_file: results.sarif
26 changes: 12 additions & 14 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ packages/interactive_media_ads/** @bparrishMines
packages/in_app_purchase/** @bparrishMines
packages/local_auth/** @stuartmorgan
packages/metrics_center/** @keyonghan
packages/multicast_dns/** @dnfield
packages/multicast_dns/** @jmagman
packages/palette_generator/** @gspencergoog
packages/path_provider/** @stuartmorgan
packages/pigeon/** @tarrinneal
Expand Down Expand Up @@ -81,23 +81,26 @@ packages/video_player/video_player_android/** @camsim99
# Owned by ecosystem team for now during the wrapper evaluation.
packages/webview_flutter/webview_flutter_android/** @bparrishMines

# - iOS
# - Darwin
packages/camera/camera_avfoundation/** @hellohuanlin
packages/file_selector/file_selector_ios/** @jmagman
packages/google_maps_flutter/google_maps_flutter_ios/** @hellohuanlin
packages/google_sign_in/google_sign_in_ios/** @vashworth
packages/image_picker/image_picker_ios/** @vashworth
packages/file_selector/file_selector_macos/** @jmagman
packages/google_maps_flutter/google_maps_flutter_ios/** @cbracken
packages/google_sign_in/google_sign_in_ios/** @vashworth @loic-sharma
packages/image_picker/image_picker_ios/** @vashworth @loic-sharma
packages/image_picker/image_picker_macos/** @jmagman
packages/in_app_purchase/in_app_purchase_storekit/** @louisehsu
packages/ios_platform_images/** @jmagman
packages/local_auth/local_auth_darwin/** @louisehsu
packages/path_provider/path_provider_foundation/** @jmagman
packages/pigeon/**/ios/**/* @hellohuanlin
packages/pointer_interceptor/pointer_interceptor_ios/** @ditman
packages/quick_actions/quick_actions_ios/** @hellohuanlin
packages/pigeon/**/ios/**/* @hellohuanlin @louisehsu
packages/pointer_interceptor/pointer_interceptor_ios/** @louisehsu
packages/quick_actions/quick_actions_ios/** @jmagman
packages/shared_preferences/shared_preferences_foundation/** @tarrinneal
packages/url_launcher/url_launcher_ios/** @jmagman
packages/url_launcher/url_launcher_macos/** @jmagman
packages/video_player/video_player_avfoundation/** @hellohuanlin
packages/webview_flutter/webview_flutter_wkwebview/** @hellohuanlin
packages/webview_flutter/webview_flutter_wkwebview/** @cbracken

# - Linux
packages/file_selector/file_selector_linux/** @cbracken
Expand All @@ -106,11 +109,6 @@ packages/path_provider/path_provider_linux/** @cbracken
packages/shared_preferences/shared_preferences_linux/** @cbracken
packages/url_launcher/url_launcher_linux/** @cbracken

# - macOS
packages/file_selector/file_selector_macos/** @cbracken
packages/image_picker/image_picker_macos/** @cbracken
packages/url_launcher/url_launcher_macos/** @cbracken

# - Windows
packages/camera/camera_windows/** @cbracken
packages/file_selector/file_selector_windows/** @cbracken
Expand Down
8 changes: 8 additions & 0 deletions packages/camera/camera_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.10.9+1

* Changes the visibility of a number of fields to `@VisibleForTesting` in order simplify testing.

## 0.10.9

* Adds support to control video FPS and bitrate. See `CameraController.withSettings`.

## 0.10.8+18

* Updates annotations lib to 1.7.1.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@
import android.os.HandlerThread;
import android.os.Looper;
import android.util.Log;
import android.util.Range;
import android.util.Size;
import android.view.Display;
import android.view.Surface;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import io.flutter.BuildConfig;
import io.flutter.embedding.engine.systemchannels.PlatformChannel;
import io.flutter.plugin.common.EventChannel;
import io.flutter.plugin.common.MethodChannel;
Expand All @@ -52,6 +54,7 @@
import io.flutter.plugins.camera.features.flash.FlashFeature;
import io.flutter.plugins.camera.features.flash.FlashMode;
import io.flutter.plugins.camera.features.focuspoint.FocusPointFeature;
import io.flutter.plugins.camera.features.fpsrange.FpsRangeFeature;
import io.flutter.plugins.camera.features.resolution.ResolutionFeature;
import io.flutter.plugins.camera.features.resolution.ResolutionPreset;
import io.flutter.plugins.camera.features.sensororientation.DeviceOrientationManager;
Expand Down Expand Up @@ -102,17 +105,16 @@ class Camera
* Takes an input/output surface and orients the recording correctly. This is needed because
* switching cameras while recording causes the wrong orientation.
*/
private VideoRenderer videoRenderer;
@VisibleForTesting VideoRenderer videoRenderer;

/**
* Whether or not the camera aligns with the initial way the camera was facing if the camera was
* flipped.
*/
private int initialCameraFacing;
@VisibleForTesting int initialCameraFacing;

private final SurfaceTextureEntry flutterTexture;
private final ResolutionPreset resolutionPreset;
private final boolean enableAudio;
@VisibleForTesting final SurfaceTextureEntry flutterTexture;
private final VideoCaptureSettings videoCaptureSettings;
private final Context applicationContext;
final DartMessenger dartMessenger;
private CameraProperties cameraProperties;
Expand All @@ -128,16 +130,16 @@ class Camera

CameraDeviceWrapper cameraDevice;
CameraCaptureSession captureSession;
private ImageReader pictureImageReader;
@VisibleForTesting ImageReader pictureImageReader;
ImageStreamReader imageStreamReader;
/** {@link CaptureRequest.Builder} for the camera preview */
CaptureRequest.Builder previewRequestBuilder;

private MediaRecorder mediaRecorder;
@VisibleForTesting MediaRecorder mediaRecorder;
/** True when recording video. */
boolean recordingVideo;
/** True when the preview is paused. */
private boolean pausedPreview;
@VisibleForTesting boolean pausedPreview;

private File captureFile;

Expand Down Expand Up @@ -185,29 +187,80 @@ public void close() {
}
}

public static class VideoCaptureSettings {
@NonNull public final ResolutionPreset resolutionPreset;
public final boolean enableAudio;
@Nullable public final Integer fps;
@Nullable public final Integer videoBitrate;
@Nullable public final Integer audioBitrate;

public VideoCaptureSettings(
@NonNull ResolutionPreset resolutionPreset,
boolean enableAudio,
@Nullable Integer fps,
@Nullable Integer videoBitrate,
@Nullable Integer audioBitrate) {
this.resolutionPreset = resolutionPreset;
this.enableAudio = enableAudio;
this.fps = fps;
this.videoBitrate = videoBitrate;
this.audioBitrate = audioBitrate;
}

public VideoCaptureSettings(@NonNull ResolutionPreset resolutionPreset, boolean enableAudio) {
this(resolutionPreset, enableAudio, null, null, null);
}
}

public Camera(
final Activity activity,
final SurfaceTextureEntry flutterTexture,
final CameraFeatureFactory cameraFeatureFactory,
final DartMessenger dartMessenger,
final CameraProperties cameraProperties,
final ResolutionPreset resolutionPreset,
final boolean enableAudio) {
final VideoCaptureSettings videoCaptureSettings) {

if (activity == null) {
throw new IllegalStateException("No activity available!");
}
this.activity = activity;
this.enableAudio = enableAudio;
this.flutterTexture = flutterTexture;
this.dartMessenger = dartMessenger;
this.applicationContext = activity.getApplicationContext();
this.cameraProperties = cameraProperties;
this.cameraFeatureFactory = cameraFeatureFactory;
this.resolutionPreset = resolutionPreset;
this.videoCaptureSettings = videoCaptureSettings;
this.cameraFeatures =
CameraFeatures.init(
cameraFeatureFactory, cameraProperties, activity, dartMessenger, resolutionPreset);
cameraFeatureFactory,
cameraProperties,
activity,
dartMessenger,
videoCaptureSettings.resolutionPreset);

Integer recordingFps = null;

if (videoCaptureSettings.fps != null && videoCaptureSettings.fps.intValue() > 0) {
recordingFps = videoCaptureSettings.fps;
} else {

if (SdkCapabilityChecker.supportsEncoderProfiles()) {
EncoderProfiles encoderProfiles = getRecordingProfile();
if (encoderProfiles != null && encoderProfiles.getVideoProfiles().size() > 0) {
recordingFps = encoderProfiles.getVideoProfiles().get(0).getFrameRate();
}
} else {
CamcorderProfile camcorderProfile = getRecordingProfileLegacy();
recordingFps = null != camcorderProfile ? camcorderProfile.videoFrameRate : null;
}
}

if (recordingFps != null && recordingFps.intValue() > 0) {

final FpsRangeFeature fpsRange = new FpsRangeFeature(cameraProperties);
fpsRange.setValue(new Range<Integer>(recordingFps, recordingFps));
this.cameraFeatures.setFpsRange(fpsRange);
}

// Create capture callback.
captureTimeouts = new CaptureTimeoutsWrapper(3000, 3000);
Expand Down Expand Up @@ -257,14 +310,28 @@ private void prepareMediaRecorder(String outputFilePath) throws IOException {
// TODO(camsim99): Revert changes that allow legacy code to be used when recordingProfile is null
// once this has largely been fixed on the Android side. https://github.com/flutter/flutter/issues/119668
if (SdkCapabilityChecker.supportsEncoderProfiles() && getRecordingProfile() != null) {
mediaRecorderBuilder = new MediaRecorderBuilder(getRecordingProfile(), outputFilePath);
mediaRecorderBuilder =
new MediaRecorderBuilder(
getRecordingProfile(),
new MediaRecorderBuilder.RecordingParameters(
outputFilePath,
videoCaptureSettings.fps,
videoCaptureSettings.videoBitrate,
videoCaptureSettings.audioBitrate));
} else {
mediaRecorderBuilder = new MediaRecorderBuilder(getRecordingProfileLegacy(), outputFilePath);
mediaRecorderBuilder =
new MediaRecorderBuilder(
getRecordingProfileLegacy(),
new MediaRecorderBuilder.RecordingParameters(
outputFilePath,
videoCaptureSettings.fps,
videoCaptureSettings.videoBitrate,
videoCaptureSettings.audioBitrate));
}

mediaRecorder =
mediaRecorderBuilder
.setEnableAudio(enableAudio)
.setEnableAudio(videoCaptureSettings.enableAudio)
.setMediaOrientation(
lockedOrientation == null
? getDeviceOrientationManager().getVideoOrientation()
Expand Down Expand Up @@ -1314,7 +1381,11 @@ public void setDescriptionWhileRecording(
cameraProperties = properties;
cameraFeatures =
CameraFeatures.init(
cameraFeatureFactory, cameraProperties, activity, dartMessenger, resolutionPreset);
cameraFeatureFactory,
cameraProperties,
activity,
dartMessenger,
videoCaptureSettings.resolutionPreset);
cameraFeatures.setAutoFocus(
cameraFeatureFactory.createAutoFocusFeature(cameraProperties, true));
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.os.Looper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import io.flutter.embedding.engine.systemchannels.PlatformChannel;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.EventChannel;
Expand All @@ -36,7 +37,7 @@ final class MethodCallHandlerImpl implements MethodChannel.MethodCallHandler {
private final TextureRegistry textureRegistry;
private final MethodChannel methodChannel;
private final EventChannel imageStreamChannel;
private @Nullable Camera camera;
@VisibleForTesting @Nullable Camera camera;

MethodCallHandlerImpl(
Activity activity,
Expand Down Expand Up @@ -388,6 +389,9 @@ private void instantiateCamera(MethodCall call, Result result) throws CameraAcce
String cameraName = call.argument("cameraName");
String preset = call.argument("resolutionPreset");
boolean enableAudio = call.argument("enableAudio");
Integer fps = call.argument("fps");
Integer videoBitrate = call.argument("videoBitrate");
Integer audioBitrate = call.argument("audioBitrate");

TextureRegistry.SurfaceTextureEntry flutterSurfaceTexture =
textureRegistry.createSurfaceTexture();
Expand All @@ -405,8 +409,8 @@ private void instantiateCamera(MethodCall call, Result result) throws CameraAcce
new CameraFeatureFactoryImpl(),
dartMessenger,
cameraProperties,
resolutionPreset,
enableAudio);
new Camera.VideoCaptureSettings(
resolutionPreset, enableAudio, fps, videoBitrate, audioBitrate));

Map<String, Object> reply = new HashMap<>();
reply.put("cameraId", flutterSurfaceTexture.id());
Expand Down

0 comments on commit 5bbb35d

Please sign in to comment.