nxplayer: add more error messages#3117
Closed
TangMeng12 wants to merge 1 commit intoapache:masterfrom
Closed
Conversation
d4b63d9 to
d4a514f
Compare
nxplayer currently only returns directly '-ENOENT', which makes it impossible to know the specific reason for the failure when testing audio with nxplayer. Therefore, I modified this part of the logic to print out the error as much as possible. Signed-off-by: Tang Meng <v-tangmeng@xiaomi.com>
cederom
requested changes
Jul 2, 2025
Contributor
cederom
left a comment
There was a problem hiding this comment.
Thanks @TangMeng12 :-)
- Please read the and update PR description accrodingly (see https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md as instructed by the PR template).
- You don't have to close #3116 and start new PR when updates are necessary - just
git commit --amendthengit push -fand the same PR will get updated :-)
cederom
reviewed
Jul 2, 2025
|
|
||
| FAR struct hostent *he; | ||
| he = gethostbyname(hostname); | ||
| if (!he) |
cederom
reviewed
Jul 2, 2025
|
|
||
| memcpy(&server.sin_addr.s_addr, | ||
| he->h_addr, sizeof(in_addr_t)); | ||
|
|
Contributor
There was a problem hiding this comment.
these blank lines increase readability we can leave them untouched :-)
cederom
reviewed
Jul 2, 2025
| int err = errno; | ||
| close(s); | ||
| return -1; | ||
| switch (err) |
Contributor
There was a problem hiding this comment.
Please take a look what switch format is preferred https://nuttx.apache.org/docs/latest/contributing/coding_style.html#switch-statement
cederom
reviewed
Jul 2, 2025
| if (pplayer->fd < 0) | ||
| #else | ||
| if ((pplayer->fd = open(pfilename, O_RDONLY)) == -1) | ||
| pplayer->fd = open(pfilename, O_RDONLY); |
Contributor
There was a problem hiding this comment.
When splitting here please also update other places (i.e. line 1859).
cederom
reviewed
Jul 2, 2025
| printf("File %s not found\n", parg); | ||
| break; | ||
|
|
||
| case ENETUNREACH: |
Contributor
There was a problem hiding this comment.
| if (pplayer->fd == -1) | ||
| #endif | ||
| { | ||
| int err = errno; |
| return -1; | ||
| switch (err) | ||
| { | ||
| case 401: |
Contributor
There was a problem hiding this comment.
why do you think errno contain 401/403?
| return -1; | ||
| switch (err) | ||
| { | ||
| case ETIMEDOUT: |
Contributor
There was a problem hiding this comment.
why not return -err
Contributor
|
Any updates on this PR @TangMeng12 ? |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
nxplayer currently only returns directly '-ENOENT', which makes it impossible to know the specific reason for the failure when testing audio with nxplayer.
Therefore, I modified this part of the logic to print out the error as much as possible.
Note: Please adhere to Contributing Guidelines.
Summary
Update this section with information on why change is necessary,
what it exactly does and how, if new feature shows up, provide
references (dependencies, similar problems and solutions), etc.
Impact
Update this section, where applicable, on how change affects users,
build process, hardware, documentation, security, compatibility, etc.
Testing
Update this section with details on how did you verify the change,
what Host was used for build (OS, CPU, compiler, ..), what Target was
used for verification (arch, board:config, ..), etc. Providing build
and runtime logs from before and after change is highly appreciated.