-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/packages
#6897Labels
⏳Bot is counting down the days until it unassigns the issueBot is counting down the days until it unassigns the issueP2Important issues not at the top of the work listImportant issues not at the top of the work listc: fatal crashCrashes that terminate the processCrashes that terminate the processfound in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.13Found to occur in 3.13Found to occur in 3.13has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: cameraThe camera pluginThe camera pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
Run test code.
Expected results
No crash.
Actual results
Property _lastVideoSampleTime (and also _lastAudioSampleTime) may be improperly initialised when used in CMTimeSubtract which can lead to this exception:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVAssetWriterInputPixelBufferAdaptor appendPixelBuffer:withPresentationTime:] invalid parameter not satisfying: CMTIME_IS_NUMERIC(presentationTime)'
libc++abi: terminating with uncaught exception of type NSException
* thread #9, queue = 'io.flutter.camera.captureSessionQueue', stop reason = signal SIGABRT
Code sample
Code sample
import "dart:io";
import "package:flutter/material.dart";
import "package:camera/camera.dart";
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override Widget build(BuildContext context) => const MaterialApp(home: MyHomePage());
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
bool loading = true;
int counter = 0;
late CameraController camera_cont;
@override void dispose() {
camera_cont.dispose();
super.dispose();
}
@override void initState() {
super.initState();
init_camera();
}
init_camera() async {
final cameras = await availableCameras();
camera_cont = CameraController(cameras.firstWhere((camera) => camera.lensDirection == CameraLensDirection.back), ResolutionPreset.ultraHigh);
await camera_cont.initialize();
setState(() => loading = false);
await camera_cont.prepareForVideoRecording();
for(int i = 0; i < 100; i++)
{
setState(() => counter = i);
await camera_cont.startVideoRecording();
await camera_cont.pauseVideoRecording();
await camera_cont.resumeVideoRecording();
await Future.delayed(const Duration(milliseconds: 100));
final file = await camera_cont.stopVideoRecording();
await File(file.path).delete();
}
}
@override Widget build(BuildContext context)
{
if(loading)return const Center(child: CircularProgressIndicator());
else return Stack(
alignment: Alignment.center,
children: [
CameraPreview(camera_cont),
Text("$counter"),
],
);
}
}Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.10.6, on macOS 13.5 22G74 darwin-x64)wreppun
Metadata
Metadata
Assignees
Labels
⏳Bot is counting down the days until it unassigns the issueBot is counting down the days until it unassigns the issueP2Important issues not at the top of the work listImportant issues not at the top of the work listc: fatal crashCrashes that terminate the processCrashes that terminate the processfound in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.13Found to occur in 3.13Found to occur in 3.13has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: cameraThe camera pluginThe camera pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team