Skip to content

Audio playback form mic to speaker works on flutter web but keeps crashing when I test in on android device #3

@gbaranedavid

Description

@gbaranedavid

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:So I am trying to record audio from mic and play it back on the speaker in real time using the tAudio library for recording from mic and using tAudio library for audio playback. Now everything works perfectly on flutter web but when I try running and testing it on my android device, it records for only about a second or less and the app closes abruptly. below is my full code:

/*
 * Copyright 2018, 2019, 2020, 2021 Dooboolab.
 *
 * This file is part of Flutter-Sound.
 *
 * Flutter-Sound is free software: you can redistribute it and/or modify
 * it under the terms of the Mozilla Public License version 2 (MPL2.0),
 * as published by the Mozilla organization.
 *
 * Flutter-Sound is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * MPL General Public License for more details.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

import 'dart:async';
import 'package:flutter/foundation.dart' show kIsWeb, Uint8List;
import 'package:flutter/material.dart';
import 'package:taudio/taudio.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:audio_session/audio_session.dart';

/*

This is a very simple example for Flutter Sound beginners,
hat shows how to record, and then playback a file.

This example is really basic.

 */
void main() {
  runApp(const MaterialApp(
    home: PlayFromMic(),
  ));
}
typedef _Fn = void Function();

const theSource = AudioSource.microphone;

// Example app.
class PlayFromMic extends StatefulWidget {
  const PlayFromMic({super.key});

  @override
  State<PlayFromMic> createState() => _PlayFromMic();
}

class _PlayFromMic extends State<PlayFromMic> {
  /// Our player
  final FlutterSoundPlayer _mPlayer = FlutterSoundPlayer();

  /// Our recorder
  final FlutterSoundRecorder _mRecorder = FlutterSoundRecorder();


  var recordingDataControllerUint8 = StreamController<Uint8List>();


  Future<void> init() async {
    final session = await AudioSession.instance;
    await session.configure(AudioSessionConfiguration(
      avAudioSessionCategory: AVAudioSessionCategory.playAndRecord,
      avAudioSessionCategoryOptions:
      AVAudioSessionCategoryOptions.allowBluetooth |
      AVAudioSessionCategoryOptions.defaultToSpeaker,
      avAudioSessionMode: AVAudioSessionMode.spokenAudio,
      avAudioSessionRouteSharingPolicy:
      AVAudioSessionRouteSharingPolicy.defaultPolicy,
      avAudioSessionSetActiveOptions: AVAudioSessionSetActiveOptions.none,
      androidAudioAttributes: const AndroidAudioAttributes(
        contentType: AndroidAudioContentType.speech,
        flags: AndroidAudioFlags.none,
        usage: AndroidAudioUsage.voiceCommunication,
      ),
      androidAudioFocusGainType: AndroidAudioFocusGainType.gain,
      androidWillPauseWhenDucked: true,
    ));

    _mPlayer.openPlayer().then((value) {
      setState(() {
        _mPlayerIsInited = true;
      });
    });

    openTheRecorder().then((value) {
      setState(() {
        _mRecorderIsInited = true;
      });
    });
  }

  @override
  void initState() {
    super.initState();
    init();
  }

  @override
  void dispose() {
    _mPlayer.closePlayer();

    _mRecorder.closeRecorder();
    super.dispose();
  }

  // ------------------------------ This is the recorder stuff -----------------------------

  static const Codec _codec = Codec.pcm16;
  static const int _sampleRate = 48000;

  bool _mRecorderIsInited = false;
  double _dbLevel = 0.0;
  StreamSubscription? _recorderSubscription;
  bool bNoiseSuppression = false;
  bool bEchoCancellation = false;

