4

I am experimenting on webrtc, My goal is to store remote audio stream as a local file without using the media server, I am aware of aecdump but I don't find proper method or blog to unzip in iOS.

I am using googleWebrtc native framework. Thanks.

Sumit Meena
  • 474
  • 3
  • 11

1 Answers1

0

Yes First to get the IOS directory path you must have to create your own objective c file.

my_ios_wav.mm

#import <Foundation/Foundation.h>
#include <string.h>

    #import "sdk/objc/helpers/NSString+StdString.h"
    
    #include "rtc_base/checks.h"
    
    namespace webrtc{
    std::string myIOSPath() {
      @autoreleasepool {
        NSString* tempDir = NSTemporaryDirectory();
        if (tempDir == nil)
            tempDir = @"/tmp";
        return [NSString stdStringForString:tempDir];
      }
    }
}

After that create a static function in the class you have data that you want to record.

static webrtc::WavWriter* my_funtion()
{
  const std::string outfilewav = webrtc::myIOSPath() + "wavtest1.wav";
  static webrtc::WavWriter *my_wav_pointer(new
  webrtc::WavWriter(outfilewav, 48000,1,webrtc::WavFile::SampleFormat::kInt16));
  return my_wav_pointer;
}

After that call this static function where you want to pass the data to wav file for recording like:

 my_funtion()->WriteSamples(audio_frame->data(), number_of_frames);
Abdul ahad
  • 1,383
  • 7
  • 18