[Player-dev] Add the FLAC codec in Helix

[Player-dev] Add the FLAC codec in Helix

Jacques Tebcherani jtebcherani at awox.com
Tue Oct 12 09:12:05 PST 2010


Kinson,

It's CFlacFileFormat::GetPacket who is called more than normal after 1"40.
I don't know why, but after 1"40 the scheduling go faster.

I have also checked the write on the audio device (CAudioOutLinux::_WriteBytes in audlinux_oss.cpp) and it's OK.

So the issue is coming from the caller of GetPacket I do not know where exactly.

Jacques

-----Original Message-----
From: Kinson Liu [mailto:kliu at real.com]
Sent: mardi 12 octobre 2010 11:27
To: Jacques Tebcherani
Cc: player-dev at helixcommunity.org
Subject: RE: [Player-dev] Add the FLAC codec in Helix

Jacques,

We have not run into that problem before. There could be different reasons behind it.

ReadDone should match Read.  So I would suggest watching whether Read is also called more than normal after 1"40.  If yes, investigate the caller of Read, if not investigate the caller of ReadDone.  That's what I can think of right now.  Thanks for looking into it and letting us know.

Kinson

-----Original Message-----
From: Jacques Tebcherani [mailto:jtebcherani at awox.com]
Sent: Tuesday, October 12, 2010 4:52 PM
To: Kinson Liu
Cc: player-dev at helixcommunity.org
Subject: RE: [Player-dev] Add the FLAC codec in Helix

Hi Kinson,

I have found a blocking issue that occurs on x86 and on ARM platforms.

When I launch the playback of a flac file with a duration of at least 2 minutes, the playback always stops after 1 minute and 40 seconds.
This issue is reproducible with many different flac files.

Do you have reproduced this problem?

I have starting to investigate and I have found that before 1 minute and 40 seconds of playback, the method CFlacFileFormat::ReadDone is called normally. But, after this duration, this method is called much more quickly what involves that m_ulFileOffset is equal to m_ulFileSize, and the decoding stops before we reach the end of the file.

Any suggestion to solve this issue will be welcome.
Thanks in advance.

Regards,
Jacques


-----Original Message-----
From: Kinson Liu [mailto:kliu at real.com]
Sent: mardi 12 octobre 2010 10:13
To: Jacques Tebcherani
Cc: player-dev at helixcommunity.org
Subject: RE: [Player-dev] Add the FLAC codec in Helix

Thanks Jacques.  That's excellent.  I will merge your fixes into code base.  Please keep us updated shall you find new improvements.

Kinson

-----Original Message-----
From: Jacques Tebcherani [mailto:jtebcherani at awox.com]
Sent: Monday, October 11, 2010 6:42 PM
To: Kinson Liu
Cc: player-dev at helixcommunity.org
Subject: RE: [Player-dev] Add the FLAC codec in Helix

Hi Kinson,

Please find below the patch that fixes some memory leaks that occur during the playback and at the end of a playback:

--------------------------------------------------------------------------
Index: renderer/flacfmt.cpp
===================================================================
--- renderer/flacfmt.cpp        (revision 20341)
+++ renderer/flacfmt.cpp        (working copy)
@@ -59,7 +59,12 @@

 CFlacAudioFormat::~CFlacAudioFormat()
 {
-    delete m_pDecoder;
+       if (m_pDecoder)
+       {
+               FLAC__stream_decoder_finish(m_pDecoder);
+               FLAC__stream_decoder_delete(m_pDecoder);
+               m_pDecoder = NULL;
+       }

     if (m_pAudioData)
     {
@@ -123,7 +128,7 @@
                                    pPacket->GetTime(),
                                    ulFlags,
                                    NULL);
-           pBuffer->Release();
+           HX_RELEASE(pBuffer);
        }
     }