  /// Request permission to record something and open the recorder
  Future<void> openTheRecorder() async {
    if (!kIsWeb) {
      var status = await Permission.microphone.request();
      if (status != PermissionStatus.granted) {
        throw RecordingPermissionException('Microphone permission not granted');
      }
    }
    await _mRecorder.openRecorder();

    /*_recorderSubscription = */ _mRecorder.onProgress!.listen((e) {
      // pos = e.duration.inMilliseconds; // We do not need this information in this example.
      setState(() {
        _dbLevel = e.decibels as double;
      });
    });
    await _mRecorder.setSubscriptionDuration(
        const Duration(milliseconds: 100)); // DO NOT FORGET THIS CALL !!!

    _mRecorderIsInited = true;
  }

  /// Begin to record.
  /// This is our main function.
  /// We ask Flutter Sound to record to a File.
  void record() async {
    try {
      assert(_mPlayerIsInited && _mRecorder.isStopped && _mPlayer.isStopped);

      await _mPlayer.startPlayerFromStream(
        codec: _codec,
        sampleRate: _sampleRate,
        interleaved: true,
        bufferSize: 1024,
        numChannels: 2,

      );

      await _mRecorder.startRecorder(
        codec: _codec,
        audioSource: theSource,
        //toStreamFloat32: _mPlayer.float32Sink,
        toStream: recordingDataControllerUint8,
        sampleRate: _sampleRate,
        numChannels: 2,
        enableNoiseSuppression: bNoiseSuppression,
        enableEchoCancellation: bEchoCancellation,

      );
      recordingDataControllerUint8.stream.listen((Uint8List buf) {

        //In actual production usage, Uint8List buf will be provided by websocket for _player.feedUint8FromStream(buf); on receiver end
        _mPlayer.feedUint8FromStream(buf);
        //print("===========$buf");

      },
        onError: (error) {
          print('Recorder error: $error');
        },
        onDone: () {
          print('Recorder stopped');
        },);
      setState(() {});


    } catch (e) {
      print('AAAAAAAAAAAAAAAAAAA----------Error starting recorder: $e -----------------BBBBBBBBBBBBBBBBBB------');
    }
  }

  /// Stop the recorder
  void stopRecorder() async {
    await _mPlayer.stopPlayer();
    await _mRecorder.stopRecorder().then((value) {
      setState(() {
        //var url = value;
      });
    });
  }

// ----------------------------- This is the player stuff ---------------------------------

  bool _mPlayerIsInited = false;

  /// Begin to play the recorded sound
  void play() {}

  /// Stop the player
  void stopPlayer() {
    _mPlayer.stopPlayer().then((value) {
      setState(() {});
    });
  }

// ----------------------------- UI --------------------------------------------

  // The user changed its selection. Reset the 3 buffers
  Future<void> reinit() async {
    await _mPlayer.stopPlayer();
    await _mRecorder.stopRecorder();
    setState(() {});
  }

  _Fn? getRecorderFn() {
    if (!_mRecorderIsInited || !_mPlayerIsInited) {
      return null;
    }
    return _mRecorder.isStopped ? record : stopRecorder;
  }

  @override
  Widget build(BuildContext context) {
    Widget makeBody() {
      return Column(
        children: [
          Container(
            margin: const EdgeInsets.all(3),
            padding: const EdgeInsets.all(3),
            height: 200,
            width: double.infinity,
            alignment: Alignment.center,
            decoration: BoxDecoration(
              color: const Color(0xFFFAF0E6),
              border: Border.all(
                color: Colors.indigo,
                width: 3,
              ),
            ),
            child: Column(children: [
              Row(children: [
                ElevatedButton(
                  onPressed: getRecorderFn(),
                  //color: Colors.white,
                  //disabledColor: Colors.grey,
                  child: Text(_mRecorder.isRecording ? 'Stop' : 'Record'),
                ),
                const SizedBox(
                  width: 20,
                ),
                Text(_mRecorder.isRecording
                    ? 'Recording in progress'
                    : 'Recorder is stopped'),
              ]),
              const SizedBox(
                height: 20,
              ),
              _mRecorder.isRecording
                  ? LinearProgressIndicator(
                  value: _dbLevel / 100,
                  valueColor:
                  const AlwaysStoppedAnimation<Color>(Colors.indigo),
                  backgroundColor: Colors.limeAccent)
                  : Container(),
              CheckboxListTile(
                tileColor: const Color(0xFFFAF0E6),
                title: const Text("Noise Suppression"),
                value: bNoiseSuppression,
                onChanged: (newValue) {
                  reinit();
                  setState(() {
                    bNoiseSuppression = newValue!;
                  });
                },
              ),
              CheckboxListTile(
                tileColor: const Color(0xFFFAF0E6),
                title: const Text("Echo Cancellation"),
                value: bEchoCancellation,
                onChanged: (newValue) {
                  reinit();
                  setState(() {
                    bEchoCancellation = newValue!;
                  });
                },
              ),
            ]),
          ),
        ],
      );
    }

    return Scaffold(
      backgroundColor: Colors.blue,
      appBar: AppBar(
        title: const Text('Play from Mic'),
      ),
      body: makeBody(),
    );
  }
}

