mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
fixed deleting/stopping video devices
This commit is contained in:
parent
b1572c2924
commit
77c0d562fb
@ -157,6 +157,8 @@ void AudioInputConfig::togglePreview(bool b)
|
||||
|
||||
AudioInputConfig::~AudioInputConfig()
|
||||
{
|
||||
disconnect( qtTick, SIGNAL( timeout ( ) ), this, SLOT( on_Tick_timeout() ) );
|
||||
|
||||
graph_source->stop() ;
|
||||
graph_source->setVideoInput(NULL) ;
|
||||
|
||||
@ -350,8 +352,10 @@ void AudioInputConfig::on_qcbTransmit_currentIndexChanged(int v) {
|
||||
}
|
||||
|
||||
|
||||
void AudioInputConfig::on_Tick_timeout() {
|
||||
if (!inputAudioProcessor) {
|
||||
void AudioInputConfig::on_Tick_timeout()
|
||||
{
|
||||
if (!inputAudioProcessor)
|
||||
{
|
||||
inputAudioProcessor = new QtSpeex::SpeexInputProcessor();
|
||||
inputAudioProcessor->open(QIODevice::WriteOnly | QIODevice::Unbuffered);
|
||||
|
||||
@ -376,7 +380,7 @@ void AudioInputConfig::on_Tick_timeout() {
|
||||
// also transmit encoded video
|
||||
RsVOIPDataChunk chunk ;
|
||||
|
||||
while(videoInput->getNextEncodedPacket(chunk))
|
||||
while((!videoInput->stopped()) && videoInput->getNextEncodedPacket(chunk))
|
||||
{
|
||||
videoProcessor->receiveEncodedData(chunk) ;
|
||||
chunk.clear() ;
|
||||
|
@ -15,6 +15,11 @@ QVideoInputDevice::QVideoInputDevice(QWidget *parent)
|
||||
_echo_output_device = NULL ;
|
||||
}
|
||||
|
||||
bool QVideoInputDevice::stopped()
|
||||
{
|
||||
return _timer == NULL ;
|
||||
}
|
||||
|
||||
void QVideoInputDevice::stop()
|
||||
{
|
||||
if(_timer != NULL)
|
||||
@ -54,6 +59,9 @@ void QVideoInputDevice::start()
|
||||
|
||||
void QVideoInputDevice::grabFrame()
|
||||
{
|
||||
if(!_timer)
|
||||
return ;
|
||||
|
||||
IplImage *img=cvQueryFrame(_capture_device);
|
||||
|
||||
if(img == NULL)
|
||||
@ -87,6 +95,9 @@ void QVideoInputDevice::grabFrame()
|
||||
|
||||
bool QVideoInputDevice::getNextEncodedPacket(RsVOIPDataChunk& chunk)
|
||||
{
|
||||
if(!_timer)
|
||||
return false ;
|
||||
|
||||
if(_video_processor)
|
||||
return _video_processor->nextEncodedPacket(chunk) ;
|
||||
else
|
||||
@ -100,7 +111,8 @@ uint32_t QVideoInputDevice::currentBandwidth() const
|
||||
|
||||
QVideoInputDevice::~QVideoInputDevice()
|
||||
{
|
||||
stop() ;
|
||||
stop() ;
|
||||
_video_processor = NULL ;
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,8 +51,8 @@ class QVideoInputDevice: public QObject
|
||||
|
||||
void start() ;
|
||||
void stop() ;
|
||||
|
||||
protected slots:
|
||||
bool stopped();
|
||||
protected slots:
|
||||
void grabFrame() ;
|
||||
|
||||
signals:
|
||||
|
Loading…
Reference in New Issue
Block a user