app/src/main/java/com/anyun/h264/H264EncodeService.java
@@ -348,6 +348,56 @@
    }
    
    /**
     * 在第二个进程(camera2)中获取资源列表
     */
    private List<ResourceInfo> getResourceListInProcess2(String startTime, String endTime, boolean useTFCard, String jsonConfig) {
        Timber.d("Routing to process 2 (camera2) for getResourceList");
        try {
            // 确保第二个进程的服务已绑定
            if (!ensureCamera2ServiceBound()) {
                Timber.e("Failed to bind camera2 service");
                return new ArrayList<>();
            }
            // 调用第二个进程的服务
            if (camera2Service != null) {
                return camera2Service.getResourceList(startTime, endTime, useTFCard, jsonConfig);
            } else {
                Timber.e("Camera2 service is null");
                return new ArrayList<>();
            }
        } catch (RemoteException e) {
            Timber.e(e, "Error calling camera2 service for getResourceList");
            return new ArrayList<>();
        }
    }
    /**
     * 在第二个进程(camera2)中设置水印信息
     */
    private void setWatermarkInfoInProcess2(String watermarkInfoJson, String jsonConfig) {
        Timber.d("Routing to process 2 (camera2) for setWatermarkInfo");
        try {
            // 确保第二个进程的服务已绑定
            if (!ensureCamera2ServiceBound()) {
                Timber.e("Failed to bind camera2 service");
                return;
            }
            // 调用第二个进程的服务
            if (camera2Service != null) {
                camera2Service.setWatermarkInfo(watermarkInfoJson, jsonConfig);
            } else {
                Timber.e("Camera2 service is null");
            }
        } catch (RemoteException e) {
            Timber.e(e, "Error calling camera2 service for setWatermarkInfo");
        }
    }
    /**
     * 确保第二个进程的服务已绑定
     */
    private synchronized boolean ensureCamera2ServiceBound() {
@@ -758,6 +808,25 @@
    private List<ResourceInfo> getResourceList(String startTime, String endTime,boolean useTFCard,String jsonConfig) {
        Timber.d("getResourceList called, startTime: %s, endTime: %s, useTFCard: %b", startTime, endTime, useTFCard);
        
        // 解析cameraId(如果配置中有)
        Integer cameraId = null;
        if (jsonConfig != null && !jsonConfig.trim().isEmpty()) {
            try {
                JSONObject json = new JSONObject(jsonConfig);
                if (json.has("cameraId")) {
                    cameraId = json.optInt("cameraId", 1);
                }
            } catch (JSONException e) {
                // 忽略解析错误,继续使用当前进程
                Timber.w(e, "Failed to parse cameraId from jsonConfig");
            }
        }
        // 如果指定了cameraId=2,路由到第二个进程
        if (cameraId != null && cameraId == 2) {
            return getResourceListInProcess2(startTime, endTime, useTFCard, jsonConfig);
        }
        List<ResourceInfo> resourceList = new ArrayList<>();
        
        try {
@@ -914,6 +983,26 @@
    private void setWatermarkInfo(String watermarkInfoJson,String jsonConfig) {
        Timber.d("setWatermarkInfo called, watermarkInfoJson: %s", watermarkInfoJson);
        
        // 解析cameraId(如果配置中有)
        Integer cameraId = null;
        if (jsonConfig != null && !jsonConfig.trim().isEmpty()) {
            try {
                JSONObject json = new JSONObject(jsonConfig);
                if (json.has("cameraId")) {
                    cameraId = json.optInt("cameraId", 1);
                }
            } catch (JSONException e) {
                // 忽略解析错误,继续使用当前进程
                Timber.w(e, "Failed to parse cameraId from jsonConfig");
            }
        }
        // 如果指定了cameraId=2,路由到第二个进程
        if (cameraId != null && cameraId == 2) {
            setWatermarkInfoInProcess2(watermarkInfoJson, jsonConfig);
            return;
        }
        try {
            if (watermarkInfoJson == null || watermarkInfoJson.trim().isEmpty()) {
                Timber.w("Watermark info JSON is null or empty, clearing watermark");