Here is what I know about the problem so far when I try to debug:

  1. When I reduce the buffer size from 1024 to something lesser like 200 or 500, it still crashes.
  2. When I change the channelNumber from 2 to 1 on the recorder and player, it still crashes.

Note, my action in 1 and 2 was done to reduce memory footprint since I suspected that it was crashing owing to limited capacity of my mobile device(128GB/4GB).

  1. When I only record using tAudio and disable play back by commenting out _mPlayer.feedUint8FromStream(buf);, the app does not crash, and I can observe the audio recorded in uint8list when I log it using print("===========$buf");. I concluded at this point that flutter tAudio library is doing just fine and the app was rather crashing because of the way I was implementing live audio playback using Just_audio library

any push in the right direction would help. Much thanks in advance.

Here is the log after record button is being pressed for the app to record and do a playback of the audio:

I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundPlayer._startPlayerFromStream (package:taudio/public/fs/flutter_sound_player.dart:1320:13)
I/flutter ( 9045): │ #1   FlutterSoundPlayer.startPlayerFromStream.<anonymous closure> (package:taudio/public/fs/flutter_sound_player.dart:1301:13)
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 FS:---> startPlayerFromStream 
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundPlayer._stop (package:taudio/public/fs/flutter_sound_player.dart:1826:13)
I/flutter ( 9045): │ #1   FlutterSoundPlayer._startPlayerFromStream (package:taudio/public/fs/flutter_sound_player.dart:1331:11)
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 FS:---> _stop 
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundPlayer.stopPlayerCompleted (package:taudio/public/fs/flutter_sound_player.dart:360:13)
I/flutter ( 9045): │ #1   MethodChannelFlutterSoundPlayer.channelMethodCallHandler.<anonymous closure> (package:flutter_sound_platform_interface/method_channel_flutter_sound_player.dart:98:21)
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 ---> stopPlayerCompleted: true
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundPlayer.stopPlayerCompleted (package:taudio/public/fs/flutter_sound_player.dart:375:13)
I/flutter ( 9045): │ #1   MethodChannelFlutterSoundPlayer.channelMethodCallHandler.<anonymous closure> (package:flutter_sound_platform_interface/method_channel_flutter_sound_player.dart:98:21)
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 <--- stopPlayerCompleted: true
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundPlayer._stop (package:taudio/public/fs/flutter_sound_player.dart:1885:13)
I/flutter ( 9045): │ #1   <asynchronous suspension>
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 FS:<--- _stop 
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundPlayer.log (package:taudio/public/fs/flutter_sound_player.dart:418:13)
I/flutter ( 9045): │ #1   MethodChannelFlutterSoundPlayer.channelMethodCallHandler.<anonymous closure> (package:flutter_sound_platform_interface/method_channel_flutter_sound_player.dart:118:21)
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 [android]: mediaPlayer prepared and started
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundPlayer._startPlayerFromStream (package:taudio/public/fs/flutter_sound_player.dart:1398:13)
I/flutter ( 9045): │ #1   <asynchronous suspension>
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 FS:<--- startPlayerFromStream 
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundPlayer.startPlayerCompleted (package:taudio/public/fs/flutter_sound_player.dart:341:13)
I/flutter ( 9045): │ #1   MethodChannelFlutterSoundPlayer.channelMethodCallHandler.<anonymous closure> (package:flutter_sound_platform_interface/method_channel_flutter_sound_player.dart:91:21)
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 ---> startPlayerCompleted: true
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundPlayer.startPlayerCompleted (package:taudio/public/fs/flutter_sound_player.dart:353:13)
I/flutter ( 9045): │ #1   MethodChannelFlutterSoundPlayer.channelMethodCallHandler.<anonymous closure> (package:flutter_sound_platform_interface/method_channel_flutter_sound_player.dart:91:21)
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 <--- startPlayerCompleted: true
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): 
I/flutter ( 9045): │ 🐛 FS:<--- _stopRecorder : 
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundRecorder.stopRecorder (package:taudio/public/fs/flutter_sound_recorder.dart:962:13)
I/flutter ( 9045): │ #1   <asynchronous suspension>
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 FS:<--- stopRecorder 
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundRecorder._startRecorder (package:taudio/public/fs/flutter_sound_recorder.dart:831:13)
I/flutter ( 9045): │ #1   FlutterSoundRecorder.startRecorder.<anonymous closure> (package:taudio/public/fs/flutter_sound_recorder.dart:794:13)
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 FS:---> _startRecorder.
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/System.out( 9045): ---> writeAudioDataToFile
I/System.out( 9045): <--- writeAudioDataToFile
I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundRecorder.startRecorderCompleted (package:taudio/public/fs/flutter_sound_recorder.dart:326:13)
I/flutter ( 9045): │ #1   MethodChannelFlutterSoundRecorder.channelMethodCallHandler.<anonymous closure> (package:flutter_sound_platform_interface/method_channel_flutter_sound_recorder.dart:129:24)
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 ---> startRecorderCompleted: true
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundRecorder.startRecorderCompleted (package:taudio/public/fs/flutter_sound_recorder.dart:335:13)
I/flutter ( 9045): │ #1   MethodChannelFlutterSoundRecorder.channelMethodCallHandler.<anonymous closure> (package:flutter_sound_platform_interface/method_channel_flutter_sound_recorder.dart:129:24)
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 <--- startRecorderCompleted: true
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundRecorder._startRecorder (package:taudio/public/fs/flutter_sound_recorder.dart:908:13)
I/flutter ( 9045): │ #1   <asynchronous suspension>
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 FS:<--- _startRecorder.
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 9045): │ #0   FlutterSoundRecorder.startRecorder (package:taudio/public/fs/flutter_sound_recorder.dart:811:13)
I/flutter ( 9045): │ #1   <asynchronous suspension>
I/flutter ( 9045): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 9045): │ 🐛 FS:<--- startRecorder 
I/flutter ( 9045): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

