feat: add custom video source.#138
Open
cloudwebrtc wants to merge 2 commits intomainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: custom video source via
RTCVideoSource::OnCapturedFrameLet's applications inject their own video frames into the libwebrtc pipeline
without going through a camera or desktop capturer. Adds a wxWidgets demo
that uses the new API to stream synthetic SMPTE colour bars between two
in-process peer connections.
Public API additions
RTCVideoSource::OnCapturedFrame(scoped_refptr<RTCVideoFrame>)RTCVideoSource::GetSourceType()RTCPeerConnectionFactory::CreateCustomVideoSource(string video_source_label, scoped_refptr<RTCMediaConstraints> constraints)Implementation notes
internal::VideoCapturer::OnFramepromoted fromprotectedtopublicso
RTCVideoSourceImplcan forward user frames into the broadcasterwithout a friend declaration.
RTCVideoSourceImplgains a second constructor that stores ashared_ptr<internal::VideoCapturer>; the desktop-source path keeps theold single-arg ctor and treats
OnCapturedFrameas a no-op.RTCVideoFrame::timestamp_us == 0falls back towebrtc::TimeMicros()socallers can omit the timestamp.
Demo:
examples/wx_loop_back_demofind_package(wxWidgets)).RTCPeerConnections, full offer/answer + ICE exchange,one audio track and one synthetic video track.
~120 px/sec via
OnCapturedFrame.wxPanel(I420 → ABGR vialibyuv →
wxImage→wxBitmap).libwebrtc.dylibintoContents/Frameworks/, rewrites the executable's recorded dependency to@rpath/libwebrtc.dylib, ad-hoc re-signs both binaries.