bug fix in video sending

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7453 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-07-15 20:49:57 +00:00
parent 01c467c4c0
commit 5df440b1bb

View File

@ -47,13 +47,16 @@ QImage JPEGVideoDecoder::decodeData(const unsigned char *encoded_image_data,uint
{ {
QByteArray qb((char*)encoded_image_data,size) ; QByteArray qb((char*)encoded_image_data,size) ;
QImage image ; QImage image ;
if(image.loadFromData(qb)) if(image.loadFromData(qb,"JPEG"))
{ {
std::cerr << "image decoded successfully" << std::endl; std::cerr << "image decoded successfully" << std::endl;
return image ; return image ;
} }
else else
{
std::cerr << "image.loadFromData(): returned an error.: " << std::endl;
return QImage() ; return QImage() ;
}
} }
void JPEGVideoEncoder::encodeData(const QImage& image) void JPEGVideoEncoder::encodeData(const QImage& image)
@ -68,11 +71,12 @@ void JPEGVideoEncoder::encodeData(const QImage& image)
RsVoipDataChunk voip_chunk ; RsVoipDataChunk voip_chunk ;
voip_chunk.data = malloc(qb.size()); voip_chunk.data = malloc(qb.size());
memcpy(voip_chunk.data,qb.data(),qb.size()) ;
voip_chunk.size = qb.size() ; voip_chunk.size = qb.size() ;
voip_chunk.type = RsVoipDataChunk::RS_VOIP_DATA_TYPE_VIDEO ; voip_chunk.type = RsVoipDataChunk::RS_VOIP_DATA_TYPE_VIDEO ;
_out_queue.push_back(voip_chunk) ; _out_queue.push_back(voip_chunk) ;
std::cerr << "sending encoded data. size = " << qb.size() << std::endl; std::cerr << "sending encoded data. size = " << std::dec << qb.size() << std::endl;
} }