F/libc    ( 9045): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 10010 (Thread-9), pid 9045 (yeconnectsocial)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/a05mxx/a05m:14/UP1A.231005.007/A055FXXS8CYC3:user/release-keys'
Revision: '0'
ABI: 'arm64'
Processor: '7'
Timestamp: 2025-08-15 12:19:44.042267365+0100
Process uptime: 24s
Cmdline: com.example.appsocial
pid: 9045, tid: 10010, name: Thread-9  >>> com.example.appsocial <<<
uid: 10313
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000000
Cause: null pointer dereference
    x0  0000000000000000  x1  000000749957b188  x2  ffffffffffffffd0  x3  00000075c25cfaa0
    x4  0000000000000001  x5  0000000000000001  x6  0000000000001008  x7  000000749957ac70
    x8  0000000000001a80  x9  ffffffffffff8870  x10 0000000000000000  x11 000000749957b188
    x12 00000075c25c9100  x13 0000000000000001  x14 0000000000000000  x15 0000000000000000
    x16 00000075d792c6b0  x17 00000075baf91df0  x18 00000074704a0000  x19 b4000074bc1f3ba8
    x20 b4000074bc1f3800  x21 0000000000000000  x22 000000749957c000  x23 00000075d79228c0
    x24 00000000000002b8  x25 000000749957c000  x26 00000075d7929ad8  x27 0000000000000000
    x28 0000000000000001  x29 000000749957b140
    lr  00000075d78e9ad8  sp  000000749957b0f0  pc  00000075d78e9b10  pst 0000000060001000
