mirror of
https://github.com/dyne/FreeJ.git
synced 2026-06-16 12:59:33 +02:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
+10
-8
@@ -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()
|
||||
{
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public:
|
||||
public slots:
|
||||
void addInput();
|
||||
void addOutput();
|
||||
void chgSampleRate();
|
||||
// void chgSampleRate();
|
||||
void chgSamples();
|
||||
void changeMixCoef(int);
|
||||
|
||||
|
||||
+1
-2
@@ -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 */
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user