Skip to content
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

misbehavior of function VFSFile::fread(...) #646

Closed
Audacious-Bot opened this issue Apr 23, 2024 · 5 comments
Closed

misbehavior of function VFSFile::fread(...) #646

Audacious-Bot opened this issue Apr 23, 2024 · 5 comments
Milestone

Comments

@Audacious-Bot
Copy link


Author Name: Andrey Karpenko
Original Redmine Issue: https://redmine.audacious-media-player.org/issues/511
Original Date: 2015-02-27


System: 3.16.0-30-generic #40-Ubuntu SMP Mon Jan 12 22:06:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
and 3.13.0-46-generic #75-Ubuntu SMP Tue Feb 10 15:24:04 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Description: misbehavior of function VFSFile::fread(...) in case of read from smb:// file server

Log message:
ERROR vfs_local.cc:116 [vfs_local_fopen]: smb://192.168.2.148/share/Music/Sandra.The.Platinum.Collection.(3CD).2009.Ape.Cue.Lossless/CD2/Sandra - Platinum Collection.ape: No such file or directory

Workaround: Use symlink to gvfs folder to access network files or use retry logic in the code

int XXX::Read(void * pBuffer, unsigned int nBytesToRead, unsigned int * pBytesRead)
{
if(vfs!=0)
{
int64_t cur = vfs-> ftell();
*pBytesRead = (unsigned int)vfs->fread(pBuffer, 1, nBytesToRead);
if(nBytesToRead > *pBytesRead)
{
if(!vfs ->feof())
{
AUDERR("Requested %d bytes, actually read %d bytes\n", nBytesToRead, *pBytesRead);
AUDERR("Trying to retry from the same place\n");
if(!vfs -> fseek(cur, VFSSeekType::VFS_SEEK_SET))
{
*pBytesRead = (unsigned int)vfs->fread(pBuffer, 1, nBytesToRead);
AUDERR("After second attempt read %d bytes\n", *pBytesRead);
}
}
}
return 0;
}
return 1;
}

In case of workaround use the log looks like:

ERROR newplugin.cc:156 [Read]: Requested 16320 bytes, actually read 64 bytes
ERROR newplugin.cc:158 [Read]: Trying to retry from the last place
ERROR newplugin.cc:162 [Read]: After second attempt read 16256 bytes

Note: It is possible to play files from the same server without any issues with different names
Thanks in advance

@Audacious-Bot
Copy link
Author


Original Redmine Comment
Author Name: John Lindgren
Original Date: 2015-02-28T14:50:59Z


I don't understand this bug report at all. There is no file named newplugin.cc in Audacious or Audacious Plugins; what code are you changing? And how does adding retry logic have anything to do with a "No such file or directory" error?

@Audacious-Bot
Copy link
Author


Original Redmine Comment
Author Name: Andrey Karpenko
Original Date: 2015-02-28T16:14:53Z


Hi John,
I have wrote two new plugins for your great and very nice player version 3.4.x . There were some reasons to write these plugins. I can explain why if you are interested in to know it.
It was tested a lot of time. Everything was fine it works on intel and arm32 platforms.

Yesterday I have ported the old code to new version of Audacious. And a strange behavior of the Monkey's Audio plugin was found.

Please, take a look at the code on https://github.com/wknightbor/Additional-plugins-for-Audacious-3.6

mac.cc line 147 (retry logic)

Please, find attached log.

If you suppose it isn't a fread function problem, Please, help me to fix it.
I believe I have found something helpful to improve the player.

Thanks in advance
Andrey

@Audacious-Bot
Copy link
Author


Original Redmine Comment
Author Name: John Lindgren
Original Date: 2015-03-03T06:47:06Z


Okay, the part about the retry logic makes sense now. I expect we need to implement a loop around g_input_stream_read() in the GIO plugin. I assumed that g_input_stream_read() would behave like POSIX fread() and read as many bytes as requested, but it appears that this is not the case.

I still don't understand the part about the "No such file or directory" error. Are you thinking this error is due to a problem in Audacious, or was it just mentioned because it happened to be in the log?

@Audacious-Bot
Copy link
Author


Original Redmine Comment
Author Name: Andrey Karpenko
Original Date: 2015-03-03T20:38:28Z


Hi John

I still don't understand the part about the "No such file or directory" error. Are you thinking this error is due to a problem in Audacious, or was it just mentioned because it happened to be in the log?

Now I know there was two issues. The second was not because of player.
The error "No such file or directory" is not relevant.
Thanks

@Audacious-Bot
Copy link
Author


Original Redmine Comment
Author Name: John Lindgren
Original Date: 2015-03-06T04:02:06Z


Fixed in Git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant