TeamPyOgg / PyOgg

Simple OGG Vorbis, Opus and FLAC bindings for Python
The Unlicense
63 stars 27 forks source link

Add flac examples and tests #50

Closed mattgwwalker closed 3 years ago

mattgwwalker commented 4 years ago

@Zuzu-Typ, would you be able to have a quick look into this for me please?

There are two tests that are now failing in the Windows build, but there are no issues under either macOS or Linux.

The tests causing the problems in Windows are the first two tests found in the file tests/test_ogg_opus_writer.py. They are both seg-faulting under Windows.

One possible reason is that my Ogg-Opus-writing code has an issue in it. However I've been using that code for a fair while now under macOS, and I'm a small bit surprised given all the testing it's had. It's also working under Linux.

Another issue might be to do with the Windows DLLs. Can you give me any detail about how you built them? What tools did you use? Visual Studio or GCC? The issue is arising when I try to write out an ogg_page header... which is a strange place to see an issue given the Ogg library is responsible for that memory.

Thanks,

Matthew

Zuzu-Typ commented 4 years ago

So, I've had a look at the issue, and it seems that it is caused by this function call. I haven't figured out why yet, but I'm thinking it might be a pointer that is automatically garbage collected. I haven't been able to find an exact source though. It seems to works if the callback function is not used and instead the encode_with_samples() function is called with callback=None, I haven't done enough testing though.

Zuzu-Typ commented 4 years ago

Another issue might be to do with the Windows DLLs. Can you give me any detail about how you built them? What tools did you use? Visual Studio or GCC? The issue is arising when I try to write out an ogg_page header... which is a strange place to see an issue given the Ogg library is responsible for that memory.

It has been a while since I built them and it might be wise to rebuild them. I can take care of that. If I recall correctly though, I've built them from the Xiph/* master repos using MSVC - which required quite a lot of work to get everything to compile. Also I think that I didn't get the OpenSSL library to compile, which was required for some specific features.

mattgwwalker commented 4 years ago

I compiled version 1.3.4 (August 2019) of the Ogg library because it said that it worked out-of-the-box under Visual Studio and also because the last three minor versions discussed issues with packet corruption bugs and I wasn't sure which version you'd included with PyOgg.

However, even with version 1.3.4 of the Ogg library I'm still seeing the same issues :o( so I'll dig into it some more. Thanks for looking into it too.

Zuzu-Typ commented 4 years ago

I compiled version 1.3.4 (August 2019) of the Ogg library because it said that it worked out-of-the-box under Visual Studio and also because the last three minor versions discussed issues with packet corruption bugs and I wasn't sure which version you'd included with PyOgg.

Unfortunately, their statement is far from true. It does not work out of the box at all. Unless you really only build the ogg library, you'll have to put in quite some efforts to get everything to build. I just did that.

Not only do you have to make sure to build the .dlls with the correct runtime library option (because if you don't, the compiled library will require a VC-redistributable to run, which we can't be sure every user has), but also most libraries don't even compile at all. For most you have to specify additional library and include paths, for some you need an additional Assembler, for some you have to completely set up the DLL-build process, that includes writing a .def file containing all of the exports and some require you to actually change the code because it is outdated. It's a very tedious process.

I haven't tried with the newly built libs yet, but I don't expect it to be any different.

mattgwwalker commented 4 years ago

Unless you really only build the ogg library

Yes, that's all I did. I built version 1.3.4 in the hope that it might fix the issue. No such luck.

I have however found that my Ogg-Opus-writing code looks to have some special condition that doesn't sit well with Windows: it looks like the bytes buffer isn't converting to a valid pointer. I'll have a bit more of a look at it and hopefully tick off this issue :o)

mattgwwalker commented 3 years ago

Closing this pull request as it has been superseded by #58.