GStreamer: improve camerabin audio settings checking.
Don't try setting a sample rate or a channel count equal to 0. Change-Id: Ib2e1728f0d9af09df9c4d3fd1322b5cb174a2981 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
This commit is contained in:
@@ -420,7 +420,7 @@ void CameraBinSession::setAudioCaptureCaps()
|
|||||||
const int sampleRate = settings.sampleRate();
|
const int sampleRate = settings.sampleRate();
|
||||||
const int channelCount = settings.channelCount();
|
const int channelCount = settings.channelCount();
|
||||||
|
|
||||||
if (sampleRate == -1 && channelCount == -1)
|
if (sampleRate <= 0 && channelCount <=0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if GST_CHECK_VERSION(1,0,0)
|
#if GST_CHECK_VERSION(1,0,0)
|
||||||
@@ -434,9 +434,9 @@ void CameraBinSession::setAudioCaptureCaps()
|
|||||||
"depth", G_TYPE_INT, 16,
|
"depth", G_TYPE_INT, 16,
|
||||||
NULL);
|
NULL);
|
||||||
#endif
|
#endif
|
||||||
if (sampleRate != -1)
|
if (sampleRate > 0)
|
||||||
gst_structure_set(structure, "rate", G_TYPE_INT, sampleRate, NULL);
|
gst_structure_set(structure, "rate", G_TYPE_INT, sampleRate, NULL);
|
||||||
if (channelCount != -1)
|
if (channelCount > 0)
|
||||||
gst_structure_set(structure, "channels", G_TYPE_INT, channelCount, NULL);
|
gst_structure_set(structure, "channels", G_TYPE_INT, channelCount, NULL);
|
||||||
|
|
||||||
GstCaps *caps = gst_caps_new_full(structure, NULL);
|
GstCaps *caps = gst_caps_new_full(structure, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user