running AppRTC for ios ,RtcEventLog issue - ios

I would like to add an interface in AppRTCMobile, this interface can start webrtc Call module, in order to achieve the audio call between two phones (LAN, already know both the IP address and port number), but when I run successfully , The software crashes every time an exception occurs when the method is called by RtcEventLog. I do not know if Calling Call is reasonable or not. I sincerely thank you for your help in the absence of a solution.
Below the source code, please help me find the problem.
std::unique_ptr<RtcEventLog> event_log = webrtc::RtcEventLog::Create();
webrtc::Call::Config callConfig = webrtc::Call::Config(event_log.get());
callConfig.bitrate_config.max_bitrate_bps = 500*1000;
callConfig.bitrate_config.min_bitrate_bps = 100*1000;
callConfig.bitrate_config.start_bitrate_bps = 250*1000;
webrtc::AudioState::Config audio_state_config = webrtc::AudioState::Config();
cricket::VoEWrapper* g_voe = nullptr;
rtc::scoped_refptr<webrtc::AudioDecoderFactory> g_audioDecoderFactory;
g_audioDecoderFactory = webrtc::CreateBuiltinAudioDecoderFactory();
g_voe = new cricket::VoEWrapper();
audio_state_config.audio_processing = webrtc::AudioProcessing::Create();
g_voe->base()->Init(NULL,audio_state_config.audio_processing,g_audioDecoderFactory);
audio_state_config.voice_engine = g_voe->engine();
audio_state_config.audio_mixer = webrtc::AudioMixerImpl::Create();
callConfig.audio_state = AudioState::Create(audio_state_config);
std::unique_ptr<RtcEventLog> event_logg = webrtc::RtcEventLog::Create();
callConfig.event_log = event_logg.get();
g_call = webrtc::Call::Create(callConfig);
g_audioSendTransport = new AudioLoopbackTransport();
webrtc::AudioSendStream::Config config(g_audioSendTransport);
g_audioSendChannelId = g_voe->base()->CreateChannel();
config.voe_channel_id = g_audioSendChannelId;
g_audioSendStream = g_call->CreateAudioSendStream(config);
webrtc::AudioReceiveStream::Config AudioReceiveConfig;
AudioReceiveConfig.decoder_factory = g_audioDecoderFactory;
g_audioReceiveChannelId = g_voe->base()->CreateChannel();
AudioReceiveConfig.voe_channel_id = g_audioReceiveChannelId;
g_audioReceiveStream = g_call->CreateAudioReceiveStream(AudioReceiveConfig);
g_audioSendStream->Start();
g_audioReceiveStream->Start();
Here's a screenshot of the error that occurred when the crash occurred. Please tell me if you want to know more.

Your code crashed at event_log_->LogAudioPlayout()...
It's obviously that event_log_ object is already released.
Objects which are managed by unique_ptr or scoped_refptr will be released after execution, but these objects may still be used in your case, that will lead to crash problem. So put these objects in global memory or retain them.

Related

"'isDeveloperModeEnabled' is deprecated: This no longer needs to be set during development. " What is isDeveloperModeEnabled used for

