-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix ffmpeg parser error, fix alloc error #74
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
Index: b/libavdevice/v4l2.c | ||
=================================================================== | ||
--- a/libavdevice/v4l2.c | ||
+++ b/libavdevice/v4l2.c | ||
@@ -108,8 +108,8 @@ struct video_data { | ||
int fd_ddr; | ||
int fd_share_memory; | ||
int pts; | ||
- int repeat_index; | ||
- unsigned int buf_bytesused; | ||
+ int repeat_index; | ||
+ unsigned int buf_bytesused; | ||
unsigned int reg_QoS_ctrl0; | ||
unsigned int reg_QoS_ctrl1; | ||
unsigned int reg_QoS_ctrl2; | ||
@@ -176,7 +176,12 @@ int parse_conf(char* dev_name, char* fil | ||
cJSON *newitem; | ||
cJSON *object; | ||
cJSON *sensor0; | ||
+ cJSON *sensor1; | ||
cJSON *video; | ||
+ | ||
+ char video_used_name[20]; | ||
+ char video_width_name[20]; | ||
+ char video_height_name[20]; | ||
int i = 0; | ||
|
||
fp=fopen(filename,"rb"); | ||
@@ -203,44 +208,39 @@ int parse_conf(char* dev_name, char* fil | ||
out=cJSON_Print(root); | ||
|
||
sensor0 = cJSON_GetObjectItem(root,"sensor0"); | ||
- if(sensor0 != NULL) | ||
+ sensor1 = cJSON_GetObjectItem(root,"sensor1"); | ||
+ if(sensor0 != NULL && sensor1 != NULL) | ||
{ | ||
- // int size=cJSON_GetArraySize(arrayItem); | ||
- if(strcmp(dev_name, "/dev/video3") == 0) | ||
+ snprintf(video_used_name, sizeof(video_used_name), "video%c_used", dev_name[10]); | ||
+ snprintf(video_width_name, sizeof(video_width_name), "video%c_width", dev_name[10]); | ||
+ snprintf(video_height_name, sizeof(video_height_name), "video%c_height", dev_name[10]); | ||
+ printf("dev_name: %s\n", dev_name); | ||
+ printf("video_used_name: %s\n", video_used_name); | ||
+ printf("video_width_name: %s\n", video_width_name); | ||
+ printf("video_height_name: %s\n", video_height_name); | ||
+ | ||
+ if((dev_name[10] >= '2') && (dev_name[10] <= '5')) | ||
{ | ||
- video = cJSON_GetObjectItem(sensor0,"/dev/video3"); | ||
- item = cJSON_GetObjectItem(video, "video3_used"); | ||
- cJSON_SetIntValue(item, 1); | ||
- | ||
- item = cJSON_GetObjectItem(video, "video3_width"); | ||
- cJSON_SetIntValue(item, width); | ||
- | ||
- item = cJSON_GetObjectItem(video, "video3_height"); | ||
- cJSON_SetIntValue(item, height); | ||
+ video = cJSON_GetObjectItem(sensor0,dev_name); | ||
} | ||
- else if(strcmp(dev_name, "/dev/video5") == 0) | ||
+ else if((dev_name[10] >= '6') && (dev_name[10] <= '9')) | ||
{ | ||
- video = cJSON_GetObjectItem(sensor0,"/dev/video5"); | ||
- item = cJSON_GetObjectItem(video, "video5_used"); | ||
- cJSON_SetIntValue(item, 1); | ||
- | ||
- item = cJSON_GetObjectItem(video, "video5_width"); | ||
- cJSON_SetIntValue(item, width); | ||
- | ||
- item = cJSON_GetObjectItem(video, "video5_height"); | ||
- cJSON_SetIntValue(item, height); | ||
+ video = cJSON_GetObjectItem(sensor1,dev_name); | ||
} | ||
- else if(strcmp(dev_name, "/dev/video9") == 0) | ||
+ else | ||
{ | ||
- video = cJSON_GetObjectItem(sensor0,"/dev/video9"); | ||
- item = cJSON_GetObjectItem(video, "video9_used"); | ||
- cJSON_SetIntValue(item, 1); | ||
- item = cJSON_GetObjectItem(video, "video9_width"); | ||
- cJSON_SetIntValue(item, width); | ||
- item = cJSON_GetObjectItem(video, "video9_height"); | ||
- cJSON_SetIntValue(item, height); | ||
- } | ||
+ printf("dev name error!\n"); | ||
+ return -1; | ||
+ } | ||
+ | ||
+ item = cJSON_GetObjectItem(video, video_used_name); | ||
+ cJSON_SetIntValue(item, 1); | ||
+ | ||
+ item = cJSON_GetObjectItem(video, video_width_name); | ||
+ cJSON_SetIntValue(item, width); | ||
|
||
+ item = cJSON_GetObjectItem(video, video_height_name); | ||
+ cJSON_SetIntValue(item, height); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
From a45bbd422e05488a4818106a8f59d6046388b899 Mon Sep 17 00:00:00 2001 | ||
From: cuiyan <cuiyan@canaan-creative.com> | ||
Date: Sat, 28 May 2022 11:51:36 +0800 | ||
Subject: [PATCH] cuiyan | ||
|
||
--- | ||
drivers/memory/canaan/k510_share_memory.c | 5 +++++ | ||
1 file changed, 5 insertions(+) | ||
|
||
diff --git a/drivers/memory/canaan/k510_share_memory.c b/drivers/memory/canaan/k510_share_memory.c | ||
index e357c56a..561ce639 100755 | ||
--- a/drivers/memory/canaan/k510_share_memory.c | ||
+++ b/drivers/memory/canaan/k510_share_memory.c | ||
@@ -625,6 +625,11 @@ static long share_memory_align_alloc(unsigned long arg) | ||
#endif | ||
|
||
alloc_args.phyAddr = BlockPhysical; | ||
+ if(pBlockVirtual == NULL) | ||
+ { | ||
+ copy_to_user((void *)arg, (void *)&alloc_args, sizeof(struct share_memory_alloc_align_args)); | ||
+ return -EFAULT; | ||
+ } | ||
if(copy_to_user((void *)arg, (void *)&alloc_args, sizeof(struct share_memory_alloc_align_args))) | ||
return -EFAULT; | ||
|
||
-- | ||
2.36.1 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么要改kernal? 没有memory不会返回错误?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
之前kernel的share memory align alloc的kernel如果memory不够的话,也不会返回错误,会返回上一次alloc的出来的物理地址,但是又没有真的alloc,所以就会出错。