7

I compiled the WebRTC native code (C++) and I'm playing with peerconnection server and client examples (under src\talk\examples\peerconnection). In particular I am trying to change the client sample to stream a custom sequence of images rather than the webcam video. I used something similar to http://sourcey.com/webrtc-custom-opencv-video-capture/ as a starting point, where a custom VideoCapturerFactory returns a custom VideoCapturer that I can use to generate custom image frames. Every time I have a new image to stream, I call SignalFrameCaptured(this, &frame) on the VideoCapturer.

My problem is that, in debug mode, I get this crash:

#
# Fatal error in e:\webrtc\webrtc checkout\src\webrtc\modules\video_coding\main\source\video_sender.cc, line 90
# Check failed: main_thread_.CalledOnValidThread()
#

And my understanding is that it has something to do with an inconsistency between the thread which started the video stream and the thread which is pushing these individual frames. It seems as though the former is an internal WebRTC thread, while the latter is currently the main thread of the application.

Things work in Release mode because this thread check is disabled.

Any idea how to properly fix this? Thanks

1 Answer 1

4

Just stumbled on it myself, and I hope you solved it by now. Generally, you're supposed to invoke SignalFrameCaptured on the start thread -- see example in Google's code:

https://chromium.googlesource.com/external/webrtc/+/edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1/talk/app/webrtc/objc/avfoundationvideocapturer.mm#419 (line 419)

As you can see, this is a recent change.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.