xuggler を使用してマイク ストリーム (SPEEX コーデック) をライブしようとしていますが、コーデックが null であるという警告が表示されます。この問題の修正は何ですか?
public void audioCapture(String streamName, String sessionId) {
IContainer readContainer = IContainer.make();
readContainer.setInputBufferLength(4096);
String url = "rtmp://127.0.0.1:1935/live/Session_"
+ sessionId + "/" + streamName + " live=1";
if (readContainer.open(url, IContainer.Type.READ, null, true, false) < 0) {
// if(readContainer.open(url, IContainer.Type.READ, null) < 0){
throw new RuntimeException("unable to open read container");
}
int numStreamAudio = readContainer.getNumStreams();
System.out.println("Numer of audio stream: " + numStreamAudio);
IStream stream = readContainer.getStream(0);
audioCoder = readContainer.getStream(0).getStreamCoder();
int st = audioCoder.open(null, null);
// if(st<0) throw new RuntimeException("cant open audio coder");
// if(audioCoder.open() <0) throw new
// RuntimeException("cant open audio coder");
System.out.println(" audio coder prop channels"
+ audioCoder.getChannels() + " sample rate "
+ audioCoder.getSampleRate() + " bit rate "
+ audioCoder.getBitRate() + " codec type "
+ audioCoder.getCodecType().toString() + " codec tag "
+ audioCoder.getCodecTag() + " audio frame size "
+ audioCoder.getAudioFrameSize() + " codec id "
+ audioCoder.getCodecID().toString() + " num properties "
+ audioCoder.getNumProperties());
writer.addAudioStream(1, 1, 1, 16000);
IPacket packet = IPacket.make();
while (readContainer.readNextPacket(packet) >= 0) {
IAudioSamples samples = IAudioSamples.make(1024, 1);
int offset = 0;
while (offset < packet.getSize()) {
int bytesDecoded = audioCoder.decodeAudio(samples, packet,
offset);
// if(bytesDecoded < 0) throw new
// RuntimeException("got error decoding audio in: " );
offset += bytesDecoded;
}
}
// IAudioSamples samples = IAudioSamples.make(numSamples, numChannels)
}
エラー:
20:24:25,569 INFO [stdout] (http-0.0.0.0-0.0.0.0-8081-2) 20:24:25.568 [http-0.0.0.0-0.0.0.0-8081-2] WARN com.xuggle.xuggler - Attempting to decode when not ready; codec not opened (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:873)
20:25:41,517 INFO [stdout] (http-0.0.0.0-0.0.0.0-8081-2) 20:25:41.517 [http-0.0.0.0-0.0.0.0-8081-2] WARN com.xuggle.xuggler - Attempting to decode when not ready; codec not opened (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:873)
20:25:42,621 INFO [stdout] (http-0.0.0.0-0.0.0.0-8081-2) 20:25:42.621 [http-0.0.0.0-0.0.0.0-8081-2] WARN com.xuggle.xuggler - Attempting to decode when not ready; codec not opened (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:873)
20:25:43,485 INFO [stdout] (http-0.0.0.0-0.0.0.0-8081-2) 20:25:43.485 [http-0.0.0.0-0.0.0.0-8081-2] WARN com.xuggle.xuggler - Attempting to decode when not ready; codec not opened (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:873)