Open szpnygo opened 1 year ago
I added a new function in RTCVideoCapturer
virtual void GenerateFrame(scoped_refptr<RTCVideoFrame> frame) = 0
void GenerateFrame(scoped_refptr<RTCVideoFrame> frame) override {
if (video_capturer_ != nullptr) {
VideoFrameBufferImpl* impl =
static_cast<VideoFrameBufferImpl*>(frame.get());
auto newFrame = webrtc::VideoFrame::Builder()
.set_video_frame_buffer(impl->buffer())
.set_rotation(static_cast<webrtc::VideoRotation>(
impl->rotation()))
.set_timestamp_us(rtc::TimeMicros())
.build();
video_capturer_->GenerateFrame(newFrame);
}
}
Additionally, I added a new method in VideoCapturer:
virtual void GenerateFrame(const VideoFrame& frame) { OnFrame(frame); }
After implementing this, I achieved my goal. However, I'm uncertain if this is the correct approach. Will the library continue to support such objectives in the future?
I'm currently working on a project where I need to implement custom capture functionality using Libwebrtc.
As a beginner exploring the vast landscape of WebRTC, I've been trying to customize the VideoCapturer. While attempting to extend the RTCVideoCapturer class, I noticed there doesn't seem to be an 'OnFrame' method that allows me to pass my customized frame.
I'd like to confirm if this would be the appropriate and recommended way to achieve my objective. If not, could you kindly suggest an alternative approach?