WebRTC Never Stream Video - c++

I have a website that recieves WEBRTC from my mobileApp very well.
A new C++ module that I develop that should send video using WEBRTC to the same website is not working and I failed to know why.
NOT WORKING FILES:
https://drive.google.com/open?id=1-6ZsfcQztexAspYWB4Nzvgf2e0-0C8vC
WORKING FILE:
https://drive.google.com/open?id=1bL_WOW6L1mGCXQC6HT6a14Sa58hOIcAh
kindly advise. I am stuck.

SOLVED AT LAST:
the issue mainly was due mDNS that is activated on chrome but gives "network unreachable" from my code.
the main problem was due to mDNS that chrome activates by default while webrtc need a lib called libnice v>0.1.14 which is the current stable release to resolve local addresses.
second peerConnectionFactory init:
I had to pass threads parameter. not this but also I had to init the network thread differently.
g_worker_thread = rtc::Thread::Create();
g_worker_thread->Start();
g_signaling_thread = rtc::Thread::Create();
g_signaling_thread->Start();
g_networking_thread = **rtc::Thread::CreateWithSocketServer();**
g_networking_thread->Start();
I am not sure what is the reason of the second point but maybe because I initiate webrtc from my main function in c and not through a thread.
Anyway I hope this helps someone... I was stuck for two weeks to solve it.

Related

How to access frames of RTCVideoRenderer ? (ios)

I try to access frames of RTCVideoRenderer without success, can you help me please ?
I noticed that there is a "didCaptureVideoFrame" method in RTCVideoCapturerDelegate, but not in RTCVideoViewDelegate.
I have never done objc, I added a method in RTCVideoViewDelegate to get frames (bellow "didChangeVideoSize"), but it do not get fired, I guess it do not work like that.
I am able to access frames from the remote using Android using the "onFrame" of VideoSink, I thought it would be that easy using ios.
PS: To add the method, I took the framework from the pod and put it in the project, because I noticed that when you modify a pod, changes do not apply.
Here is the line I added :
- (void)videoView:(id<RTCVideoRenderer>)videoView didRenderVideoFrame:(RTCVideoFrame *)frame;
I will now try to compile the library with the changes I want.
EDIT:
I am now compiling the library, I noticed the need to change several files to be able to access frames, it will not be done just by adding 10 lines.
Solved thanks to this : How to get frame data in AppRTC iOS app for video modifications?
I used this line instead (because names changed since) :
#property(atomic, strong) RTCVideoFrame* videoFrame;
I wanted a "onFrame" like VideoSink on Android, but it will be ok for now.

Can't use the Virtual Stick even though isVirtualStickControlModeAvailable returns true

I am having a problem with the virtual sticks, the following is the problem.
The Virtual sticks fire the notification, the listener sends the proper values to the roll, pitch, yaw and throttle, the isVirtualStickControlModeAvailable method from the sdk returns true, when it returns true I use the command from the flight controller send which returns the completion error nil, which means I can not do anything else from there, actually I do not need to do anything else. The virtual Sticks are working in a timer as the sample simulator from DJI.
What can I do in my app?
- Take off
- Land
- Give control back and forward to the RC
None of the list above brings me errors, including the process of the virtualStick.
What else did I try?
- Run the sample simulator app from DJI, linked above.
- Run the sample app on Android
- Run using the Bridge APP (Thats how i know the values are being passed correctly, even though i added labels on screen to debug without the Bridge APP)
- Update firmware from the aircraft and RC to the latest
- Sample simulator IOS
- Went back to previous working commits and branches on git
None of the things I have tried above worked.
Curious Stuf:
- The virtual Sticks worked fine till Yesterday, and before yesterday, in many diferent branches and commits in multiple branches.
- Reseting the Remote control, Executing Manual Linking and Linking through the DJI Official APP, and clearing the cache, memory sdcard made it work on Simulator Assistent DJI (Latest version) with a lot of interference, in the Sample apps on Android and IOS, and on my Swift 3 application. Then it had some interference, I tested outside on the real Aircraft, it was working beautifully.
- Today, the same thing happens. Already did the whole testing above mentioned, the Android sample apps, IOS Sample Apps, the Simulator, Bridge, My application, Reset remote etc. And it does not work.
I would be really glad if someone could point me out the problem.
On this thread I explain partially the problem and what I have tried. http://forum.dev.dji.com/forum.php?mod=viewthread&tid=32729
Already sent an email to DJI support, still no answer.
Aircraft: Phanton 4.
I have found the problem, it was the aircraft, I could get hands in a new aircraft, just pluged to the new RC linked to the new Aircraft, it worked with no problem.
Then I tested the new RC linking to the old aircraft, It did not work, then the Old RC with linked to the new Aircraft, it worked.
Glad you found the fix.
It might be worth it to update the firmware of the old aircraft.
You can do so using the DJIGo app or DJI Assistant software for desktop.

