From e0cf4f960f75ca0fd5cad0d681485fe77f647f21 Mon Sep 17 00:00:00 2001 From: zcy <290198252@qq.com> Date: Wed, 11 Jan 2023 12:09:27 +0800 Subject: [PATCH] no message --- .../webrtc_capture/src/camera_video_sink.cpp | 23 ++--------------- client/webrtc_capture/src/camera_video_sink.h | 2 +- client/webrtc_capture/src/main.cpp | 4 +-- client/webrtc_capture/src/mainwindow.cpp | 25 ------------------- 4 files changed, 4 insertions(+), 50 deletions(-) diff --git a/client/webrtc_capture/src/camera_video_sink.cpp b/client/webrtc_capture/src/camera_video_sink.cpp index 8987969..f71f45d 100644 --- a/client/webrtc_capture/src/camera_video_sink.cpp +++ b/client/webrtc_capture/src/camera_video_sink.cpp @@ -82,24 +82,9 @@ void CameraVideoSink::OnFrame(const webrtc::VideoFrame& frame) { cnt++; int width = this->m_capability.width; int height = this->m_capability.height; -<<<<<<< HEAD - webrtc::VideoCaptureCapability cap; - int ret = this->Capability(cap); - if(ret < 0) - return ; - qDebug()<GetI420()->type()); -======= uint8_t *data = new uint8_t[width * height*4]; // qDebug()<GetI420()->type()); ->>>>>>> ceaccb7db090d07a75d14c43e07a96773ac1e9a6 memcpy(data,frameBuffer->GetI420()->DataY(),width*height); memcpy(data + width*height ,frameBuffer->GetI420()->DataU(), width*height/4); @@ -120,13 +105,9 @@ void CameraVideoSink::OnFrame(const webrtc::VideoFrame& frame) { } -int CameraVideoSink::Capability(webrtc::VideoCaptureCapability &cap) +webrtc::VideoCaptureCapability CameraVideoSink::Capability() { - if(nullptr != this) - cap = this->m_capability; - else - return -1; - return 0; + return this->m_capability; } 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 3a4c314..9043a87 100644 --- a/client/webrtc_capture/src/camera_video_sink.h +++ b/client/webrtc_capture/src/camera_video_sink.h @@ -31,7 +31,7 @@ public: size_t capture_device_index); virtual ~CameraVideoSink(); void OnFrame(const webrtc::VideoFrame& frame) override; - int Capability(webrtc::VideoCaptureCapability &cap); + webrtc::VideoCaptureCapability Capability(); FrameBufferList *VideoBuffer(){ return &this->m_buf; } diff --git a/client/webrtc_capture/src/main.cpp b/client/webrtc_capture/src/main.cpp index 2bb2190..b6df6b1 100644 --- a/client/webrtc_capture/src/main.cpp +++ b/client/webrtc_capture/src/main.cpp @@ -13,7 +13,6 @@ #include #include "cv_ssd.h" - # pragma comment(lib, "secur32.lib") # pragma comment(lib, "winmm.lib") # pragma comment(lib, "dmoguids.lib") @@ -22,7 +21,6 @@ # pragma comment(lib, "Strmiids.lib") # pragma comment(lib, "User32.lib") - int BubbleSort(int *p,int len){ if(nullptr == p) return -1; @@ -89,7 +87,7 @@ int main(int argc, char *argv[]) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication a(argc, argv); MainWindow w; - w.setWindowTitle("webrtc easy demo"); + w.setWindowTitle("learning tool"); w.show(); return a.exec(); } diff --git a/client/webrtc_capture/src/mainwindow.cpp b/client/webrtc_capture/src/mainwindow.cpp index d258118..a7ac5c6 100644 --- a/client/webrtc_capture/src/mainwindow.cpp +++ b/client/webrtc_capture/src/mainwindow.cpp @@ -187,30 +187,6 @@ void MainWindow::on_pushButton_clicked() info->GetCapability(ids,id,p); qDebug()<GetDeviceName(id,nullptr,0,ids,128,nullptr,0); - info->GetCapability(ids,id,p); - qDebug()<Capability(cap); - if(ret < 0) - return; - ui->openGLWidget->SetDataType(CPlayWidget::TYPE_YUV420P); - ui->openGLWidget->SetImgSize(cap.width, - cap.height); - ui->openGLWidget->StartRender(); -// ui->openGLWidget->moveToThread(&gRender->Thread()); - if(gRender == nullptr){ - gRender = new AsyncRennder(this,m_capturer->VideoBuffer(),ui->openGLWidget); - gRender->Start(this); - connect(gRender,&QSSASyncProcess::Done,this,&MainWindow::RenderDone); -======= m_capturer.reset(CameraVideoSink::Create(p.width, p.height, 25, id)); if (!m_capturer) { qDebug()<<"error"; @@ -231,7 +207,6 @@ void MainWindow::on_pushButton_clicked() ui->pushButton->setText(QString::asprintf("正在采集")); }else{ ui->openGLWidget->StopRender(); ->>>>>>> ceaccb7db090d07a75d14c43e07a96773ac1e9a6 } }