no message

master
zcy 2023-01-11 12:09:27 +08:00
parent b872dbf500
commit e0cf4f960f
4 changed files with 4 additions and 50 deletions

View File

@ -82,24 +82,9 @@ 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;
<<<<<<< HEAD
webrtc::VideoCaptureCapability cap;
int ret = this->Capability(cap);
if(ret < 0)
return ;
qDebug()<<cap.height<<cap.width
<<int(cap.videoType)
<<int(webrtc::VideoType::kI420)
<<cap.interlaced<<width * height*4;
uint8_t *data =
new uint8_t[width * height*4];
qDebug()<<width*height<<int(frameBuffer->GetI420()->type());
=======
uint8_t *data = new uint8_t[width * height*4]; uint8_t *data = new uint8_t[width * height*4];
// qDebug()<<width*height<<int(frameBuffer->GetI420()->type()); // qDebug()<<width*height<<int(frameBuffer->GetI420()->type());
>>>>>>> ceaccb7db090d07a75d14c43e07a96773ac1e9a6
memcpy(data,frameBuffer->GetI420()->DataY(),width*height); memcpy(data,frameBuffer->GetI420()->DataY(),width*height);
memcpy(data + width*height ,frameBuffer->GetI420()->DataU(), memcpy(data + width*height ,frameBuffer->GetI420()->DataU(),
width*height/4); 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) return this->m_capability;
cap = this->m_capability;
else
return -1;
return 0;
} }
uint8_t *FrameBufferList::TakeLast() uint8_t *FrameBufferList::TakeLast()

View File

@ -31,7 +31,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;
int Capability(webrtc::VideoCaptureCapability &cap); webrtc::VideoCaptureCapability Capability();
FrameBufferList *VideoBuffer(){ FrameBufferList *VideoBuffer(){
return &this->m_buf; return &this->m_buf;
} }

View File

@ -13,7 +13,6 @@
#include <QMetaType> #include <QMetaType>
#include "cv_ssd.h" #include "cv_ssd.h"
# pragma comment(lib, "secur32.lib") # pragma comment(lib, "secur32.lib")
# pragma comment(lib, "winmm.lib") # pragma comment(lib, "winmm.lib")
# pragma comment(lib, "dmoguids.lib") # pragma comment(lib, "dmoguids.lib")
@ -22,7 +21,6 @@
# pragma comment(lib, "Strmiids.lib") # pragma comment(lib, "Strmiids.lib")
# pragma comment(lib, "User32.lib") # pragma comment(lib, "User32.lib")
int BubbleSort(int *p,int len){ int BubbleSort(int *p,int len){
if(nullptr == p) if(nullptr == p)
return -1; return -1;
@ -89,7 +87,7 @@ int main(int argc, char *argv[])
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv); QApplication a(argc, argv);
MainWindow w; MainWindow w;
w.setWindowTitle("webrtc easy demo"); w.setWindowTitle("learning tool");
w.show(); w.show();
return a.exec(); return a.exec();
} }

View File

@ -187,30 +187,6 @@ void MainWindow::on_pushButton_clicked()
info->GetCapability(ids,id,p); info->GetCapability(ids,id,p);
qDebug()<<QString::asprintf("GetCapability: %d %d %d %d",id,p.width,p.height,p.maxFPS); qDebug()<<QString::asprintf("GetCapability: %d %d %d %d",id,p.width,p.height,p.maxFPS);
<<<<<<< HEAD
char ids[128];
info->GetDeviceName(id,nullptr,0,ids,128,nullptr,0);
info->GetCapability(ids,id,p);
qDebug()<<QString::asprintf("GetCapability: %d %d %d %d",id,p.width,p.height,p.maxFPS);
m_capturer.reset(CameraVideoSink::Create(p.width, p.height, 25, id));
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(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)); m_capturer.reset(CameraVideoSink::Create(p.width, p.height, 25, id));
if (!m_capturer) { if (!m_capturer) {
qDebug()<<"error"; qDebug()<<"error";
@ -231,7 +207,6 @@ void MainWindow::on_pushButton_clicked()
ui->pushButton->setText(QString::asprintf("正在采集")); ui->pushButton->setText(QString::asprintf("正在采集"));
}else{ }else{
ui->openGLWidget->StopRender(); ui->openGLWidget->StopRender();
>>>>>>> ceaccb7db090d07a75d14c43e07a96773ac1e9a6
} }
} }