no message

master
zcy 2022-10-04 23:49:46 +08:00
parent b1f865dda7
commit b4f0cdca74
3 changed files with 20 additions and 8 deletions

View File

@ -82,10 +82,14 @@ void CameraVideoSink::OnFrame(const webrtc::VideoFrame& frame) {
cnt++; cnt++;
int width = this->m_capability.width; int width = this->m_capability.width;
int height = this->m_capability.height; int height = this->m_capability.height;
qDebug()<<this->Capability().height<<this->Capability().width webrtc::VideoCaptureCapability cap;
<<int(this->Capability().videoType) int ret = this->Capability(cap);
if(ret < 0)
return ;
qDebug()<<cap.height<<cap.width
<<int(cap.videoType)
<<int(webrtc::VideoType::kI420) <<int(webrtc::VideoType::kI420)
<<this->Capability().interlaced<<width * height*4; <<cap.interlaced<<width * height*4;
uint8_t *data = uint8_t *data =
new uint8_t[width * height*4]; new uint8_t[width * height*4];
@ -108,9 +112,13 @@ void CameraVideoSink::OnFrame(const webrtc::VideoFrame& frame) {
} }
webrtc::VideoCaptureCapability CameraVideoSink::Capability() int CameraVideoSink::Capability(webrtc::VideoCaptureCapability &cap)
{ {
return this->m_capability; if(nullptr != this)
cap = this->m_capability;
else
return -1;
return 0;
} }
uint8_t *FrameBufferList::TakeLast() uint8_t *FrameBufferList::TakeLast()

View File

@ -33,7 +33,7 @@ public:
size_t capture_device_index); size_t capture_device_index);
virtual ~CameraVideoSink(); virtual ~CameraVideoSink();
void OnFrame(const webrtc::VideoFrame& frame) override; void OnFrame(const webrtc::VideoFrame& frame) override;
webrtc::VideoCaptureCapability Capability(); int Capability(webrtc::VideoCaptureCapability &cap);
FrameBufferList *VideoBuffer(){ FrameBufferList *VideoBuffer(){
return &this->m_buf; return &this->m_buf;
} }

View File

@ -87,9 +87,13 @@ void MainWindow::on_pushButton_clicked()
if (!m_capturer) { if (!m_capturer) {
qDebug()<<"error"; qDebug()<<"error";
} }
webrtc::VideoCaptureCapability cap;
int ret = m_capturer->Capability(cap);
if(ret < 0)
return;
ui->openGLWidget->SetDataType(CPlayWidget::TYPE_YUV420P); ui->openGLWidget->SetDataType(CPlayWidget::TYPE_YUV420P);
ui->openGLWidget->SetImgSize(m_capturer->Capability().width, ui->openGLWidget->SetImgSize(cap.width,
m_capturer->Capability().height); cap.height);
ui->openGLWidget->StartRender(); ui->openGLWidget->StartRender();
// ui->openGLWidget->moveToThread(&gRender->Thread()); // ui->openGLWidget->moveToThread(&gRender->Thread());
if(gRender == nullptr){ if(gRender == nullptr){