mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added graph display of instantly required bandwidth for VOIP, in preparation to chosing new video codec. GUI layout needs to be sorted.
This commit is contained in:
parent
d5c33f5631
commit
ec67ee0e00
@ -39,6 +39,7 @@
|
|||||||
//#include "NetworkConfig.h"
|
//#include "NetworkConfig.h"
|
||||||
#include "audiodevicehelper.h"
|
#include "audiodevicehelper.h"
|
||||||
#include "AudioWizard.h"
|
#include "AudioWizard.h"
|
||||||
|
#include "gui/common/RSGraphWidget.h"
|
||||||
#include <interface/rsVOIP.h>
|
#include <interface/rsVOIP.h>
|
||||||
|
|
||||||
#define iroundf(x) ( static_cast<int>(x) )
|
#define iroundf(x) ( static_cast<int>(x) )
|
||||||
@ -51,6 +52,59 @@ void AudioInputDialog::showEvent(QShowEvent *) {
|
|||||||
qtTick->start(20);
|
qtTick->start(20);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
class voipGraphSource: public RSGraphSource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
voipGraphSource() {}
|
||||||
|
|
||||||
|
void setVideoInput(QVideoInputDevice *vid) { video_input = vid ; }
|
||||||
|
|
||||||
|
virtual QString displayName(int) const { return tr("Required bandwidth") ;}
|
||||||
|
|
||||||
|
virtual QString displayValue(float v) const
|
||||||
|
{
|
||||||
|
if(v < 1000)
|
||||||
|
return QString::number(v,10,2) + " B/s" ;
|
||||||
|
else if(v < 1000*1024)
|
||||||
|
return QString::number(v/1024,10,2) + " KB/s" ;
|
||||||
|
else
|
||||||
|
return QString::number(v/(1024*1024),10,2) + " MB/s" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void getValues(std::map<std::string,float>& vals) const
|
||||||
|
{
|
||||||
|
RsVOIPDataChunk chunk ;
|
||||||
|
uint32_t total_size = 0 ;
|
||||||
|
vals.clear() ;
|
||||||
|
|
||||||
|
while(video_input && video_input->getNextEncodedPacket(chunk))
|
||||||
|
{
|
||||||
|
total_size += chunk.size ;
|
||||||
|
chunk.clear() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
vals[std::string("bw")] = (float)total_size ;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QVideoInputDevice *video_input ;
|
||||||
|
};
|
||||||
|
|
||||||
|
void voipGraph::setVoipSource(voipGraphSource *gs)
|
||||||
|
{
|
||||||
|
_src = gs ;
|
||||||
|
RSGraphWidget::setSource(gs) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
voipGraph::voipGraph(QWidget *parent)
|
||||||
|
: RSGraphWidget(parent)
|
||||||
|
{
|
||||||
|
setFlags(RSGraphWidget::RSGRAPH_FLAGS_SHOW_LEGEND) ;
|
||||||
|
setFlags(RSGraphWidget::RSGRAPH_FLAGS_PAINT_STYLE_PLAIN) ;
|
||||||
|
|
||||||
|
_src = NULL ;
|
||||||
|
}
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
AudioInputConfig::AudioInputConfig(QWidget * parent, Qt::WindowFlags flags)
|
AudioInputConfig::AudioInputConfig(QWidget * parent, Qt::WindowFlags flags)
|
||||||
: ConfigPage(parent, flags)
|
: ConfigPage(parent, flags)
|
||||||
@ -71,11 +125,21 @@ AudioInputConfig::AudioInputConfig(QWidget * parent, Qt::WindowFlags flags)
|
|||||||
//
|
//
|
||||||
videoInput = new QVideoInputDevice(this) ;
|
videoInput = new QVideoInputDevice(this) ;
|
||||||
videoInput->setEchoVideoTarget(ui.videoDisplay) ;
|
videoInput->setEchoVideoTarget(ui.videoDisplay) ;
|
||||||
videoInput->setVideoEncoder(NULL) ;
|
videoInput->setVideoEncoder(new JPEGVideoEncoder()) ;
|
||||||
|
|
||||||
|
graph_source = new voipGraphSource ;
|
||||||
|
ui.voipBwGraph->setSource(graph_source);
|
||||||
|
|
||||||
|
graph_source->setVideoInput(videoInput) ;
|
||||||
|
graph_source->setCollectionTimeLimit(1000*300) ;
|
||||||
|
graph_source->start() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioInputConfig::~AudioInputConfig()
|
AudioInputConfig::~AudioInputConfig()
|
||||||
{
|
{
|
||||||
|
graph_source->stop() ;
|
||||||
|
graph_source->setVideoInput(NULL) ;
|
||||||
|
|
||||||
std::cerr << "Deleting audioInputConfig object" << std::endl;
|
std::cerr << "Deleting audioInputConfig object" << std::endl;
|
||||||
if(videoInput != NULL)
|
if(videoInput != NULL)
|
||||||
{
|
{
|
||||||
|
@ -35,10 +35,27 @@
|
|||||||
|
|
||||||
#include "retroshare-gui/configpage.h"
|
#include "retroshare-gui/configpage.h"
|
||||||
|
|
||||||
#include "ui_AudioInputConfig.h"
|
|
||||||
#include "SpeexProcessor.h"
|
#include "SpeexProcessor.h"
|
||||||
#include "VideoProcessor.h"
|
#include "VideoProcessor.h"
|
||||||
#include "AudioStats.h"
|
#include "AudioStats.h"
|
||||||
|
#include "gui/common/RSGraphWidget.h"
|
||||||
|
|
||||||
|
class voipGraphSource ;
|
||||||
|
|
||||||
|
class voipGraph: public RSGraphWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
voipGraph(QWidget *parent) ;
|
||||||
|
|
||||||
|
voipGraphSource *voipSource() const { return _src ; }
|
||||||
|
|
||||||
|
void setVoipSource(voipGraphSource *gs) ;
|
||||||
|
|
||||||
|
private:
|
||||||
|
voipGraphSource *_src ;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "ui_AudioInputConfig.h"
|
||||||
|
|
||||||
class AudioInputConfig : public ConfigPage
|
class AudioInputConfig : public ConfigPage
|
||||||
{
|
{
|
||||||
@ -54,6 +71,7 @@ class AudioInputConfig : public ConfigPage
|
|||||||
QVideoInputDevice *videoInput ;
|
QVideoInputDevice *videoInput ;
|
||||||
bool loaded;
|
bool loaded;
|
||||||
|
|
||||||
|
voipGraphSource *graph_source ;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QTimer *qtTick;
|
QTimer *qtTick;
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>501</width>
|
<width>1155</width>
|
||||||
<height>406</height>
|
<height>713</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
@ -348,33 +348,49 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>Video Processing</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QVideoOutputDevice" name="videoDisplay">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>170</width>
|
|
||||||
<height>128</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Video Processing</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QVideoOutputDevice" name="videoDisplay">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>170</width>
|
||||||
|
<height>128</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="voipGraph" name="voipBwGraph">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -397,6 +413,12 @@
|
|||||||
<header>gui/QVideoDevice.h</header>
|
<header>gui/QVideoDevice.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>voipGraph</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>gui/AudioInputConfig.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>qcbTransmit</tabstop>
|
<tabstop>qcbTransmit</tabstop>
|
||||||
|
@ -88,7 +88,10 @@ void QVideoInputDevice::grabFrame()
|
|||||||
|
|
||||||
bool QVideoInputDevice::getNextEncodedPacket(RsVOIPDataChunk& chunk)
|
bool QVideoInputDevice::getNextEncodedPacket(RsVOIPDataChunk& chunk)
|
||||||
{
|
{
|
||||||
return _video_encoder->nextPacket(chunk) ;
|
if(_video_encoder)
|
||||||
|
return _video_encoder->nextPacket(chunk) ;
|
||||||
|
else
|
||||||
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVideoInputDevice::~QVideoInputDevice()
|
QVideoInputDevice::~QVideoInputDevice()
|
||||||
|
@ -56,6 +56,8 @@ struct RsVOIPDataChunk
|
|||||||
void *data ; // create/delete using malloc/free.
|
void *data ; // create/delete using malloc/free.
|
||||||
uint32_t size ;
|
uint32_t size ;
|
||||||
RsVOIPDataType type ; // video or audio
|
RsVOIPDataType type ; // video or audio
|
||||||
|
|
||||||
|
void clear() ;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RsVOIP
|
class RsVOIP
|
||||||
|
@ -147,6 +147,14 @@ RsServiceInfo p3VOIP::getServiceInfo()
|
|||||||
TURTLE_MIN_MINOR_VERSION);
|
TURTLE_MIN_MINOR_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RsVOIPDataChunk::clear()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(data)
|
||||||
|
free(data) ;
|
||||||
|
data=NULL;
|
||||||
|
size=0 ;
|
||||||
|
}
|
||||||
int p3VOIP::tick()
|
int p3VOIP::tick()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VOIP
|
#ifdef DEBUG_VOIP
|
||||||
|
Loading…
Reference in New Issue
Block a user