mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05:00
fix memory management issue in voip (patch from electron)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7804 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
326d91d4c7
commit
67bd9493e1
@ -65,14 +65,17 @@ void QVideoInputDevice::grabFrame()
|
|||||||
if(img->nChannels != 3)
|
if(img->nChannels != 3)
|
||||||
{
|
{
|
||||||
std::cerr << "(EE) expected 3 channels. Got " << img->nChannels << std::endl;
|
std::cerr << "(EE) expected 3 channels. Got " << img->nChannels << std::endl;
|
||||||
cvReleaseImage(&img) ;
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// convert to RGB and copy to new buffer, because cvQueryFrame tells us to not modify the buffer
|
||||||
|
cv::Mat img_rgb;
|
||||||
|
cv::cvtColor(cv::Mat(img), img_rgb, CV_BGR2RGB);
|
||||||
|
|
||||||
static const int _encoded_width = 128 ;
|
static const int _encoded_width = 128 ;
|
||||||
static const int _encoded_height = 128 ;
|
static const int _encoded_height = 128 ;
|
||||||
|
|
||||||
QImage image = QImage((uchar*)img->imageData,img->width,img->height,QImage::Format_RGB888).scaled(QSize(_encoded_width,_encoded_height),Qt::IgnoreAspectRatio,Qt::SmoothTransformation) ;
|
QImage image = QImage(img_rgb.data,img_rgb.cols,img_rgb.rows,QImage::Format_RGB888).scaled(QSize(_encoded_width,_encoded_height),Qt::IgnoreAspectRatio,Qt::SmoothTransformation) ;
|
||||||
|
|
||||||
if(_video_encoder != NULL)
|
if(_video_encoder != NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user