#android #uvc
#Android #uvc
Вопрос:
Прямо сейчас я использую UVC-камеру и отправляю видео и аудио с UVC-камеры на телефон Android
Когда я пытаюсь записывать AudioRecord
, появляются странные ценности, и я в замешательстве.
Есть ли способ настроить AudioRecord
использование микрофона UVC-камеры?
Звук хорошо работает в других приложениях в Play Store, поэтому должен быть какой-то способ заставить его работать.
int bufferSize = AudioRecord.getMinBufferSize(sampleRate, recorder_channels, RECORDER_AUDIO_ENCODING) ; // bufferSize *= 2; if(audioMode == AudioManager.MODE_NORMAL) audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, recorder_channels, RECORDER_AUDIO_ENCODING, bufferSize); else if(audioMode == AudioManager.MODE_IN_COMMUNICATION) audioRecord = new AudioRecord(MediaRecorder.AudioSource.VOICE_COMMUNICATION, sampleRate, recorder_channels, RECORDER_AUDIO_ENCODING, bufferSize); if(audioRecord.getState() == AudioRecord.STATE_INITIALIZED) { audioRecord.startRecording(); } short[] sData = new short[bufferSize/2]; while ( isRun) { int bufferReadResult = audioRecord.read(sData, 0, bufferSize/2); byte[] buffer = short2byte(sData); if(mute) Arrays.fill(buffer, (byte) 0); pcmQueue.add(buffer); } if(audioRecord != null) { if(audioRecord.getState() != AudioRecord.STATE_INITIALIZED) { audioRecord.stop(); audioRecord.release(); } }
подключите ЖУРНАЛ ДАННЫХ UVC
AudioRecorder: run: [1, 0, 1, 0, 0, 0, -1, -1, -1, -1, 2, 0, -1, -1, -2, -1, 1, 0, -1, -1, 1, 0, 2, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, -1, -1, 1, 0, -1, -1, 1, 0, 2, 0, 0, 0, -1, -1, 0, 0, 1, 0, 1, 0, -2, -1, -2, -1, 0, 0, -1, -1, 2, 0, 1, 0, -2, -1, 1, 0, 1, 0, 2, 0, 2, 0, 0, 0, -2, -1, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, 1, 0, 1, 0, 2, 0, 0, 0, -1, -1, -1, -1, 1, 0, 1, 0, -1, -1, 1, 0, -2, -1, 0, 0, 0, 0, -2, -1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 2, 0, -1, -1, -3, -1, 1, 0, 0, 0, 1, 0, 0, 0, -1, -1, 0, 0, 1, 0, 1, 0, -2, -1, 2, 0, 0, 0, -1, -1, 0, 0, 0, 0, 2, 0, -1, -1, 1, 0, 0, 0, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 2, 0, -2, -1, -1, -1, 1, 0, -1, -1, 2, 0, 2, 0, 0, 0, -1, -1, -1, -1, 0, 0, -2, -1, -1, -1, 0, 0, 2, 0, 0, 0, -1, -1, 1, 0, -1, -1, 1, 0, 2, 0, 1, 0, -2, -1, 1, 0, 1, 0, -1, -1, -2, -1, -1, -1, 0, 0, 0, 0, 2, 0, 1, 0, 2, 0, -1, -1, 0, 0, 0, 0, -1, -1, 0, 0, -1, -1, 1, 0, -1, -1, 0, 0, 2, 0, -1, -1, 2, 0, 1, 0, -1, -1, 0, 0, -2, -1, -1, -1, 1, 0, -1, -1, -1, -1, 1, 0, 1, 0, 1, 0, -2, -1, -1, -1, 0, 0, 2, 0, 2, 0, -1, -1, -1, -1, -1, -1, 2, 0, 2, 0, -1, -1, -1, -1, -2, -1, -1, -1, 1, 0, 1, 0, 2, 0, 0, 0, 0, 0, -1, -1, 0, 0, 2, 0, -1, -1, 0, 0, 1, 0, 0, 0, 0, 0, -1, -1, -1, -1, 1, 0, 2, 0, -1, -1, -1, -1, 0, 0, 2, 0, 0, 0, -1, -1, 0, 0, -2, -1, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, -1, -1, 1, 0, 2, 0, 2, 0, -1, -1, 0, 0, -2, -1, -2, -1, 1, 0, -2, -1, 3, 0, 1, 0, 0, 0, 1, 0, -1, -1, 1, 0, -1, -1, 0, 0, -1, -1, -2, -1, -1, -1, 0, 0, 3, 0, 1, 0, 0, 0, 1, 0, -1, -1, -1, -1, 1, 0, -2, -1, 0, 0, 0, 0, -2, -1, 1, 0, 1, 0, 0, 0, 2, 0, 1, 0, 0, 0, -2, -1, 0, 0, 1, 0, -1, -1, 1, 0, -2, -1, 0, 0, 2, 0, -1, -1, -2, -1, -1, -1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, -1, -1, -1, -1, -2, -1, 1, 0, 1, 0, 1, 0, 1, 0, -1, -1, 0, 0, -2, -1, 1, 0, 0, 0, -1, -1, 0, 0, -2, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, -1, -1, -2, -1, -1, -1, 1, 0, 1, 0, -2, -1, 0, 0, 2, 0, -1, -1, 3, 0, 1, 0, 0, 0, 0, 0, -2, -1, 2, 0, -2, -1, 0, 0, 0, 0, -1, -1, 1, 0, -2, -1, 1, 0, 0, 0, -2, -1, 1, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, -2, -1, 1, 0, 0, 0, -1, -1, 1, 0, -1, -1, 0, 0, -3, -1, 0, 0, 0, 0, -1, -1, 1, 0, 1, 0, 1, 0, -2, -1, 1, 0, 0, 0, -1, -1, 1, 0, -2, -1, -1, -1, 2, 0, 0, 0, 0, 0, 2, 0, 1, 0, -1, -1, 0, 0, 1, 0, 0, 0, -1, -1, -2, -1, -1, -1, -1, -1, 1, 0, 2, 0, -1, -1, -1, -1, 1, 0, 2, 0, 1, 0, 0, 0, -1, -1, -1, -1, 0, 0, -1, -1, 0, 0, 1, 0, 0, 0, -1, -1, 1, 0, 2, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, 1, 0, 1, 0, -1, -1, 1, 0, 1, 0, 0, 0, -2, -1, -2, -1, 0, 0, 1, 0, 0, 0, 0, 0, -2, -1, -1, -1, 1, 0, 1, 0, 0, 0, -2, -1, 1, 0, 0, 0, 0, 0, 1, 0, -1, -1, 2, 0, 0, 0, 0, 0, 0, 0, -2, -1, 1, 0, -2, -1, 1, 0, 2, 0, -1, -1, -1, -1, -2, -1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 1, 0, -1, -1, -1, -1, -1, -1, 0, 0, 2, 0, 1, 0, 1, 0, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, 1, 0, 0, 0, 2, 0, 2, 0, 1, 0, -1, -1, -3, -1, 2, 0, -1, -1, -2, -1, 1, 0, -1, -1, 0, 0, 1, 0, 2, 0, 0, 0, 2, 0, -1, -1, -1, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, -2, -1, 0, 0, 1, 0, 0, 0, -1, -1, -1, -1, -2, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -2, -1, 3, 0, -1, -1, 1, 0, 0, 0, -1, -1, 2, 0, -2, -1, 1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 1, 0, 0, 0, 2, 0, 1, 0, -2, -1, 1, 0, -3, -1, -2, -1, 2, 0, 0, 0, -1, -1, 3, 0, 3, 0, 0, 0, -1, -1, 0, 0, 1, 0, -2, -1, -2, -1, -3, -1, 1, 0, 0, 0, -2, -1, 2, 0, 0, 0, 2, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, -1, -1, 0, 0, -2, -1, -2, -1, 2, 0, -1, -1, 1, 0, 0, 0, 0, 0, 1, 0, -1, -1, 0, 0, 1, 0, 1, 0, -1, -1, 0, 0, 0, 0, -1, -1, 1, 0, 1, 0, -1, -1, -2, -1, 0, 0, 1, 0, 1, 0, 1, 0, -1, -1, -2, -1, 1, 0, 2, 0, 1, 0, -1, -1, 0, 0, 2, 0, -1, -1, -1, -1, -2, -1, 0, 0, 0, 0, -2, -1, 2, 0, 2, 0, -1, -1, 1, 0, -1, -1, 0, 0, 0, 0, -1, -1, 0, 0, -2, -1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, -1, -1, -2, -1, 1, 0, -1, -1, -2, -1, 1, 0, 2, 0, 2, 0, -1, -1, 0, 0, 1, 0, -1, -1, -1, -1, 0, 0, 2, 0, -1, -1, -1, -1, 1, 0, 1, 0, 0, 0, -1, -1, 2, 0, -1, -1, -1, -1, 1, 0, -1, -1, 2, 0, -2, -1, -1, -1, 0, 0, -2, -1, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, -1, -1, 0, 0,
обычный журнал
run: [-5, -28, -1, -28, -112, -29, -123, -29, 102, -29, 97, -29, -73, -29, -65, -29, -56, -27, -56, -27, -74, -24, -78, -24, -83, -25, -90, -25, 52, -28, 59, -28, -79, -31, -85, -31, -9, -31, -1, -31, -30, -30, -22, -30, -79, -27, -79, -27, -12, -26, -10, -26, -108, -24, -121, -24, -47, -23, -53, -23, -29, -25, -27, -25, -56, -26, -51, -26, 0, -26, -6, -27, 21, -26, 24, -26, -108, -24, -100, -24, -103, -22, -106, -22, -33, -22, -39, -22, 36, -21, 43, -21, -8, -24, 2, -23, 18, -24, 25, -24, 61, -23, 58, -23, 118, -20, 110, -20, 104, -17, 109, -17, -56, -18, -65, -18, -76, -19, -78, -19, 101, -18, 100, -18, 104, -16, 100, -16, -33, -16, -27, -16, 33, -14, 33, -14, 14, -12, 11, -12, -100, -12, -105, -12, 21, -12, 31, -12, 22, -11, 23, -11, 63, -9, 66, -9, -93, -8, -91, -8, -67, -7, -79, -7, 43, -4, 42, -4, 76, -6, 71, -6, 79, -9, 86, -9, -121, -9, -106, -9, 31, -4, 27, -4, -108, 2, -115, 2, -70, 7, -87, 7, 32, 7, 32, 7, -55, -1, -55, -1, -41, -8, -39, -8, -59, -6, -55, -6, -60, 2, -60, 2, 47, 13, 49, 13, -20, 16, -27, 16, 59, 10, 59, 10, 9, 0, 15, 0, 21, -6, 25, -6, -52, -3, -44, -3, -51, 6, -51, 6, -88, 14, -88, 14, 19, 14, 15, 14, -11, 6, -7, 6, 32, -1, 26, -1, -27, -3, -32, -3, 73, 4, 80, 4, 64, 11, 61, 11, 1, 14, 1, 14, -75, 10, -69, 10, -53, 3, -57, 3, 83, -1, 81, -1, -121, 0, -106, 0, -36, 6, -28, 6, -34, 11, -43, 11, -122, 12, 125, 12, 107, 9, 104, 9, -124, 5, -117, 5, 14, 3, 15, 3, -78, 3, -78, 3, -43, 7, -49, 7, -34, 11, -35, 11, -30, 14, -30, 14, -82, 13, -78, 13, 110, 10, 116, 10, -22, 7, -29, 7, 85, 8, 75, 8, 49, 12, 64, 12, 36, 16, 40, 16, -54, 18, -57, 18, -2, 17, -10, 17, -81, 16, -75, 16, -50, 15, -50, 15, -76, 15, -74, 15, -84, 16, -79, 16, -52, 17, -67, 17, -33, 18, -29, 18, 52, 20, 48, 20, 66, 20, 70, 20, 13, 18, 19, 18, -48, 13, -48, 13, -59, 12, -57, 12, -71, 15, -76, 15, -85, 19, -84, 19, 57, 20, 58, 20, -49, 16, -47, 16, 74, 14, 90, 14, -18, 12, -23, 12, -57, 13, -67, 13, 36, 17, 39, 17, 75, 18, 79, 18, -52, 16, -55, 16, 39, 14, 37, 14, -38, 12, -38, 12, 102, 13, 93, 13, 38, 14, 33, 14, 86, 15, 91, 15, 11, 19, 14, 19, 101, 17, 92, 17, -70, 11, -73, 11, -100, 11, -95, 11, 109, 12, 122, 12, -99, 11, -93, 11, -103, 11, -104, 11, -70, 13, -76, 13, -116, 14, 127, 14, -107, 14, -103, 14, 69, 13, 69, 13, 112, 11, 119, 11, 122, 12, 121, 12, -121, 12, -118, 12, 127, 11, 113, 11, 99, 13, 100, 13, -25, 13, -19, 13, -117, 12, -114, 12, -69, 14, -68, 14, -37, 13, -29, 13, 70, 13, 62, 13, 53, 16, 62, 16, -13, 16, -17, 16, -121, 18, -117, 18, 72, 17, 73, 17, -15, 15, -21, 15, 15, 15, 16, 15, -121, 15, 121, 15, 6, 16, 9, 16, 24, 17, 38, 17, -26, 17, -19, 17, 16, 16, 12, 16, -76, 14, -85, 14, 26, 13, 23, 13, 62, 15, 76, 15, 84, 17, 80, 17, 56, 18, 48, 18, 37, 18, 44, 18, 49, 15, 41, 15, 70, 12, 77, 12, -34, 11, -27, 11, 7, 16, 5, 16, 64, 19, 59, 19, 32, 18, 22, 18, -109, 14, -111, 14, -4, 11, -7, 11, -124, 12, 126, 12, -118, 14, -110, 14, 64, 17, 77, 17, -96, 19, -106, 19, 13, 18, 11, 18, -66, 12, -68, 12, -106, 9, -96, 9, -6, 11, -20, 11, 8, 17, 16, 17, -21, 22, -20, 22, 39, 25, 37, 25, -107, 22, -106, 22, -93, 16, -94, 16, 75, 13, 75, 13, -123, 14, -121, 14, -80, 19, -79, 19, -10, 24, -8, 24, 16, 26, 5, 26, 56, 21, 52, 21, -110, 15, -103, 15, 17, 16, 15, 16, 35, 21, 31, 21, 82, 26, 76, 26, -76, 27, -71, 27, 117, 25, 124, 25, 82, 20, 81, 20, 125, 14, 124, 14, 97, 14, 91, 14, 42, 20, 52, 20, 71, 26, 71, 26, -61, 27, -57, 27, -60, 21, -72, 21, -126, 14, -116, 14, -60, 11, -55, 11, -55, 15, -60, 15, -102, 21, -97, 21, 12, 25, 8, 25, 52, 24, 59, 24, -29, 19, -34, 19, -79, 15, -73, 15, 100, 13, 98, 13, -49, 14, -55, 14, -2, 15, 2, 16, -106, 16, -115, 16, -19, 17, -17, 17, -115, 18, 126, 18, 63, 16, 67, 16, 98, 13, 105, 13, -34, 12, -33, 12, 96, 12, 94, 12, 23, 12, 22, 12, -49, 12, -53, 12, -47, 11, -34, 11, -71, 11, -81, 11, -15, 12, -18, 12, 127, 14, -118, 14, -113, 15, -123, 15, -35, 14, -26, 14, 42, 12, 47, 12, -82, 8, -90, 8, -62, 6, -61, 6, -9, 6, -6, 6, 42, 9, 31, 9, 16, 12, 9, 12, 59, 12, 66, 12, 56, 9, 66, 9, -128, 7, 119, 7, 95, 5, 91, 5,
При первом подключении UVC-камеры и записи отображается значение «подключить журнал ДАННЫХ UVC», а после завершения записи снова нажмите кнопку записи, чтобы отобразить значение «обычный журнал».
Комментарии:
1. Это проблема с приложением, которое вы пишете, или только с вашим телефоном?
2. Судя по тому, что другие приложения работают хорошо, похоже, что проблема заключается в приложении, которое я создаю.
3. Если UVC-камера не используется, она работает нормально. Камера UVC в настоящее время подключена к мобильному телефону через плату захвата, будет ли это иметь какой-либо эффект?
4. Я сделал пару правок, чтобы попытаться прояснить вопрос — есть ли у меня правильная идея?