summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfred <fred@home.lan>2011-03-28 09:38:27 (GMT)
committer fred <fred@home.lan>2011-03-28 09:38:27 (GMT)
commitbfca90554d5bc27c56a9d410120adaad45ccbb1b (patch)
tree3ba1a862aec020ec4abd436492de4c59257b55e2
parent4cac1689a0133dca3e83083c1b7a972a56ccfdad (diff)
Modified encoder sample rate to sync sound with video
- in QJackClient, modified sample rate parameter when creating the AudioCollector object. This modify the vorbis speed when streaming. Commented out ::chgSampleRate() since it is not used - in init_info(), use again the skeleton. - VideoEncoder::thread_loop(), shaws the shout delay for testing.
-rw-r--r--qt/TODO11
-rw-r--r--qt/qJackClient.cpp18
-rw-r--r--qt/qJackClient.h2
-rw-r--r--src/theorautils.cpp3
-rw-r--r--src/video_encoder.cpp3
5 files changed, 20 insertions, 17 deletions
diff --git a/qt/TODO b/qt/TODO
index d205367..ecdc454 100644
--- a/qt/TODO
+++ b/qt/TODO
@@ -7,15 +7,14 @@
//add a x:x ratio button, resizing to the closest width and lenght to obtain this ratio
//create a console for messages comming from func() warning() notice() act(). see Logger class
//see to integrate ogg skeleton config on the graphic interface
-//there is the amount of delay between audio and video if you open a video before creating
+//there is a delay between audio and video if you open a video before creating
the QJackClient of the time you waited to open the QJackClient .... see if a fix possible or needed.
//Jack server sample rate and buffer size is hard coded for the moment, provide a way to put it manualy
//try to fix sound problem issue when opening several VideoLayer with audio
-//add the capability to have a config file..... important :)
-//if resizing the wiewport when the layer is bigger, you need to just touch the layer size to display it correctly
+//add the capability to keep the actual config in a file..... important :)
+//if resizing the wiewport when the layer is bigger, you just need to touch the layer size to display it correctly
//why qfreej doesn't install with the AUR packages
//see if possible to manage an audio layer
//be able to change v4l2 resolution from the graphic interface
-//see why sound delay increases on video during streaming
-//see why sound stops after a whyle when streaming .... have to deconnect jack ports and connect back
-//need do adjust stream bitrate value.
+//see why sound delay increases on video during streaming (sound slower than video ... or video too fast)
+//see why sound coming from the jack input stops after a whyle when streaming .... have to deconnect jack ports and reconnect
diff --git a/qt/qJackClient.cpp b/qt/qJackClient.cpp
index 7078e6e..6a2f9a3 100644
--- a/qt/qJackClient.cpp
+++ b/qt/qJackClient.cpp
@@ -49,7 +49,8 @@ bool QJackClient::init()
return (false);
}
- m_audio = new AudioCollector(1024, 48000, m_Jack);
+ m_audio = new AudioCollector(1024, 48192, m_Jack); //48240 seems to be a good value in my config
+// m_audio = new AudioCollector(1024, 48000, m_Jack);
m_Jack->isEncoded(false);
m_Enc = m_Qfreej->getEnc();
@@ -71,14 +72,15 @@ bool QJackClient::init()
m_Coef->setEnabled(false);
layoutG->addWidget(m_Coef, 2, 0, 1, 2);
m_Coef->setToolTip("sets the Mix coefficient between Jack Input and Video Layer output");
-
+
+ //not used
m_SampleRate = new QLineEdit;
- connect (m_SampleRate, SIGNAL(returnPressed()), this, SLOT(chgSampleRate()));
+// connect (m_SampleRate, SIGNAL(returnPressed()), this, SLOT(chgSampleRate()));
m_SampleRate->setValidator(new QIntValidator(m_SampleRate));
m_SampleRate->setText("48000"); //default Jackd sample rate
m_SampleRate->setEnabled(false);
// m_Jack->m_SampleRate = 48000; //not necessary as it is donne in AudioCollector constructor
-
+ //
QLabel *vSampleRate = new QLabel("J SampleRate :");
layoutG->addWidget(vSampleRate, 3, 0);
layoutG->addWidget(m_SampleRate, 3, 1);
@@ -166,10 +168,10 @@ void QJackClient::addInput()
}
}
-void QJackClient::chgSampleRate()
-{
- m_Jack->m_SampleRate = m_SampleRate->text().toInt();
-}
+// void QJackClient::chgSampleRate()
+// {
+// m_Jack->m_SampleRate = m_SampleRate->text().toInt();
+// }
int QJackClient::getSampleRate()
{
diff --git a/qt/qJackClient.h b/qt/qJackClient.h
index 4f005a2..9180445 100644
--- a/qt/qJackClient.h
+++ b/qt/qJackClient.h
@@ -25,7 +25,7 @@ public:
public slots:
void addInput();
void addOutput();
- void chgSampleRate();
+// void chgSampleRate();
void chgSamples();
void changeMixCoef(int);
diff --git a/src/theorautils.cpp b/src/theorautils.cpp
index dec9077..a27e6c4 100644
--- a/src/theorautils.cpp
+++ b/src/theorautils.cpp
@@ -72,7 +72,7 @@ static double rint(double x)
void init_info(oggmux_info *info) {
info->audio_only = 0;
- info->with_skeleton = 0; /* skeleton is enabled by default */
+ info->with_skeleton = 1; /* skeleton is enabled by default */
info->frontend = NULL; /*frontend mode*/
info->videotime = 0;
info->audiotime = 0;
@@ -572,7 +572,6 @@ void oggmux_init (oggmux_info *info){
if (info->with_skeleton) {
add_fisbone_packet (info);
while (1) {
- std::cerr << "------- with_skeleton !!!!" << std::endl;
int result = ogg_stream_flush (&info->so, &og); //3 with_skeleton
if (result < 0) {
/* can't get here */
diff --git a/src/video_encoder.cpp b/src/video_encoder.cpp
index 21b5e51..c3ac432 100644
--- a/src/video_encoder.cpp
+++ b/src/video_encoder.cpp
@@ -260,6 +260,9 @@ void VideoEncoder::thread_loop() {
fwrite(encbuf, 1, encnum, filedump_fd);
if(write_to_stream) {
+ int wait_ms;
+ wait_ms = shout_delay(ice);
+ std::cerr << "---- shout delay :" << wait_ms << std::endl;
// shout_sync(ice); //no sound when commented out !!
if( shout_send(ice, (const unsigned char*)encbuf, encnum)
!= SHOUTERR_SUCCESS) {