通过以下代码,我开始从一台设备开始播放视频并成功运行
// Begin video communication
final ParcelFileDescriptor pfd = ParcelFileDescriptor.fromSocket(client);
handler.post(new Runnable() {
@Override
public void run() {
recorder = new MediaRecorder();
recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setOutputFile(pfd.getFileDescriptor());
// recorder.setVideoFrameRate(20);
recorder.setVideoSize(176, 144);
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
recorder.setPreviewDisplay(mHolder.getSurface());
try {
recorder.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
recorder.start();
}
catch (Exception e)
{
System.out.println("Video recorder3.3333 " + e);
}
通过以下代码我正在第二台设备上播放视频流
clientSocket = new Socket(InetAddress.getByName(SERVERIP), SERVERPORT);
ParcelFileDescriptor pfd = ParcelFileDescriptor.fromSocket(clientSocket);
pfd.getFileDescriptor().sync();
pfd.close();
mp.setDisplay(holder);
mp.prepareAsync();
mp.start();
但此行问题// pfd.getFileDescriptor().sync();
我收到了错误:
java.io.SyncFailedException:fsync failed:EINVAL(无效参数)
这是什么解决方案?