java - When I put ParcelFileDescriptor into my MediaExtractor setDataSource(),cause IOException -
i video data datagramsocket,and it's byte[] know,and can't decode byte[] exactly. have used mediaextractor work. here code:
@override public void run() { eosreceived = false; try { socket.receive(packet); parcelfiledescriptor pfd = parcelfiledescriptor.fromdatagramsocket(socket); filedescriptor fd = pfd.getfiledescriptor(); mextractor.setdatasource(fd, 0, packet.getdata().length); (int = 0; < mextractor.gettrackcount(); i++) { mediaformat format = mextractor.gettrackformat(i); string mime = format.getstring(mediaformat.key_mime); if (mime.startswith(video)) { mextractor.selecttrack(i); mdecoder = mediacodec.createdecoderbytype(mime); try { log.d(tag, "format : " + format); mdecoder.configure(format, surface, null, 0 /* decoder */); } catch (illegalstateexception e) { log.e(tag, "codec '" + mime + "' failed configuration. " + e); } mdecoder.start(); break; } } } catch (exception e) { e.printstacktrace(); }
it go catch when code run on mextractor.setdatasource(fd, 0, packet.getdata().length); , exception java.io.ioexception: failed instantiate extractor. have no idea solve problem.... way.it's work yesterday morning,but since yesterday afternoon,it doesn't work more .... please help,thanks lot :)
Comments
Post a Comment