Skip to content

Commit

Permalink
Small fixes for the publication tests. Removed some old osip referenc…
Browse files Browse the repository at this point in the history
…es, resolution setting for qcamera, disabled speex aec, because it does not work properly at this point, update Qt every 30 ms instead of every 10, draw only if there is something new to draw in videowidget and print out TID:s to make reading process explorer much easier. Removed unhelpful readme.
  • Loading branch information
jrsnen committed Jul 12, 2017
1 parent 77c5605 commit fa43dfa
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 40 deletions.
9 changes: 3 additions & 6 deletions HEVC_conference.pro
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,10 @@ QT+=network

QMAKE_CXXFLAGS += -std=c++11

#CONFIG += console
CONFIG += console

INCLUDEPATH += $$PWD/../include/kvazaar/src
INCLUDEPATH += $$PWD/../include/openHEVC/gpac/modules/openhevc_dec
INCLUDEPATH += $$PWD/../include/opus/include
INCLUDEPATH += $$PWD/../include/libosip2/include
INCLUDEPATH += $$PWD/../include/openhevc_dec
INCLUDEPATH += $$PWD/../include/opus
INCLUDEPATH += $$PWD/../include/live/liveMedia/include
INCLUDEPATH += $$PWD/../include/live/groupsock/include
INCLUDEPATH += $$PWD/../include/live/UsageEnvironment/include
Expand All @@ -110,7 +108,6 @@ win32: LIBS += -llibLibOpenHevcWrapper.dll
win32: LIBS += -llivemedia.dll
win32: LIBS += -llibspeexdsp.dll
win32: LIBS += -lws2_32
win32: LIBS += -llibosip2.dll

INCLUDEPATH += $$PWD/../
DEPENDPATH += $$PWD/../
Expand Down
13 changes: 0 additions & 13 deletions README

This file was deleted.

