| | |
| | | String timestampStr = null; |
| | | // camera2的文件名格式:h264_camera2_1234567890123.h264 |
| | | if (fileName.startsWith("h264_camera2_") && fileName.endsWith(".h264")) { |
| | | timestampStr = fileName.substring(14, fileName.length() - 5); // 去掉 "h264_camera2_" 和 ".h264" |
| | | timestampStr = fileName.substring(13, fileName.length() - 5); // 去掉 "h264_camera2_" 和 ".h264" |
| | | } |
| | | |
| | | if (timestampStr == null || timestampStr.trim().isEmpty()) { |
| | |
| | | if (fileName.startsWith("h264_camera2_") && fileName.endsWith(".h264")) { |
| | | try { |
| | | // 提取文件名中的时间戳 |
| | | String timestampStr = fileName.substring(14, fileName.length() - 5); // 去掉 "h264_camera2_" 和 ".h264" |
| | | String timestampStr = fileName.substring(13, fileName.length() - 5); // 去掉 "h264_camera2_" 和 ".h264" |
| | | long timestamp = Long.parseLong(timestampStr); |
| | | startTimeFromFileName = new Date(timestamp); |
| | | } catch (NumberFormatException e) { |
| | |
| | | // 复制 IDR 帧 |
| | | System.arraycopy(idr, 0, combined, offset, idr.length); |
| | | |
| | | Timber.d("Combined SPS/PPS/IDR frame, total size: %d (SPS: %d, PPS: %d, IDR: %d)", |
| | | totalLength, sps.length, pps.length, idr.length); |
| | | // Timber.d("Combined SPS/PPS/IDR frame, total size: %d (SPS: %d, PPS: %d, IDR: %d)", |
| | | // totalLength, sps.length, pps.length, idr.length); |
| | | |
| | | return combined; |
| | | } |