As a part of upgrading the code base to Swift5, I have updated Firebase pod in my project. After that i started getting warning as below.
isDeveloperModeEnabled is deprecated: This no longer needs to be set during development. Refer to documentation for additional details..
Can somebody explain what is the alternative way to resolve this issue
remoteConfig = RemoteConfig.remoteConfig()
let conSettings = RemoteConfigSettings(developerModeEnabled: true)
if TargetBuild.isProd {
remoteConfig.configSettings = RemoteConfigSettings()
} else if settings.isDeveloperModeEnabled {
remoteConfig.configSettings = conSettings
} else {
print("Could not set config settings")
}
i need to resolve the warning on above code. This was an existing codebase. When i did a global search, i didnt see this value getting used. somebody please help me
Old way:
let remoteConfigSettings = RemoteConfigSettings(developerModeEnabled: true)
New way:
let remoteConfigSettings = RemoteConfigSettings()
remoteConfigSettings.minimumFetchInterval = 0
The iOS documentation does not yet mention that developerModeEnabled is deprecated, but an updated commented example can be found here: https://github.com/firebase/quickstart-ios/blob/master/config/ConfigExample/RemoteConfigViewController.swift#L57 (README here)
That config setting is deprecated.. With a simple google search..
https://firebase.google.com/docs/reference/android/com/google/firebase/remoteconfig/FirebaseRemoteConfigSettings.html#getMinimumFetchIntervalInSeconds()
The docs say to use getMinimumFetchIntervalInSeconds() instead of isDeveloperModeEnabled().
Update -- Android docs say it is deprecated, iOS does not say anything about deprecating isDeveloperModeEnabled
https://firebase.google.com/docs/reference/swift/firebaseremoteconfig/api/reference/Classes/RemoteConfigSettings
If you are using Objective-C, you can solve the issue with:
FIRRemoteConfigSettings *remoteConfigSettings = [[FIRRemoteConfigSettings alloc] init];
[remoteConfigSettings setMinimumFetchInterval:0];

What causes a breakpoint to fail to bind?

What causes a breakpoint to fail to bind?
I receive an error when attempting to execute the following expression:
let grid_1 = { grid with Four= grid |> update };; // Updated here
The error I receive is as follows:
Code:
type State = Alive | Dead
type Response = | Survives
| Dies
| Resurected
type Grid = { Zero:State
One:State
Two:State
Three:State
Four:State // Central
Five:State
Six:State
Seven:State
Eight:State }
let isUnderPopulated (grid:Grid) =
let zero = if grid.Zero = Alive then 1 else 0
let one = if grid.One = Alive then 1 else 0
let two = if grid.Two = Alive then 1 else 0
let three = if grid.Three = Alive then 1 else 0
let four = if grid.Four = Alive then 1 else 0
let five = if grid.Five = Alive then 1 else 0
let six = if grid.Six = Alive then 1 else 0
let seven = if grid.Seven = Alive then 1 else 0
let eight = if grid.Eight = Alive then 1 else 0
let livingCount = zero + one + two + three + four + five + six + seven + eight
livingCount < 2
let grid = { Zero = Dead
One = Dead
Two = Dead
Three = Dead
Four = Dead
Five = Dead
Six = Dead
Seven = Dead
Eight = Dead }
let update (grid:Grid) =
let underPopulated = grid |> isUnderPopulated
if underPopulated then Dead
else Alive
let grid_1 = { grid with Four= grid |> update };; // Updated here
You may be trying to bind a breakpoint to an application that is out-of-date, meaning that after changes have been made and before they have been recompiled.
Try:
Compile in Debug mode.
Try to Clean Solution before setting the breakpoint.
Go to the Debug folder, and delete [Your application].pdb file.
Then do a Build or Rebuild your application.
Go to the Debug folder and confirm you have a brand new [Your
application].pdb file.
Then try to set your break point.
You may be not be generating Debug information or you may be in optimization mode which could have an effect on this.
For C++ projects:
Check the following project properties:
C++/General/Debug Information Format: Program Database.
C++/Optimization: Disabled.
C++/Code generation/Runtime library: Multi-threaded Debug.
Linker/Debugging/Generate Debug Info: Yes.
Linker/Debugging/Generate program database:
$(TargetDir)$(TargetName).pdb.
Linker/Manifest File/Generate Manifest: No.
Linker/Manifest File/Allow Isolation: No.
Linker/Embedded IDL/Ignore embedded IDL: Yes.
For C# projects check the following:
In the projects properties set Build/General/Optimize code : Disabled.
In the IDE settings Debug/Options/Debug/General Suppress JIT
optimization on module load (Managed only): Enabled
It may be a bug in your VS.
Try opening your solution in another machines IDE. If you can bind a breakpoint on a different machine this can mean that there is an issue with either your VS or your OS..
Check that your IDE is up-to-date:
There have been reports of issues like this in the VS2013 RTM as well as VS2015 Update 1 and Update2.
In VS go to Tools/Extensions & Updates/Updates/Product Updates and see what version you are running. If an update is needed it will appear there.
It may be due to a bug in the OS.
If your running a Win 10 OS, there was a reported bug regarding this issue which existed in build 14251. This was resolved in build 14257 (and above).

