打断点的坑

背景:我在编写 h264 转 mp4 格式demo时出现的问题
代码:

String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/1.h264";
try {
	H264TrackImpl h264Track = new H264TrackImpl(new FileDataSourceImpl(path));
	// AACTrackImpl aacTrack = new AACTrackImpl(new FileDataSourceImpl(Environment.getExternalStorageDirectory() + "/test.aac"));
	Movie movie = new Movie();
	movie.addTrack(h264Track);
	// movie.addTrack(aacTrack);
	Container mp4file = new DefaultMp4Builder().build(movie);
	int index = path.lastIndexOf(".")+1;
	String extname = path.substring(index);
	String path_t = path.substring(0, index) + "mp4";
	FileChannel fc = new FileOutputStream(new File(path_t)).getChannel();
	mp4file.writeContainer(fc);
	fc.close();
	path = path_t;
} catch (IOException e) {//IOException e
	e.printStackTrace();
}

过程:
我在H264TrackImpl h264Track = new H264TrackImpl(new FileDataSourceImpl(path));
path = path_t;e.printStackTrace();行打了断点,监听执行情况,然而出现的结果是:进入断点后,按F10,程序再也不进入断点。后续的代码也没有执行(从是否有文件被创建看出)。
后来取消H264TrackImpl h264Track = new H264TrackImpl(new FileDataSourceImpl(path)); 行的断点,程序正确执行到path = path_t;行断点处,文件也被创建。

结论:
1.断点慎打,特别是在耗费资源,消耗性能的函数调用时。
2.如果出现上述情况,取消断点,执行看看。

分析原因:
1.函数执行耗费资源与时间上的数据,导致数据不对应。出现程序跑飞的现象。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值