diff --git a/client/webrtc_capture/src/camera_video_sink.cpp b/client/webrtc_capture/src/camera_video_sink.cpp index cd55558..2dc19df 100644 --- a/client/webrtc_capture/src/camera_video_sink.cpp +++ b/client/webrtc_capture/src/camera_video_sink.cpp @@ -82,10 +82,14 @@ void CameraVideoSink::OnFrame(const webrtc::VideoFrame& frame) { cnt++; int width = this->m_capability.width; int height = this->m_capability.height; - qDebug()<Capability().height<Capability().width - <Capability().videoType) + webrtc::VideoCaptureCapability cap; + int ret = this->Capability(cap); + if(ret < 0) + return ; + qDebug()<Capability().interlaced<m_capability; + if(nullptr != this) + cap = this->m_capability; + else + return -1; + return 0; } uint8_t *FrameBufferList::TakeLast() diff --git a/client/webrtc_capture/src/camera_video_sink.h b/client/webrtc_capture/src/camera_video_sink.h index 4eb512f..8195902 100644 --- a/client/webrtc_capture/src/camera_video_sink.h +++ b/client/webrtc_capture/src/camera_video_sink.h @@ -33,7 +33,7 @@ public: size_t capture_device_index); virtual ~CameraVideoSink(); void OnFrame(const webrtc::VideoFrame& frame) override; - webrtc::VideoCaptureCapability Capability(); + int Capability(webrtc::VideoCaptureCapability &cap); FrameBufferList *VideoBuffer(){ return &this->m_buf; } diff --git a/client/webrtc_capture/src/mainwindow.cpp b/client/webrtc_capture/src/mainwindow.cpp index 13f4d29..7c0123d 100644 --- a/client/webrtc_capture/src/mainwindow.cpp +++ b/client/webrtc_capture/src/mainwindow.cpp @@ -87,9 +87,13 @@ void MainWindow::on_pushButton_clicked() if (!m_capturer) { qDebug()<<"error"; } + webrtc::VideoCaptureCapability cap; + int ret = m_capturer->Capability(cap); + if(ret < 0) + return; ui->openGLWidget->SetDataType(CPlayWidget::TYPE_YUV420P); - ui->openGLWidget->SetImgSize(m_capturer->Capability().width, - m_capturer->Capability().height); + ui->openGLWidget->SetImgSize(cap.width, + cap.height); ui->openGLWidget->StartRender(); // ui->openGLWidget->moveToThread(&gRender->Thread()); if(gRender == nullptr){