How to download offline maps with SKMaps?

I tried downloading offline maps with SKMaps.
At first I'd like to create a region from a self made SKTPackage like this:
SKTPackage* packageToDownload;
packageToDownload.type = 3;
packageToDownload.packageCode = #"DEBY";
SKTDownloadObjectHelper* region = [SKTDownloadObjectHelper downloadObjectHelperWithSKTPackage:packageToDownload];
Unfortunately the region is empty and every attempt to add packageToDownload.languages led to a crash. What can I do to initiate an offline map download with only the packageCode and packageType?
Thanks for your help!
In the provided code snippet, the packageToDownload object is never initialized. Replace the first line with:
SKTPackage *packageToDownload = [[SKTPackage alloc] init];

Is there a replacement for AUSplitter in iOS?

AUSplitter takes an audio signal and makes multiple copies of it. However, it is only available on OS X. How can I achieve the same effect in iOS?
For future reference, the kAudioUnitSubType_Splitter audio unit was added in iOS 6. From the AUComponent headers:
enum {
kAudioUnitSubType_AUConverter = 'conv',
kAudioUnitSubType_Varispeed = 'vari',
kAudioUnitSubType_DeferredRenderer = 'defr',
kAudioUnitSubType_Splitter = 'splt',
kAudioUnitSubType_Merger = 'merg',
kAudioUnitSubType_NewTimePitch = 'nutp',
#if !TARGET_OS_IPHONE
kAudioUnitSubType_TimePitch = 'tmpt',
kAudioUnitSubType_RoundTripAAC = 'raac'
#else
kAudioUnitSubType_AUiPodTime = 'iptm',
kAudioUnitSubType_AUiPodTimeOther = 'ipto'
#endif
};
I ended up creating a custom class called Splitter. The Splitter class allows you to set its upstream audio unit.
It also has a render method similar to AudioUnitRender. When its render method is called it alternates between asking its upstream audio unit to render and buffering the rendered data and simply returning the buffered copy of the last render operation.
Its only a 1-2 Splitter and it doesn't handle format conversions, but it worked for what I needed.

"Dead Store" Warning in Xcode

I am getting a dead store warning when I analyze my project but the project does not crash.
Here is what I am doing
NSString *graphUrl = nil;
if ([graphArray count] == 1)
{
objTrial = [graphArray objectAtIndex:0];
graphUrl = #"http://chart.apis.google.com/chart?cht=s:nda&chf=bg,s,FFFFFF&chs=";
graphUrl = [graphUrl stringByAppendingString:#"&chd=t:"];
graphUrl = [graphUrl stringByAppendingString:objTrial.highValue];// get the dead store error here
}
else
{
//someother operation is done and a value is loaded to aURL
}
I get a dead store warning as mentioned in the code.. How can I prevent this?
It would be great if someone could help me out in this
The warning is telling you that the store that you do in the first line gets thrown away (i.e assigning an empty string to the variable and then reassigning it afterwards without using the original value). Just change the first line to the following and the warning should go away:
NSString *aUrl;
Edit:
you should change the line where you use it also:
aURL = [aValue copy];
"dead store" means something that's not used, or rather something useless.
You get it when you have a variable defined that you never do anything with. So, the Analyzer tells you that you have wasted some storage.
Here you haven't used the aUrl object after assigning it.
It won't cause any problems other than a few bytes of wasted memory. Of course if it's a large object that could be more.
Perhaps someone could chip in with knowledge of compilers, as compiler optimization might take care of dead stores in any case.
Dead Store is a value that is assigned but never used. There is nothing to worry about it. But if you can't control yourself from worrying ;-) you can change your code to,
NSString aUrl = nil;
if ([anArray count] == 1) {
// a value is store in aValue
// then that value is appended to aURL
aURL = [aURL stringByAppendingString:aValue];
} else {
aUrl = #"";
//someother operation is done and a value is loaded to aURL
}

Resources