private static final int MSG_OPEN = 0;
private static final int MSG_CLOSE = 1;
HandlerThread handlerThread = new HandlerThread("Muxer");
handlerThread.start();
Handler handler = new Handler(handlerThread.getLooper(), new Handler.Callback()
{
@Override
public boolean handleMessage(Message msg) {
RTMPMessage m = (RTMPMessage) msg.obj;
switch (msg.what) {
case MSG_OPEN:
nativeOpen(m.mUrl, m.mWidth, m.mHeight, m.mSampleRate, m.mChannels);
break;
case MSG_CLOSE:
nativeClose(mNativeMuxer);
break;
}
return false;
}
});
handler.sendEmptyMessage(MSG_CLOSE);
RTMPMessage m = new RTMPMessage(mUrl, video_width, video_height, sampleRate, channels);
Message message = handler.obtainMessage(MSG_OPEN, m);
handler.sendMessage(message);
java 消息队列
最新推荐文章于 2024-06-17 09:50:51 发布