2 changes: 1 addition & 1 deletion src/callwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CallWindow::CallWindow(QWidget *parent, uint16_t width, uint16_t height, QString
currentResolution_ = QSize(width, height);

// GUI updates are handled solely by timer
timer_->setInterval(10);
timer_->setInterval(30);
timer_->setSingleShot(false);
connect(timer_, SIGNAL(timeout()), this, SLOT(update()));
connect(timer_, SIGNAL(timeout()), stats_, SLOT(update()));
Expand Down
35 changes: 26 additions & 9 deletions src/camerafilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ CameraFilter::CameraFilter(QString id, StatisticsInterface *stats, QSize resolut

connect(cameraFrameGrabber_, SIGNAL(frameAvailable(QVideoFrame)), this, SLOT(handleFrame(QVideoFrame)));

camera_->start();
QCameraViewfinderSettings settings = camera_->viewfinderSettings();

if( camera_->state() == QCamera::ActiveState)
{
QCameraViewfinderSettings settings = camera_->viewfinderSettings();
stats_->videoInfo(settings.maximumFrameRate(), settings.resolution());
framerate_ = settings.maximumFrameRate();
}
settings.setResolution(QSize(640, 480));
settings.setPixelFormat(QVideoFrame::Format_Jpeg);
camera_->setViewfinderSettings(settings);
camera_->start();
}

CameraFilter::~CameraFilter()
Expand Down Expand Up @@ -66,6 +64,25 @@ void CameraFilter::stop()

void CameraFilter::handleFrame(const QVideoFrame &frame)
{
if(framerate_ == 0)
{
QCameraViewfinderSettings settings = camera_->viewfinderSettings();
QList<QVideoFrame::PixelFormat> formats = camera_->supportedViewfinderPixelFormats();
/*
for(auto format : formats)
{
qDebug() << "QCamera supported format:" << format;
}
QList<QSize> resolutions = camera_->supportedViewfinderResolutions();
for(auto reso : resolutions)
{
qDebug() << "QCamera supported resolutions:" << reso;
}
*/
stats_->videoInfo(settings.maximumFrameRate(), settings.resolution());
framerate_ = settings.maximumFrameRate();
}

QVideoFrame cloneFrame(frame);
cloneFrame.map(QAbstractVideoBuffer::ReadOnly);
Expand Down Expand Up @@ -95,7 +112,7 @@ void CameraFilter::handleFrame(const QVideoFrame &frame)
newImage->height = cloneFrame.height();
newImage->source = LOCAL;
newImage->framerate = framerate_;

/*
// scale the image and copy to new data
if(resolution_ != cloneFrame.size())
{
Expand All @@ -117,7 +134,7 @@ void CameraFilter::handleFrame(const QVideoFrame &frame)
newImage->data_size = image2.byteCount();
newImage->framerate = 30; // TODO Input this using settings.
}

*/
//qDebug() << "Frame generated. Format: " << pf
// << " width: " << newImage->width << ", height: " << newImage->height;

Expand Down
2 changes: 1 addition & 1 deletion src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ struct SDPMessageInfo
void qSleep(int ms);

// TODO fix AEC bugs and faulty operating.
const bool AEC = true;
const bool AEC = false;
1 change: 1 addition & 0 deletions src/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ void Filter::stop()

void Filter::run()
{
qDebug() << name_ << "TID:" << (uint64_t)currentThreadId();
running_ = true;
while(running_)
{
Expand Down
2 changes: 1 addition & 1 deletion src/filtergraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ FilterGraph::FilterGraph(StatisticsInterface* stats):
Q_ASSERT(stats);
// TODO negotiate these values with all included filters
format_.setSampleRate(48000);
format_.setChannelCount(2);
format_.setChannelCount(1);
format_.setSampleSize(16);
format_.setSampleType(QAudioFormat::SignedInt);
format_.setByteOrder(QAudioFormat::LittleEndian);
Expand Down
4 changes: 2 additions & 2 deletions src/kvazaarfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ int KvazaarFilter::init(QSize resolution,

api_->config_init(config_);
api_->config_parse(config_, "preset", "ultrafast");
config_->width = resolution.width();
config_->height = resolution.height();
config_->width = 640;
config_->height = 480;
config_->threads = 4;
config_->qp = 32;
config_->wpp = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/opusencoderfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ OpusEncoderFilter::~OpusEncoderFilter()
void OpusEncoderFilter::init(QAudioFormat format)
{
int error = 0;
enc_ = opus_encoder_create(format.sampleRate(), format.channelCount(), OPUS_APPLICATION_AUDIO, &error);
enc_ = opus_encoder_create(format.sampleRate(), format.channelCount(), OPUS_APPLICATION_VOIP, &error);

if(error)
qWarning() << "Failed to initialize opus encoder with errorcode:" << error;
Expand Down
2 changes: 2 additions & 0 deletions src/rtpstreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ RTPStreamer::RTPStreamer(StatisticsInterface* stats):

void RTPStreamer::run()
{
qDebug() << "Live555 TID:" << (uint64_t)currentThreadId();

// QThread run function
qDebug() << "Iniating RTP streamer";
iniated_.lock();
Expand Down
2 changes: 1 addition & 1 deletion src/statisticswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ uint32_t StatisticsWindow::bitrate(std::vector<PacketInfo*>& packets, uint32_t i
uint32_t currentTime = QDateTime::currentMSecsSinceEpoch();
uint32_t timeInterval = 0;
uint32_t bitrate = 0;
uint32_t bitrateInterval = 2000;
uint32_t bitrateInterval = 5000;

uint32_t i = index - 1;

Expand Down
15 changes: 10 additions & 5 deletions src/videowidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ unsigned int VideoWidget::number_ = 0;

VideoWidget::VideoWidget(QWidget* parent): QWidget(parent),
hasImage_(false),
id_(number_)
id_(number_),
updated_(false)
{
++number_;
setAutoFillBackground(false);
Expand All @@ -33,6 +34,7 @@ void VideoWidget::inputImage(std::unique_ptr<uchar[]> input,
currentImage_ = image;
hasImage_ = true;
drawMutex_.unlock();
updated_ = true;

updateTargetRect();
}
Expand All @@ -46,11 +48,14 @@ void VideoWidget::paintEvent(QPaintEvent *event)

if(hasImage_)
{
drawMutex_.lock();
Q_ASSERT(input_);
if(updated_)
{
drawMutex_.lock();
Q_ASSERT(input_);

painter.drawImage(targetRect_, currentImage_);
drawMutex_.unlock();
painter.drawImage(targetRect_, currentImage_);
drawMutex_.unlock();
}
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions src/videowidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ class VideoWidget : public QWidget
QImage currentImage_;
std::unique_ptr<uchar[]> input_;

bool updated_;

unsigned int id_;
};

0 comments on commit fa43dfa

Please sign in to comment.