Hi everyone,
This thread is related to a previous thread of mine:
https://groups.google.com/forum/#!topic/discuss-webrtc/m1y8ZawuqC4.
I'm using the latest version of webrtc as a basis for my C++ app. Some issues have appear while calling some webrtc native functions.To make it easier for you to understand the issue, I created a small program that re-creates the bugs on every run. The code is in the archive attached to this mail.
I was able to trigger this bug on this configuration:
- MacBook Air 2012
- Mac OS X 10.9.2
- Compiling either with Ninja, or with clang inside XCode 5.0.2
It's interesting that there program works just fine on an Ubuntu 13.10, custom hardware, Ninja compiler configuration; I did not get to try on Windows yet.
How to use the program:
- Download the latest version of webrtc and the archived attached to this email
- Extract the archive and copy/paste the folder BugExp and the file bugExp.gyp in the trunk/talk directory
- Add this target to you all.gyp: 'talk/bugExp.gyp:*',
- runhooks
- compile: ninja -C out/Debug bugExp (alternatively, you can use Xcode/clang
- run the executable: ./out/Debug/bugExp
- There are some std::cin in the program to let you time to see what's happening. Just follow the instructions from the program.
What the program should do: - Create a PC factory
- List the video devices
- Create a MediaStream (called localMediaStream) with the first video capture device found
- Create a peerConnection (I have a wrapper around it that handles the observers)
- Add the MediaStream into the peerConnection
- Render the stream in a new window
- Create the offer for this PC
Issue 1: The program basically gets stuck in the creation of the videoSource.
For more precision, I went down with the debugger and the program is waiting forever in
thread.cc on this line:
void Thread::Send(MessageHandler *phandler, uint32 id, MessageData *pdata) {
...
current_thread->socketserver()->Wait(kForever, false);
...
}
In my main program I was able to bypass this lock by launching my GUM in a new boost::thread, but it didn't do the trick here, I'm not sure why (I let the code in comments in case somebody would like to try it).
Issue 2: Even when GUM works in my main program, calling createOffer on the PeerConnection containing the MediaStream causes its rendering to stop. I actually don't believe the problem comes from the renderer. I believe it must be in the stream or the source, but I can't get a proper idea as simply entering the debugger causes the renderer to freeze until the program resumes (as expected).
Questions:- What are the differences that prevent my program to run properly on Mac not on Linux?
- What is expected of me regarding threading? Am I supposed to work on the main thread? Create different threads? If yes in which case?
- Do I miss some pre-proc definition, or initialization somewhere?
- The rendering freezing every time I enter the debugger is going to be a big issue all along the development of my app. Is there a way to bypass this freezing effect? How do you guys handle it?
- Should I open an issue?
Thanks in advance.