Unable take input from USART - FreeRTOS - AT32UC3A0512

Just trying my hands on FreeRTOS. Following are my setup -
Micro-controller - AT32UC3A0512
Board - EVK1105
Using FreeRTOS
Environment - AVR Studio 5 with ASF latest 2.3 framework
I just created a new project from Example project FreeRTOS. I am checking the USART currently.
When run the example project, I am able to transmit characters from my development board to PC through USART but when I type or input something on my PC usart terminal program(using Putty), I am not able to see anything. Can anybody suggest what may be wrong? Or do I need to change the code in the current example code to get input and display on my terminal program for USART?
Thanks...
Off the top of my head, I'm thinking:
Is your putty character ending set right? Like probably utf-8 to send to your MCU?
Is your MCU receiving anything in its receive buffer?
Hope it helps (:
I figured out my problem too. It seemed that the task had an stackoverflow.
It didn't freeze but went into an infinite loop in the applicationstackoverflowhook function.
Giving the task more stack solved the problem.
I got the problem solved. I removed the ISR based code. Just I initialized the gpio module and then initialized the rs_232 mode for usart , rest I used the existing USART.h and usart.c file API to send or receive data in a FreeRTOS task. That solved my problem...

Problems with changing flexmojos to give testing support to air applications

I want to test air applications and air libraries using flexmojos 3.9-SNAPSHOT.
However, although flexmojos does indeed has support for air, it tries to run the swf generated by the build using flash player, and as I need to use air native libraries I wanted to run the tests using adl (AIR debug launcher).
To do this, I cloned flexmojos in github.com to this repository (http://github.com/mi007/flexmojos). I then created a class that created an -app.xml for the TestRunner.swf file that was generated and ran:
adl TestRunner-app.xml
However, before the Test ends, it should call the server in the port 13540 to report something. When that happens, I'm getting the following error:
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: app:/TestRunner.swf cannot load data from 127.0.0.1:13540.
at org.sonatype.flexmojos.unitestingsupport::ControlSocket/connect()[/Users/rafael/p2d/others/flexmojos/flexmojos-testing/flexmojos-unittest-support/src/main/flex/org/sonatype/flexmojos/unitestingsupport/ControlSocket.as:46]
at org.sonatype.flexmojos.unitestingsupport::TestApplication/runTests()[/Users/rafael/p2d/others/flexmojos/flexmojos-testing/flexmojos-unittest-support/src/main/flex/org/sonatype/flexmojos/unitestingsupport/TestApplication.as:52]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:9408]
at mx.core::UIComponent/set initialized()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:1169]
at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\LayoutManager.as:718]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:8733]
at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:8673]
I know that it is calling the server before in port 13539 successfully, because it prints the test results on the console. I also know that it is opening port 13540 because I was able to telnet to it. However, for some reason it is unable to connect from the air application.
Given the circunstances, I have the following questions:
1) Is there any good documentation that I can read to understand how this security framework works? The only documentation that I found was terribly confusing.
2) Does anyone has any ideas or hints about what might be happening?
3) I have read somewhere that flexmojos hacks the security framework so that flex applications can open a socket to localhost without problems during tests. Is there any documentation about how this is done?
Thanks,
You've got very close to the answer in your comment...
You need to add a line to a file in ~/Library/Preferences/Macromedia/Flash Player/#Security/FlashPlayerTrust yourself, covering the swf you want to run. You can do this by hand directly (all files in that folder will be processed) or by using the Flash Player Settings Manager.

Selenium wait for download?

I'm trying to test the happy-path for a piece of code which takes a long time to respond, and then begins writing a file to the response output stream, which prompts a download dialog in browsers.
The problem is that this process has failed in the past, throwing an exception after this long amount of work. Is there a way in selenium to wait-for-download or equivalent?
I could throw in a Thread.sleep, but that would be inaccurate and unnecessarily slow down the test run.
What should I do, here?
I had the same problem. I invented something to solve the problem. A tempt file is created by Python with '.part' extension. So, if still we have the temp, python can wait for 10 second and check again if the file is downloaded or not yet.
while True:
if os.path.isfile('ts.csv.part'):
sleep(10)
elif os.path.isfile('ts.csv'):
break
else:
sleep(10)
driver.close()
So you have two problems here:
You need to cause the browser to download the file
You need to measure when the downloaded file is complete
Neither problemc an be directly solved by Selenium (yet - 2.0 may help), but both are solvable problems. The first problem can be solved by GUI automation toolkits, such as AutoIT. But they can also be solved by simply sending an automated keypress at the OS level that simulates the enter key (works for Firefox, a little harder on some versions of Chrome and Safari). If you're using Java, you can use Robot to do that. Other languages have similar toolkits to do such a thing.
The second issue is probably best solved with some sort of proxy solution. For example, if your browser was configured to go through a proxy and that proxy had an API, you could query the proxy with that API to ask when network activity had ended.
That's what we do at http://browsermob.com, which is a a startup I founded that uses Selenium to do load testing. We've released some of the proxy code as open source, available at http://browsermob.com/tools.
But two problems still persist:
You need to configure the browser to use the proxy. In Selenium 2 this is easier, but it's possible to do it with Selenium 1 as well. The key is just making sure that your browser launcher brings up the browser with the right profile/settings.
There currently is no API for BrowserMob proxy to tell you when network traffic has stopped! This is a big hole in the concept of the project that I want to fix as soon as I get the time. However, if you're keen to help out, join the Google Group and I can definitely point you in the right direction.
Hope that helps you identify your various options. Best of luck!
This is Chrome-testing-only solution for controlling the downloads with javascript..
Using WebDriver (Selenium2) it can be done within Chrome's chrome:// which is HTML/CSS/Javascript:
driver.get( "chrome://downloads/" );
waitElement( By.CssSelector("#downloads-summary-text") );
// next javascript snippet cancels the last/current download
// if your test ends in file attachment downloading
// you'll very likely need this if you more re-instantiated tests left
((JavascriptExecutor)driver).executeScript("downloads.downloads_[0].cancel_();");
There are other Download.prototype.functions in "chrome://downloads/downloads.js"
This suites you if you just need to test some info note eg. caused by file attachment starting activity, and not the file itself.
Naturally you need to control step 1. - mentioned by Patrick above - and by this you control step 2. FOR THE TEST, not for the functionality of actual file download completion / cancel.
See also : Javascript: Cancel/Stop Image Requests which is relating to Browser stopping.
This falls under the "things that can't be automated" category. Selenium is built with JavaScipt and due to JavaScript sandbox restrictions it can't access downloads.
Selenium 2 might be able to do this once Alerts/Prompts have been implemented but that this won't happen for the next little while yet.
If you want to check for the download dialog, try with AutoIt. I use that for uploading and downloading the files. Using AutoIt with Se RC is easier.
def file_downloaded?(file)
while File.file?(file) == false
p "File downloading in progress..."
sleep 1
end
end
*Ruby Syntax