@@ -133,7 +138,6 @@
 HX_RESULT CFlacAudioFormat::DecodeAudioData(   HXAudioData& audioData,
                                                HXBOOL bEndOfPackets)
 {
-    CMediaPacket* pPacket = NULL;
     switch (m_DecodeState)
     {
     case DecodeReady:
@@ -191,6 +195,11 @@
 HX_RESULT
 CFlacAudioFormat::SetAudioData(IHXBuffer* pBuffer)
 {
+       if (m_pAudioData)
+       {
+               HX_RELEASE(m_pAudioData);
+       }
+
     m_pAudioData = pBuffer;
     m_pAudioData->AddRef();

Index: fileformat/flacfformat.cpp
===================================================================
--- fileformat/flacfformat.cpp  (revision 20341)
+++ fileformat/flacfformat.cpp  (working copy)
@@ -1610,7 +1610,7 @@

     if (m_Seektable.points)
     {
-       delete m_Seektable.points;
+       delete[] m_Seektable.points;
     }

     if (m_Comments.pComments)
--------------------------------------------------------------------------

Regards,
Jacques



-----Original Message-----
From: Jacques Tebcherani [mailto:jtebcherani at awox.com]
Sent: mardi 5 octobre 2010 11:29
To: Kinson Liu; Tony Seaward
Cc: player-dev at helixcommunity.org
Subject: RE: [Player-dev] Add the FLAC codec in Helix

Hi Kinson,

This issue is not a platform-specific problem but a datatype issue.

This issue is due to a buffer overflow in the method "HX_RESULT CFlacAudioFormat::Init(IHXValues* pHeader)".

Please find below the patch that fixes the problem:

--------------------------------------------------------------------------
Index: flacfmt.cpp
===================================================================
--- flacfmt.cpp (revision 20178)
+++ flacfmt.cpp (working copy)
@@ -69,17 +69,26 @@

 HX_RESULT CFlacAudioFormat::Init(IHXValues* pHeader)
 {
+       ULONG32 theTempVal;
+
     HX_RESULT retVal = CAudioFormat::Init(pHeader);
     if (SUCCEEDED(retVal))
     {
        pHeader->GetPropertyULONG32("Channels",
-                                       (ULONG32&)m_pAudioFmt->uChannels);
+                                       (ULONG32&)theTempVal);
+       m_pAudioFmt->uChannels = (UINT16)theTempVal;
+
        pHeader->GetPropertyULONG32("BitsPerSample",
-                                       (ULONG32&)m_pAudioFmt->uBitsPerSample);
+                                       (ULONG32&)theTempVal);
+       m_pAudioFmt->uBitsPerSample = (UINT16)theTempVal;
+
        pHeader->GetPropertyULONG32("SamplesPerSec",
-                                       (ULONG32&)m_pAudioFmt->ulSamplesPerSec);
+                                       (ULONG32&)theTempVal);
+       m_pAudioFmt->ulSamplesPerSec = (UINT32)theTempVal;
+
        pHeader->GetPropertyULONG32("MaxBlockSize",
-                                       (ULONG32&)m_pAudioFmt->uMaxBlockSize);
+                                       (ULONG32&)theTempVal);
+       m_pAudioFmt->uMaxBlockSize = (UINT16)theTempVal;

        // it seems audio services does not work with bps = 24, upgrading to 32
        if (m_pAudioFmt->uBitsPerSample == 24)
--------------------------------------------------------------------------

For your information, I also found that there are some memory leaks that occur at the end of a file playback.
I am trying to fix them.

Thanks again.

Regards,
Jacques


-----Original Message-----
From: Kinson Liu [mailto:kliu at real.com]
Sent: samedi 25 septembre 2010 10:17
To: Jacques Tebcherani; Tony Seaward
Cc: player-dev at helixcommunity.org
Subject: RE: [Player-dev] Add the FLAC codec in Helix

Hi Jacques,

When it comes to "HXR_AUDIO_DRIVER", it's always a platform-specific problem.  In other words, it has nothing to do with the datatype itself.  You can look at whether Helix supports such a platform or whether any other media player is running.

You can try playing other datatypes, eg, mp3, using helix to make sure it's not a datatype issue.

Kinson
-----Original Message-----
From: Jacques Tebcherani [mailto:jtebcherani at awox.com]
Sent: Wednesday, September 22, 2010 9:01 PM
To: Kinson Liu; Tony Seaward
Cc: player-dev at helixcommunity.org
Subject: RE : [Player-dev] Add the FLAC codec in Helix

Hi Kinson,

My problem was that the library 'libflacrend.so' was not loaded.
Now it's OK and the FLAC playback works fine on x86 platform.

But when I launch the playback on ARM platform, I have the following error:
Report(3, 80040100, "(NULL)", 0, "(NULL)", "HXR_AUDIO_DRIVER")

When I compare the pAudioFormat structure on x86 and ARM platforms, I have the following results with the same flac sample:

x86:
pAudioFormat->uChannels = '2'
pAudioFormat->uBitsPerSample = '16'
pAudioFormat->ulSamplesPerSec = '48000'
pAudioFormat->uMaxBlockSize = '4608'

ARM:
pAudioFormat->uChannels = '16'               !!! ERROR
pAudioFormat->uBitsPerSample = '16'
pAudioFormat->ulSamplesPerSec = '48000'
pAudioFormat->uMaxBlockSize = '4608'

The channel value is not correctly retrieved on ARM platform.

I continue to investigate to find a solution on ARM platform.

Regards,
Jacques

________________________________________
De : Jacques Tebcherani [jtebcherani at awox.com]
Date d'envoi : mardi 21 septembre 2010 12:56
À : Kinson Liu; Tony Seaward
Cc : player-dev at helixcommunity.org
Objet : RE: [Player-dev] Add the FLAC codec in Helix

Hi Kinson,



I have successfully build splay.

But when I try to play a flac file, I have no sound.

It seems that CFlacAudioRenderer is never instantiated so the file is correctly read but not decoded.



Where do I have to call CFlacAudioRenderer::HXcreateInstance method to be able to decode the file?



Thanks in advance.



Regards,

Jacques



  _____

From: Kinson Liu [mailto:kliu at real.com]
Sent: lundi 20 septembre 2010 14:05
To: Jacques Tebcherani; Tony Seaward
Cc: player-dev at helixcommunity.org
Subject: RE: [Player-dev] Add the FLAC codec in Helix



Yes, please follow the instructions.



Kinson



  _____

From: Jacques Tebcherani [mailto:jtebcherani at awox.com]
Sent: Monday, September 20, 2010 6:58 PM
To: Kinson Liu; Tony Seaward
Cc: player-dev at helixcommunity.org
Subject: RE: [Player-dev] Add the FLAC codec in Helix



Hi Kinson and Tony,



Thank you for your feedbacks.



The nightly build sources are not accessible anymore.

Can you please tell me the CVS command that I can use to checkout all the branch "hxclient_3_1_0_atlas"?

Or should I have to follow the instructions below to get the source code?



Regards,

Jacques



  _____

From: Kinson Liu [mailto:kliu at real.com]
Sent: dimanche 19 septembre 2010 04:57
To: Tony Seaward; Jacques Tebcherani
Cc: player-dev at helixcommunity.org
Subject: RE: [Player-dev] Add the FLAC codec in Helix



Hi Jacques,



Please go through Part A & B to set up the environment(https://community.helixcommunity.org/Developers/quick_start/linux), and use the following settings instead for going through Part C for building 310atlas.



Branch: hxclient_3_1_0_atlas

Profile: helix-client-all-defines

Target: splay



SYSTEM_ID being linux-2.2-libc6-gcc32-i586





Once build is done, you will find splay in the debug or release folder (depends on what build you are trying to build).  You can then use splay to play any kind of medias that helix supports, including flac.



Let me know if you have any further questions.



Cheers,



Kinson



  _____

From: player-dev-bounces at helixcommunity.org [mailto:player-dev-bounces at helixcommunity.org] On Behalf Of Tony Seaward
Sent: Saturday, September 18, 2010 12:56 AM
To: Jacques Tebcherani
Cc: player-dev at helixcommunity.org
Subject: Re: [Player-dev] Add the FLAC codec in Helix



Jacques-
 I just found out that we have just recently finished the FLAC implementation into Helix and now ships by default with splay on 310atlas. If you would like to try it out, perhaps this will help you along. Basically you will need to build out splay on 310atlas.  For sanity, it would be safe to delete the ~/.helix/Helix* file before using the new build, that way makes sure the new flac related .so's are recognized.

Tony Seaward
Program Manager
RealNetworks


On 9/10/10 5:37 AM, Jacques Tebcherani wrote:

Hi,



I am using the Helix Client of an Atlas branch.



I want to add the FLAC codec in Helix.

I would like to know if there is a template to add a new codec in the Helix client.



Currently, I have added a new flac datatype under "helix-client/datatype" directory.

I have also modified the Makefile located under "helix-client/builders/linux-gcc/" and "helix-client/datatype/group/audio/builders/linux-gcc".

I have added the flac mime type in the file nullrend.cpp.



But when I launch the playback of a flac file, the mime type is not detected and the following error occurs:

"Report(3, 80040011, "file:///home/jtebcherani/Music/flac/sample.flac"<file:///\\home\jtebcherani\Music\flac\sample.flac>, 0, "(NULL)", "HXR_NO_RENDERER")".



Regards,

Jacques Tebcherani



__________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5439 (20100910) __________

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com



__________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5460 (20100918) __________

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com



__________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5463 (20100920) __________

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com



__________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5463 (20100920) __________

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com



__________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5466 (20100921) __________

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com



__________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5477 (20100924) __________

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com



__________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5503 (20101004) __________

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com


_______________________________________________
Player-dev mailing list
Player-dev at helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/player-dev


__________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5503 (20101004) __________

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com



__________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5520 (20101011) __________

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com



__________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5522 (20101011) __________

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com



__________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5522 (20101011) __________

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com



__________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5522 (20101011) __________

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com



__________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5524 (20101012) __________

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com




More information about the Player-dev mailing list
 

Site Map   |   Terms of Use   |   Privacy Policy   |   Contact Us

Copyright © 1995-2007 RealNetworks, Inc. All rights reserved. RealNetworks and Helix are trademarks of RealNetworks.
All other trademarks or registered trademarks are the property of their respective holders.