19 total frames
backtrace:
      #00 pc 00000000000a8b10  /system/lib64/libaudioclient.so (android::AudioTrack::releaseBuffer(android::AudioTrack::Buffer const*)+160) (BuildId: c9c85c1ccfec157826e4357bcfd80e2c)
      #01 pc 00000000000b443c  /system/lib64/libaudioclient.so (android::AudioTrack::write(void const*, unsigned long, bool)+428) (BuildId: c9c85c1ccfec157826e4357bcfd80e2c)
      #02 pc 00000000001c2b14  /system/lib64/libandroid_runtime.so (int writeToTrack<signed char>(android::sp<android::AudioTrack> const&, int, signed char const*, int, int, bool)+372) (BuildId: f860997c17a32a85d39a4fcf9f819664)
      #03 pc 00000000001bcb38  /system/lib64/libandroid_runtime.so (int android_media_AudioTrack_writeArray<_jbyteArray*>(_JNIEnv*, _jobject*, _jbyteArray*, int, int, int, unsigned char)+216) (BuildId: f860997c17a32a85d39a4fcf9f819664)
      #04 pc 0000000002434fe8  /memfd:jit-cache (deleted) (offset 0x2000000) (art_jni_trampoline+152)
      #05 pc 00000000024348c4  /memfd:jit-cache (deleted) (offset 0x2000000) (android.media.AudioTrack.write+580)
      #06 pc 000000000032d194  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612) (BuildId: 80d2ab18f9d259d8e546c1e6bae752b1)
      #07 pc 000000000067900c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+1580) (BuildId: 80d2ab18f9d259d8e546c1e6bae752b1)
      #08 pc 00000000005c95d0  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+868) (BuildId: 80d2ab18f9d259d8e546c1e6bae752b1)
      #09 pc 000000000031c9b8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 80d2ab18f9d259d8e546c1e6bae752b1)
      #10 pc 00000000001496b8  /data/app/~~wNPNIOz6T4qwkX3uMNDl2Q==/com.example.appsocial-1kyrZcga6M4tVVUSDbkq_A==/base.apk (xyz.canardoux.TauEngine.FlautoPlayerEngine$FeedThread.run+0)
      #11 pc 00000000002dc564  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238.llvm.7923196258099814811)+332) (BuildId: 80d2ab18f9d259d8e546c1e6bae752b1)
      #12 pc 00000000002dbd98  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+888) (BuildId: 80d2ab18f9d259d8e546c1e6bae752b1)
      #13 pc 0000000000344638  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 80d2ab18f9d259d8e546c1e6bae752b1)
      #14 pc 000000000032d194  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612) (BuildId: 80d2ab18f9d259d8e546c1e6bae752b1)
      #15 pc 00000000002de270  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+216) (BuildId: 80d2ab18f9d259d8e546c1e6bae752b1)
      #16 pc 00000000004bfcf4  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+932) (BuildId: 80d2ab18f9d259d8e546c1e6bae752b1)
      #17 pc 0000000000101c2c  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+204) (BuildId: a6a4bb5d4c7b3e99262fee774c3907c6)
      #18 pc 0000000000095a00  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: a6a4bb5d4c7b3e99262fee774c3907c6)

In addition to what I have mentioned above, in my exact use case, I intend to record live audio chunks/frames as uint8list using tAudio library from device A and send it via websocket to device B and also play it via tAudio player.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions