From helixuser at kensystem.com  Thu May  1 13:25:51 2008
From: helixuser at kensystem.com (Ken Johanson)
Date: Thu May  1 12:18:24 2008
Subject: [datatype-dev] MP4/Quicktime stuttering video (out-of-order Bfs)?
Message-ID: <481A274F.2060504@kensystem.com>

Hi all,

A while back I wrote in a bug about a server problem, where newer MP4 + 
h264 content played through Helix server (11.1) and Quicktime client, 
has stuttering video (guessing out-of-order B frames??). Does anyone 
know what a quick fix is, and if newer server version fixed this?

Reproduction test case:
rtsp://stream01.breezeway.tv/static/test-helixserver.mp4 (Helix server 
11.1.0.719)
Sample media:
http://65.125.174.101/sys/public/test-helixserver.mp4
Bug report:
https://bugs.helixcommunity.org/show_bug.cgi?id=7950&link=0

Regards,

Ken



From jgordon at real.com  Thu May  1 13:32:34 2008
From: jgordon at real.com (Jamie Gordon)
Date: Thu May  1 12:24:43 2008
Subject: [datatype-dev] MP4/Quicktime stuttering video (out-of-order Bfs)?
In-Reply-To: <481A274F.2060504@kensystem.com>
References: <481A274F.2060504@kensystem.com>
Message-ID: <481A28E2.6070005@real.com>

Ken Johanson wrote:
> Hi all,
> 
> A while back I wrote in a bug about a server problem, where newer MP4 + 
> h264 content played through Helix server (11.1) and Quicktime client, 
> has stuttering video (guessing out-of-order B frames??). Does anyone 
> know what a quick fix is, and if newer server version fixed this?
> 
If there are out of order B-frames or similar type problem, that would
not be a server issue - it would be an encoding or hinting problem which
would occur with any server.

Jamie

> Reproduction test case:
> rtsp://stream01.breezeway.tv/static/test-helixserver.mp4 (Helix server 
> 11.1.0.719)
> Sample media:
> http://65.125.174.101/sys/public/test-helixserver.mp4
> Bug report:
> https://bugs.helixcommunity.org/show_bug.cgi?id=7950&link=0
> 
> Regards,
> 
> Ken
> 
> 
> 
> _______________________________________________
> Datatype-dev mailing list
> Datatype-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/datatype-dev

From helixuser at kensystem.com  Thu May  1 14:50:58 2008
From: helixuser at kensystem.com (Ken Johanson)
Date: Thu May  1 13:43:09 2008
Subject: [datatype-dev] MP4/Quicktime stuttering video (out-of-order Bfs)?
In-Reply-To: <481A28E2.6070005@real.com>
References: <481A274F.2060504@kensystem.com> <481A28E2.6070005@real.com>
Message-ID: <481A3B42.2030102@kensystem.com>

Jamie Gordon wrote:
> Ken Johanson wrote:
>> Hi all,
>>
>> A while back I wrote in a bug about a server problem, where newer MP4 
>> + h264 content played through Helix server (11.1) and Quicktime 
>> client, has stuttering video (guessing out-of-order B frames??). Does 
>> anyone know what a quick fix is, and if newer server version fixed this?
>>
> If there are out of order B-frames or similar type problem, that would
> not be a server issue - it would be an encoding or hinting problem which
> would occur with any server.
> 
> Jamie
> 

I was told that the same file plays OK on a Darwin server (I cannot 
vouch for this for not having one). And the file does play OK off a 
local disk. So it appears Helix server is somehow reading or sending 
timestamps differently.

Ken



From jgordon at real.com  Thu May  1 15:01:25 2008
From: jgordon at real.com (Jamie Gordon)
Date: Thu May  1 13:53:35 2008
Subject: [datatype-dev] MP4/Quicktime stuttering video (out-of-order Bfs)?
In-Reply-To: <481A3B42.2030102@kensystem.com>
References: <481A274F.2060504@kensystem.com> <481A28E2.6070005@real.com>
	<481A3B42.2030102@kensystem.com>
Message-ID: <481A3DB5.1050909@real.com>

Ken Johanson wrote:
> Jamie Gordon wrote:
>> Ken Johanson wrote:
>>> Hi all,
>>>
>>> A while back I wrote in a bug about a server problem, where newer MP4 
>>> + h264 content played through Helix server (11.1) and Quicktime 
>>> client, has stuttering video (guessing out-of-order B frames??). Does 
>>> anyone know what a quick fix is, and if newer server version fixed this?
>>>
>> If there are out of order B-frames or similar type problem, that would
>> not be a server issue - it would be an encoding or hinting problem which
>> would occur with any server.
>>
>> Jamie
>>
> 
> I was told that the same file plays OK on a Darwin server (I cannot 
> vouch for this for not having one). And the file does play OK off a 
> local disk. So it appears Helix server is somehow reading or sending 
> timestamps differently.
> 
Okay, if the same file plays fine with the same player from a Darwin
server, then it's almost certainly not out-of-order B-frames but rather
something else entirely. Local playback is completely different, as it
does not use the hint track.

Thanks,
Jamie

> Ken
> 
> 

From ehyche at real.com  Thu May  1 15:04:44 2008
From: ehyche at real.com (Eric Hyche)
Date: Thu May  1 13:56:46 2008
Subject: [datatype-dev] MP4/Quicktime stuttering video (out-of-order Bfs)?
In-Reply-To: <481A3DB5.1050909@real.com>
References: <481A274F.2060504@kensystem.com>
	<481A28E2.6070005@real.com><481A3B42.2030102@kensystem.com>
	<481A3DB5.1050909@real.com>
Message-ID: <00f501c8abd7$5daee340$db68a8c0@EHYCHED620>


Ken,

Does the .mp4 file have a hint track?

Eric

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: datatype-dev-bounces@helixcommunity.org 
> [mailto:datatype-dev-bounces@helixcommunity.org] On Behalf Of 
> Jamie Gordon
> Sent: Thursday, May 01, 2008 6:01 PM
> To: Ken Johanson
> Cc: helix-server-dev@helixcommunity.org; 
> datatype-dev@helixcommunity.org
> Subject: Re: [datatype-dev] MP4/Quicktime stuttering video 
> (out-of-order Bfs)?
> 
> Ken Johanson wrote:
> > Jamie Gordon wrote:
> >> Ken Johanson wrote:
> >>> Hi all,
> >>>
> >>> A while back I wrote in a bug about a server problem, 
> where newer MP4 
> >>> + h264 content played through Helix server (11.1) and Quicktime 
> >>> client, has stuttering video (guessing out-of-order B 
> frames??). Does 
> >>> anyone know what a quick fix is, and if newer server 
> version fixed this?
> >>>
> >> If there are out of order B-frames or similar type 
> problem, that would
> >> not be a server issue - it would be an encoding or hinting 
> problem which
> >> would occur with any server.
> >>
> >> Jamie
> >>
> > 
> > I was told that the same file plays OK on a Darwin server (I cannot 
> > vouch for this for not having one). And the file does play OK off a 
> > local disk. So it appears Helix server is somehow reading 
> or sending 
> > timestamps differently.
> > 
> Okay, if the same file plays fine with the same player from a Darwin
> server, then it's almost certainly not out-of-order B-frames 
> but rather
> something else entirely. Local playback is completely different, as it
> does not use the hint track.
> 
> Thanks,
> Jamie
> 
> > Ken
> > 
> > 
> 
> _______________________________________________
> Datatype-dev mailing list
> Datatype-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
> 


From ehyche at real.com  Thu May  1 15:12:39 2008
From: ehyche at real.com (Eric Hyche)
Date: Thu May  1 14:04:41 2008
Subject: RESEND: [datatype-dev] CR: Changes in datatype/wm/common to fixes
	thecrashof Helix while trying to play WM files on
	Symbianplatformwith realignment checking ON
In-Reply-To: <01f001c8aac1$7e7472f0$0b01a8c0@anshuman1>
References: <01f001c8aac1$7e7472f0$0b01a8c0@anshuman1>
Message-ID: <00f901c8abd8$793bd8b0$db68a8c0@EHYCHED620>


+                    memcpy((BYTE*) pTmpWChar,  *ppBuf,  ulNumWideChar*2);    

I think this should be ulNumWideChar * sizeof(wchar_t) instead
of ulNumWideChar*2. The size of wchar_t is not always 2 bytes.
It's actually 4 bytes on Linux.

Rest looks good.

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: datatype-dev-bounces@helixcommunity.org 
> [mailto:datatype-dev-bounces@helixcommunity.org] On Behalf Of 
> Anshuman Singh
> Sent: Wednesday, April 30, 2008 8:56 AM
> To: 'datatype-dev'
> Subject: RESEND: [datatype-dev] CR: Changes in 
> datatype/wm/common to fixes thecrashof Helix while trying to 
> play WM files on Symbianplatformwith realignment checking ON
> 
> Synopsis:
> This change fixes the crash of Helix while trying to play WM 
> files on Symbian based platforms with realignment checking ON.
>  
> Overview:
> Using wide character pointer instead of BYTE pointer fixes 
> the issue as it allows only even addesses to be assigned to 
> metadata string pointer.
>  
> Files Added:
> none
>  
> Files Modified:
> datatype/wm/common/parse_asf_objects.cpp
>  
> Image Size and Heap Use impact (Client -Only):
> None.
> 
> Platforms and Profiles Affected:
> platform : win32-i386-vc7
> profile    : helix-client-all-defines
>  
> Distribution Libraries Affected:
> None
> 
> Distribution library impact and planned action:
> None
> 
> Platforms and Profiles Build Verified:
> 
> BIF branch   -> hxclient_3_1_0_atlas_restricted, 
> hxclient_2_1_0_cayennes 
> Target(s)      -> splay
> Profile          -> helix-client-all-defines
> System ID   -> win32-i386-vc7
>  
> Note: Branch:
> Atlas310
>  
> Files Attached:
> parse_asf_objects.cpp_diff.txt
>  
> Thanks & Regards
> Anshuman
> 
> ________________________________
> 
> _______________________________________________
> Datatype-dev mailing list
> Datatype-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
> 
> 


From jgordon at real.com  Thu May  1 15:44:43 2008
From: jgordon at real.com (Jamie Gordon)
Date: Thu May  1 14:36:50 2008
Subject: [datatype-dev] Re: [Helix-server-dev] MP4/Quicktime stuttering
 video (out-of-order Bfs)?
In-Reply-To: <481A274F.2060504@kensystem.com>
References: <481A274F.2060504@kensystem.com>
Message-ID: <481A47DB.6080901@real.com>

Ken Johanson wrote:
> Hi all,
> 
> A while back I wrote in a bug about a server problem, where newer MP4 + 
> h264 content played through Helix server (11.1) and Quicktime client, 
> has stuttering video (guessing out-of-order B frames??). Does anyone 
> know what a quick fix is, and if newer server version fixed this?
> 
> Reproduction test case:
> rtsp://stream01.breezeway.tv/static/test-helixserver.mp4 (Helix server 
> 11.1.0.719)

The issue you are seeing should be fixed as of 11.1.5 (you are using
11.1.0). The problem that was fixed is playback issues similar to what
you mention with h.264 content created/hinted with QT tools.

Thanks,
Jamie

> Sample media:
> http://65.125.174.101/sys/public/test-helixserver.mp4
> Bug report:
> https://bugs.helixcommunity.org/show_bug.cgi?id=7950&link=0
> 
> Regards,
> 
> Ken
> 
> 
> 
> _______________________________________________
> Helix-server-dev mailing list
> Helix-server-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/helix-server-dev

From asingh at adroit-inc.com  Sat May  3 23:17:31 2008
From: asingh at adroit-inc.com (Anshuman)
Date: Sun May  4 22:10:29 2008
Subject: [datatype-dev] CN: Changes in datatype/wm/common to fixesthecrashof
	Helix while trying to play WM files onSymbianplatformwith
	realignment checking ON
References: <01f001c8aac1$7e7472f0$0b01a8c0@anshuman1>
	<00f901c8abd8$793bd8b0$db68a8c0@EHYCHED620>
Message-ID: <007c01c8adae$8c9e2bb0$0b01a8c0@anshuman1>

Thanks Eric,

Changes are checked into Head, Atlas_310 and Cayennes_210 after 
incorporating the change suggested by you.

Thanks,
Anshuman

----- Original Message ----- 
From: "Eric Hyche" 
To: "'Anshuman Singh'" ; "'datatype-dev'" 

Sent: Friday, May 02, 2008 3:42 AM
Subject: RE: RESEND: [datatype-dev] CR: Changes in datatype/wm/common to 
fixesthecrashof Helix while trying to play WM files onSymbianplatformwith 
realignment checking ON


>
> +                    memcpy((BYTE*) pTmpWChar,  *ppBuf,  ulNumWideChar*2);
>
> I think this should be ulNumWideChar * sizeof(wchar_t) instead
> of ulNumWideChar*2. The size of wchar_t is not always 2 bytes.
> It's actually 4 bytes on Linux.
>
> Rest looks good.
>
> =============================================
> Eric Hyche (ehyche@real.com)
> Technical Lead
> RealNetworks, Inc.
>
>> -----Original Message-----
>> From: datatype-dev-bounces@helixcommunity.org
>> [mailto:datatype-dev-bounces@helixcommunity.org] On Behalf Of
>> Anshuman Singh
>> Sent: Wednesday, April 30, 2008 8:56 AM
>> To: 'datatype-dev'
>> Subject: RESEND: [datatype-dev] CR: Changes in
>> datatype/wm/common to fixes thecrashof Helix while trying to
>> play WM files on Symbianplatformwith realignment checking ON
>>
>> Synopsis:
>> This change fixes the crash of Helix while trying to play WM
>> files on Symbian based platforms with realignment checking ON.
>>
>> Overview:
>> Using wide character pointer instead of BYTE pointer fixes
>> the issue as it allows only even addesses to be assigned to
>> metadata string pointer.
>>
>> Files Added:
>> none
>>
>> Files Modified:
>> datatype/wm/common/parse_asf_objects.cpp
>>
>> Image Size and Heap Use impact (Client -Only):
>> None.
>>
>> Platforms and Profiles Affected:
>> platform : win32-i386-vc7
>> profile    : helix-client-all-defines
>>
>> Distribution Libraries Affected:
>> None
>>
>> Distribution library impact and planned action:
>> None
>>
>> Platforms and Profiles Build Verified:
>>
>> BIF branch   -> hxclient_3_1_0_atlas_restricted,
>> hxclient_2_1_0_cayennes
>> Target(s)      -> splay
>> Profile          -> helix-client-all-defines
>> System ID   -> win32-i386-vc7
>>
>> Note: Branch:
>> Atlas310
>>
>> Files Attached:
>> parse_asf_objects.cpp_diff.txt
>>
>> Thanks & Regards
>> Anshuman
>>
>> ________________________________
>>
>> _______________________________________________
>> Datatype-dev mailing list
>> Datatype-dev@helixcommunity.org
>> http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
>>
>>
>
>
> _______________________________________________
> Datatype-dev mailing list
> Datatype-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/datatype-dev 


From Yury.Ramanovich at nokia.com  Mon May  5 13:17:48 2008
From: Yury.Ramanovich at nokia.com (Yury.Ramanovich@nokia.com)
Date: Mon May  5 12:10:31 2008
Subject: RESEND: [datatype-dev] CR: Changes in datatype/wm/common to
	fixesthecrashof Helix while trying to play WM files
	onSymbianplatformwith realignment checking ON
In-Reply-To: <00f901c8abd8$793bd8b0$db68a8c0@EHYCHED620>
References: <01f001c8aac1$7e7472f0$0b01a8c0@anshuman1>
	<00f901c8abd8$793bd8b0$db68a8c0@EHYCHED620>
Message-ID: <654E856A5136DF4382BE4B57B5E93A4107BF0AFB@daebe101.NOE.Nokia.com>

Checked in to 221Cays as well
yury 

>-----Original Message-----
>From: datatype-dev-bounces@helixcommunity.org 
>[mailto:datatype-dev-bounces@helixcommunity.org] On Behalf Of 
>ext Eric Hyche
>Sent: Thursday, May 01, 2008 5:13 PM
>To: 'Anshuman Singh'; 'datatype-dev'
>Subject: RE: RESEND: [datatype-dev] CR: Changes in 
>datatype/wm/common to fixesthecrashof Helix while trying to 
>play WM files onSymbianplatformwith realignment checking ON
>
>
>+                    memcpy((BYTE*) pTmpWChar,  *ppBuf,  
>ulNumWideChar*2);    
>
>I think this should be ulNumWideChar * sizeof(wchar_t) instead 
>of ulNumWideChar*2. The size of wchar_t is not always 2 bytes.
>It's actually 4 bytes on Linux.
>
>Rest looks good.
>
>=============================================
>Eric Hyche (ehyche@real.com)
>Technical Lead
>RealNetworks, Inc.  
>
>> -----Original Message-----
>> From: datatype-dev-bounces@helixcommunity.org
>> [mailto:datatype-dev-bounces@helixcommunity.org] On Behalf 
>Of Anshuman 
>> Singh
>> Sent: Wednesday, April 30, 2008 8:56 AM
>> To: 'datatype-dev'
>> Subject: RESEND: [datatype-dev] CR: Changes in datatype/wm/common to 
>> fixes thecrashof Helix while trying to play WM files on 
>> Symbianplatformwith realignment checking ON
>> 
>> Synopsis:
>> This change fixes the crash of Helix while trying to play WM 
>files on 
>> Symbian based platforms with realignment checking ON.
>>  
>> Overview:
>> Using wide character pointer instead of BYTE pointer fixes the issue 
>> as it allows only even addesses to be assigned to metadata string 
>> pointer.
>>  
>> Files Added:
>> none
>>  
>> Files Modified:
>> datatype/wm/common/parse_asf_objects.cpp
>>  
>> Image Size and Heap Use impact (Client -Only):
>> None.
>> 
>> Platforms and Profiles Affected:
>> platform : win32-i386-vc7
>> profile    : helix-client-all-defines
>>  
>> Distribution Libraries Affected:
>> None
>> 
>> Distribution library impact and planned action:
>> None
>> 
>> Platforms and Profiles Build Verified:
>> 
>> BIF branch   -> hxclient_3_1_0_atlas_restricted, 
>> hxclient_2_1_0_cayennes 
>> Target(s)      -> splay
>> Profile          -> helix-client-all-defines
>> System ID   -> win32-i386-vc7
>>  
>> Note: Branch:
>> Atlas310
>>  
>> Files Attached:
>> parse_asf_objects.cpp_diff.txt
>>  
>> Thanks & Regards
>> Anshuman
>> 
>> ________________________________
>> 
>> _______________________________________________
>> Datatype-dev mailing list
>> Datatype-dev@helixcommunity.org
>> http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
>> 
>> 
>
>
>_______________________________________________
>Datatype-dev mailing list
>Datatype-dev@helixcommunity.org
>http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
>

From Yury.Ramanovich at nokia.com  Mon May  5 13:31:44 2008
From: Yury.Ramanovich at nokia.com (Yury.Ramanovich@nokia.com)
Date: Mon May  5 12:23:41 2008
Subject: [datatype-dev] RE: [Nokia-private-dev] CR needed: ECTN-7CMLEA -
	phonedisplayed'invalid clip' when streaming unsupported wm
	videoandsupported wm audio
In-Reply-To: <654E856A5136DF4382BE4B57B5E93A410799DB25@daebe101.NOE.Nokia.com>
References: <654E856A5136DF4382BE4B57B5E93A410796CAA7@daebe101.NOE.Nokia.com><00df01c899b7$1a52d480$db68a8c0@EHYCHED620>
	<654E856A5136DF4382BE4B57B5E93A410799DB25@daebe101.NOE.Nokia.com>
Message-ID: <654E856A5136DF4382BE4B57B5E93A4107BF0B1F@daebe101.NOE.Nokia.com>

Checked in to 221Cays
yury 

>-----Original Message-----
>From: nokia-private-dev-bounces@helixcommunity.org 
>[mailto:nokia-private-dev-bounces@helixcommunity.org] On 
>Behalf Of ext Yury.Ramanovich@nokia.com
>Sent: Tuesday, April 08, 2008 4:24 PM
>To: ehyche@real.com; datatype-dev@helixcommunity.org; 
>nokia-private-dev@helixcommunity.org
>Subject: RE: [Nokia-private-dev] CR needed: ECTN-7CMLEA - 
>phonedisplayed'invalid clip' when streaming unsupported wm 
>videoandsupported wm audio
>
>Checked in to 210Cays and HEAD
>
>Thanks
>Yury
> 
>
>>-----Original Message-----
>>From: ext Eric Hyche [mailto:ehyche@real.com]
>>Sent: Tuesday, April 08, 2008 3:28 PM
>>To: Ramanovich Yury (Nokia-D-MSW/Dallas); 
>>datatype-dev@helixcommunity.org; nokia-private-dev@helixcommunity.org
>>Subject: RE: [Nokia-private-dev] CR needed: ECTN-7CMLEA - phone 
>>displayed'invalid clip' when streaming unsupported wm video 
>>andsupported wm audio
>>
>>
>>Looks good.
>>
>>=============================================
>>Eric Hyche (ehyche@real.com)
>>Technical Lead
>>RealNetworks, Inc.  
>>
>>> -----Original Message-----
>>> From: nokia-private-dev-bounces@helixcommunity.org
>>> [mailto:nokia-private-dev-bounces@helixcommunity.org] On Behalf Of 
>>> Yury.Ramanovich@nokia.com
>>> Sent: Tuesday, April 08, 2008 3:55 PM
>>> To: datatype-dev@helixcommunity.org;
>>> nokia-private-dev@helixcommunity.org
>>> Subject: [Nokia-private-dev] CR needed: ECTN-7CMLEA - phone 
>>> displayed'invalid clip' when streaming unsupported wm video 
>>> andsupported wm audio
>>> 
>>> Modified by:  yury.ramanovich@nokia.com
>>>   
>>> Reviewed by: 
>>>   
>>> Date: 04/07/2008
>>>   
>>> Project: SymbianMmf_wm
>>>   
>>> ErrorId: ECTN-7CMLEA
>>>   
>>> Synopsis:   phone displayed 'invalid clip' when streaming 
>>> unsupported wm video and supported wm audio
>>> 
>>> Overview: currently clip with supported wm audio and 
>unsupported wmv 
>>> video is not rejected by wm decoder during ConfigureDecoderL
>>call but
>>> during actual decoding of a first picture, which causes
>>> PlaybackComplete(KErrNotSupported) and "Invalid clip" message 
>>> displayed to user and audio is Not played. We need to 
>ensure that in 
>>> this case "Partial playback" message is shown and supported 
>wm audio 
>>> is played.
>>> 
>>> Solution: currently only WMV3 fourcc is supported. Get the
>>fourcc code
>>> from Bitmap Info Header's Compression ID in Stream
>>Properties Object. 
>>> Then check the fourcc code of wm video in
>>> CWMVPayloadFormatPluginDevice::Init() and if it is not
>>supported, then
>>> return HXR_UNSUPPORTED_VIDEO to CMdfVideoAdapter::Init().
>>> 
>>> Files modified: 
>>> /datatype/mdf/video/format/wmv/pub/mdfwmvpayloadformat.h
>>> /datatype/mdf/video/format/wmv/mdfwmvpayloadformat.cpp
>>> 
>>> 
>>> Files added: 
>>> None
>>> 
>>> 
>>> Image Size and Heap Use impact: minor. 
>>> 
>>> Module Release testing (STIF) : Yes, Passed
>>> 
>>> Test case(s) Added  : No
>>>   
>>> Memory leak check performed : Yes. No new memory leaks introduced. 
>>>   
>>> Platforms and Profiles Build Verified: 
>>> helix-client-s60-50-mmf-mdf-arm
>>> 
>>> Platforms and Profiles Functionality verified: armv5, winscw
>>>   
>>> Branch: Head & 210CayS
>>> <>
>>> 
>>> Thanks
>>> Yury
>>> 
>>> 
>>
>>
>
>_______________________________________________
>Nokia-private-dev mailing list
>Nokia-private-dev@helixcommunity.org
>http://lists.helixcommunity.org/mailman/listinfo/nokia-private-dev
>

From rajesh.rathinasamy at nokia.com  Wed May  7 13:42:27 2008
From: rajesh.rathinasamy at nokia.com (rajesh.rathinasamy@nokia.com)
Date: Wed May  7 12:34:36 2008
Subject: [datatype-dev] CR: Head Build error fixes for symbianMmf
Message-ID: <78988A0C817D8B4F9734DE8EFCEA6F67017DD115@daebe104.NOE.Nokia.com>



> "Nokia submits this code under the terms of a commercial contribution
> agreement with RealNetworks, and I am authorized to contribute this
> code under said agreement."
> 
> Modified by: rajesh.rathinasamy@nokia.com
> 
> Reviewed by: 
> 
> Date: 07-May-2008
> 
> Project: SymbianMmf_rel
> 
> ErrorId: NA
>             
> Synopsis: CR: Head Build error fixes for symbianMmf
> 
> Build error fixes:
> XPStest library umakefil not updated after recent changes
> Mmf statecontroller merge error on last checkin.
> 
> Other build failures to be fixed:
> * Symbian metadata engine
> * flv realted changes ( Helix.bif & payload format changes).
>   
>  
> Root Cause of the problem: Implementation
>  
> Files Modified:
> ===========
> datatype/xps/test/XPSRtpFlSrcLib
> clientapps/symbianMmf/hxmmfstatectrl.cpp
> 
> Image Size and Heap Use impact: no major impact
> 
> Module Release testing (STIF) :  Passed.
> 
> Test case(s) Added  :  No.
> 
> Memory leak check performed : Yes, no new leaks introduced
> 
> Platforms and Profiles Build Verified: helix-client-s60-32-mmf-mdf-arm
> 
> Platforms and Profiles Functionality verified: armv5, winscw
> 
> Branch: Head
> 
> 
> Index: XPSRtpFlSrcLib
> ===================================================================
> RCS file: /cvsroot/datatype/xps/test/XPSRtpFlSrcLib,v
> retrieving revision 1.1
> diff -w -u -b -r1.1 XPSRtpFlSrcLib
> --- XPSRtpFlSrcLib	15 Nov 2006 20:13:41 -0000	1.1
> +++ XPSRtpFlSrcLib	7 May 2008 18:30:54 -0000
> @@ -63,7 +63,10 @@
>  
>  UmakefileVersion(2,2)
>  
> -project.AddModuleIncludes('datatype/xps/packetsink')
> +project.AddModuleIncludes(
> +                           'datatype/xps/packetsink'
> +			  ,'datatype/xps/fileformat')
> +
>  
>  project.AddSources("CXPSRtpFlSrc.cpp")
>  project.AddSources("CXPSRtpPktFlReader.cpp")
> 
> Index: hxmmfstatectrl.cpp
> ===================================================================
> RCS file: /cvsroot/clientapps/symbianMmf/hxmmfstatectrl.cpp,v
> retrieving revision 1.28
> diff -w -u -b -r1.28 hxmmfstatectrl.cpp
> --- hxmmfstatectrl.cpp	25 Mar 2008 19:44:24 -0000	1.28
> +++ hxmmfstatectrl.cpp	7 May 2008 18:31:58 -0000
> @@ -373,7 +373,6 @@
>      m_pPlaying = NULL;
>      m_pError = NULL;
>      m_pObserver   = NULL;
> -    m_pProperties = NULL;
>      m_bVideoController = FALSE;
>  }
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080507/ccc7f84d/attachment.html
From ehyche at real.com  Thu May  8 08:26:41 2008
From: ehyche at real.com (Eric Hyche)
Date: Thu May  8 07:17:11 2008
Subject: [datatype-dev] RE: [Clientapps-dev] CR: Head Build error fixes for
	symbianMmf
In-Reply-To: <78988A0C817D8B4F9734DE8EFCEA6F67017DD115@daebe104.NOE.Nokia.com>
References: <78988A0C817D8B4F9734DE8EFCEA6F67017DD115@daebe104.NOE.Nokia.com>
Message-ID: <007f01c8b11f$eb5d6c50$db68a8c0@EHYCHED620>


Looks good.

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: clientapps-dev-bounces@helixcommunity.org 
> [mailto:clientapps-dev-bounces@helixcommunity.org] On Behalf 
> Of rajesh.rathinasamy@nokia.com
> Sent: Wednesday, May 07, 2008 4:42 PM
> To: clientapps-dev@helixcommunity.org; datatype-dev@helixcommunity.org
> Subject: [Clientapps-dev] CR: Head Build error fixes for symbianMmf
> 
> 
> 
> 	"Nokia submits this code under the terms of a 
> commercial contribution agreement with RealNetworks, and I am 
> authorized to contribute this code under said agreement."
> 
> 	Modified by: rajesh.rathinasamy@nokia.com 
> 
> 	Reviewed by: 
> 
> 	Date: 07-May-2008 
> 
> 	Project: SymbianMmf_rel 
> 
> 	ErrorId: NA 
> 	            
> 	Synopsis: CR: Head Build error fixes for symbianMmf 
> 
> 	Build error fixes: 
> 	XPStest library umakefil not updated after recent changes 
> 	Mmf statecontroller merge error on last checkin. 
> 
> 	Other build failures to be fixed: 
> 	* Symbian metadata engine 
> 	* flv realted changes ( Helix.bif & payload format changes). 
> 	  
> 	  
> 	Root Cause of the problem: Implementation 
> 	  
> 	Files Modified: 
> 	=========== 
> 	datatype/xps/test/XPSRtpFlSrcLib 
> 	clientapps/symbianMmf/hxmmfstatectrl.cpp 
> 
> 	Image Size and Heap Use impact: no major impact 
> 
> 	Module Release testing (STIF) :  Passed. 
> 
> 	Test case(s) Added  :  No. 
> 
> 	Memory leak check performed : Yes, no new leaks introduced 
> 
> 	Platforms and Profiles Build Verified: 
> helix-client-s60-32-mmf-mdf-arm 
> 
> 	Platforms and Profiles Functionality verified: armv5, winscw 
> 
> 	Branch: Head 
> 
> 
> 	Index: XPSRtpFlSrcLib 
> 	
> =================================================================== 
> 	RCS file: /cvsroot/datatype/xps/test/XPSRtpFlSrcLib,v 
> 	retrieving revision 1.1 
> 	diff -w -u -b -r1.1 XPSRtpFlSrcLib 
> 	--- XPSRtpFlSrcLib      15 Nov 2006 20:13:41 -0000      1.1 
> 	+++ XPSRtpFlSrcLib      7 May 2008 18:30:54 -0000 
> 	@@ -63,7 +63,10 @@ 
> 	  
> 	 UmakefileVersion(2,2) 
> 	  
> 	-project.AddModuleIncludes('datatype/xps/packetsink') 
> 	+project.AddModuleIncludes( 
> 	+                           'datatype/xps/packetsink' 
> 	+                         ,'datatype/xps/fileformat') 
> 	+ 
> 	  
> 	 project.AddSources("CXPSRtpFlSrc.cpp") 
> 	 project.AddSources("CXPSRtpPktFlReader.cpp") 
> 
> 	Index: hxmmfstatectrl.cpp 
> 	
> =================================================================== 
> 	RCS file: /cvsroot/clientapps/symbianMmf/hxmmfstatectrl.cpp,v 
> 	retrieving revision 1.28 
> 	diff -w -u -b -r1.28 hxmmfstatectrl.cpp 
> 	--- hxmmfstatectrl.cpp  25 Mar 2008 19:44:24 -0000      1.28 
> 	+++ hxmmfstatectrl.cpp  7 May 2008 18:31:58 -0000 
> 	@@ -373,7 +373,6 @@ 
> 	     m_pPlaying = NULL; 
> 	     m_pError = NULL; 
> 	     m_pObserver   = NULL; 
> 	-    m_pProperties = NULL; 
> 	     m_bVideoController = FALSE; 
> 	 } 
> 
> 
> 


From rajesh.rathinasamy at nokia.com  Thu May  8 14:17:43 2008
From: rajesh.rathinasamy at nokia.com (rajesh.rathinasamy@nokia.com)
Date: Thu May  8 13:09:27 2008
Subject: [datatype-dev] RE: [Clientapps-dev] CR: Head Build error fixes for
	symbianMmf
In-Reply-To: <007f01c8b11f$eb5d6c50$db68a8c0@EHYCHED620>
References: <78988A0C817D8B4F9734DE8EFCEA6F67017DD115@daebe104.NOE.Nokia.com>
	<007f01c8b11f$eb5d6c50$db68a8c0@EHYCHED620>
Message-ID: <78988A0C817D8B4F9734DE8EFCEA6F6701807310@daebe104.NOE.Nokia.com>

Thanks Eric

The changes have been checked into Head.

- Rajesh.
 

>-----Original Message-----
>From: ext Eric Hyche [mailto:ehyche@real.com] 
>Sent: Thursday, May 08, 2008 10:27 AM
>To: Rathinasamy Rajesh (Nokia-D-MSW/Dallas); 
>clientapps-dev@helixcommunity.org; datatype-dev@helixcommunity.org
>Subject: RE: [Clientapps-dev] CR: Head Build error fixes for symbianMmf
>
>
>Looks good.
>
>=============================================
>Eric Hyche (ehyche@real.com)
>Technical Lead
>RealNetworks, Inc.  
>
>> -----Original Message-----
>> From: clientapps-dev-bounces@helixcommunity.org
>> [mailto:clientapps-dev-bounces@helixcommunity.org] On Behalf Of 
>> rajesh.rathinasamy@nokia.com
>> Sent: Wednesday, May 07, 2008 4:42 PM
>> To: clientapps-dev@helixcommunity.org; 
>datatype-dev@helixcommunity.org
>> Subject: [Clientapps-dev] CR: Head Build error fixes for symbianMmf
>> 
>> 
>> 
>> 	"Nokia submits this code under the terms of a 
>commercial contribution 
>> agreement with RealNetworks, and I am authorized to contribute this 
>> code under said agreement."
>> 
>> 	Modified by: rajesh.rathinasamy@nokia.com
>> 
>> 	Reviewed by: 
>> 
>> 	Date: 07-May-2008
>> 
>> 	Project: SymbianMmf_rel
>> 
>> 	ErrorId: NA
>> 	            
>> 	Synopsis: CR: Head Build error fixes for symbianMmf
>> 
>> 	Build error fixes: 
>> 	XPStest library umakefil not updated after recent changes 
>> 	Mmf statecontroller merge error on last checkin. 
>> 
>> 	Other build failures to be fixed: 
>> 	* Symbian metadata engine 
>> 	* flv realted changes ( Helix.bif & payload format changes). 
>> 	  
>> 	  
>> 	Root Cause of the problem: Implementation
>> 	  
>> 	Files Modified: 
>> 	=========== 
>> 	datatype/xps/test/XPSRtpFlSrcLib 
>> 	clientapps/symbianMmf/hxmmfstatectrl.cpp
>> 
>> 	Image Size and Heap Use impact: no major impact
>> 
>> 	Module Release testing (STIF) :  Passed. 
>> 
>> 	Test case(s) Added  :  No. 
>> 
>> 	Memory leak check performed : Yes, no new leaks introduced
>> 
>> 	Platforms and Profiles Build Verified: 
>> helix-client-s60-32-mmf-mdf-arm
>> 
>> 	Platforms and Profiles Functionality verified: armv5, winscw
>> 
>> 	Branch: Head
>> 
>> 
>> 	Index: XPSRtpFlSrcLib
>> 	
>> =================================================================== 
>> 	RCS file: /cvsroot/datatype/xps/test/XPSRtpFlSrcLib,v 
>> 	retrieving revision 1.1 
>> 	diff -w -u -b -r1.1 XPSRtpFlSrcLib 
>> 	--- XPSRtpFlSrcLib      15 Nov 2006 20:13:41 -0000      1.1 
>> 	+++ XPSRtpFlSrcLib      7 May 2008 18:30:54 -0000 
>> 	@@ -63,7 +63,10 @@
>> 	  
>> 	 UmakefileVersion(2,2)
>> 	  
>> 	-project.AddModuleIncludes('datatype/xps/packetsink') 
>> 	+project.AddModuleIncludes( 
>> 	+                           'datatype/xps/packetsink' 
>> 	+                         ,'datatype/xps/fileformat') 
>> 	+
>> 	  
>> 	 project.AddSources("CXPSRtpFlSrc.cpp") 
>> 	 project.AddSources("CXPSRtpPktFlReader.cpp")
>> 
>> 	Index: hxmmfstatectrl.cpp
>> 	
>> =================================================================== 
>> 	RCS file: /cvsroot/clientapps/symbianMmf/hxmmfstatectrl.cpp,v 
>> 	retrieving revision 1.28 
>> 	diff -w -u -b -r1.28 hxmmfstatectrl.cpp 
>> 	--- hxmmfstatectrl.cpp  25 Mar 2008 19:44:24 -0000      1.28 
>> 	+++ hxmmfstatectrl.cpp  7 May 2008 18:31:58 -0000 
>> 	@@ -373,7 +373,6 @@ 
>> 	     m_pPlaying = NULL; 
>> 	     m_pError = NULL; 
>> 	     m_pObserver   = NULL; 
>> 	-    m_pProperties = NULL; 
>> 	     m_bVideoController = FALSE; 
>> 	 }
>> 
>> 
>> 
>
>

From cbailey at real.com  Mon May 12 13:04:09 2008
From: cbailey at real.com (Christina Bailey)
Date: Mon May 12 11:53:31 2008
Subject: [datatype-dev] CN: Fix for SWFs playing in prefetched mode.
In-Reply-To: 
References: <48289834.9080802@real.com>
	
Message-ID: <4828A2B9.7040407@real.com>

Thanks, checked into HEAD and 310Atlas.

--christina

Henry Ping wrote:
> Looks good
>
> Henry
>
>   
>> -----Original Message-----
>> From: Christina Bailey [mailto:cbailey@real.com]
>> Sent: Monday, May 12, 2008 12:19 PM
>> To: liteplayer_dev@real.com; Henry Ping
>> Subject: CR: Fix for SWFs playing in prefetched mode.
>>
>> Synopsis: Playback of a SWF with prefetch on and autoplay off caused
>> playback to start.
>>
>> Overview: For prefetch, pause is called, after the content is 100%
>> prefetched. The flash guest player is in the 'ready' state after
>> prefetch, so the state check failed when trying to pause the content.
>>
>> Files: datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
>>
>> Branch: HEAD, 310Atlas
>>
>> Diff:
>> Index: platform/win32/flash_guest_player_ax.cpp
>> ===================================================================
>> RCS file:
>> /cvsroot/datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
>> ,v
>> retrieving revision 1.21.2.23
>> diff -w -u -9 -r1.21.2.23 flash_guest_player_ax.cpp
>> --- platform/win32/flash_guest_player_ax.cpp    7 May 2008 00:55:42
>> -0000    1.21.2.23
>> +++ platform/win32/flash_guest_player_ax.cpp    12 May 2008 19:11:43 -0000
>> @@ -1000,19 +1000,20 @@
>>  //
>>  STDMETHODIMP CFlashGuestPlayerAX::Pause()
>>  {
>>      HXLOGL4(HXLOG_FPHR, "CFlashGuestPlayerAX::Pause()");
>>      HX_RESULT retVal = HXR_UNEXPECTED;
>>
>>      HX_ASSERT(m_ulGuestPlayerState == HXGUEST_STATE_MEDIA_PLAYING ||
>>            m_ulGuestPlayerState == HXGUEST_STATE_MEDIA_READY);
>>
>> -    if (m_ulGuestPlayerState == HXGUEST_STATE_MEDIA_PLAYING &&
>> m_pFlashPlayer)
>> +    if ((m_ulGuestPlayerState == HXGUEST_STATE_MEDIA_PLAYING ||
>> +     m_ulGuestPlayerState == HXGUEST_STATE_MEDIA_READY) &&
>>     
> m_pFlashPlayer)
>   
>>      {
>>          HXLOGL4(HXLOG_FPHR, "Calling IShockwaveFlash::StopPlay()");
>>      if (m_bIsFLVSource)
>>      {
>>          HXLOGL4(HXLOG_FPHR, "\tPause() - calling
>> SendFlashMessage(PauseFLV)");
>>          retVal = SendFlashMessage("PauseFLV");
>>      }
>>      else
>>      {
>>     
>
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080512/b4477fd4/attachment-0001.html
From ext-anuj.dhamija at nokia.com  Mon May 12 17:02:46 2008
From: ext-anuj.dhamija at nokia.com (ext-anuj.dhamija@nokia.com)
Date: Mon May 12 15:52:42 2008
Subject: [datatype-dev] CR: Helix Crashes while playing WMV file
Message-ID: <2198383E1141814486F0B881B3260CF5024DB0C3@daebe103.NOE.Nokia.com>


> 		"Nokia submits this code under the terms of a commercial
> contribution agreement with RealNetworks, and I am authorized to
> contribute this code under said agreement."
> 		 
> 		Modified by:  ext-anuj.dhamija@nokia.com
> 		 
> 		Reviewed by: 
> 		 
> 		Date: 05/12/2008
> 		 
> 		Project: SymbianMmf_wm
> 		 
> 		Synopsis: Multiple Audio Streams in WMV File cause Helix
> Audiocontroller Crash
> 
> 		Overview: 
> 		In WM Audio Format (CWMAduiFormat::UpdateAudioFormat)
> output buffer for decoded data is allocated with size for the stream
> which is selected as initial active stream based on sampling rate and
> number of channels (in CWMAudioFormat::ChooseInitialActiveSubStream
> method). This buffer is then used for decoder output disregard of the
> fact that which stream gets decoded. As long as the decoded stream is
> of less bitrate than the one chosen as active, there is no problem.
> But when the stream to be decoded is of higher bit rate than the one
> chosen as active ,then decoded output overflows the output buffer
> causing the crash.
> 
> 		Fix:
> 		Currently choice of Initial Active substream is made
> based on sample rate and number of channels. Whereas the size of
> decoded output depends on samples per frame. So if there are two
> streams with same sampling rate and same number of channels, samples
> per frame would be higher for the stream with higher bitrate and so it
> would need a bigger buffer if the packets of this stream are to be
> decoded.
> 		Since only one buffer is used for decoder output and
> packets from any of streams may have to be decoded (and not
> necessarily the one chosen as initial active stream) depending on what
> stream is chosen by controller, the size of buffer should be chosen
> for the stream with max samples per frame. So fix is made to chose the
> initial active stream as one which has max samples per frame. If
> samples per frame are same then choose the one with higher sampling
> rate and number of channels.
> 
> 		Files modified & changes:
> 		src\datatype\wm\audio\renderer\wmaformat.cpp
> 
> 		Image Size and Heap Use impact: None
> 
> 		Module Release testing (STIF, Audio) : Passed
> 
> 		Test case(s) Added  : No
> 
> 		Memory leak check performed : Passed, No leaks found
> 		  
> 		Platforms and Profiles Build Verified:
> helix-client-s60-50-mmf-mdf-arm
> 
> 		Platforms and Profiles Functionality verified: armv5
> 		  
> 		Branch: Head, 210CayS
> 
> 
> Index: wmaformat.cpp
> ===================================================================
> RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
> retrieving revision 1.4
> diff -u -w -r1.4 wmaformat.cpp
> --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4
> +++ wmaformat.cpp       12 May 2008 19:44:12 -0000
> @@ -815,6 +815,7 @@
>          // Initialize our counters
>          UINT16 usCurNumChannels   = 0;
>          UINT32 ulCurSampleRate    = 0;
> +                       UINT32 ulCurSampleOut    = 0;
>          UINT32 ulInitialStream    = m_ulNumSubStreams;
>          UINT32 i                  = 0;
>          // Clear the return value
> @@ -833,15 +834,26 @@
>                  retVal =
> m_ppWMAudioDecoder[i]->GetNumChannels(&usNumChannels);
>                  if (SUCCEEDED(retVal))
>                  {
> +                                       UINT32 ulSampleOut = 0;
> +                                       retVal =
> m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&ulSampleOut);
>                      // Get the sample rate for this substream
>                      UINT32 ulSampleRate = 0;
>                      retVal =
> m_ppWMAudioDecoder[i]->GetSampleRate(&ulSampleRate);
>                      if (SUCCEEDED(retVal))
>                      {
> -                        // Choose the highest sample rate and for
> substreams
> -                        // with the same sample rate, choose the
> highest
> -                        // number of channels
> -                        if (ulSampleRate > ulCurSampleRate)
> +                                               // Choose the highest
> samples per frame
> +                                               //for substreams with
> the same samples per frame,
> +                                               //choose the highest
> sample rate
> +                                               //for same sample rate
> choose the max number of channels
> +                                               if (ulSampleOut >
> ulCurSampleOut)
> +                                               {
> +                                                       ulCurSampleOut
> = ulSampleOut;
> +
> ulCurSampleRate  = ulSampleRate;
> +
> usCurNumChannels = usNumChannels;
> +
> ulInitialStream  = i;
> +                                               }
> +                                               else if(ulSampleOut ==
> ulCurSampleOut &&
> +
> ulSampleRate > ulCurSampleRate)
>                          {
>                              ulCurSampleRate  = ulSampleRate;
>                              usCurNumChannels = usNumChannels;
> ______________________________________________ 
> 
> thnx & regds
> AD
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080512/b9b16e09/attachment.html
From ehyche at real.com  Tue May 13 07:44:29 2008
From: ehyche at real.com (Eric Hyche)
Date: Tue May 13 06:33:40 2008
Subject: [datatype-dev] RE: [Nokia-private-dev] CR: Helix Crashes while
	playing WMV file
In-Reply-To: <2198383E1141814486F0B881B3260CF5024DB0C3@daebe103.NOE.Nokia.com>
References: <2198383E1141814486F0B881B3260CF5024DB0C3@daebe103.NOE.Nokia.com>
Message-ID: <00fa01c8b507$da4bfa30$db68a8c0@EHYCHED620>


I don't think we should change which stream is initially
selected, but rather change how the size of the decoder
output buffer is computed.

It sounds like we currently compute the size of the output decoder
buffer based upon the size needed for the initially
selected sub-stream. However, we should compute the
size of the decoder output buffer to be the maximum
size needed across all sub-streams.

I think all we need to do is make a change in
CWMAudioFormat::UpdateAudioFormat() here:

        // Allocate Decoder Buffer
        if (SUCCEEDED(retVal))
        {
            // Did the size change?
            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
            {

This is where we detect that a sub-stream switch
has occurred and we adjust the size of the
decoder output buffer. It seems to me we should
only let ulDecoderBufferSize go up, but not
be reduced. Let's say we have a stream switch
to a lower bitrate sub-stream. Therefore, the required
decoder output buffer size for this new sub-stream
might change to a lower number. So currently
we would re-compute the size of this buffer and
re-allocate it. However, if we get a packet 
from the old sub-stream in after this point, we will
not have enough room to decode it.

So I would just do the following:

-            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
+            if (m_ulDecoderBufferSize >  m_ulMaxDecoderOutputBytes)

Does this fix your problem?

Eric

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: nokia-private-dev-bounces@helixcommunity.org 
> [mailto:nokia-private-dev-bounces@helixcommunity.org] On 
> Behalf Of ext-anuj.dhamija@nokia.com
> Sent: Monday, May 12, 2008 8:03 PM
> To: datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: [Nokia-private-dev] CR: Helix Crashes while playing WMV file
> 
> 
> 			"Nokia submits this code under the 
> terms of a commercial contribution agreement with 
> RealNetworks, and I am authorized to contribute this code 
> under said agreement."
> 
> 			  
> 			Modified by:  ext-anuj.dhamija@nokia.com 
> 			  
> 			Reviewed by: 
> 			  
> 			Date: 05/12/2008 
> 			  
> 			Project: SymbianMmf_wm 
> 			  
> 			Synopsis: Multiple Audio Streams in WMV 
> File cause Helix Audiocontroller Crash 
> 
> 			Overview: 
> 			In WM Audio Format 
> (CWMAduiFormat::UpdateAudioFormat) output buffer for decoded 
> data is allocated with size for the stream which is selected 
> as initial active stream based on sampling rate and number of 
> channels (in CWMAudioFormat::ChooseInitialActiveSubStream 
> method). This buffer is then used for decoder output 
> disregard of the fact that which stream gets decoded. As long 
> as the decoded stream is of less bitrate than the one chosen 
> as active, there is no problem. But when the stream to be 
> decoded is of higher bit rate than the one chosen as active 
> ,then decoded output overflows the output buffer causing the crash.
> 
> 			Fix: 
> 			Currently choice of Initial Active 
> substream is made based on sample rate and number of 
> channels. Whereas the size of decoded output depends on 
> samples per frame. So if there are two streams with same 
> sampling rate and same number of channels, samples per frame 
> would be higher for the stream with higher bitrate and so it 
> would need a bigger buffer if the packets of this stream are 
> to be decoded.
> 
> 			Since only one buffer is used for 
> decoder output and packets from any of streams may have to be 
> decoded (and not necessarily the one chosen as initial active 
> stream) depending on what stream is chosen by controller, the 
> size of buffer should be chosen for the stream with max 
> samples per frame. So fix is made to chose the initial active 
> stream as one which has max samples per frame. If samples per 
> frame are same then choose the one with higher sampling rate 
> and number of channels.
> 
> 			Files modified & changes: 
> 			src\datatype\wm\audio\renderer\wmaformat.cpp 
> 
> 			Image Size and Heap Use impact: None 
> 
> 			Module Release testing (STIF, Audio) : Passed 
> 
> 			Test case(s) Added  : No 
> 
> 			Memory leak check performed : Passed, 
> No leaks found 
> 			  
> 			Platforms and Profiles Build Verified: 
> helix-client-s60-50-mmf-mdf-arm 
> 
> 			Platforms and Profiles Functionality 
> verified: armv5 
> 			  
> 			Branch: Head, 210CayS 
> 
> 
> Index: wmaformat.cpp 
> =================================================================== 
> RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v 
> retrieving revision 1.4 
> diff -u -w -r1.4 wmaformat.cpp 
> --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4 
> +++ wmaformat.cpp       12 May 2008 19:44:12 -0000 
> @@ -815,6 +815,7 @@ 
>          // Initialize our counters 
>          UINT16 usCurNumChannels   = 0; 
>          UINT32 ulCurSampleRate    = 0; 
> +                       UINT32 ulCurSampleOut    = 0; 
>          UINT32 ulInitialStream    = m_ulNumSubStreams; 
>          UINT32 i                  = 0; 
>          // Clear the return value 
> @@ -833,15 +834,26 @@ 
>                  retVal = 
> m_ppWMAudioDecoder[i]->GetNumChannels(&usNumChannels); 
>                  if (SUCCEEDED(retVal)) 
>                  { 
> +                                       UINT32 ulSampleOut = 0; 
> +                                       retVal = 
> m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&ulSampleOut); 
>                      // Get the sample rate for this substream 
>                      UINT32 ulSampleRate = 0; 
>                      retVal = 
> m_ppWMAudioDecoder[i]->GetSampleRate(&ulSampleRate); 
>                      if (SUCCEEDED(retVal)) 
>                      { 
> -                        // Choose the highest sample rate 
> and for substreams 
> -                        // with the same sample rate, choose 
> the highest 
> -                        // number of channels 
> -                        if (ulSampleRate > ulCurSampleRate) 
> +                                               // Choose the 
> highest samples per frame 
> +                                               //for 
> substreams with the same samples per frame, 
> +                                               //choose the 
> highest sample rate 
> +                                               //for same 
> sample rate choose the max number of channels 
> +                                               if 
> (ulSampleOut > ulCurSampleOut) 
> +                                               { 
> +                                                       
> ulCurSampleOut   = ulSampleOut; 
> +                                                       
> ulCurSampleRate  = ulSampleRate; 
> +                                                       
> usCurNumChannels = usNumChannels; 
> +                                                       
> ulInitialStream  = i; 
> +                                               } 
> +                                               else 
> if(ulSampleOut == ulCurSampleOut && 
> +                                                             
>   ulSampleRate > ulCurSampleRate) 
>                          { 
>                              ulCurSampleRate  = ulSampleRate; 
>                              usCurNumChannels = usNumChannels; 
> ______________________________________________ 
> 
> thnx & regds 
> AD 
> 
> 


From ext-anuj.dhamija at nokia.com  Tue May 13 09:10:48 2008
From: ext-anuj.dhamija at nokia.com (ext-anuj.dhamija@nokia.com)
Date: Tue May 13 08:01:02 2008
Subject: [datatype-dev] RE: [Nokia-private-dev] CR: Helix Crashes while
	playing WMV file
In-Reply-To: <00fa01c8b507$da4bfa30$db68a8c0@EHYCHED620>
References: <2198383E1141814486F0B881B3260CF5024DB0C3@daebe103.NOE.Nokia.com>
	<00fa01c8b507$da4bfa30$db68a8c0@EHYCHED620>
Message-ID: <2198383E1141814486F0B881B3260CF5024DB350@daebe103.NOE.Nokia.com>

Hi Eric,

There is no substream switch happening here and so fix you suggested may
not work.

This is the flow of how initially buffer is allocated:
A) CWMAudioFormat::Init is invoked
B) CWMAudioFormat::ParseOpaqueData ==> Initialise array of audio
decoders with substream headers
C) ChooseInitialActiveSubStream ==> Choose the Active substream 
D) UpdateAudioFormat ==> Allocate Decoder Output Buffer for Active
Substream

Now later when first packet from any of the substream is received
CWMAudioFormat::DecodeAudioData gets invoked and so far no change in
buffer size is made. GetNextAssembledFrame() is then invoked which finds
the stream-id for received packet and change the active stream-id to the
same. But still Output buffer is of same size as the initial Active
substream.
pDecoder->Decode is then called and there it crashes if the initial
active substream was of lower bit rate than the stream from which packet
is received.

CWMAudioFormat::UpdateAudioFormat() is called again only after the
decode call which is too late for the given scenario.

So what I have tried to do is to change the initial active substream to
be one which needs maximum output buffer size. The problem with current
logic of selecting active substream is that bitrate parameter is
completely ignored and only sample rate and number of channels is used.
Also choosing initial Active Substream on AudioFormat does not have any
influence on the actual substream id that is displayed as that selection
is made by controller somewhere else. 

Thnx & regds
AD
-----Original Message-----
From: ext Eric Hyche [mailto:ehyche@real.com] 
Sent: Tuesday, May 13, 2008 9:44 AM
To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
datatype-dev@helixcommunity.org
Cc: nokia-private-dev@helixcommunity.org
Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV
file


I don't think we should change which stream is initially selected, but
rather change how the size of the decoder output buffer is computed.

It sounds like we currently compute the size of the output decoder
buffer based upon the size needed for the initially selected sub-stream.
However, we should compute the size of the decoder output buffer to be
the maximum size needed across all sub-streams.

I think all we need to do is make a change in
CWMAudioFormat::UpdateAudioFormat() here:

        // Allocate Decoder Buffer
        if (SUCCEEDED(retVal))
        {
            // Did the size change?
            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
            {

This is where we detect that a sub-stream switch has occurred and we
adjust the size of the decoder output buffer. It seems to me we should
only let ulDecoderBufferSize go up, but not be reduced. Let's say we
have a stream switch to a lower bitrate sub-stream. Therefore, the
required decoder output buffer size for this new sub-stream might change
to a lower number. So currently we would re-compute the size of this
buffer and re-allocate it. However, if we get a packet from the old
sub-stream in after this point, we will not have enough room to decode
it.

So I would just do the following:

-            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
+            if (m_ulDecoderBufferSize >  m_ulMaxDecoderOutputBytes)

Does this fix your problem?

Eric

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: nokia-private-dev-bounces@helixcommunity.org
> [mailto:nokia-private-dev-bounces@helixcommunity.org] On Behalf Of 
> ext-anuj.dhamija@nokia.com
> Sent: Monday, May 12, 2008 8:03 PM
> To: datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: [Nokia-private-dev] CR: Helix Crashes while playing WMV file
> 
> 
> 			"Nokia submits this code under the terms of a
commercial 
> contribution agreement with RealNetworks, and I am authorized to 
> contribute this code under said agreement."
> 
> 			  
> 			Modified by:  ext-anuj.dhamija@nokia.com
> 			  
> 			Reviewed by: 
> 			  
> 			Date: 05/12/2008
> 			  
> 			Project: SymbianMmf_wm
> 			  
> 			Synopsis: Multiple Audio Streams in WMV File
cause Helix 
> Audiocontroller Crash
> 
> 			Overview: 
> 			In WM Audio Format
> (CWMAduiFormat::UpdateAudioFormat) output buffer for decoded data is 
> allocated with size for the stream which is selected as initial active

> stream based on sampling rate and number of channels (in 
> CWMAudioFormat::ChooseInitialActiveSubStream
> method). This buffer is then used for decoder output disregard of the 
> fact that which stream gets decoded. As long as the decoded stream is 
> of less bitrate than the one chosen as active, there is no problem. 
> But when the stream to be decoded is of higher bit rate than the one 
> chosen as active ,then decoded output overflows the output buffer 
> causing the crash.
> 
> 			Fix: 
> 			Currently choice of Initial Active substream is
made based on 
> sample rate and number of channels. Whereas the size of decoded output

> depends on samples per frame. So if there are two streams with same 
> sampling rate and same number of channels, samples per frame would be 
> higher for the stream with higher bitrate and so it would need a 
> bigger buffer if the packets of this stream are to be decoded.
> 
> 			Since only one buffer is used for
> decoder output and packets from any of streams may have to be decoded 
> (and not necessarily the one chosen as initial active
> stream) depending on what stream is chosen by controller, the size of 
> buffer should be chosen for the stream with max samples per frame. So 
> fix is made to chose the initial active stream as one which has max 
> samples per frame. If samples per frame are same then choose the one 
> with higher sampling rate and number of channels.
> 
> 			Files modified & changes: 
> 			src\datatype\wm\audio\renderer\wmaformat.cpp
> 
> 			Image Size and Heap Use impact: None
> 
> 			Module Release testing (STIF, Audio) : Passed
> 
> 			Test case(s) Added  : No
> 
> 			Memory leak check performed : Passed, No leaks
found
> 			  
> 			Platforms and Profiles Build Verified: 
> helix-client-s60-50-mmf-mdf-arm
> 
> 			Platforms and Profiles Functionality
> verified: armv5
> 			  
> 			Branch: Head, 210CayS
> 
> 
> Index: wmaformat.cpp
> ===================================================================
> RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
> retrieving revision 1.4
> diff -u -w -r1.4 wmaformat.cpp 
> --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4 
> +++ wmaformat.cpp       12 May 2008 19:44:12 -0000 
> @@ -815,6 +815,7 @@ 
>          // Initialize our counters 
>          UINT16 usCurNumChannels   = 0; 
>          UINT32 ulCurSampleRate    = 0; 
> +                       UINT32 ulCurSampleOut    = 0; 
>          UINT32 ulInitialStream    = m_ulNumSubStreams; 
>          UINT32 i                  = 0; 
>          // Clear the return value
> @@ -833,15 +834,26 @@ 
>                  retVal =
> m_ppWMAudioDecoder[i]->GetNumChannels(&usNumChannels); 
>                  if (SUCCEEDED(retVal)) 
>                  {
> +                                       UINT32 ulSampleOut = 0; 
> +                                       retVal =
> m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&ulSampleOut); 
>                      // Get the sample rate for this substream 
>                      UINT32 ulSampleRate = 0; 
>                      retVal =
> m_ppWMAudioDecoder[i]->GetSampleRate(&ulSampleRate); 
>                      if (SUCCEEDED(retVal)) 
>                      { 
> -                        // Choose the highest sample rate 
> and for substreams 
> -                        // with the same sample rate, choose 
> the highest 
> -                        // number of channels 
> -                        if (ulSampleRate > ulCurSampleRate) 
> +                                               // Choose the
> highest samples per frame
> +                                               //for
> substreams with the same samples per frame,
> +                                               //choose the
> highest sample rate
> +                                               //for same
> sample rate choose the max number of channels
> +                                               if
> (ulSampleOut > ulCurSampleOut)
> +                                               {
> +                                                       
> ulCurSampleOut   = ulSampleOut; 
> +                                                       
> ulCurSampleRate  = ulSampleRate;
> +                                                       
> usCurNumChannels = usNumChannels;
> +                                                       
> ulInitialStream  = i;
> +                                               } 
> +                                               else
> if(ulSampleOut == ulCurSampleOut &&
> +                                                             
>   ulSampleRate > ulCurSampleRate) 
>                          { 
>                              ulCurSampleRate  = ulSampleRate; 
>                              usCurNumChannels = usNumChannels; 
> ______________________________________________
> 
> thnx & regds
> AD
> 
> 


From ehyche at real.com  Tue May 13 09:41:04 2008
From: ehyche at real.com (Eric Hyche)
Date: Tue May 13 08:30:15 2008
Subject: [datatype-dev] RE: [Nokia-private-dev] CR: Helix Crashes while
	playing WMV file
In-Reply-To: <2198383E1141814486F0B881B3260CF5024DB350@daebe103.NOE.Nokia.com>
References: <2198383E1141814486F0B881B3260CF5024DB0C3@daebe103.NOE.Nokia.com>
	<00fa01c8b507$da4bfa30$db68a8c0@EHYCHED620>
	<2198383E1141814486F0B881B3260CF5024DB350@daebe103.NOE.Nokia.com>
Message-ID: <011b01c8b518$23e08b60$db68a8c0@EHYCHED620>


> The problem with current logic of selecting active substream
> is that bitrate parameter is completely ignored and only
> sample rate and number of channels is used.
> Also choosing initial Active Substream on AudioFormat does 
> not have any influence on the actual substream id that is displayed as 
> that selection is made by controller somewhere else. 
> 

The reason we do this is that with some audio device
implementations, the audio device is opened with the
paramters of the first audio stream created. So if
have three sub-streams:

SubStream 0: 1 channel, sample rate 11025
SubStream 1: 2 channel, sample rate 22050
SubStream 2: 2 channel, sample rate 44100

and you choose substream 0 as the initial substream,
then with the audio device may be opened at
a sample rate of 11025. Then when you have a stream
switch to substream 2, then audio services will
downsample to 44100 to 11025 and 2 channels to 1 channel.

So it's always a good idea for audio renderers to create
the first IHXAudioStream with the parameters of the highest
sample rate and number of channels.

In CWMAudioFormat::Init(), after the call to ParseOpaqueData(),
we know all the information about every sub-stream. Therefore,
at that point, we could calculate the required decoder output
buffer size for each substream. Then we would just take the
maximum size across all substreams and use that for the
decoder buffer size. Then, it would not be necessary to re-allocate
this buffer in UpdateAudioFormat().

Eric


=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: ext-anuj.dhamija@nokia.com [mailto:ext-anuj.dhamija@nokia.com] 
> Sent: Tuesday, May 13, 2008 12:11 PM
> To: ehyche@real.com; datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while 
> playing WMV file
> 
> Hi Eric,
> 
> There is no substream switch happening here and so fix you 
> suggested may
> not work.
> 
> This is the flow of how initially buffer is allocated:
> A) CWMAudioFormat::Init is invoked
> B) CWMAudioFormat::ParseOpaqueData ==> Initialise array of audio
> decoders with substream headers
> C) ChooseInitialActiveSubStream ==> Choose the Active substream 
> D) UpdateAudioFormat ==> Allocate Decoder Output Buffer for Active
> Substream
> 
> Now later when first packet from any of the substream is received
> CWMAudioFormat::DecodeAudioData gets invoked and so far no change in
> buffer size is made. GetNextAssembledFrame() is then invoked 
> which finds
> the stream-id for received packet and change the active 
> stream-id to the
> same. But still Output buffer is of same size as the initial Active
> substream.
> pDecoder->Decode is then called and there it crashes if the initial
> active substream was of lower bit rate than the stream from 
> which packet
> is received.
> 
> CWMAudioFormat::UpdateAudioFormat() is called again only after the
> decode call which is too late for the given scenario.
> 
> So what I have tried to do is to change the initial active 
> substream to
> be one which needs maximum output buffer size. The problem 
> with current
> logic of selecting active substream is that bitrate parameter is
> completely ignored and only sample rate and number of 
> channels is used.
> Also choosing initial Active Substream on AudioFormat does 
> not have any
> influence on the actual substream id that is displayed as 
> that selection
> is made by controller somewhere else. 
> 
> Thnx & regds
> AD
> -----Original Message-----
> From: ext Eric Hyche [mailto:ehyche@real.com] 
> Sent: Tuesday, May 13, 2008 9:44 AM
> To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
> datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV
> file
> 
> 
> I don't think we should change which stream is initially selected, but
> rather change how the size of the decoder output buffer is computed.
> 
> It sounds like we currently compute the size of the output decoder
> buffer based upon the size needed for the initially selected 
> sub-stream.
> However, we should compute the size of the decoder output buffer to be
> the maximum size needed across all sub-streams.
> 
> I think all we need to do is make a change in
> CWMAudioFormat::UpdateAudioFormat() here:
> 
>         // Allocate Decoder Buffer
>         if (SUCCEEDED(retVal))
>         {
>             // Did the size change?
>             if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
>             {
> 
> This is where we detect that a sub-stream switch has occurred and we
> adjust the size of the decoder output buffer. It seems to me we should
> only let ulDecoderBufferSize go up, but not be reduced. Let's say we
> have a stream switch to a lower bitrate sub-stream. Therefore, the
> required decoder output buffer size for this new sub-stream 
> might change
> to a lower number. So currently we would re-compute the size of this
> buffer and re-allocate it. However, if we get a packet from the old
> sub-stream in after this point, we will not have enough room to decode
> it.
> 
> So I would just do the following:
> 
> -            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
> +            if (m_ulDecoderBufferSize >  m_ulMaxDecoderOutputBytes)
> 
> Does this fix your problem?
> 
> Eric
> 
> =============================================
> Eric Hyche (ehyche@real.com)
> Technical Lead
> RealNetworks, Inc.  
> 
> > -----Original Message-----
> > From: nokia-private-dev-bounces@helixcommunity.org
> > [mailto:nokia-private-dev-bounces@helixcommunity.org] On Behalf Of 
> > ext-anuj.dhamija@nokia.com
> > Sent: Monday, May 12, 2008 8:03 PM
> > To: datatype-dev@helixcommunity.org
> > Cc: nokia-private-dev@helixcommunity.org
> > Subject: [Nokia-private-dev] CR: Helix Crashes while 
> playing WMV file
> > 
> > 
> > 			"Nokia submits this code under the terms of a
> commercial 
> > contribution agreement with RealNetworks, and I am authorized to 
> > contribute this code under said agreement."
> > 
> > 			  
> > 			Modified by:  ext-anuj.dhamija@nokia.com
> > 			  
> > 			Reviewed by: 
> > 			  
> > 			Date: 05/12/2008
> > 			  
> > 			Project: SymbianMmf_wm
> > 			  
> > 			Synopsis: Multiple Audio Streams in WMV File
> cause Helix 
> > Audiocontroller Crash
> > 
> > 			Overview: 
> > 			In WM Audio Format
> > (CWMAduiFormat::UpdateAudioFormat) output buffer for 
> decoded data is 
> > allocated with size for the stream which is selected as 
> initial active
> 
> > stream based on sampling rate and number of channels (in 
> > CWMAudioFormat::ChooseInitialActiveSubStream
> > method). This buffer is then used for decoder output 
> disregard of the 
> > fact that which stream gets decoded. As long as the decoded 
> stream is 
> > of less bitrate than the one chosen as active, there is no problem. 
> > But when the stream to be decoded is of higher bit rate 
> than the one 
> > chosen as active ,then decoded output overflows the output buffer 
> > causing the crash.
> > 
> > 			Fix: 
> > 			Currently choice of Initial Active substream is
> made based on 
> > sample rate and number of channels. Whereas the size of 
> decoded output
> 
> > depends on samples per frame. So if there are two streams with same 
> > sampling rate and same number of channels, samples per 
> frame would be 
> > higher for the stream with higher bitrate and so it would need a 
> > bigger buffer if the packets of this stream are to be decoded.
> > 
> > 			Since only one buffer is used for
> > decoder output and packets from any of streams may have to 
> be decoded 
> > (and not necessarily the one chosen as initial active
> > stream) depending on what stream is chosen by controller, 
> the size of 
> > buffer should be chosen for the stream with max samples per 
> frame. So 
> > fix is made to chose the initial active stream as one which has max 
> > samples per frame. If samples per frame are same then 
> choose the one 
> > with higher sampling rate and number of channels.
> > 
> > 			Files modified & changes: 
> > 			src\datatype\wm\audio\renderer\wmaformat.cpp
> > 
> > 			Image Size and Heap Use impact: None
> > 
> > 			Module Release testing (STIF, Audio) : Passed
> > 
> > 			Test case(s) Added  : No
> > 
> > 			Memory leak check performed : Passed, No leaks
> found
> > 			  
> > 			Platforms and Profiles Build Verified: 
> > helix-client-s60-50-mmf-mdf-arm
> > 
> > 			Platforms and Profiles Functionality
> > verified: armv5
> > 			  
> > 			Branch: Head, 210CayS
> > 
> > 
> > Index: wmaformat.cpp
> > ===================================================================
> > RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
> > retrieving revision 1.4
> > diff -u -w -r1.4 wmaformat.cpp 
> > --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4 
> > +++ wmaformat.cpp       12 May 2008 19:44:12 -0000 
> > @@ -815,6 +815,7 @@ 
> >          // Initialize our counters 
> >          UINT16 usCurNumChannels   = 0; 
> >          UINT32 ulCurSampleRate    = 0; 
> > +                       UINT32 ulCurSampleOut    = 0; 
> >          UINT32 ulInitialStream    = m_ulNumSubStreams; 
> >          UINT32 i                  = 0; 
> >          // Clear the return value
> > @@ -833,15 +834,26 @@ 
> >                  retVal =
> > m_ppWMAudioDecoder[i]->GetNumChannels(&usNumChannels); 
> >                  if (SUCCEEDED(retVal)) 
> >                  {
> > +                                       UINT32 ulSampleOut = 0; 
> > +                                       retVal =
> > m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&ulSampleOut); 
> >                      // Get the sample rate for this substream 
> >                      UINT32 ulSampleRate = 0; 
> >                      retVal =
> > m_ppWMAudioDecoder[i]->GetSampleRate(&ulSampleRate); 
> >                      if (SUCCEEDED(retVal)) 
> >                      { 
> > -                        // Choose the highest sample rate 
> > and for substreams 
> > -                        // with the same sample rate, choose 
> > the highest 
> > -                        // number of channels 
> > -                        if (ulSampleRate > ulCurSampleRate) 
> > +                                               // Choose the
> > highest samples per frame
> > +                                               //for
> > substreams with the same samples per frame,
> > +                                               //choose the
> > highest sample rate
> > +                                               //for same
> > sample rate choose the max number of channels
> > +                                               if
> > (ulSampleOut > ulCurSampleOut)
> > +                                               {
> > +                                                       
> > ulCurSampleOut   = ulSampleOut; 
> > +                                                       
> > ulCurSampleRate  = ulSampleRate;
> > +                                                       
> > usCurNumChannels = usNumChannels;
> > +                                                       
> > ulInitialStream  = i;
> > +                                               } 
> > +                                               else
> > if(ulSampleOut == ulCurSampleOut &&
> > +                                                             
> >   ulSampleRate > ulCurSampleRate) 
> >                          { 
> >                              ulCurSampleRate  = ulSampleRate; 
> >                              usCurNumChannels = usNumChannels; 
> > ______________________________________________
> > 
> > thnx & regds
> > AD
> > 
> > 
> 


From ext-anuj.dhamija at nokia.com  Tue May 13 11:43:14 2008
From: ext-anuj.dhamija at nokia.com (ext-anuj.dhamija@nokia.com)
Date: Tue May 13 10:32:49 2008
Subject: [datatype-dev] RE: [Nokia-private-dev] CR: Helix Crashes while
	playing WMV file
In-Reply-To: <011b01c8b518$23e08b60$db68a8c0@EHYCHED620>
References: <2198383E1141814486F0B881B3260CF5024DB0C3@daebe103.NOE.Nokia.com>
	<00fa01c8b507$da4bfa30$db68a8c0@EHYCHED620>
	<2198383E1141814486F0B881B3260CF5024DB350@daebe103.NOE.Nokia.com>
	<011b01c8b518$23e08b60$db68a8c0@EHYCHED620>
Message-ID: <2198383E1141814486F0B881B3260CF5024DB4D5@daebe103.NOE.Nokia.com>

I was wondering what about invoking method UpdateAudioFormat immediately
after calling GetNextAssembledFrame in CWMAudioFormat::DecodeAudioData
if the received frame is from a different stream than active one?

thnx & regds
AD

-----Original Message-----
From: ext Eric Hyche [mailto:ehyche@real.com] 
Sent: Tuesday, May 13, 2008 11:41 AM
To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
datatype-dev@helixcommunity.org
Cc: nokia-private-dev@helixcommunity.org
Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV
file


> The problem with current logic of selecting active substream is that 
> bitrate parameter is completely ignored and only sample rate and 
> number of channels is used.
> Also choosing initial Active Substream on AudioFormat does not have 
> any influence on the actual substream id that is displayed as that 
> selection is made by controller somewhere else.
> 

The reason we do this is that with some audio device implementations,
the audio device is opened with the paramters of the first audio stream
created. So if have three sub-streams:

SubStream 0: 1 channel, sample rate 11025 SubStream 1: 2 channel, sample
rate 22050 SubStream 2: 2 channel, sample rate 44100

and you choose substream 0 as the initial substream, then with the audio
device may be opened at a sample rate of 11025. Then when you have a
stream switch to substream 2, then audio services will downsample to
44100 to 11025 and 2 channels to 1 channel.

So it's always a good idea for audio renderers to create the first
IHXAudioStream with the parameters of the highest sample rate and number
of channels.

In CWMAudioFormat::Init(), after the call to ParseOpaqueData(), we know
all the information about every sub-stream. Therefore, at that point, we
could calculate the required decoder output buffer size for each
substream. Then we would just take the maximum size across all
substreams and use that for the decoder buffer size. Then, it would not
be necessary to re-allocate this buffer in UpdateAudioFormat().

Eric


=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: ext-anuj.dhamija@nokia.com [mailto:ext-anuj.dhamija@nokia.com]
> Sent: Tuesday, May 13, 2008 12:11 PM
> To: ehyche@real.com; datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV 
> file
> 
> Hi Eric,
> 
> There is no substream switch happening here and so fix you suggested 
> may not work.
> 
> This is the flow of how initially buffer is allocated:
> A) CWMAudioFormat::Init is invoked
> B) CWMAudioFormat::ParseOpaqueData ==> Initialise array of audio 
> decoders with substream headers
> C) ChooseInitialActiveSubStream ==> Choose the Active substream
> D) UpdateAudioFormat ==> Allocate Decoder Output Buffer for Active 
> Substream
> 
> Now later when first packet from any of the substream is received 
> CWMAudioFormat::DecodeAudioData gets invoked and so far no change in 
> buffer size is made. GetNextAssembledFrame() is then invoked which 
> finds the stream-id for received packet and change the active 
> stream-id to the same. But still Output buffer is of same size as the 
> initial Active substream.
> pDecoder->Decode is then called and there it crashes if the initial
> active substream was of lower bit rate than the stream from which 
> packet is received.
> 
> CWMAudioFormat::UpdateAudioFormat() is called again only after the 
> decode call which is too late for the given scenario.
> 
> So what I have tried to do is to change the initial active substream 
> to be one which needs maximum output buffer size. The problem with 
> current logic of selecting active substream is that bitrate parameter 
> is completely ignored and only sample rate and number of channels is 
> used.
> Also choosing initial Active Substream on AudioFormat does not have 
> any influence on the actual substream id that is displayed as that 
> selection is made by controller somewhere else.
> 
> Thnx & regds
> AD
> -----Original Message-----
> From: ext Eric Hyche [mailto:ehyche@real.com]
> Sent: Tuesday, May 13, 2008 9:44 AM
> To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
> datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV 
> file
> 
> 
> I don't think we should change which stream is initially selected, but

> rather change how the size of the decoder output buffer is computed.
> 
> It sounds like we currently compute the size of the output decoder 
> buffer based upon the size needed for the initially selected 
> sub-stream.
> However, we should compute the size of the decoder output buffer to be

> the maximum size needed across all sub-streams.
> 
> I think all we need to do is make a change in
> CWMAudioFormat::UpdateAudioFormat() here:
> 
>         // Allocate Decoder Buffer
>         if (SUCCEEDED(retVal))
>         {
>             // Did the size change?
>             if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
>             {
> 
> This is where we detect that a sub-stream switch has occurred and we 
> adjust the size of the decoder output buffer. It seems to me we should

> only let ulDecoderBufferSize go up, but not be reduced. Let's say we 
> have a stream switch to a lower bitrate sub-stream. Therefore, the 
> required decoder output buffer size for this new sub-stream might 
> change to a lower number. So currently we would re-compute the size of

> this buffer and re-allocate it. However, if we get a packet from the 
> old sub-stream in after this point, we will not have enough room to 
> decode it.
> 
> So I would just do the following:
> 
> -            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
> +            if (m_ulDecoderBufferSize >  m_ulMaxDecoderOutputBytes)
> 
> Does this fix your problem?
> 
> Eric
> 
> =============================================
> Eric Hyche (ehyche@real.com)
> Technical Lead
> RealNetworks, Inc.  
> 
> > -----Original Message-----
> > From: nokia-private-dev-bounces@helixcommunity.org
> > [mailto:nokia-private-dev-bounces@helixcommunity.org] On Behalf Of 
> > ext-anuj.dhamija@nokia.com
> > Sent: Monday, May 12, 2008 8:03 PM
> > To: datatype-dev@helixcommunity.org
> > Cc: nokia-private-dev@helixcommunity.org
> > Subject: [Nokia-private-dev] CR: Helix Crashes while
> playing WMV file
> > 
> > 
> > 			"Nokia submits this code under the terms of a
> commercial
> > contribution agreement with RealNetworks, and I am authorized to 
> > contribute this code under said agreement."
> > 
> > 			  
> > 			Modified by:  ext-anuj.dhamija@nokia.com
> > 			  
> > 			Reviewed by: 
> > 			  
> > 			Date: 05/12/2008
> > 			  
> > 			Project: SymbianMmf_wm
> > 			  
> > 			Synopsis: Multiple Audio Streams in WMV File
> cause Helix
> > Audiocontroller Crash
> > 
> > 			Overview: 
> > 			In WM Audio Format
> > (CWMAduiFormat::UpdateAudioFormat) output buffer for
> decoded data is
> > allocated with size for the stream which is selected as
> initial active
> 
> > stream based on sampling rate and number of channels (in 
> > CWMAudioFormat::ChooseInitialActiveSubStream
> > method). This buffer is then used for decoder output
> disregard of the
> > fact that which stream gets decoded. As long as the decoded
> stream is
> > of less bitrate than the one chosen as active, there is no problem. 
> > But when the stream to be decoded is of higher bit rate
> than the one
> > chosen as active ,then decoded output overflows the output buffer 
> > causing the crash.
> > 
> > 			Fix: 
> > 			Currently choice of Initial Active substream is
> made based on
> > sample rate and number of channels. Whereas the size of
> decoded output
> 
> > depends on samples per frame. So if there are two streams with same 
> > sampling rate and same number of channels, samples per
> frame would be
> > higher for the stream with higher bitrate and so it would need a 
> > bigger buffer if the packets of this stream are to be decoded.
> > 
> > 			Since only one buffer is used for decoder output
and packets from 
> > any of streams may have to
> be decoded
> > (and not necessarily the one chosen as initial active
> > stream) depending on what stream is chosen by controller,
> the size of
> > buffer should be chosen for the stream with max samples per
> frame. So
> > fix is made to chose the initial active stream as one which has max 
> > samples per frame. If samples per frame are same then
> choose the one
> > with higher sampling rate and number of channels.
> > 
> > 			Files modified & changes: 
> > 			src\datatype\wm\audio\renderer\wmaformat.cpp
> > 
> > 			Image Size and Heap Use impact: None
> > 
> > 			Module Release testing (STIF, Audio) : Passed
> > 
> > 			Test case(s) Added  : No
> > 
> > 			Memory leak check performed : Passed, No leaks
> found
> > 			  
> > 			Platforms and Profiles Build Verified: 
> > helix-client-s60-50-mmf-mdf-arm
> > 
> > 			Platforms and Profiles Functionality
> > verified: armv5
> > 			  
> > 			Branch: Head, 210CayS
> > 
> > 
> > Index: wmaformat.cpp
> > ===================================================================
> > RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
> > retrieving revision 1.4
> > diff -u -w -r1.4 wmaformat.cpp 
> > --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4 
> > +++ wmaformat.cpp       12 May 2008 19:44:12 -0000 
> > @@ -815,6 +815,7 @@ 
> >          // Initialize our counters 
> >          UINT16 usCurNumChannels   = 0; 
> >          UINT32 ulCurSampleRate    = 0; 
> > +                       UINT32 ulCurSampleOut    = 0; 
> >          UINT32 ulInitialStream    = m_ulNumSubStreams; 
> >          UINT32 i                  = 0; 
> >          // Clear the return value
> > @@ -833,15 +834,26 @@ 
> >                  retVal =
> > m_ppWMAudioDecoder[i]->GetNumChannels(&usNumChannels); 
> >                  if (SUCCEEDED(retVal)) 
> >                  {
> > +                                       UINT32 ulSampleOut = 0; 
> > +                                       retVal =
> > m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&ulSampleOut); 
> >                      // Get the sample rate for this substream 
> >                      UINT32 ulSampleRate = 0; 
> >                      retVal =
> > m_ppWMAudioDecoder[i]->GetSampleRate(&ulSampleRate); 
> >                      if (SUCCEEDED(retVal)) 
> >                      { 
> > -                        // Choose the highest sample rate 
> > and for substreams 
> > -                        // with the same sample rate, choose 
> > the highest 
> > -                        // number of channels 
> > -                        if (ulSampleRate > ulCurSampleRate) 
> > +                                               // Choose the
> > highest samples per frame
> > +                                               //for
> > substreams with the same samples per frame,
> > +                                               //choose the
> > highest sample rate
> > +                                               //for same
> > sample rate choose the max number of channels
> > +                                               if
> > (ulSampleOut > ulCurSampleOut)
> > +                                               {
> > +                                                       
> > ulCurSampleOut   = ulSampleOut; 
> > +                                                       
> > ulCurSampleRate  = ulSampleRate;
> > +                                                       
> > usCurNumChannels = usNumChannels;
> > +                                                       
> > ulInitialStream  = i;
> > +                                               } 
> > +                                               else
> > if(ulSampleOut == ulCurSampleOut &&
> > +                                                             
> >   ulSampleRate > ulCurSampleRate) 
> >                          { 
> >                              ulCurSampleRate  = ulSampleRate; 
> >                              usCurNumChannels = usNumChannels; 
> > ______________________________________________
> > 
> > thnx & regds
> > AD
> > 
> > 
> 


From ext-anuj.dhamija at nokia.com  Wed May 14 11:43:28 2008
From: ext-anuj.dhamija at nokia.com (ext-anuj.dhamija@nokia.com)
Date: Wed May 14 10:34:14 2008
Subject: [datatype-dev] RE: [Nokia-private-dev] CR: Helix Crashes while
	playing WMV file
References: <2198383E1141814486F0B881B3260CF5024DB0C3@daebe103.NOE.Nokia.com>
	<00fa01c8b507$da4bfa30$db68a8c0@EHYCHED620>
	<2198383E1141814486F0B881B3260CF5024DB350@daebe103.NOE.Nokia.com>
	<011b01c8b518$23e08b60$db68a8c0@EHYCHED620> 
Message-ID: <2198383E1141814486F0B881B3260CF50251616F@daebe103.NOE.Nokia.com>

 
Hi Eric,

I made change to call UpdateAudioFormat just before decode call in
DecodeAudioData function instead of calling it after decoding. 
Can you think of any reasons for UpdateAudioFormat being invoked after
decode? I think that as long as the main purpose of UpdateAudioFormat is
to update parameters for active stream in AudioFormat we should be
calling it immediately after we figure out that packet received is for a
different stream than the active one.
Also I have used flag bSubStreamSwitch as condition for call to
UpdateAudioFormat instead of m_bCanChangeAudioStream as is used
currently when calling UpdateAudioFormat after decode call.

Following are the changes (in method CWMAudioFormat::DecodeAudioData).
Please let me know your comments.

@@ -498,6 +498,15 @@
                     {
                         bLastPacketInQueue = FALSE;
                     }
+
+
+                    // If the audio stream can change, then we need to
+                    // check to see if it did
+                    if (bSubStreamSwitch)
+                    {
+                        retVal =
UpdateAudioFormat(ulNextDecodeStartTimeInSamples);
+                    }
+
                     // Decode the encoded audio frame
                     // The bFlushCodec argument is TRUE when the
renderer has
                     // received an OnEndofPackets(). However, we only
want to
@@ -529,15 +538,7 @@
                 // Place decoded data into the audio buffer
                 if (ulSamplesProduced > 0)
                 {
-                    // If the audio stream can change, then we need to
-                    // check to see if it did
-                    if (m_bCanChangeAudioStream)
-                    {
-                        retVal =
UpdateAudioFormat(ulNextDecodeStartTimeInSamples);
-                    }
                     // Copy the decoder buffer into the audio data
-                    if (SUCCEEDED(retVal))
-                    {
                         // Convert samples to bytes
                         ulBytesProduced =
CAudioFormat::ConvertSamplesToBytes(ulSamplesProduced);
                         // Create and set the buffer
@@ -551,7 +552,6 @@
                                                  m_ulCodecDelayInMs;
                         }
                     }
-                }

Thnx & regds
AD

-----Original Message-----
From: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas) 
Sent: Tuesday, May 13, 2008 1:43 PM
To: 'ehyche@real.com'; datatype-dev@helixcommunity.org
Cc: nokia-private-dev@helixcommunity.org
Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV
file

I was wondering what about invoking method UpdateAudioFormat immediately
after calling GetNextAssembledFrame in CWMAudioFormat::DecodeAudioData
if the received frame is from a different stream than active one?

thnx & regds
AD

-----Original Message-----
From: ext Eric Hyche [mailto:ehyche@real.com]
Sent: Tuesday, May 13, 2008 11:41 AM
To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
datatype-dev@helixcommunity.org
Cc: nokia-private-dev@helixcommunity.org
Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV
file


> The problem with current logic of selecting active substream is that 
> bitrate parameter is completely ignored and only sample rate and 
> number of channels is used.
> Also choosing initial Active Substream on AudioFormat does not have 
> any influence on the actual substream id that is displayed as that 
> selection is made by controller somewhere else.
> 

The reason we do this is that with some audio device implementations,
the audio device is opened with the paramters of the first audio stream
created. So if have three sub-streams:

SubStream 0: 1 channel, sample rate 11025 SubStream 1: 2 channel, sample
rate 22050 SubStream 2: 2 channel, sample rate 44100

and you choose substream 0 as the initial substream, then with the audio
device may be opened at a sample rate of 11025. Then when you have a
stream switch to substream 2, then audio services will downsample to
44100 to 11025 and 2 channels to 1 channel.

So it's always a good idea for audio renderers to create the first
IHXAudioStream with the parameters of the highest sample rate and number
of channels.

In CWMAudioFormat::Init(), after the call to ParseOpaqueData(), we know
all the information about every sub-stream. Therefore, at that point, we
could calculate the required decoder output buffer size for each
substream. Then we would just take the maximum size across all
substreams and use that for the decoder buffer size. Then, it would not
be necessary to re-allocate this buffer in UpdateAudioFormat().

Eric


=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: ext-anuj.dhamija@nokia.com [mailto:ext-anuj.dhamija@nokia.com]
> Sent: Tuesday, May 13, 2008 12:11 PM
> To: ehyche@real.com; datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV 
> file
> 
> Hi Eric,
> 
> There is no substream switch happening here and so fix you suggested 
> may not work.
> 
> This is the flow of how initially buffer is allocated:
> A) CWMAudioFormat::Init is invoked
> B) CWMAudioFormat::ParseOpaqueData ==> Initialise array of audio 
> decoders with substream headers
> C) ChooseInitialActiveSubStream ==> Choose the Active substream
> D) UpdateAudioFormat ==> Allocate Decoder Output Buffer for Active 
> Substream
> 
> Now later when first packet from any of the substream is received 
> CWMAudioFormat::DecodeAudioData gets invoked and so far no change in 
> buffer size is made. GetNextAssembledFrame() is then invoked which 
> finds the stream-id for received packet and change the active 
> stream-id to the same. But still Output buffer is of same size as the 
> initial Active substream.
> pDecoder->Decode is then called and there it crashes if the initial
> active substream was of lower bit rate than the stream from which 
> packet is received.
> 
> CWMAudioFormat::UpdateAudioFormat() is called again only after the 
> decode call which is too late for the given scenario.
> 
> So what I have tried to do is to change the initial active substream 
> to be one which needs maximum output buffer size. The problem with 
> current logic of selecting active substream is that bitrate parameter 
> is completely ignored and only sample rate and number of channels is 
> used.
> Also choosing initial Active Substream on AudioFormat does not have 
> any influence on the actual substream id that is displayed as that 
> selection is made by controller somewhere else.
> 
> Thnx & regds
> AD
> -----Original Message-----
> From: ext Eric Hyche [mailto:ehyche@real.com]
> Sent: Tuesday, May 13, 2008 9:44 AM
> To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
> datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV 
> file
> 
> 
> I don't think we should change which stream is initially selected, but

> rather change how the size of the decoder output buffer is computed.
> 
> It sounds like we currently compute the size of the output decoder 
> buffer based upon the size needed for the initially selected 
> sub-stream.
> However, we should compute the size of the decoder output buffer to be

> the maximum size needed across all sub-streams.
> 
> I think all we need to do is make a change in
> CWMAudioFormat::UpdateAudioFormat() here:
> 
>         // Allocate Decoder Buffer
>         if (SUCCEEDED(retVal))
>         {
>             // Did the size change?
>             if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
>             {
> 
> This is where we detect that a sub-stream switch has occurred and we 
> adjust the size of the decoder output buffer. It seems to me we should

> only let ulDecoderBufferSize go up, but not be reduced. Let's say we 
> have a stream switch to a lower bitrate sub-stream. Therefore, the 
> required decoder output buffer size for this new sub-stream might 
> change to a lower number. So currently we would re-compute the size of

> this buffer and re-allocate it. However, if we get a packet from the 
> old sub-stream in after this point, we will not have enough room to 
> decode it.
> 
> So I would just do the following:
> 
> -            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
> +            if (m_ulDecoderBufferSize >  m_ulMaxDecoderOutputBytes)
> 
> Does this fix your problem?
> 
> Eric
> 
> =============================================
> Eric Hyche (ehyche@real.com)
> Technical Lead
> RealNetworks, Inc.  
> 
> > -----Original Message-----
> > From: nokia-private-dev-bounces@helixcommunity.org
> > [mailto:nokia-private-dev-bounces@helixcommunity.org] On Behalf Of 
> > ext-anuj.dhamija@nokia.com
> > Sent: Monday, May 12, 2008 8:03 PM
> > To: datatype-dev@helixcommunity.org
> > Cc: nokia-private-dev@helixcommunity.org
> > Subject: [Nokia-private-dev] CR: Helix Crashes while
> playing WMV file
> > 
> > 
> > 			"Nokia submits this code under the terms of a
> commercial
> > contribution agreement with RealNetworks, and I am authorized to 
> > contribute this code under said agreement."
> > 
> > 			  
> > 			Modified by:  ext-anuj.dhamija@nokia.com
> > 			  
> > 			Reviewed by: 
> > 			  
> > 			Date: 05/12/2008
> > 			  
> > 			Project: SymbianMmf_wm
> > 			  
> > 			Synopsis: Multiple Audio Streams in WMV File
> cause Helix
> > Audiocontroller Crash
> > 
> > 			Overview: 
> > 			In WM Audio Format
> > (CWMAduiFormat::UpdateAudioFormat) output buffer for
> decoded data is
> > allocated with size for the stream which is selected as
> initial active
> 
> > stream based on sampling rate and number of channels (in 
> > CWMAudioFormat::ChooseInitialActiveSubStream
> > method). This buffer is then used for decoder output
> disregard of the
> > fact that which stream gets decoded. As long as the decoded
> stream is
> > of less bitrate than the one chosen as active, there is no problem. 
> > But when the stream to be decoded is of higher bit rate
> than the one
> > chosen as active ,then decoded output overflows the output buffer 
> > causing the crash.
> > 
> > 			Fix: 
> > 			Currently choice of Initial Active substream is
> made based on
> > sample rate and number of channels. Whereas the size of
> decoded output
> 
> > depends on samples per frame. So if there are two streams with same 
> > sampling rate and same number of channels, samples per
> frame would be
> > higher for the stream with higher bitrate and so it would need a 
> > bigger buffer if the packets of this stream are to be decoded.
> > 
> > 			Since only one buffer is used for decoder output
and packets from 
> > any of streams may have to
> be decoded
> > (and not necessarily the one chosen as initial active
> > stream) depending on what stream is chosen by controller,
> the size of
> > buffer should be chosen for the stream with max samples per
> frame. So
> > fix is made to chose the initial active stream as one which has max 
> > samples per frame. If samples per frame are same then
> choose the one
> > with higher sampling rate and number of channels.
> > 
> > 			Files modified & changes: 
> > 			src\datatype\wm\audio\renderer\wmaformat.cpp
> > 
> > 			Image Size and Heap Use impact: None
> > 
> > 			Module Release testing (STIF, Audio) : Passed
> > 
> > 			Test case(s) Added  : No
> > 
> > 			Memory leak check performed : Passed, No leaks
> found
> > 			  
> > 			Platforms and Profiles Build Verified: 
> > helix-client-s60-50-mmf-mdf-arm
> > 
> > 			Platforms and Profiles Functionality
> > verified: armv5
> > 			  
> > 			Branch: Head, 210CayS
> > 
> > 
> > Index: wmaformat.cpp
> > ===================================================================
> > RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
> > retrieving revision 1.4
> > diff -u -w -r1.4 wmaformat.cpp 
> > --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4 
> > +++ wmaformat.cpp       12 May 2008 19:44:12 -0000 
> > @@ -815,6 +815,7 @@ 
> >          // Initialize our counters 
> >          UINT16 usCurNumChannels   = 0; 
> >          UINT32 ulCurSampleRate    = 0; 
> > +                       UINT32 ulCurSampleOut    = 0; 
> >          UINT32 ulInitialStream    = m_ulNumSubStreams; 
> >          UINT32 i                  = 0; 
> >          // Clear the return value
> > @@ -833,15 +834,26 @@ 
> >                  retVal =
> > m_ppWMAudioDecoder[i]->GetNumChannels(&usNumChannels); 
> >                  if (SUCCEEDED(retVal)) 
> >                  {
> > +                                       UINT32 ulSampleOut = 0; 
> > +                                       retVal =
> > m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&ulSampleOut); 
> >                      // Get the sample rate for this substream 
> >                      UINT32 ulSampleRate = 0; 
> >                      retVal =
> > m_ppWMAudioDecoder[i]->GetSampleRate(&ulSampleRate); 
> >                      if (SUCCEEDED(retVal)) 
> >                      { 
> > -                        // Choose the highest sample rate 
> > and for substreams 
> > -                        // with the same sample rate, choose 
> > the highest 
> > -                        // number of channels 
> > -                        if (ulSampleRate > ulCurSampleRate) 
> > +                                               // Choose the
> > highest samples per frame
> > +                                               //for
> > substreams with the same samples per frame,
> > +                                               //choose the
> > highest sample rate
> > +                                               //for same
> > sample rate choose the max number of channels
> > +                                               if
> > (ulSampleOut > ulCurSampleOut)
> > +                                               {
> > +                                                       
> > ulCurSampleOut   = ulSampleOut; 
> > +                                                       
> > ulCurSampleRate  = ulSampleRate;
> > +                                                       
> > usCurNumChannels = usNumChannels;
> > +                                                       
> > ulInitialStream  = i;
> > +                                               } 
> > +                                               else
> > if(ulSampleOut == ulCurSampleOut &&
> > +                                                             
> >   ulSampleRate > ulCurSampleRate) 
> >                          { 
> >                              ulCurSampleRate  = ulSampleRate; 
> >                              usCurNumChannels = usNumChannels; 
> > ______________________________________________
> > 
> > thnx & regds
> > AD
> > 
> > 
> 


From weian.chen at intel.com  Thu May 15 00:32:57 2008
From: weian.chen at intel.com (Chen, Weian)
Date: Wed May 14 23:22:50 2008
Subject: [datatype-dev] CR: Fix the thumbnail issue that when the video stream
	can not support time-seeking, the dbus-server will hang up
Message-ID: 

Skipped content of type multipart/alternative-------------- next part --------------
A non-text attachment was scrubbed...
Name: dtdriver-thumbnail-ffdriver.diff
Type: application/octet-stream
Size: 852 bytes
Desc: dtdriver-thumbnail-ffdriver.diff
Url : http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080515/d0410fcb/dtdriver-thumbnail-ffdriver-0001.obj
From ext-anuj.dhamija at nokia.com  Thu May 15 12:42:00 2008
From: ext-anuj.dhamija at nokia.com (ext-anuj.dhamija@nokia.com)
Date: Thu May 15 11:31:49 2008
Subject: [datatype-dev] RE: CR: Helix Crashes while playing WMV file
In-Reply-To: 
References: <2198383E1141814486F0B881B3260CF5025167AC@daebe103.NOE.Nokia.com>
	
Message-ID: <2198383E1141814486F0B881B3260CF502516914@daebe103.NOE.Nokia.com>

Hi,

I am awaiting community approval for fixing this error. Any comments
please?

Thnx & regds
AD 
-----Original Message-----
From: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas)
Sent: Wednesday, May 14, 2008 1:43 PM
To: 'ehyche@real.com'; 'datatype-dev@helixcommunity.org'
Cc: 'nokia-private-dev@helixcommunity.org'
Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV
file

 
Hi Eric,

I made change to call UpdateAudioFormat just before decode call in
DecodeAudioData function instead of calling it after decoding. 
Can you think of any reasons for UpdateAudioFormat being invoked after
decode? I think that as long as the main purpose of UpdateAudioFormat is
to update parameters for active stream in AudioFormat we should be
calling it immediately after we figure out that packet received is for a
different stream than the active one.
Also I have used flag bSubStreamSwitch as condition for call to
UpdateAudioFormat instead of m_bCanChangeAudioStream as is used
currently when calling UpdateAudioFormat after decode call.

Following are the changes (in method CWMAudioFormat::DecodeAudioData).
Please let me know your comments.

@@ -498,6 +498,15 @@
                     {
                         bLastPacketInQueue = FALSE;
                     }
+
+
+                    // If the audio stream can change, then we need to
+                    // check to see if it did
+                    if (bSubStreamSwitch)
+                    {
+                        retVal =
UpdateAudioFormat(ulNextDecodeStartTimeInSamples);
+                    }
+
                     // Decode the encoded audio frame
                     // The bFlushCodec argument is TRUE when the
renderer has
                     // received an OnEndofPackets(). However, we only
want to @@ -529,15 +538,7 @@
                 // Place decoded data into the audio buffer
                 if (ulSamplesProduced > 0)
                 {
-                    // If the audio stream can change, then we need to
-                    // check to see if it did
-                    if (m_bCanChangeAudioStream)
-                    {
-                        retVal =
UpdateAudioFormat(ulNextDecodeStartTimeInSamples);
-                    }
                     // Copy the decoder buffer into the audio data
-                    if (SUCCEEDED(retVal))
-                    {
                         // Convert samples to bytes
                         ulBytesProduced =
CAudioFormat::ConvertSamplesToBytes(ulSamplesProduced);
                         // Create and set the buffer @@ -551,7 +552,6
@@
                                                  m_ulCodecDelayInMs;
                         }
                     }
-                }

Thnx & regds
AD

-----Original Message-----
From: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas)
Sent: Tuesday, May 13, 2008 1:43 PM
To: 'ehyche@real.com'; datatype-dev@helixcommunity.org
Cc: nokia-private-dev@helixcommunity.org
Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV
file

I was wondering what about invoking method UpdateAudioFormat immediately
after calling GetNextAssembledFrame in CWMAudioFormat::DecodeAudioData
if the received frame is from a different stream than active one?

thnx & regds
AD

-----Original Message-----
From: ext Eric Hyche [mailto:ehyche@real.com]
Sent: Tuesday, May 13, 2008 11:41 AM
To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
datatype-dev@helixcommunity.org
Cc: nokia-private-dev@helixcommunity.org
Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV
file


> The problem with current logic of selecting active substream is that 
> bitrate parameter is completely ignored and only sample rate and 
> number of channels is used.
> Also choosing initial Active Substream on AudioFormat does not have 
> any influence on the actual substream id that is displayed as that 
> selection is made by controller somewhere else.
> 

The reason we do this is that with some audio device implementations,
the audio device is opened with the paramters of the first audio stream
created. So if have three sub-streams:

SubStream 0: 1 channel, sample rate 11025 SubStream 1: 2 channel, sample
rate 22050 SubStream 2: 2 channel, sample rate 44100

and you choose substream 0 as the initial substream, then with the audio
device may be opened at a sample rate of 11025. Then when you have a
stream switch to substream 2, then audio services will downsample to
44100 to 11025 and 2 channels to 1 channel.

So it's always a good idea for audio renderers to create the first
IHXAudioStream with the parameters of the highest sample rate and number
of channels.

In CWMAudioFormat::Init(), after the call to ParseOpaqueData(), we know
all the information about every sub-stream. Therefore, at that point, we
could calculate the required decoder output buffer size for each
substream. Then we would just take the maximum size across all
substreams and use that for the decoder buffer size. Then, it would not
be necessary to re-allocate this buffer in UpdateAudioFormat().

Eric


=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: ext-anuj.dhamija@nokia.com [mailto:ext-anuj.dhamija@nokia.com]
> Sent: Tuesday, May 13, 2008 12:11 PM
> To: ehyche@real.com; datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV 
> file
> 
> Hi Eric,
> 
> There is no substream switch happening here and so fix you suggested 
> may not work.
> 
> This is the flow of how initially buffer is allocated:
> A) CWMAudioFormat::Init is invoked
> B) CWMAudioFormat::ParseOpaqueData ==> Initialise array of audio 
> decoders with substream headers
> C) ChooseInitialActiveSubStream ==> Choose the Active substream
> D) UpdateAudioFormat ==> Allocate Decoder Output Buffer for Active 
> Substream
> 
> Now later when first packet from any of the substream is received 
> CWMAudioFormat::DecodeAudioData gets invoked and so far no change in 
> buffer size is made. GetNextAssembledFrame() is then invoked which 
> finds the stream-id for received packet and change the active 
> stream-id to the same. But still Output buffer is of same size as the 
> initial Active substream.
> pDecoder->Decode is then called and there it crashes if the initial
> active substream was of lower bit rate than the stream from which 
> packet is received.
> 
> CWMAudioFormat::UpdateAudioFormat() is called again only after the 
> decode call which is too late for the given scenario.
> 
> So what I have tried to do is to change the initial active substream 
> to be one which needs maximum output buffer size. The problem with 
> current logic of selecting active substream is that bitrate parameter 
> is completely ignored and only sample rate and number of channels is 
> used.
> Also choosing initial Active Substream on AudioFormat does not have 
> any influence on the actual substream id that is displayed as that 
> selection is made by controller somewhere else.
> 
> Thnx & regds
> AD
> -----Original Message-----
> From: ext Eric Hyche [mailto:ehyche@real.com]
> Sent: Tuesday, May 13, 2008 9:44 AM
> To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
> datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV 
> file
> 
> 
> I don't think we should change which stream is initially selected, but

> rather change how the size of the decoder output buffer is computed.
> 
> It sounds like we currently compute the size of the output decoder 
> buffer based upon the size needed for the initially selected 
> sub-stream.
> However, we should compute the size of the decoder output buffer to be

> the maximum size needed across all sub-streams.
> 
> I think all we need to do is make a change in
> CWMAudioFormat::UpdateAudioFormat() here:
> 
>         // Allocate Decoder Buffer
>         if (SUCCEEDED(retVal))
>         {
>             // Did the size change?
>             if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
>             {
> 
> This is where we detect that a sub-stream switch has occurred and we 
> adjust the size of the decoder output buffer. It seems to me we should

> only let ulDecoderBufferSize go up, but not be reduced. Let's say we 
> have a stream switch to a lower bitrate sub-stream. Therefore, the 
> required decoder output buffer size for this new sub-stream might 
> change to a lower number. So currently we would re-compute the size of

> this buffer and re-allocate it. However, if we get a packet from the 
> old sub-stream in after this point, we will not have enough room to 
> decode it.
> 
> So I would just do the following:
> 
> -            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
> +            if (m_ulDecoderBufferSize >  m_ulMaxDecoderOutputBytes)
> 
> Does this fix your problem?
> 
> Eric
> 
> =============================================
> Eric Hyche (ehyche@real.com)
> Technical Lead
> RealNetworks, Inc.  
> 
> > -----Original Message-----
> > From: nokia-private-dev-bounces@helixcommunity.org
> > [mailto:nokia-private-dev-bounces@helixcommunity.org] On Behalf Of 
> > ext-anuj.dhamija@nokia.com
> > Sent: Monday, May 12, 2008 8:03 PM
> > To: datatype-dev@helixcommunity.org
> > Cc: nokia-private-dev@helixcommunity.org
> > Subject: [Nokia-private-dev] CR: Helix Crashes while
> playing WMV file
> > 
> > 
> > 			"Nokia submits this code under the terms of a
> commercial
> > contribution agreement with RealNetworks, and I am authorized to 
> > contribute this code under said agreement."
> > 
> > 			  
> > 			Modified by:  ext-anuj.dhamija@nokia.com
> > 			  
> > 			Reviewed by: 
> > 			  
> > 			Date: 05/12/2008
> > 			  
> > 			Project: SymbianMmf_wm
> > 			  
> > 			Synopsis: Multiple Audio Streams in WMV File
> cause Helix
> > Audiocontroller Crash
> > 
> > 			Overview: 
> > 			In WM Audio Format
> > (CWMAduiFormat::UpdateAudioFormat) output buffer for
> decoded data is
> > allocated with size for the stream which is selected as
> initial active
> 
> > stream based on sampling rate and number of channels (in 
> > CWMAudioFormat::ChooseInitialActiveSubStream
> > method). This buffer is then used for decoder output
> disregard of the
> > fact that which stream gets decoded. As long as the decoded
> stream is
> > of less bitrate than the one chosen as active, there is no problem. 
> > But when the stream to be decoded is of higher bit rate
> than the one
> > chosen as active ,then decoded output overflows the output buffer 
> > causing the crash.
> > 
> > 			Fix: 
> > 			Currently choice of Initial Active substream is
> made based on
> > sample rate and number of channels. Whereas the size of
> decoded output
> 
> > depends on samples per frame. So if there are two streams with same 
> > sampling rate and same number of channels, samples per
> frame would be
> > higher for the stream with higher bitrate and so it would need a 
> > bigger buffer if the packets of this stream are to be decoded.
> > 
> > 			Since only one buffer is used for decoder output
and packets from 
> > any of streams may have to
> be decoded
> > (and not necessarily the one chosen as initial active
> > stream) depending on what stream is chosen by controller,
> the size of
> > buffer should be chosen for the stream with max samples per
> frame. So
> > fix is made to chose the initial active stream as one which has max 
> > samples per frame. If samples per frame are same then
> choose the one
> > with higher sampling rate and number of channels.
> > 
> > 			Files modified & changes: 
> > 			src\datatype\wm\audio\renderer\wmaformat.cpp
> > 
> > 			Image Size and Heap Use impact: None
> > 
> > 			Module Release testing (STIF, Audio) : Passed
> > 
> > 			Test case(s) Added  : No
> > 
> > 			Memory leak check performed : Passed, No leaks
> found
> > 			  
> > 			Platforms and Profiles Build Verified: 
> > helix-client-s60-50-mmf-mdf-arm
> > 
> > 			Platforms and Profiles Functionality
> > verified: armv5
> > 			  
> > 			Branch: Head, 210CayS
> > 
> > 
> > Index: wmaformat.cpp
> > ===================================================================
> > RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
> > retrieving revision 1.4
> > diff -u -w -r1.4 wmaformat.cpp 
> > --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4 
> > +++ wmaformat.cpp       12 May 2008 19:44:12 -0000 
> > @@ -815,6 +815,7 @@ 
> >          // Initialize our counters 
> >          UINT16 usCurNumChannels   = 0; 
> >          UINT32 ulCurSampleRate    = 0; 
> > +                       UINT32 ulCurSampleOut    = 0; 
> >          UINT32 ulInitialStream    = m_ulNumSubStreams; 
> >          UINT32 i                  = 0; 
> >          // Clear the return value
> > @@ -833,15 +834,26 @@ 
> >                  retVal =
> > m_ppWMAudioDecoder[i]->GetNumChannels(&usNumChannels); 
> >                  if (SUCCEEDED(retVal)) 
> >                  {
> > +                                       UINT32 ulSampleOut = 0; 
> > +                                       retVal =
> > m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&ulSampleOut); 
> >                      // Get the sample rate for this substream 
> >                      UINT32 ulSampleRate = 0; 
> >                      retVal =
> > m_ppWMAudioDecoder[i]->GetSampleRate(&ulSampleRate); 
> >                      if (SUCCEEDED(retVal)) 
> >                      { 
> > -                        // Choose the highest sample rate 
> > and for substreams 
> > -                        // with the same sample rate, choose 
> > the highest 
> > -                        // number of channels 
> > -                        if (ulSampleRate > ulCurSampleRate) 
> > +                                               // Choose the
> > highest samples per frame
> > +                                               //for
> > substreams with the same samples per frame,
> > +                                               //choose the
> > highest sample rate
> > +                                               //for same
> > sample rate choose the max number of channels
> > +                                               if
> > (ulSampleOut > ulCurSampleOut)
> > +                                               {
> > +                                                       
> > ulCurSampleOut   = ulSampleOut; 
> > +                                                       
> > ulCurSampleRate  = ulSampleRate;
> > +                                                       
> > usCurNumChannels = usNumChannels;
> > +                                                       
> > ulInitialStream  = i;
> > +                                               } 
> > +                                               else
> > if(ulSampleOut == ulCurSampleOut &&
> > +                                                             
> >   ulSampleRate > ulCurSampleRate) 
> >                          { 
> >                              ulCurSampleRate  = ulSampleRate; 
> >                              usCurNumChannels = usNumChannels; 
> > ______________________________________________
> > 
> > thnx & regds
> > AD
> > 
> > 
> 


From ltani at real.com  Thu May 15 13:04:22 2008
From: ltani at real.com (Leina Tani)
Date: Thu May 15 11:53:01 2008
Subject: [datatype-dev] RE: CR: Helix Crashes while playing WMV file
In-Reply-To: <2198383E1141814486F0B881B3260CF502516914@daebe103.NOE.Nokia.com>
References: <2198383E1141814486F0B881B3260CF5025167AC@daebe103.NOE.Nokia.com>
	
	<2198383E1141814486F0B881B3260CF502516914@daebe103.NOE.Nokia.com>
Message-ID: <09f101c8b6c6$de4df550$c140a8c0@corp.real.com>

Hi AD,

Sorry for the delay, Eric is out sick today.  Can you wait until tomorrow
for his response?

Thank you,
-leina

-----Original Message-----
From: ext-anuj.dhamija@nokia.com [mailto:ext-anuj.dhamija@nokia.com] 
Sent: Thursday, May 15, 2008 12:42 PM
To: datatype-dev@helixcommunity.org; nokia-private-dev@helixcommunity.org
Cc: ehyche@real.com; ltani@real.com
Subject: RE: CR: Helix Crashes while playing WMV file

Hi,

I am awaiting community approval for fixing this error. Any comments
please?

Thnx & regds
AD 
-----Original Message-----
From: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas)
Sent: Wednesday, May 14, 2008 1:43 PM
To: 'ehyche@real.com'; 'datatype-dev@helixcommunity.org'
Cc: 'nokia-private-dev@helixcommunity.org'
Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV
file

 
Hi Eric,

I made change to call UpdateAudioFormat just before decode call in
DecodeAudioData function instead of calling it after decoding. 
Can you think of any reasons for UpdateAudioFormat being invoked after
decode? I think that as long as the main purpose of UpdateAudioFormat is
to update parameters for active stream in AudioFormat we should be
calling it immediately after we figure out that packet received is for a
different stream than the active one.
Also I have used flag bSubStreamSwitch as condition for call to
UpdateAudioFormat instead of m_bCanChangeAudioStream as is used
currently when calling UpdateAudioFormat after decode call.

Following are the changes (in method CWMAudioFormat::DecodeAudioData).
Please let me know your comments.

@@ -498,6 +498,15 @@
                     {
                         bLastPacketInQueue = FALSE;
                     }
+
+
+                    // If the audio stream can change, then we need to
+                    // check to see if it did
+                    if (bSubStreamSwitch)
+                    {
+                        retVal =
UpdateAudioFormat(ulNextDecodeStartTimeInSamples);
+                    }
+
                     // Decode the encoded audio frame
                     // The bFlushCodec argument is TRUE when the
renderer has
                     // received an OnEndofPackets(). However, we only
want to @@ -529,15 +538,7 @@
                 // Place decoded data into the audio buffer
                 if (ulSamplesProduced > 0)
                 {
-                    // If the audio stream can change, then we need to
-                    // check to see if it did
-                    if (m_bCanChangeAudioStream)
-                    {
-                        retVal =
UpdateAudioFormat(ulNextDecodeStartTimeInSamples);
-                    }
                     // Copy the decoder buffer into the audio data
-                    if (SUCCEEDED(retVal))
-                    {
                         // Convert samples to bytes
                         ulBytesProduced =
CAudioFormat::ConvertSamplesToBytes(ulSamplesProduced);
                         // Create and set the buffer @@ -551,7 +552,6
@@
                                                  m_ulCodecDelayInMs;
                         }
                     }
-                }

Thnx & regds
AD

-----Original Message-----
From: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas)
Sent: Tuesday, May 13, 2008 1:43 PM
To: 'ehyche@real.com'; datatype-dev@helixcommunity.org
Cc: nokia-private-dev@helixcommunity.org
Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV
file

I was wondering what about invoking method UpdateAudioFormat immediately
after calling GetNextAssembledFrame in CWMAudioFormat::DecodeAudioData
if the received frame is from a different stream than active one?

thnx & regds
AD

-----Original Message-----
From: ext Eric Hyche [mailto:ehyche@real.com]
Sent: Tuesday, May 13, 2008 11:41 AM
To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
datatype-dev@helixcommunity.org
Cc: nokia-private-dev@helixcommunity.org
Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV
file


> The problem with current logic of selecting active substream is that 
> bitrate parameter is completely ignored and only sample rate and 
> number of channels is used.
> Also choosing initial Active Substream on AudioFormat does not have 
> any influence on the actual substream id that is displayed as that 
> selection is made by controller somewhere else.
> 

The reason we do this is that with some audio device implementations,
the audio device is opened with the paramters of the first audio stream
created. So if have three sub-streams:

SubStream 0: 1 channel, sample rate 11025 SubStream 1: 2 channel, sample
rate 22050 SubStream 2: 2 channel, sample rate 44100

and you choose substream 0 as the initial substream, then with the audio
device may be opened at a sample rate of 11025. Then when you have a
stream switch to substream 2, then audio services will downsample to
44100 to 11025 and 2 channels to 1 channel.

So it's always a good idea for audio renderers to create the first
IHXAudioStream with the parameters of the highest sample rate and number
of channels.

In CWMAudioFormat::Init(), after the call to ParseOpaqueData(), we know
all the information about every sub-stream. Therefore, at that point, we
could calculate the required decoder output buffer size for each
substream. Then we would just take the maximum size across all
substreams and use that for the decoder buffer size. Then, it would not
be necessary to re-allocate this buffer in UpdateAudioFormat().

Eric


=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: ext-anuj.dhamija@nokia.com [mailto:ext-anuj.dhamija@nokia.com]
> Sent: Tuesday, May 13, 2008 12:11 PM
> To: ehyche@real.com; datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV 
> file
> 
> Hi Eric,
> 
> There is no substream switch happening here and so fix you suggested 
> may not work.
> 
> This is the flow of how initially buffer is allocated:
> A) CWMAudioFormat::Init is invoked
> B) CWMAudioFormat::ParseOpaqueData ==> Initialise array of audio 
> decoders with substream headers
> C) ChooseInitialActiveSubStream ==> Choose the Active substream
> D) UpdateAudioFormat ==> Allocate Decoder Output Buffer for Active 
> Substream
> 
> Now later when first packet from any of the substream is received 
> CWMAudioFormat::DecodeAudioData gets invoked and so far no change in 
> buffer size is made. GetNextAssembledFrame() is then invoked which 
> finds the stream-id for received packet and change the active 
> stream-id to the same. But still Output buffer is of same size as the 
> initial Active substream.
> pDecoder->Decode is then called and there it crashes if the initial
> active substream was of lower bit rate than the stream from which 
> packet is received.
> 
> CWMAudioFormat::UpdateAudioFormat() is called again only after the 
> decode call which is too late for the given scenario.
> 
> So what I have tried to do is to change the initial active substream 
> to be one which needs maximum output buffer size. The problem with 
> current logic of selecting active substream is that bitrate parameter 
> is completely ignored and only sample rate and number of channels is 
> used.
> Also choosing initial Active Substream on AudioFormat does not have 
> any influence on the actual substream id that is displayed as that 
> selection is made by controller somewhere else.
> 
> Thnx & regds
> AD
> -----Original Message-----
> From: ext Eric Hyche [mailto:ehyche@real.com]
> Sent: Tuesday, May 13, 2008 9:44 AM
> To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
> datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV 
> file
> 
> 
> I don't think we should change which stream is initially selected, but

> rather change how the size of the decoder output buffer is computed.
> 
> It sounds like we currently compute the size of the output decoder 
> buffer based upon the size needed for the initially selected 
> sub-stream.
> However, we should compute the size of the decoder output buffer to be

> the maximum size needed across all sub-streams.
> 
> I think all we need to do is make a change in
> CWMAudioFormat::UpdateAudioFormat() here:
> 
>         // Allocate Decoder Buffer
>         if (SUCCEEDED(retVal))
>         {
>             // Did the size change?
>             if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
>             {
> 
> This is where we detect that a sub-stream switch has occurred and we 
> adjust the size of the decoder output buffer. It seems to me we should

> only let ulDecoderBufferSize go up, but not be reduced. Let's say we 
> have a stream switch to a lower bitrate sub-stream. Therefore, the 
> required decoder output buffer size for this new sub-stream might 
> change to a lower number. So currently we would re-compute the size of

> this buffer and re-allocate it. However, if we get a packet from the 
> old sub-stream in after this point, we will not have enough room to 
> decode it.
> 
> So I would just do the following:
> 
> -            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
> +            if (m_ulDecoderBufferSize >  m_ulMaxDecoderOutputBytes)
> 
> Does this fix your problem?
> 
> Eric
> 
> =============================================
> Eric Hyche (ehyche@real.com)
> Technical Lead
> RealNetworks, Inc.  
> 
> > -----Original Message-----
> > From: nokia-private-dev-bounces@helixcommunity.org
> > [mailto:nokia-private-dev-bounces@helixcommunity.org] On Behalf Of 
> > ext-anuj.dhamija@nokia.com
> > Sent: Monday, May 12, 2008 8:03 PM
> > To: datatype-dev@helixcommunity.org
> > Cc: nokia-private-dev@helixcommunity.org
> > Subject: [Nokia-private-dev] CR: Helix Crashes while
> playing WMV file
> > 
> > 
> > 			"Nokia submits this code under the terms of a
> commercial
> > contribution agreement with RealNetworks, and I am authorized to 
> > contribute this code under said agreement."
> > 
> > 			  
> > 			Modified by:  ext-anuj.dhamija@nokia.com
> > 			  
> > 			Reviewed by: 
> > 			  
> > 			Date: 05/12/2008
> > 			  
> > 			Project: SymbianMmf_wm
> > 			  
> > 			Synopsis: Multiple Audio Streams in WMV File
> cause Helix
> > Audiocontroller Crash
> > 
> > 			Overview: 
> > 			In WM Audio Format
> > (CWMAduiFormat::UpdateAudioFormat) output buffer for
> decoded data is
> > allocated with size for the stream which is selected as
> initial active
> 
> > stream based on sampling rate and number of channels (in 
> > CWMAudioFormat::ChooseInitialActiveSubStream
> > method). This buffer is then used for decoder output
> disregard of the
> > fact that which stream gets decoded. As long as the decoded
> stream is
> > of less bitrate than the one chosen as active, there is no problem. 
> > But when the stream to be decoded is of higher bit rate
> than the one
> > chosen as active ,then decoded output overflows the output buffer 
> > causing the crash.
> > 
> > 			Fix: 
> > 			Currently choice of Initial Active substream is
> made based on
> > sample rate and number of channels. Whereas the size of
> decoded output
> 
> > depends on samples per frame. So if there are two streams with same 
> > sampling rate and same number of channels, samples per
> frame would be
> > higher for the stream with higher bitrate and so it would need a 
> > bigger buffer if the packets of this stream are to be decoded.
> > 
> > 			Since only one buffer is used for decoder output
and packets from 
> > any of streams may have to
> be decoded
> > (and not necessarily the one chosen as initial active
> > stream) depending on what stream is chosen by controller,
> the size of
> > buffer should be chosen for the stream with max samples per
> frame. So
> > fix is made to chose the initial active stream as one which has max 
> > samples per frame. If samples per frame are same then
> choose the one
> > with higher sampling rate and number of channels.
> > 
> > 			Files modified & changes: 
> > 			src\datatype\wm\audio\renderer\wmaformat.cpp
> > 
> > 			Image Size and Heap Use impact: None
> > 
> > 			Module Release testing (STIF, Audio) : Passed
> > 
> > 			Test case(s) Added  : No
> > 
> > 			Memory leak check performed : Passed, No leaks
> found
> > 			  
> > 			Platforms and Profiles Build Verified: 
> > helix-client-s60-50-mmf-mdf-arm
> > 
> > 			Platforms and Profiles Functionality
> > verified: armv5
> > 			  
> > 			Branch: Head, 210CayS
> > 
> > 
> > Index: wmaformat.cpp
> > ===================================================================
> > RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
> > retrieving revision 1.4
> > diff -u -w -r1.4 wmaformat.cpp 
> > --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4 
> > +++ wmaformat.cpp       12 May 2008 19:44:12 -0000 
> > @@ -815,6 +815,7 @@ 
> >          // Initialize our counters 
> >          UINT16 usCurNumChannels   = 0; 
> >          UINT32 ulCurSampleRate    = 0; 
> > +                       UINT32 ulCurSampleOut    = 0; 
> >          UINT32 ulInitialStream    = m_ulNumSubStreams; 
> >          UINT32 i                  = 0; 
> >          // Clear the return value
> > @@ -833,15 +834,26 @@ 
> >                  retVal =
> > m_ppWMAudioDecoder[i]->GetNumChannels(&usNumChannels); 
> >                  if (SUCCEEDED(retVal)) 
> >                  {
> > +                                       UINT32 ulSampleOut = 0; 
> > +                                       retVal =
> > m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&ulSampleOut); 
> >                      // Get the sample rate for this substream 
> >                      UINT32 ulSampleRate = 0; 
> >                      retVal =
> > m_ppWMAudioDecoder[i]->GetSampleRate(&ulSampleRate); 
> >                      if (SUCCEEDED(retVal)) 
> >                      { 
> > -                        // Choose the highest sample rate 
> > and for substreams 
> > -                        // with the same sample rate, choose 
> > the highest 
> > -                        // number of channels 
> > -                        if (ulSampleRate > ulCurSampleRate) 
> > +                                               // Choose the
> > highest samples per frame
> > +                                               //for
> > substreams with the same samples per frame,
> > +                                               //choose the
> > highest sample rate
> > +                                               //for same
> > sample rate choose the max number of channels
> > +                                               if
> > (ulSampleOut > ulCurSampleOut)
> > +                                               {
> > +                                                       
> > ulCurSampleOut   = ulSampleOut; 
> > +                                                       
> > ulCurSampleRate  = ulSampleRate;
> > +                                                       
> > usCurNumChannels = usNumChannels;
> > +                                                       
> > ulInitialStream  = i;
> > +                                               } 
> > +                                               else
> > if(ulSampleOut == ulCurSampleOut &&
> > +                                                             
> >   ulSampleRate > ulCurSampleRate) 
> >                          { 
> >                              ulCurSampleRate  = ulSampleRate; 
> >                              usCurNumChannels = usNumChannels; 
> > ______________________________________________
> > 
> > thnx & regds
> > AD
> > 
> > 
> 


From ljun at real.com  Fri May 16 00:57:20 2008
From: ljun at real.com (ljun)
Date: Thu May 15 23:46:12 2008
Subject: [Datatype-dev] Build errors on HEAD
In-Reply-To: <2a209d2a0805152335y451ce612x430972531daf998a@mail.gmail.com>
References: <2a209d2a0805152335y451ce612x430972531daf998a@mail.gmail.com>
Message-ID: <002401c8b72a$7c81f420$6401a8c0@reald867064935>

Forward to datatype-dev maillist. This is the right list.

'MAKEFOURCC' is defined somewhere, you can make a search in the files. I =
remember it should be located at video folder.
Because I never build mpg plugin, I don't know the specific error. But =
it seems easy, you'd better look into the code and find the
solution by yourself.

If you don't care about the mpg playback, just ignore it. Only one =
plugin build error doesn't matter for splay unless you want to
use mpg plugin.
=20
Best regards
=20
Eric Li (=C0=EE=BE=FC)
=20
www.realnetworks.com

> -----Original Message-----
> From: ribosome-dev-bounces@helixcommunity.org =
[mailto:ribosome-dev-bounces@helixcommunity.org] On Behalf Of jupiter
> Sent: Friday, May 16, 2008 2:35 PM
> To: ribosome-dev@helixcommunity.org
> Subject: [Ribosome-dev] Build errors on HEAD
>=20
> Hi,
>=20
> I tried to build a splay on HEAD for Linux , but got following an
> error. Please advise how to fix the problem, if this is not a proper
> mailing list for the issues, please advise which mailing list should
> go.
>=20
> SYSTEM_ID=3Dlinux-2.2-libc6-gcc32-i586
>=20
> Build complete in 70:37, 1 of 184 modules failed.
>=20
> Build System Menu
> Ribosome v2.4.10
> -> Current Directory: /Helix/src
> [0] Set BIF branch (helix_restricted)
> [1] Set Target(s) (splay)
> [2] Set Profile (/Helix/build/umakepf/helix-client-all-defines)
>=20
> mpgvideo.cpp: In member function 'virtual CVideoFormat*
> CMPGVideoRenderer::CreateFormatObject(IHXValues*)':
> mpgvideo.cpp:217: error: cannot allocate an object of abstract type
> 'CMPEGDecoderYUV'
>=20
> mpgvideo.cpp:264: error: 'MAKEFOURCC' was not declared in this scope
> mpgvideo.cpp: In member function 'virtual HX_RESULT
> CMPGVideoRenderer::OnOptimizedVideo(HX_RESULT, const
> HXBitmapInfoHeader&, HXBitmapInfoHeader&, ULONG32&)':
> mpgvideo.cpp:285: error: 'THREAD_PRIORITY_NORMAL' was not declared in =
this scope
> ../../../common/container/pub/hxslist.h: At global scope:
>=20
> ERROR: UNIXCompile(datatype/mpg/renderer) ERROR: Make failed.
>=20
> Thank you.
>=20
> Kind Regards,
>=20
> Jim
>=20
> _______________________________________________
> Ribosome-dev mailing list
> Ribosome-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/ribosome-dev


From ehyche at real.com  Fri May 16 08:37:32 2008
From: ehyche at real.com (Eric Hyche)
Date: Fri May 16 07:25:59 2008
Subject: [datatype-dev] RE: CR: Helix Crashes while playing WMV file
In-Reply-To: <2198383E1141814486F0B881B3260CF502516914@daebe103.NOE.Nokia.com>
References: <2198383E1141814486F0B881B3260CF5025167AC@daebe103.NOE.Nokia.com>
	
	<2198383E1141814486F0B881B3260CF502516914@daebe103.NOE.Nokia.com>
Message-ID: <009a01c8b76a$c2b494d0$db68a8c0@EHYCHED620>


The reason we call UpdateAudioFormat *after* the call
to Decode() is to handle audio streams where the parameters
(sampling rate, mainly) can change mid-stream. The decoder
would not know this until the Decode() call.

There are two parts to this bug:

1) The WMA renderer is choosing the wrong initial stream
   and is therefore computing a buffer that less than
   the *ideal* size for that sub-stream and that decoder.
   However, it is perfectly valid for the WMA renderer to
   pass into the decoder any output buffer size it chooses,
   as long as it correctly informs the decoder of the size
   of the output buffer. The WMA renderer informs the decoder
   of the size of the output buffer by initially setting the
   value of the nSamplesOut parameter in the IHXAudioDecoder::Decode()
   call.  Here is the Decode call:

  STDMETHOD(Decode) (THIS_ const UCHAR* data, UINT32 nBytes,
                           UINT32 &nBytesConsumed, INT16 *samplesOut,
                            UINT32& nSamplesOut, HXBOOL eof) PURE ;

   Before the call to Decode(), the renderer sets the value
   of nSamplesOut to match the size of the samplesOut output
   buffer. The decoder then has to respect this number and not
   write any more into the samplesOut output buffer than the
   initial value. Then when it's done and before it returns
   from the Decode() call, it sets the nSamplesOut value to
   be the number of samples it actually wrote into the
   samplesOut buffer.

   So the WMA renderer can pass whatever size output buffer it
   wants into the Decode() call. If the decoder writes past the
   end of the that buffer, then that's a bug in the decoder.

2) For *optimal* performance, the WMA renderer should pass an output
   buffer into Decode that has space for as many samples as the Decoder
   returns in IHXAudioDecoder::GetMaxSamplesOut() (after adjusting 
   by number of channels).

So there's two parts of this fix:

a) make sure WMA decoder respects the initial output buffer
   size set by the WMA renderer (so we don't ever write past
   the end of the output buffer).
b) create an output buffer which is big enough to handle all
   sub-streams and so that we don't have to keep recomputing
   the output buffer size every time we switch active sub-stream.

We must have (a) to solve the current crash and any
future crashes related to this issue. The fix for
(a) is in the decoder.

A fix for (b) will mask the problem in (a) (or 1).
A fix for (a) will make the fix for (b) moot, albeit
with somewhat reduced performance (the WMA renderer may
have to make two calls instead of one to decode a frame).

Ideally we should make both fixes, although I'm Ok with
making just one of them for now.

Eric

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: ext-anuj.dhamija@nokia.com [mailto:ext-anuj.dhamija@nokia.com] 
> Sent: Thursday, May 15, 2008 3:42 PM
> To: datatype-dev@helixcommunity.org; 
> nokia-private-dev@helixcommunity.org
> Cc: ehyche@real.com; ltani@real.com
> Subject: RE: CR: Helix Crashes while playing WMV file
> 
> Hi,
> 
> I am awaiting community approval for fixing this error. Any comments
> please?
> 
> Thnx & regds
> AD 
> -----Original Message-----
> From: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas)
> Sent: Wednesday, May 14, 2008 1:43 PM
> To: 'ehyche@real.com'; 'datatype-dev@helixcommunity.org'
> Cc: 'nokia-private-dev@helixcommunity.org'
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV
> file
> 
>  
> Hi Eric,
> 
> I made change to call UpdateAudioFormat just before decode call in
> DecodeAudioData function instead of calling it after decoding. 
> Can you think of any reasons for UpdateAudioFormat being invoked after
> decode? I think that as long as the main purpose of 
> UpdateAudioFormat is
> to update parameters for active stream in AudioFormat we should be
> calling it immediately after we figure out that packet 
> received is for a
> different stream than the active one.
> Also I have used flag bSubStreamSwitch as condition for call to
> UpdateAudioFormat instead of m_bCanChangeAudioStream as is used
> currently when calling UpdateAudioFormat after decode call.
> 
> Following are the changes (in method CWMAudioFormat::DecodeAudioData).
> Please let me know your comments.
> 
> @@ -498,6 +498,15 @@
>                      {
>                          bLastPacketInQueue = FALSE;
>                      }
> +
> +
> +                    // If the audio stream can change, then 
> we need to
> +                    // check to see if it did
> +                    if (bSubStreamSwitch)
> +                    {
> +                        retVal =
> UpdateAudioFormat(ulNextDecodeStartTimeInSamples);
> +                    }
> +
>                      // Decode the encoded audio frame
>                      // The bFlushCodec argument is TRUE when the
> renderer has
>                      // received an OnEndofPackets(). However, we only
> want to @@ -529,15 +538,7 @@
>                  // Place decoded data into the audio buffer
>                  if (ulSamplesProduced > 0)
>                  {
> -                    // If the audio stream can change, then 
> we need to
> -                    // check to see if it did
> -                    if (m_bCanChangeAudioStream)
> -                    {
> -                        retVal =
> UpdateAudioFormat(ulNextDecodeStartTimeInSamples);
> -                    }
>                      // Copy the decoder buffer into the audio data
> -                    if (SUCCEEDED(retVal))
> -                    {
>                          // Convert samples to bytes
>                          ulBytesProduced =
> CAudioFormat::ConvertSamplesToBytes(ulSamplesProduced);
>                          // Create and set the buffer @@ -551,7 +552,6
> @@
>                                                   m_ulCodecDelayInMs;
>                          }
>                      }
> -                }
> 
> Thnx & regds
> AD
> 
> -----Original Message-----
> From: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas)
> Sent: Tuesday, May 13, 2008 1:43 PM
> To: 'ehyche@real.com'; datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV
> file
> 
> I was wondering what about invoking method UpdateAudioFormat 
> immediately
> after calling GetNextAssembledFrame in CWMAudioFormat::DecodeAudioData
> if the received frame is from a different stream than active one?
> 
> thnx & regds
> AD
> 
> -----Original Message-----
> From: ext Eric Hyche [mailto:ehyche@real.com]
> Sent: Tuesday, May 13, 2008 11:41 AM
> To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
> datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV
> file
> 
> 
> > The problem with current logic of selecting active 
> substream is that 
> > bitrate parameter is completely ignored and only sample rate and 
> > number of channels is used.
> > Also choosing initial Active Substream on AudioFormat does not have 
> > any influence on the actual substream id that is displayed as that 
> > selection is made by controller somewhere else.
> > 
> 
> The reason we do this is that with some audio device implementations,
> the audio device is opened with the paramters of the first 
> audio stream
> created. So if have three sub-streams:
> 
> SubStream 0: 1 channel, sample rate 11025 SubStream 1: 2 
> channel, sample
> rate 22050 SubStream 2: 2 channel, sample rate 44100
> 
> and you choose substream 0 as the initial substream, then 
> with the audio
> device may be opened at a sample rate of 11025. Then when you have a
> stream switch to substream 2, then audio services will downsample to
> 44100 to 11025 and 2 channels to 1 channel.
> 
> So it's always a good idea for audio renderers to create the first
> IHXAudioStream with the parameters of the highest sample rate 
> and number
> of channels.
> 
> In CWMAudioFormat::Init(), after the call to 
> ParseOpaqueData(), we know
> all the information about every sub-stream. Therefore, at 
> that point, we
> could calculate the required decoder output buffer size for each
> substream. Then we would just take the maximum size across all
> substreams and use that for the decoder buffer size. Then, it 
> would not
> be necessary to re-allocate this buffer in UpdateAudioFormat().
> 
> Eric
> 
> 
> =============================================
> Eric Hyche (ehyche@real.com)
> Technical Lead
> RealNetworks, Inc.  
> 
> > -----Original Message-----
> > From: ext-anuj.dhamija@nokia.com [mailto:ext-anuj.dhamija@nokia.com]
> > Sent: Tuesday, May 13, 2008 12:11 PM
> > To: ehyche@real.com; datatype-dev@helixcommunity.org
> > Cc: nokia-private-dev@helixcommunity.org
> > Subject: RE: [Nokia-private-dev] CR: Helix Crashes while 
> playing WMV 
> > file
> > 
> > Hi Eric,
> > 
> > There is no substream switch happening here and so fix you 
> suggested 
> > may not work.
> > 
> > This is the flow of how initially buffer is allocated:
> > A) CWMAudioFormat::Init is invoked
> > B) CWMAudioFormat::ParseOpaqueData ==> Initialise array of audio 
> > decoders with substream headers
> > C) ChooseInitialActiveSubStream ==> Choose the Active substream
> > D) UpdateAudioFormat ==> Allocate Decoder Output Buffer for Active 
> > Substream
> > 
> > Now later when first packet from any of the substream is received 
> > CWMAudioFormat::DecodeAudioData gets invoked and so far no 
> change in 
> > buffer size is made. GetNextAssembledFrame() is then invoked which 
> > finds the stream-id for received packet and change the active 
> > stream-id to the same. But still Output buffer is of same 
> size as the 
> > initial Active substream.
> > pDecoder->Decode is then called and there it crashes if the initial
> > active substream was of lower bit rate than the stream from which 
> > packet is received.
> > 
> > CWMAudioFormat::UpdateAudioFormat() is called again only after the 
> > decode call which is too late for the given scenario.
> > 
> > So what I have tried to do is to change the initial active 
> substream 
> > to be one which needs maximum output buffer size. The problem with 
> > current logic of selecting active substream is that bitrate 
> parameter 
> > is completely ignored and only sample rate and number of 
> channels is 
> > used.
> > Also choosing initial Active Substream on AudioFormat does not have 
> > any influence on the actual substream id that is displayed as that 
> > selection is made by controller somewhere else.
> > 
> > Thnx & regds
> > AD
> > -----Original Message-----
> > From: ext Eric Hyche [mailto:ehyche@real.com]
> > Sent: Tuesday, May 13, 2008 9:44 AM
> > To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
> > datatype-dev@helixcommunity.org
> > Cc: nokia-private-dev@helixcommunity.org
> > Subject: RE: [Nokia-private-dev] CR: Helix Crashes while 
> playing WMV 
> > file
> > 
> > 
> > I don't think we should change which stream is initially 
> selected, but
> 
> > rather change how the size of the decoder output buffer is computed.
> > 
> > It sounds like we currently compute the size of the output decoder 
> > buffer based upon the size needed for the initially selected 
> > sub-stream.
> > However, we should compute the size of the decoder output 
> buffer to be
> 
> > the maximum size needed across all sub-streams.
> > 
> > I think all we need to do is make a change in
> > CWMAudioFormat::UpdateAudioFormat() here:
> > 
> >         // Allocate Decoder Buffer
> >         if (SUCCEEDED(retVal))
> >         {
> >             // Did the size change?
> >             if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
> >             {
> > 
> > This is where we detect that a sub-stream switch has 
> occurred and we 
> > adjust the size of the decoder output buffer. It seems to 
> me we should
> 
> > only let ulDecoderBufferSize go up, but not be reduced. 
> Let's say we 
> > have a stream switch to a lower bitrate sub-stream. Therefore, the 
> > required decoder output buffer size for this new sub-stream might 
> > change to a lower number. So currently we would re-compute 
> the size of
> 
> > this buffer and re-allocate it. However, if we get a packet 
> from the 
> > old sub-stream in after this point, we will not have enough room to 
> > decode it.
> > 
> > So I would just do the following:
> > 
> > -            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
> > +            if (m_ulDecoderBufferSize >  m_ulMaxDecoderOutputBytes)
> > 
> > Does this fix your problem?
> > 
> > Eric
> > 
> > =============================================
> > Eric Hyche (ehyche@real.com)
> > Technical Lead
> > RealNetworks, Inc.  
> > 
> > > -----Original Message-----
> > > From: nokia-private-dev-bounces@helixcommunity.org
> > > [mailto:nokia-private-dev-bounces@helixcommunity.org] On 
> Behalf Of 
> > > ext-anuj.dhamija@nokia.com
> > > Sent: Monday, May 12, 2008 8:03 PM
> > > To: datatype-dev@helixcommunity.org
> > > Cc: nokia-private-dev@helixcommunity.org
> > > Subject: [Nokia-private-dev] CR: Helix Crashes while
> > playing WMV file
> > > 
> > > 
> > > 			"Nokia submits this code under the terms of a
> > commercial
> > > contribution agreement with RealNetworks, and I am authorized to 
> > > contribute this code under said agreement."
> > > 
> > > 			  
> > > 			Modified by:  ext-anuj.dhamija@nokia.com
> > > 			  
> > > 			Reviewed by: 
> > > 			  
> > > 			Date: 05/12/2008
> > > 			  
> > > 			Project: SymbianMmf_wm
> > > 			  
> > > 			Synopsis: Multiple Audio Streams in WMV File
> > cause Helix
> > > Audiocontroller Crash
> > > 
> > > 			Overview: 
> > > 			In WM Audio Format
> > > (CWMAduiFormat::UpdateAudioFormat) output buffer for
> > decoded data is
> > > allocated with size for the stream which is selected as
> > initial active
> > 
> > > stream based on sampling rate and number of channels (in 
> > > CWMAudioFormat::ChooseInitialActiveSubStream
> > > method). This buffer is then used for decoder output
> > disregard of the
> > > fact that which stream gets decoded. As long as the decoded
> > stream is
> > > of less bitrate than the one chosen as active, there is 
> no problem. 
> > > But when the stream to be decoded is of higher bit rate
> > than the one
> > > chosen as active ,then decoded output overflows the output buffer 
> > > causing the crash.
> > > 
> > > 			Fix: 
> > > 			Currently choice of Initial Active substream is
> > made based on
> > > sample rate and number of channels. Whereas the size of
> > decoded output
> > 
> > > depends on samples per frame. So if there are two streams 
> with same 
> > > sampling rate and same number of channels, samples per
> > frame would be
> > > higher for the stream with higher bitrate and so it would need a 
> > > bigger buffer if the packets of this stream are to be decoded.
> > > 
> > > 			Since only one buffer is used for decoder output
> and packets from 
> > > any of streams may have to
> > be decoded
> > > (and not necessarily the one chosen as initial active
> > > stream) depending on what stream is chosen by controller,
> > the size of
> > > buffer should be chosen for the stream with max samples per
> > frame. So
> > > fix is made to chose the initial active stream as one 
> which has max 
> > > samples per frame. If samples per frame are same then
> > choose the one
> > > with higher sampling rate and number of channels.
> > > 
> > > 			Files modified & changes: 
> > > 			src\datatype\wm\audio\renderer\wmaformat.cpp
> > > 
> > > 			Image Size and Heap Use impact: None
> > > 
> > > 			Module Release testing (STIF, Audio) : Passed
> > > 
> > > 			Test case(s) Added  : No
> > > 
> > > 			Memory leak check performed : Passed, No leaks
> > found
> > > 			  
> > > 			Platforms and Profiles Build Verified: 
> > > helix-client-s60-50-mmf-mdf-arm
> > > 
> > > 			Platforms and Profiles Functionality
> > > verified: armv5
> > > 			  
> > > 			Branch: Head, 210CayS
> > > 
> > > 
> > > Index: wmaformat.cpp
> > > 
> ===================================================================
> > > RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
> > > retrieving revision 1.4
> > > diff -u -w -r1.4 wmaformat.cpp 
> > > --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4 
> > > +++ wmaformat.cpp       12 May 2008 19:44:12 -0000 
> > > @@ -815,6 +815,7 @@ 
> > >          // Initialize our counters 
> > >          UINT16 usCurNumChannels   = 0; 
> > >          UINT32 ulCurSampleRate    = 0; 
> > > +                       UINT32 ulCurSampleOut    = 0; 
> > >          UINT32 ulInitialStream    = m_ulNumSubStreams; 
> > >          UINT32 i                  = 0; 
> > >          // Clear the return value
> > > @@ -833,15 +834,26 @@ 
> > >                  retVal =
> > > m_ppWMAudioDecoder[i]->GetNumChannels(&usNumChannels); 
> > >                  if (SUCCEEDED(retVal)) 
> > >                  {
> > > +                                       UINT32 ulSampleOut = 0; 
> > > +                                       retVal =
> > > m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&ulSampleOut); 
> > >                      // Get the sample rate for this substream 
> > >                      UINT32 ulSampleRate = 0; 
> > >                      retVal =
> > > m_ppWMAudioDecoder[i]->GetSampleRate(&ulSampleRate); 
> > >                      if (SUCCEEDED(retVal)) 
> > >                      { 
> > > -                        // Choose the highest sample rate 
> > > and for substreams 
> > > -                        // with the same sample rate, choose 
> > > the highest 
> > > -                        // number of channels 
> > > -                        if (ulSampleRate > ulCurSampleRate) 
> > > +                                               // Choose the
> > > highest samples per frame
> > > +                                               //for
> > > substreams with the same samples per frame,
> > > +                                               //choose the
> > > highest sample rate
> > > +                                               //for same
> > > sample rate choose the max number of channels
> > > +                                               if
> > > (ulSampleOut > ulCurSampleOut)
> > > +                                               {
> > > +                                                       
> > > ulCurSampleOut   = ulSampleOut; 
> > > +                                                       
> > > ulCurSampleRate  = ulSampleRate;
> > > +                                                       
> > > usCurNumChannels = usNumChannels;
> > > +                                                       
> > > ulInitialStream  = i;
> > > +                                               } 
> > > +                                               else
> > > if(ulSampleOut == ulCurSampleOut &&
> > > +                                                             
> > >   ulSampleRate > ulCurSampleRate) 
> > >                          { 
> > >                              ulCurSampleRate  = ulSampleRate; 
> > >                              usCurNumChannels = usNumChannels; 
> > > ______________________________________________
> > > 
> > > thnx & regds
> > > AD
> > > 
> > > 
> > 
> 


From gwright at real.com  Fri May 16 08:38:29 2008
From: gwright at real.com (Greg Wright)
Date: Fri May 16 07:28:54 2008
Subject: [Datatype-dev] Build errors on HEAD
In-Reply-To: <002401c8b72a$7c81f420$6401a8c0@reald867064935>
References: <2a209d2a0805152335y451ce612x430972531daf998a@mail.gmail.com>
	<002401c8b72a$7c81f420$6401a8c0@reald867064935>
Message-ID: <482DAA75.7050502@real.com>

We should fix this.

Linux on HEAD with our standard splay/all-defines
build should work all the time. There should rarely
be a build buster on HEAD and practically never on
our dev-stable branches.

Unless Jim(jupiter) is the one that broke it he shouldn't have
to research and fix it unless he wants to.

Now, it could be that only Jim is seeing this error,
in which case it is just a setup problem.


>> mpgvideo.cpp: In member function 'virtual CVideoFormat*
>> CMPGVideoRenderer::CreateFormatObject(IHXValues*)':
>> mpgvideo.cpp:217: error: cannot allocate an object of abstract type
>> 'CMPEGDecoderYUV'


That is strange since last I looked mpgvideo.cpp was
only in datatype_rn, which he should not have access
too.

Has some mpg code moved recently?

--greg.





ljun wrote:
> Forward to datatype-dev maillist. This is the right list.
> 
> 'MAKEFOURCC' is defined somewhere, you can make a search in the files. =
I remember it should be located at video folder.
> Because I never build mpg plugin, I don't know the specific error. But =
it seems easy, you'd better look into the code and find the
> solution by yourself.
> 
> If you don't care about the mpg playback, just ignore it. Only one plug=
in build error doesn't matter for splay unless you want to
> use mpg plugin.
>  
> Best regards
>  
> Eric Li (=C0=EE=BE=FC)
>  
> www.realnetworks.com
> 
>> -----Original Message-----
>> From: ribosome-dev-bounces@helixcommunity.org [mailto:ribosome-dev-bou=
nces@helixcommunity.org] On Behalf Of jupiter
>> Sent: Friday, May 16, 2008 2:35 PM
>> To: ribosome-dev@helixcommunity.org
>> Subject: [Ribosome-dev] Build errors on HEAD
>>
>> Hi,
>>
>> I tried to build a splay on HEAD for Linux , but got following an
>> error. Please advise how to fix the problem, if this is not a proper
>> mailing list for the issues, please advise which mailing list should
>> go.
>>
>> SYSTEM_ID=3Dlinux-2.2-libc6-gcc32-i586
>>
>> Build complete in 70:37, 1 of 184 modules failed.
>>
>> Build System Menu
>> Ribosome v2.4.10
>> -> Current Directory: /Helix/src
>> [0] Set BIF branch (helix_restricted)
>> [1] Set Target(s) (splay)
>> [2] Set Profile (/Helix/build/umakepf/helix-client-all-defines)
>>
>> mpgvideo.cpp: In member function 'virtual CVideoFormat*
>> CMPGVideoRenderer::CreateFormatObject(IHXValues*)':
>> mpgvideo.cpp:217: error: cannot allocate an object of abstract type
>> 'CMPEGDecoderYUV'
>>
>> mpgvideo.cpp:264: error: 'MAKEFOURCC' was not declared in this scope
>> mpgvideo.cpp: In member function 'virtual HX_RESULT
>> CMPGVideoRenderer::OnOptimizedVideo(HX_RESULT, const
>> HXBitmapInfoHeader&, HXBitmapInfoHeader&, ULONG32&)':
>> mpgvideo.cpp:285: error: 'THREAD_PRIORITY_NORMAL' was not declared in =
this scope
>> ../../../common/container/pub/hxslist.h: At global scope:
>>
>> ERROR: UNIXCompile(datatype/mpg/renderer) ERROR: Make failed.
>>
>> Thank you.
>>
>> Kind Regards,
>>
>> Jim
>>
>> _______________________________________________
>> Ribosome-dev mailing list
>> Ribosome-dev@helixcommunity.org
>> http://lists.helixcommunity.org/mailman/listinfo/ribosome-dev
> 
> 
> _______________________________________________
> Datatype-dev mailing list
> Datatype-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
> 


From dyek at real.com  Fri May 16 13:11:24 2008
From: dyek at real.com (Daniel Yek)
Date: Fri May 16 11:59:48 2008
Subject: [Datatype-dev] Build errors on HEAD / mpeg-2 mpgvideo.cpp file
In-Reply-To: <482DAA75.7050502@real.com>
References: <2a209d2a0805152335y451ce612x430972531daf998a@mail.gmail.com>	<002401c8b72a$7c81f420$6401a8c0@reald867064935>
	<482DAA75.7050502@real.com>
Message-ID: <482DEA6C.8040200@real.com>


Greg Wright wrote:
>>> mpgvideo.cpp: In member function 'virtual CVideoFormat*
>>> CMPGVideoRenderer::CreateFormatObject(IHXValues*)':
>>> mpgvideo.cpp:217: error: cannot allocate an object of abstract type
>>> 'CMPEGDecoderYUV'
>>>       
>
> That is strange since last I looked mpgvideo.cpp was
> only in datatype_rn, which he should not have access
> too.
>
> Has some mpg code moved recently?
>   

Hi Greg,

I just happened to build these targets:
datatype_mpg_common datatype_mpg_fileformat datatype_mpg_renderer

and mpgvideo.cpp is checked out as this path:
datatype/mpg/renderer/mpgvideo.cpp

It is in Helix mpeg-2 source code: mpg_renderer module, that we seldom 
utilize because of the associated royalty cost.

The version in datatype_rn is the old version before it was ported to Helix.

-- 
Daniel Yek.



> --greg.
>
>
>   

From ext-anuj.dhamija at nokia.com  Fri May 16 15:58:17 2008
From: ext-anuj.dhamija at nokia.com (ext-anuj.dhamija@nokia.com)
Date: Fri May 16 14:46:54 2008
Subject: [datatype-dev] CR: Turn Auto-Bandwidth detection OFF by default
Message-ID: <2198383E1141814486F0B881B3260CF5025483C1@daebe103.NOE.Nokia.com>


> 		"Nokia submits this code under the terms of a commercial
> contribution agreement with RealNetworks, and I am authorized to
> contribute this code under said agreement."
> 		 
> 		Modified by:  ext-anuj.dhamija@nokia.com
> 		 
> 		Reviewed by: 
> 		 
> 		Date: 05/16/2008
> 		 
> 		Project: SymbianMmf_rel
> 		 
> 		Synopsis: Turn Auto Bandwidth Detection OFF by default 
> 
> 		Overview: 
> 		Currently Auto-Bandwidth detection is turned ON by
> default for Helix client. Some of the proxies have problems in
> handling Bandwidth Detection messages. Moreover bandwidth detection is
> not very significant/useful in context of Wireless Mobile networks. So
> fixing to turn it OFF by default in Helix client configuration.
> 
> 		Fix:
> 		Set AutoBWDetection parameter to 0 in Factory
> Configuration file.
> 
> 		Files modified & changes:
> 	
> src\clientapps\symbiancommon\config\R1_Mobile_4_0_Factory.cfg
> 
> 		Image Size and Heap Use impact: None
> 
> 		Module Release testing (STIF, Audio) : Passed
> 
> 		Test case(s) Added  : No
> 
> 		Memory leak check performed : Passed, No leaks found
> 		  
> 		Platforms and Profiles Build Verified:
> helix-client-s60-32-mmf-mdf-arm
> 
> 		Platforms and Profiles Functionality verified: armv5
> 		  
> 		Branch: Head, 210CayS & 221CayS
> 
> 
> 		Index: R1_Mobile_4_0_Factory.cfg
> 	
> ===================================================================
> 		RCS file:
> /cvsroot/clientapps/symbiancommon/config/R1_Mobile_4_0_Factory.cfg,v
> 		retrieving revision 1.26.2.27
> 		diff -u -h -r1.26.2.27 R1_Mobile_4_0_Factory.cfg
> 		--- R1_Mobile_4_0_Factory.cfg   6 May 2008 18:47:02
> -0000       1.26.2.27
> 		+++ R1_Mobile_4_0_Factory.cfg   16 May 2008 22:47:10
> -0000
> 		@@ -131,4 +131,5 @@
> 		 #
> 		 DisablePlusURLHandling=1
> 
> 		-
> 		+#Turn AutoBandwidth Detection OFF by default
> 		+AutoBWDetection=0
> 
> 
> 		------------
> 		thnx & regds
> 		AD		
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080516/43c1a4d5/attachment.html
From jupiter.hce at gmail.com  Sat May 17 04:51:23 2008
From: jupiter.hce at gmail.com (yh)
Date: Fri May 16 17:35:54 2008
Subject: [Datatype-dev] Build errors on HEAD
In-Reply-To: <002401c8b72a$7c81f420$6401a8c0@reald867064935>
References: <2a209d2a0805152335y451ce612x430972531daf998a@mail.gmail.com>
	<002401c8b72a$7c81f420$6401a8c0@reald867064935>
Message-ID: <20080517115123.GC3407@gmail.com>

On 2008-05-16 15:57+0800, ljun wrote:
>Forward to datatype-dev maillist. This is the right list.
>
>'MAKEFOURCC' is defined somewhere, you can make a search in the files. I remember it should be located at video folder.
>Because I never build mpg plugin, I don't know the specific error. But it seems easy, you'd better look into the code and find the
>solution by yourself.

I've tried to fix it, should I discuss the following issues to this mailing 
list or which mailing list is a proper one?

There are three files defined the MAKEFOURCC, colormap.h, minifmt.h
and xmdfourcc.h. Which one should be used?

To my guess, I added #define "colormap.h" to the mpgvideo.cpp, the
"MAKEFOURCC" error has gone. But there was another error "mpgvideo.cpp:286: 
error: ?THREAD_PRIORITY_NORMAL? was not declared in this scope".

I searched my local CVS source files, there were no header files 
define the THREAD_PRIORITY_NORMAL. I guess I need to add a target which 
includes the "THREAD_PRIORITY_NORMAL". 

Here is the question:

Is there a way to login to HEAD branch to search all files from the HEAD cvs 
tree? Or, is there a list of all files from HEAD on line I can search from?

Thanks Eric.

Kind Regards.

Jim

>If you don't care about the mpg playback, just ignore it. Only one plugin build error doesn't matter for splay unless you want to
>use mpg plugin.
> 
>Best regards
> 
>Eric Li (??)
> 
>www.realnetworks.com
>
>> -----Original Message-----
>> From: ribosome-dev-bounces@helixcommunity.org [mailto:ribosome-dev-bounces@helixcommunity.org] On Behalf Of jupiter
>> Sent: Friday, May 16, 2008 2:35 PM
>> To: ribosome-dev@helixcommunity.org
>> Subject: [Ribosome-dev] Build errors on HEAD
>> 
>> Hi,
>> 
>> I tried to build a splay on HEAD for Linux , but got following an
>> error. Please advise how to fix the problem, if this is not a proper
>> mailing list for the issues, please advise which mailing list should
>> go.
>> 
>> SYSTEM_ID=linux-2.2-libc6-gcc32-i586
>> 
>> Build complete in 70:37, 1 of 184 modules failed.
>> 
>> Build System Menu
>> Ribosome v2.4.10
>> -> Current Directory: /Helix/src
>> [0] Set BIF branch (helix_restricted)
>> [1] Set Target(s) (splay)
>> [2] Set Profile (/Helix/build/umakepf/helix-client-all-defines)
>> 
>> mpgvideo.cpp: In member function 'virtual CVideoFormat*
>> CMPGVideoRenderer::CreateFormatObject(IHXValues*)':
>> mpgvideo.cpp:217: error: cannot allocate an object of abstract type
>> 'CMPEGDecoderYUV'
>> 
>> mpgvideo.cpp:264: error: 'MAKEFOURCC' was not declared in this scope
>> mpgvideo.cpp: In member function 'virtual HX_RESULT
>> CMPGVideoRenderer::OnOptimizedVideo(HX_RESULT, const
>> HXBitmapInfoHeader&, HXBitmapInfoHeader&, ULONG32&)':
>> mpgvideo.cpp:285: error: 'THREAD_PRIORITY_NORMAL' was not declared in this scope
>> ../../../common/container/pub/hxslist.h: At global scope:
>> 
>> ERROR: UNIXCompile(datatype/mpg/renderer) ERROR: Make failed.
>> 
>> Thank you.
>> 
>> Kind Regards,
>> 
>> Jim
>> 
>> _______________________________________________
>> Ribosome-dev mailing list
>> Ribosome-dev@helixcommunity.org
>> http://lists.helixcommunity.org/mailman/listinfo/ribosome-dev

-- 

If you can't explain it simply, you don't understand it well enough.

--- Albert Einstein


From gwright at real.com  Fri May 16 19:28:56 2008
From: gwright at real.com (Greg Wright)
Date: Fri May 16 18:19:18 2008
Subject: [datatype-dev] Re: [Protocol-dev] CR: Turn Auto-Bandwidth detection
	OFF by default
In-Reply-To: <2198383E1141814486F0B881B3260CF5025483C1@daebe103.NOE.Nokia.com>
References: <2198383E1141814486F0B881B3260CF5025483C1@daebe103.NOE.Nokia.com>
Message-ID: <482E42E8.8030202@real.com>

Looks good.
--greg.


ext-anuj.dhamija@nokia.com wrote:
> 
>                   "Nokia submits this code under the terms of a
>                   commercial contribution agreement with RealNetworks,
>                   and I am authorized to contribute this code under said
>                   agreement."
> 
>                    
>                   Modified by:  ext-anuj.dhamija@nokia.com
>                    
>                   Reviewed by:
>                    
>                   Date: 05/16/2008
>                    
>                   Project: SymbianMmf_rel
>                    
>                   Synopsis: Turn Auto Bandwidth Detection OFF by default
> 
>                   Overview:
>                   Currently Auto-Bandwidth detection is turned ON by
>                   default for Helix client. Some of the proxies have
>                   problems in handling Bandwidth Detection messages.
>                   Moreover bandwidth detection is not very
>                   significant/useful in context of Wireless Mobile
>                   networks. So fixing to turn it OFF by default in Helix
>                   client configuration.
> 
>                   Fix:
>                   Set AutoBWDetection parameter to 0 in Factory
>                   Configuration file.
> 
>                   Files modified & changes:
>                   src\clientapps\symbiancommon\config\R1_Mobile_4_0_Factory.cfg
> 
> 
>                   Image Size and Heap Use impact: None
> 
>                   Module Release testing (STIF, Audio) : Passed
> 
>                   Test case(s) Added  : No
> 
>                   Memory leak check performed : Passed, No leaks found
>                    
>                   Platforms and Profiles Build Verified:
>                   helix-client-s60-32-mmf-mdf-arm
> 
>                   Platforms and Profiles Functionality verified: armv5
>                    
>                   Branch: Head, 210CayS & 221CayS
> 
> 
>                   Index: R1_Mobile_4_0_Factory.cfg
>                   ===================================================================
> 
>                   RCS file:
>                   /cvsroot/clientapps/symbiancommon/config/R1_Mobile_4_0_Factory.cfg,v
> 
>                   retrieving revision 1.26.2.27
>                   diff -u -h -r1.26.2.27 R1_Mobile_4_0_Factory.cfg
>                   --- R1_Mobile_4_0_Factory.cfg   6 May 2008 18:47:02
>                   -0000       1.26.2.27
>                   +++ R1_Mobile_4_0_Factory.cfg   16 May 2008 22:47:10
>                   -0000
>                   @@ -131,4 +131,5 @@
>                    #
>                    DisablePlusURLHandling=1
> 
>                   -
>                   +#Turn AutoBandwidth Detection OFF by default
>                   +AutoBWDetection=0
> 
> 
>                   ------------
>                   thnx & regds
>                   AD             
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Protocol-dev mailing list
> Protocol-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/protocol-dev


From ljun at real.com  Fri May 16 20:31:57 2008
From: ljun at real.com (ljun)
Date: Fri May 16 19:20:27 2008
Subject: [Datatype-dev] Build errors on HEAD / mpeg-2 mpgvideo.cpp file
In-Reply-To: <20080517115123.GC3407@gmail.com>
References: <2a209d2a0805152335y451ce612x430972531daf998a@mail.gmail.com>
	<002401c8b72a$7c81f420$6401a8c0@reald867064935>
	<20080517115123.GC3407@gmail.com>
Message-ID: <008f01c8b7ce$96c63fe0$6401a8c0@reald867064935>

Hi Daniel

      Did you meet such error when build datatype_mpg_common =
datatype_mpg_fileformat datatype_mpg_renderer?

=20
Best regards
=20
Eric Li (=C0=EE=BE=FC)
=20
www.realnetworks.com

> -----Original Message-----
> From: yh [mailto:jupiter.hce@gmail.com]
> Sent: Saturday, May 17, 2008 7:51 PM
> To: ljun
> Cc: datatype-dev@helixcommunity.org
> Subject: Re: [Datatype-dev] Build errors on HEAD
>=20
> On 2008-05-16 15:57+0800, ljun wrote:
> >Forward to datatype-dev maillist. This is the right list.
> >
> >'MAKEFOURCC' is defined somewhere, you can make a search in the =
files. I remember it should be located at video folder.
> >Because I never build mpg plugin, I don't know the specific error. =
But it seems easy, you'd better look into the code and find
the
> >solution by yourself.
>=20
> I've tried to fix it, should I discuss the following issues to this =
mailing
> list or which mailing list is a proper one?
>=20
> There are three files defined the MAKEFOURCC, colormap.h, minifmt.h
> and xmdfourcc.h. Which one should be used?
>=20
> To my guess, I added #define "colormap.h" to the mpgvideo.cpp, the
> "MAKEFOURCC" error has gone. But there was another error =
"mpgvideo.cpp:286:
> error: =A1=AETHREAD_PRIORITY_NORMAL=A1=AF was not declared in this =
scope".
>=20
> I searched my local CVS source files, there were no header files
> define the THREAD_PRIORITY_NORMAL. I guess I need to add a target =
which
> includes the "THREAD_PRIORITY_NORMAL".
>=20
> Here is the question:
>=20
> Is there a way to login to HEAD branch to search all files from the =
HEAD cvs
> tree? Or, is there a list of all files from HEAD on line I can search =
from?
>=20
> Thanks Eric.
>=20
> Kind Regards.
>=20
> Jim
>=20
> >If you don't care about the mpg playback, just ignore it. Only one =
plugin build error doesn't matter for splay unless you want to
> >use mpg plugin.
> >
> >Best regards
> >
> >Eric Li (=C0=EE=BE=FC)
> >
> >www.realnetworks.com
> >
> >> -----Original Message-----
> >> From: ribosome-dev-bounces@helixcommunity.org =
[mailto:ribosome-dev-bounces@helixcommunity.org] On Behalf Of jupiter
> >> Sent: Friday, May 16, 2008 2:35 PM
> >> To: ribosome-dev@helixcommunity.org
> >> Subject: [Ribosome-dev] Build errors on HEAD
> >>
> >> Hi,
> >>
> >> I tried to build a splay on HEAD for Linux , but got following an
> >> error. Please advise how to fix the problem, if this is not a =
proper
> >> mailing list for the issues, please advise which mailing list =
should
> >> go.
> >>
> >> SYSTEM_ID=3Dlinux-2.2-libc6-gcc32-i586
> >>
> >> Build complete in 70:37, 1 of 184 modules failed.
> >>
> >> Build System Menu
> >> Ribosome v2.4.10
> >> -> Current Directory: /Helix/src
> >> [0] Set BIF branch (helix_restricted)
> >> [1] Set Target(s) (splay)
> >> [2] Set Profile (/Helix/build/umakepf/helix-client-all-defines)
> >>
> >> mpgvideo.cpp: In member function 'virtual CVideoFormat*
> >> CMPGVideoRenderer::CreateFormatObject(IHXValues*)':
> >> mpgvideo.cpp:217: error: cannot allocate an object of abstract type
> >> 'CMPEGDecoderYUV'
> >>
> >> mpgvideo.cpp:264: error: 'MAKEFOURCC' was not declared in this =
scope
> >> mpgvideo.cpp: In member function 'virtual HX_RESULT
> >> CMPGVideoRenderer::OnOptimizedVideo(HX_RESULT, const
> >> HXBitmapInfoHeader&, HXBitmapInfoHeader&, ULONG32&)':
> >> mpgvideo.cpp:285: error: 'THREAD_PRIORITY_NORMAL' was not declared =
in this scope
> >> ../../../common/container/pub/hxslist.h: At global scope:
> >>
> >> ERROR: UNIXCompile(datatype/mpg/renderer) ERROR: Make failed.
> >>
> >> Thank you.
> >>
> >> Kind Regards,
> >>
> >> Jim
> >>
> >> _______________________________________________
> >> Ribosome-dev mailing list
> >> Ribosome-dev@helixcommunity.org
> >> http://lists.helixcommunity.org/mailman/listinfo/ribosome-dev
>=20
> --
>=20
> If you can't explain it simply, you don't understand it well enough.
>=20
> --- Albert Einstein


From ldhawan at real.com  Fri May 16 22:13:32 2008
From: ldhawan at real.com (Lovish Dhawan)
Date: Fri May 16 21:01:49 2008
Subject: [Datatype-dev] Build errors on HEAD / mpeg-2 mpgvideo.cpp file
References: <2a209d2a0805152335y451ce612x430972531daf998a@mail.gmail.com><002401c8b72a$7c81f420$6401a8c0@reald867064935><20080517115123.GC3407@gmail.com>
	<008f01c8b7ce$96c63fe0$6401a8c0@reald867064935>
Message-ID: <005501c8b7dc$c2fe1a20$8001a8c0@dhawan>

Hi Eric,

If I remember correct, mpg is currently deployed on windows only.
So you will face build errors on Linux

Thanks,
Lovish
----- Original Message ----- 
From: "ljun" 
To: ; "'Daniel Yek'" ; "'Greg Wrigh=
t'" 

Cc: 
Sent: Saturday, May 17, 2008 9:01 AM
Subject: RE: [Datatype-dev] Build errors on HEAD / mpeg-2 mpgvideo.cpp fi=
le


Hi Daniel

      Did you meet such error when build datatype_mpg_common 
datatype_mpg_fileformat datatype_mpg_renderer?


Best regards

Eric Li (=C0=EE=BE=FC)

www.realnetworks.com

> -----Original Message-----
> From: yh [mailto:jupiter.hce@gmail.com]
> Sent: Saturday, May 17, 2008 7:51 PM
> To: ljun
> Cc: datatype-dev@helixcommunity.org
> Subject: Re: [Datatype-dev] Build errors on HEAD
>
> On 2008-05-16 15:57+0800, ljun wrote:
> >Forward to datatype-dev maillist. This is the right list.
> >
> >'MAKEFOURCC' is defined somewhere, you can make a search in the files.=
 I 
> >remember it should be located at video folder.
> >Because I never build mpg plugin, I don't know the specific error. But=
 it 
> >seems easy, you'd better look into the code and find
the
> >solution by yourself.
>
> I've tried to fix it, should I discuss the following issues to this 
> mailing
> list or which mailing list is a proper one?
>
> There are three files defined the MAKEFOURCC, colormap.h, minifmt.h
> and xmdfourcc.h. Which one should be used?
>
> To my guess, I added #define "colormap.h" to the mpgvideo.cpp, the
> "MAKEFOURCC" error has gone. But there was another error 
> "mpgvideo.cpp:286:
> error: =A1=AETHREAD_PRIORITY_NORMAL=A1=AF was not declared in this scop=
e".
>
> I searched my local CVS source files, there were no header files
> define the THREAD_PRIORITY_NORMAL. I guess I need to add a target which
> includes the "THREAD_PRIORITY_NORMAL".
>
> Here is the question:
>
> Is there a way to login to HEAD branch to search all files from the HEA=
D 
> cvs
> tree? Or, is there a list of all files from HEAD on line I can search 
> from?
>
> Thanks Eric.
>
> Kind Regards.
>
> Jim
>
> >If you don't care about the mpg playback, just ignore it. Only one plu=
gin 
> >build error doesn't matter for splay unless you want to
> >use mpg plugin.
> >
> >Best regards
> >
> >Eric Li (=C0=EE=BE=FC)
> >
> >www.realnetworks.com
> >
> >> -----Original Message-----
> >> From: ribosome-dev-bounces@helixcommunity.org 
> >> [mailto:ribosome-dev-bounces@helixcommunity.org] On Behalf Of jupite=
r
> >> Sent: Friday, May 16, 2008 2:35 PM
> >> To: ribosome-dev@helixcommunity.org
> >> Subject: [Ribosome-dev] Build errors on HEAD
> >>
> >> Hi,
> >>
> >> I tried to build a splay on HEAD for Linux , but got following an
> >> error. Please advise how to fix the problem, if this is not a proper
> >> mailing list for the issues, please advise which mailing list should
> >> go.
> >>
> >> SYSTEM_ID=3Dlinux-2.2-libc6-gcc32-i586
> >>
> >> Build complete in 70:37, 1 of 184 modules failed.
> >>
> >> Build System Menu
> >> Ribosome v2.4.10
> >> -> Current Directory: /Helix/src
> >> [0] Set BIF branch (helix_restricted)
> >> [1] Set Target(s) (splay)
> >> [2] Set Profile (/Helix/build/umakepf/helix-client-all-defines)
> >>
> >> mpgvideo.cpp: In member function 'virtual CVideoFormat*
> >> CMPGVideoRenderer::CreateFormatObject(IHXValues*)':
> >> mpgvideo.cpp:217: error: cannot allocate an object of abstract type
> >> 'CMPEGDecoderYUV'
> >>
> >> mpgvideo.cpp:264: error: 'MAKEFOURCC' was not declared in this scope
> >> mpgvideo.cpp: In member function 'virtual HX_RESULT
> >> CMPGVideoRenderer::OnOptimizedVideo(HX_RESULT, const
> >> HXBitmapInfoHeader&, HXBitmapInfoHeader&, ULONG32&)':
> >> mpgvideo.cpp:285: error: 'THREAD_PRIORITY_NORMAL' was not declared i=
n 
> >> this scope
> >> ../../../common/container/pub/hxslist.h: At global scope:
> >>
> >> ERROR: UNIXCompile(datatype/mpg/renderer) ERROR: Make failed.
> >>
> >> Thank you.
> >>
> >> Kind Regards,
> >>
> >> Jim
> >>
> >> _______________________________________________
> >> Ribosome-dev mailing list
> >> Ribosome-dev@helixcommunity.org
> >> http://lists.helixcommunity.org/mailman/listinfo/ribosome-dev
>
> --
>
> If you can't explain it simply, you don't understand it well enough.
>
> --- Albert Einstein


_______________________________________________
Datatype-dev mailing list
Datatype-dev@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-dev 


From dyek at real.com  Sat May 17 21:40:28 2008
From: dyek at real.com (Daniel Yek)
Date: Sat May 17 20:28:32 2008
Subject: [Datatype-dev] Build errors on HEAD / mpeg-2 mpgvideo.cpp file
In-Reply-To: <005501c8b7dc$c2fe1a20$8001a8c0@dhawan>
References: <2a209d2a0805152335y451ce612x430972531daf998a@mail.gmail.com><002401c8b72a$7c81f420$6401a8c0@reald867064935><20080517115123.GC3407@gmail.com>
	<008f01c8b7ce$96c63fe0$6401a8c0@reald867064935>
	<005501c8b7dc$c2fe1a20$8001a8c0@dhawan>
Message-ID: <482FB33C.3000104@real.com>

Hi Eric Li,

Yes, I did see that error. My intention was only to check out the module 
to take a look, so I simply overlooked the build error.

I think Lovish is correct in that this module will only build 
successfully on Windows. To build it on Linux, besides fixing this build 
error, the hand-optimized i586 assembly files, in the platform-specific 
directory, must be ported to Linux too.

-- 
Daniel Yek.



Lovish Dhawan wrote:
> Hi Eric,
>
> If I remember correct, mpg is currently deployed on windows only.
> So you will face build errors on Linux
>
> Thanks,
> Lovish
> ----- Original Message ----- From: "ljun" 
> To: ; "'Daniel Yek'" ; "'Greg 
> Wright'" 
> Cc: 
> Sent: Saturday, May 17, 2008 9:01 AM
> Subject: RE: [Datatype-dev] Build errors on HEAD / mpeg-2 mpgvideo.cpp 
> file
>
>
> Hi Daniel
>
>      Did you meet such error when build datatype_mpg_common 
> datatype_mpg_fileformat datatype_mpg_renderer?
>
>
> Best regards
>
> Eric Li (??)
>
> www.realnetworks.com
>
>> -----Original Message-----
>> From: yh [mailto:jupiter.hce@gmail.com]
>> Sent: Saturday, May 17, 2008 7:51 PM
>> To: ljun
>> Cc: datatype-dev@helixcommunity.org
>> Subject: Re: [Datatype-dev] Build errors on HEAD
>>
>> On 2008-05-16 15:57+0800, ljun wrote:
>> >Forward to datatype-dev maillist. This is the right list.
>> >
>> >'MAKEFOURCC' is defined somewhere, you can make a search in the 
>> files. I >remember it should be located at video folder.
>> >Because I never build mpg plugin, I don't know the specific error. 
>> But it >seems easy, you'd better look into the code and find
> the
>> >solution by yourself.
>>
>> I've tried to fix it, should I discuss the following issues to this 
>> mailing
>> list or which mailing list is a proper one?
>>
>> There are three files defined the MAKEFOURCC, colormap.h, minifmt.h
>> and xmdfourcc.h. Which one should be used?
>>
>> To my guess, I added #define "colormap.h" to the mpgvideo.cpp, the
>> "MAKEFOURCC" error has gone. But there was another error 
>> "mpgvideo.cpp:286:
>> error: ?THREAD_PRIORITY_NORMAL? was not declared in this scope".
>>
>> I searched my local CVS source files, there were no header files
>> define the THREAD_PRIORITY_NORMAL. I guess I need to add a target which
>> includes the "THREAD_PRIORITY_NORMAL".
>>
>> Here is the question:
>>
>> Is there a way to login to HEAD branch to search all files from the 
>> HEAD cvs
>> tree? Or, is there a list of all files from HEAD on line I can search 
>> from?
>>
>> Thanks Eric.
>>
>> Kind Regards.
>>
>> Jim
>>
>> >If you don't care about the mpg playback, just ignore it. Only one 
>> plugin >build error doesn't matter for splay unless you want to
>> >use mpg plugin.
>> >
>> >Best regards
>> >
>> >Eric Li (??)
>> >
>> >www.realnetworks.com
>> >
>> >> -----Original Message-----
>> >> From: ribosome-dev-bounces@helixcommunity.org >> 
>> [mailto:ribosome-dev-bounces@helixcommunity.org] On Behalf Of jupiter
>> >> Sent: Friday, May 16, 2008 2:35 PM
>> >> To: ribosome-dev@helixcommunity.org
>> >> Subject: [Ribosome-dev] Build errors on HEAD
>> >>
>> >> Hi,
>> >>
>> >> I tried to build a splay on HEAD for Linux , but got following an
>> >> error. Please advise how to fix the problem, if this is not a proper
>> >> mailing list for the issues, please advise which mailing list should
>> >> go.
>> >>
>> >> SYSTEM_ID=linux-2.2-libc6-gcc32-i586
>> >>
>> >> Build complete in 70:37, 1 of 184 modules failed.
>> >>
>> >> Build System Menu
>> >> Ribosome v2.4.10
>> >> -> Current Directory: /Helix/src
>> >> [0] Set BIF branch (helix_restricted)
>> >> [1] Set Target(s) (splay)
>> >> [2] Set Profile (/Helix/build/umakepf/helix-client-all-defines)
>> >>
>> >> mpgvideo.cpp: In member function 'virtual CVideoFormat*
>> >> CMPGVideoRenderer::CreateFormatObject(IHXValues*)':
>> >> mpgvideo.cpp:217: error: cannot allocate an object of abstract type
>> >> 'CMPEGDecoderYUV'
>> >>
>> >> mpgvideo.cpp:264: error: 'MAKEFOURCC' was not declared in this scope
>> >> mpgvideo.cpp: In member function 'virtual HX_RESULT
>> >> CMPGVideoRenderer::OnOptimizedVideo(HX_RESULT, const
>> >> HXBitmapInfoHeader&, HXBitmapInfoHeader&, ULONG32&)':
>> >> mpgvideo.cpp:285: error: 'THREAD_PRIORITY_NORMAL' was not declared 
>> in >> this scope
>> >> ../../../common/container/pub/hxslist.h: At global scope:
>> >>
>> >> ERROR: UNIXCompile(datatype/mpg/renderer) ERROR: Make failed.
>> >>
>> >> Thank you.
>> >>
>> >> Kind Regards,
>> >>
>> >> Jim
>> >>
>> >> _______________________________________________
>> >> Ribosome-dev mailing list
>> >> Ribosome-dev@helixcommunity.org
>> >> http://lists.helixcommunity.org/mailman/listinfo/ribosome-dev
>>
>> -- 
>>
>> If you can't explain it simply, you don't understand it well enough.
>>
>> --- Albert Einstein
>
>
> _______________________________________________
> Datatype-dev mailing list
> Datatype-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/datatype-dev


From weian.chen at intel.com  Mon May 19 01:12:04 2008
From: weian.chen at intel.com (Chen, Weian)
Date: Mon May 19 00:00:16 2008
Subject: [datatype-dev] Re-Send: CR: Fix the thumbnail issue that when the
	video streamcan not support time-seeking, the dbus-server will hang up
In-Reply-To: 
References: 
Message-ID: 

All:

 

Could you please have a review.

 

Thanks a lot.

Weian

________________________________

From: datatype-dev-bounces@helixcommunity.org [mailto:datatype-dev-bounces@helixcommunity.org] On Behalf Of Chen, Weian
Sent: 2008Äê5ÔÂ15ÈÕ 15:33
To: datatype-dev@helixcommunity.org
Subject: [datatype-dev] CR: Fix the thumbnail issue that when the video streamcan not support time-seeking, the dbus-server will hang up

 

Synopsis:

  Fix the thumbnail issue that when the video stream can not support time-seeking, the dbus-server will hang up.

 

Overview:

  When the video stream can not support time-seeking, the dbus-server will hang up, and we fix it with following solution: when we find the stream can not support time-seeking, we set the StartTime to 0 to avoid exception.

 

Files Added:

  No file added

 

Files Modified:

  datatype/tools/dtdriver/engine/ffdriver.cpp

 

Image Size and Heap Use impact (Client-Only):

  Little

 

Platform and Profiles Affected:

  platform: linux-2.2-libc6-gcc32-i586

  profile:    helix-client-all-defines

 

Distribution Libraries Affected:

 

 

Distribution library impact and planned action:

  

 

Platforms and Profiles Build Verfied:

  Set BIF branch  ->  hxclient_3_1_0_atlas_restricted

  Set Target(s)    ->  datatype_tools_dtdrive

  Set Profile      ->  helix-client-all-defines

  System ID      ->  linux-2.2-libc6-gcc32-i586

 

Branch:

  HEAD, hxclient_3_1_0_atlas_restricted

 

Copyright assignment: 

  2.    Intel has signed and delivered a Joint Copyright Assignment to RealNetworks, and received acknowledgment that the agreement was received.

 

Files Attached:

  dtdriver-thumbnail-ffdriver.diff

 

Weian

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080519/0bfda4e6/attachment.html
From ehyche at real.com  Mon May 19 07:56:13 2008
From: ehyche at real.com (Eric Hyche)
Date: Mon May 19 06:43:56 2008
Subject: [datatype-dev] CR: Fix the thumbnail issue that when the video
	streamcan not support time-seeking, the dbus-server will hang up
In-Reply-To: 
References: 
Message-ID: <009601c8b9c0$7c61e930$db68a8c0@EHYCHED620>


Weian,

Several questions:

1) In what circumstances are you seeing a SeekDone() call back
   from the fileformat with a status other than HXR_OK? Specifically
   I'm interested in which content and what seek time was used.

2) I think being able to handle a failure in SeekDone() in a good
   change. However, the place you have made the change assumes that
   the SeekDone() call will happen synchronously (that the SeekDone()
   call will come before the m_pFileFormat->Seek(m_ulStartTime); call
   returns. We cannot assume that this will be the case. Some fileformats
   may make that call asynchronously.

   So I think the proper place to make that call is in SeekDone(). If
   we get a failure in SeekDone() and we had a non-zero m_ulStartTime,
   then change m_ulStartTime to 0 and re-issue the m_pFileFormat->Seek(m_ulStartTime)
   call. If m_ulStartTime is *already* 0, then we should error out.

Eric

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: datatype-dev-bounces@helixcommunity.org 
> [mailto:datatype-dev-bounces@helixcommunity.org] On Behalf Of 
> Chen, Weian
> Sent: Thursday, May 15, 2008 3:33 AM
> To: datatype-dev@helixcommunity.org
> Subject: [datatype-dev] CR: Fix the thumbnail issue that when 
> the video streamcan not support time-seeking, the dbus-server 
> will hang up
> 
> Synopsis:
> 
>   Fix the thumbnail issue that when the video stream can not 
> support time-seeking, the dbus-server will hang up.
> 
>  
> 
> Overview:
> 
>   When the video stream can not support time-seeking, the 
> dbus-server will hang up, and we fix it with following 
> solution: when we find the stream can not support 
> time-seeking, we set the StartTime to 0 to avoid exception.
> 
>  
> 
> Files Added:
> 
>   No file added
> 
>  
> 
> Files Modified:
> 
>   datatype/tools/dtdriver/engine/ffdriver.cpp
> 
>  
> 
> Image Size and Heap Use impact (Client-Only):
> 
>   Little
> 
>  
> 
> Platform and Profiles Affected:
> 
>   platform: linux-2.2-libc6-gcc32-i586
> 
>   profile:    helix-client-all-defines
> 
>  
> 
> Distribution Libraries Affected:
> 
>  
> 
>  
> 
> Distribution library impact and planned action:
> 
>   
> 
>  
> 
> Platforms and Profiles Build Verfied:
> 
>   Set BIF branch  ->  hxclient_3_1_0_atlas_restricted
> 
>   Set Target(s)    ->  datatype_tools_dtdrive
> 
>   Set Profile      ->  helix-client-all-defines
> 
>   System ID      ->  linux-2.2-libc6-gcc32-i586
> 
>  
> 
> Branch:
> 
>   HEAD, hxclient_3_1_0_atlas_restricted
> 
>  
> 
> Copyright assignment: 
> 
>   2.    Intel has signed and delivered a Joint Copyright 
> Assignment to RealNetworks, and received acknowledgment that 
> the agreement was received.
> 
>  
> 
> Files Attached:
> 
>   dtdriver-thumbnail-ffdriver.diff
> 
>  
> 
> Weian
> 
>  
> 
> 


From weian.chen at intel.com  Mon May 19 19:43:37 2008
From: weian.chen at intel.com (Chen, Weian)
Date: Mon May 19 18:32:11 2008
Subject: [datatype-dev] CR: Fix the thumbnail issue that when the video
	streamcan not support time-seeking, the dbus-server will hang up
In-Reply-To: <009601c8b9c0$7c61e930$db68a8c0@EHYCHED620>
References: 
	<009601c8b9c0$7c61e930$db68a8c0@EHYCHED620>
Message-ID: 

Eric:

 

1.       The content is Demo_512k_RV10_480x272_30fps_RA_355k_music.rm, and the seek time is 1000. BTW, when playing back, if we seek it, it also failed.

2.       If we call into SeekDone() with asynchronous mode (seems only content with time-seeking issue will use asynchronous mode), then the system will hang up, we can¡¯t return back.

 

Weian

-----Original Message-----
From: Eric Hyche [mailto:ehyche@real.com] 
Sent: 2008Äê5ÔÂ19ÈÕ 22:56
To: Chen, Weian; datatype-dev@helixcommunity.org
Subject: RE: [datatype-dev] CR: Fix the thumbnail issue that when the video streamcan not support time-seeking, the dbus-server will hang up

 

 

Weian,

 

Several questions:

 

1) In what circumstances are you seeing a SeekDone() call back

   from the fileformat with a status other than HXR_OK? Specifically

   I'm interested in which content and what seek time was used.

 

2) I think being able to handle a failure in SeekDone() in a good

   change. However, the place you have made the change assumes that

   the SeekDone() call will happen synchronously (that the SeekDone()

   call will come before the m_pFileFormat->Seek(m_ulStartTime); call

   returns. We cannot assume that this will be the case. Some fileformats

   may make that call asynchronously.

 

   So I think the proper place to make that call is in SeekDone(). If

   we get a failure in SeekDone() and we had a non-zero m_ulStartTime,

   then change m_ulStartTime to 0 and re-issue the m_pFileFormat->Seek(m_ulStartTime)

   call. If m_ulStartTime is *already* 0, then we should error out.

 

Eric

 

=============================================

Eric Hyche (ehyche@real.com)

Technical Lead

RealNetworks, Inc.  

 

> -----Original Message-----

> From: datatype-dev-bounces@helixcommunity.org 

> [mailto:datatype-dev-bounces@helixcommunity.org] On Behalf Of 

> Chen, Weian

> Sent: Thursday, May 15, 2008 3:33 AM

> To: datatype-dev@helixcommunity.org

> Subject: [datatype-dev] CR: Fix the thumbnail issue that when 

> the video streamcan not support time-seeking, the dbus-server 

> will hang up

> 

> Synopsis:

> 

>   Fix the thumbnail issue that when the video stream can not 

> support time-seeking, the dbus-server will hang up.

> 

>  

> 

> Overview:

> 

>   When the video stream can not support time-seeking, the 

> dbus-server will hang up, and we fix it with following 

> solution: when we find the stream can not support 

> time-seeking, we set the StartTime to 0 to avoid exception.

> 

>  

> 

> Files Added:

> 

>   No file added

> 

>  

> 

> Files Modified:

> 

>   datatype/tools/dtdriver/engine/ffdriver.cpp

> 

>  

> 

> Image Size and Heap Use impact (Client-Only):

> 

>   Little

> 

>  

> 

> Platform and Profiles Affected:

> 

>   platform: linux-2.2-libc6-gcc32-i586

> 

>   profile:    helix-client-all-defines

> 

>  

> 

> Distribution Libraries Affected:

> 

>  

> 

>  

> 

> Distribution library impact and planned action:

> 

>   

> 

>  

> 

> Platforms and Profiles Build Verfied:

> 

>   Set BIF branch  ->  hxclient_3_1_0_atlas_restricted

> 

>   Set Target(s)    ->  datatype_tools_dtdrive

> 

>   Set Profile      ->  helix-client-all-defines

> 

>   System ID      ->  linux-2.2-libc6-gcc32-i586

> 

>  

> 

> Branch:

> 

>   HEAD, hxclient_3_1_0_atlas_restricted

> 

>  

> 

> Copyright assignment: 

> 

>   2.    Intel has signed and delivered a Joint Copyright 

> Assignment to RealNetworks, and received acknowledgment that 

> the agreement was received.

> 

>  

> 

> Files Attached:

> 

>   dtdriver-thumbnail-ffdriver.diff

> 

>  

> 

> Weian

> 

>  

> 

> 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080520/1b6649a5/attachment-0001.html
From ext-anuj.dhamija at nokia.com  Tue May 20 15:30:47 2008
From: ext-anuj.dhamija at nokia.com (ext-anuj.dhamija@nokia.com)
Date: Tue May 20 14:18:58 2008
Subject: [datatype-dev] RE: CR: Helix Crashes while playing WMV file
In-Reply-To: <009a01c8b76a$c2b494d0$db68a8c0@EHYCHED620>
References: <2198383E1141814486F0B881B3260CF5025167AC@daebe103.NOE.Nokia.com>
	
	<2198383E1141814486F0B881B3260CF502516914@daebe103.NOE.Nokia.com>
	<009a01c8b76a$c2b494d0$db68a8c0@EHYCHED620>
Message-ID: <2198383E1141814486F0B881B3260CF50257DB05@daebe103.NOE.Nokia.com>

Hi Eric,

Thanks a lot for your insight into this.

I have now made changes to allocate Decoder buffer outside the
UpdateAudioFormat Function. I added a new function AllocateDecoderBuffer
for this and invoke it after ChooseInitialActiveSubStream. Following is
the diff for file Wmaformat.cpp. Let me know if you are OK with these
changes. If so I will send out a new CR.

Index: wmaformat.cpp
===================================================================
RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
retrieving revision 1.4
diff -u -w -r1.4 wmaformat.cpp
--- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4
+++ wmaformat.cpp       20 May 2008 22:28:12 -0000
@@ -137,6 +137,11 @@
                     // Set the source properties ("SrcCodec" and
"SrcBitRate").
                     // These are needed for transcoding.
                     SetSourceProperties(pHeader);
+
+                                       //Allocate Decoder Buffer
+                                       retVal =
AllocateDecoderBuffer();
+                                       if(SUCCEEDED(retVal))
+                                       {
                     // Update the CHXAudioStream format
                     retVal =
UpdateAudioFormat(m_ulLastDecodedEndTimeInSamples, TRUE); // force an
update
                     if (SUCCEEDED(retVal))
@@ -166,6 +171,7 @@
                 }
             }
         }
+        }
         HX_RELEASE(pOpaqueData);
     }

@@ -206,6 +212,49 @@
     return bRet;
 }

+HX_RESULT CWMAudioFormat::AllocateDecoderBuffer()
+{
+
+       HX_RESULT retVal = HXR_FAIL;
+       UINT32  ulMaxSamplesOut = 0;
+
+       // Loop through the substreams and determine
+       //then max sampleOut
+       for (int i = 0; i < m_ulNumSubStreams; i++)
+       {
+               // Make sure we have a CWMAudioDecoder for this
substream
+               if (m_ppWMAudioDecoder[i])
+               {
+                       UINT32 samplesOut = 0;
+                       retVal =
m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&samplesOut);
+                       if(SUCCEEDED(retVal))
+                       {
+                               if(samplesOut>ulMaxSamplesOut)
+                               {
+                                       ulMaxSamplesOut = samplesOut;
+                               }
+                       }
+                       else return retVal;
+               }
+       }
+
+       m_ulDecoderBufferSize =
CAudioFormat::ConvertSamplesToBytes(ulMaxSamplesOut);
+
+       // Allocate a new decoder buffer
+    HX_VECTOR_DELETE(m_pDecoderBuffer);
+       m_pDecoderBuffer = new BYTE [m_ulDecoderBufferSize];
+
+       if (!m_pDecoderBuffer)
+       {
+               // return Out Of Memory
+               retVal = HXR_OUTOFMEMORY;
+               // reset decoder buffer size to zero
+               m_ulDecoderBufferSize = 0;
+       }
+
+       return retVal;
+}
+
 HX_RESULT CWMAudioFormat::UpdateAudioFormat(UINT32&
rulAnchorTimeInSamples, HXBOOL bForceUpdate)
 {
     HX_RESULT retVal = HXR_FAIL;
@@ -286,26 +335,6 @@
                 m_ulCodecDelayInMs =
CAudioFormat::ConvertSamplesToMs(ulCodecDelaySamples);
             }
         }
-        // Allocate Decoder Buffer
-        if (SUCCEEDED(retVal))
-        {
-            // Did the size change?
-            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
-            {
-                // Set the return value
-                retVal = HXR_OUTOFMEMORY;
-                // Allocate a new decoder buffer
-                HX_VECTOR_DELETE(m_pDecoderBuffer);
-                m_pDecoderBuffer = new BYTE
[m_ulMaxDecoderOutputBytes];
-                if (m_pDecoderBuffer)
-                {
-                    // Clear the return value
-                    retVal = HXR_OK;
-                    // Save the decoder buffer size
-                    m_ulDecoderBufferSize = m_ulMaxDecoderOutputBytes;
-                }
-            }
-        }
     }

     return retVal;

Thnx & Regds
AD

-----Original Message-----
From: ext Eric Hyche [mailto:ehyche@real.com] 
Sent: Friday, May 16, 2008 10:38 AM
To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
datatype-dev@helixcommunity.org; nokia-private-dev@helixcommunity.org
Cc: ltani@real.com
Subject: RE: CR: Helix Crashes while playing WMV file


The reason we call UpdateAudioFormat *after* the call to Decode() is to
handle audio streams where the parameters (sampling rate, mainly) can
change mid-stream. The decoder would not know this until the Decode()
call.

There are two parts to this bug:

1) The WMA renderer is choosing the wrong initial stream
   and is therefore computing a buffer that less than
   the *ideal* size for that sub-stream and that decoder.
   However, it is perfectly valid for the WMA renderer to
   pass into the decoder any output buffer size it chooses,
   as long as it correctly informs the decoder of the size
   of the output buffer. The WMA renderer informs the decoder
   of the size of the output buffer by initially setting the
   value of the nSamplesOut parameter in the IHXAudioDecoder::Decode()
   call.  Here is the Decode call:

  STDMETHOD(Decode) (THIS_ const UCHAR* data, UINT32 nBytes,
                           UINT32 &nBytesConsumed, INT16 *samplesOut,
                            UINT32& nSamplesOut, HXBOOL eof) PURE ;

   Before the call to Decode(), the renderer sets the value
   of nSamplesOut to match the size of the samplesOut output
   buffer. The decoder then has to respect this number and not
   write any more into the samplesOut output buffer than the
   initial value. Then when it's done and before it returns
   from the Decode() call, it sets the nSamplesOut value to
   be the number of samples it actually wrote into the
   samplesOut buffer.

   So the WMA renderer can pass whatever size output buffer it
   wants into the Decode() call. If the decoder writes past the
   end of the that buffer, then that's a bug in the decoder.

2) For *optimal* performance, the WMA renderer should pass an output
   buffer into Decode that has space for as many samples as the Decoder
   returns in IHXAudioDecoder::GetMaxSamplesOut() (after adjusting 
   by number of channels).

So there's two parts of this fix:

a) make sure WMA decoder respects the initial output buffer
   size set by the WMA renderer (so we don't ever write past
   the end of the output buffer).
b) create an output buffer which is big enough to handle all
   sub-streams and so that we don't have to keep recomputing
   the output buffer size every time we switch active sub-stream.

We must have (a) to solve the current crash and any future crashes
related to this issue. The fix for
(a) is in the decoder.

A fix for (b) will mask the problem in (a) (or 1).
A fix for (a) will make the fix for (b) moot, albeit with somewhat
reduced performance (the WMA renderer may have to make two calls instead
of one to decode a frame).

Ideally we should make both fixes, although I'm Ok with making just one
of them for now.

Eric

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: ext-anuj.dhamija@nokia.com [mailto:ext-anuj.dhamija@nokia.com]
> Sent: Thursday, May 15, 2008 3:42 PM
> To: datatype-dev@helixcommunity.org;
> nokia-private-dev@helixcommunity.org
> Cc: ehyche@real.com; ltani@real.com
> Subject: RE: CR: Helix Crashes while playing WMV file
> 
> Hi,
> 
> I am awaiting community approval for fixing this error. Any comments 
> please?
> 
> Thnx & regds
> AD
> -----Original Message-----
> From: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas)
> Sent: Wednesday, May 14, 2008 1:43 PM
> To: 'ehyche@real.com'; 'datatype-dev@helixcommunity.org'
> Cc: 'nokia-private-dev@helixcommunity.org'
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV 
> file
> 
>  
> Hi Eric,
> 
> I made change to call UpdateAudioFormat just before decode call in 
> DecodeAudioData function instead of calling it after decoding.
> Can you think of any reasons for UpdateAudioFormat being invoked after

> decode? I think that as long as the main purpose of UpdateAudioFormat 
> is to update parameters for active stream in AudioFormat we should be 
> calling it immediately after we figure out that packet received is for

> a different stream than the active one.
> Also I have used flag bSubStreamSwitch as condition for call to 
> UpdateAudioFormat instead of m_bCanChangeAudioStream as is used 
> currently when calling UpdateAudioFormat after decode call.
> 
> Following are the changes (in method CWMAudioFormat::DecodeAudioData).
> Please let me know your comments.
> 
> @@ -498,6 +498,15 @@
>                      {
>                          bLastPacketInQueue = FALSE;
>                      }
> +
> +
> +                    // If the audio stream can change, then
> we need to
> +                    // check to see if it did
> +                    if (bSubStreamSwitch)
> +                    {
> +                        retVal =
> UpdateAudioFormat(ulNextDecodeStartTimeInSamples);
> +                    }
> +
>                      // Decode the encoded audio frame
>                      // The bFlushCodec argument is TRUE when the 
> renderer has
>                      // received an OnEndofPackets(). However, we only

> want to @@ -529,15 +538,7 @@
>                  // Place decoded data into the audio buffer
>                  if (ulSamplesProduced > 0)
>                  {
> -                    // If the audio stream can change, then 
> we need to
> -                    // check to see if it did
> -                    if (m_bCanChangeAudioStream)
> -                    {
> -                        retVal =
> UpdateAudioFormat(ulNextDecodeStartTimeInSamples);
> -                    }
>                      // Copy the decoder buffer into the audio data
> -                    if (SUCCEEDED(retVal))
> -                    {
>                          // Convert samples to bytes
>                          ulBytesProduced = 
> CAudioFormat::ConvertSamplesToBytes(ulSamplesProduced);
>                          // Create and set the buffer @@ -551,7 +552,6

> @@
>                                                   m_ulCodecDelayInMs;
>                          }
>                      }
> -                }
> 
> Thnx & regds
> AD
> 
> -----Original Message-----
> From: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas)
> Sent: Tuesday, May 13, 2008 1:43 PM
> To: 'ehyche@real.com'; datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV 
> file
> 
> I was wondering what about invoking method UpdateAudioFormat 
> immediately after calling GetNextAssembledFrame in 
> CWMAudioFormat::DecodeAudioData if the received frame is from a 
> different stream than active one?
> 
> thnx & regds
> AD
> 
> -----Original Message-----
> From: ext Eric Hyche [mailto:ehyche@real.com]
> Sent: Tuesday, May 13, 2008 11:41 AM
> To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
> datatype-dev@helixcommunity.org
> Cc: nokia-private-dev@helixcommunity.org
> Subject: RE: [Nokia-private-dev] CR: Helix Crashes while playing WMV 
> file
> 
> 
> > The problem with current logic of selecting active
> substream is that
> > bitrate parameter is completely ignored and only sample rate and 
> > number of channels is used.
> > Also choosing initial Active Substream on AudioFormat does not have 
> > any influence on the actual substream id that is displayed as that 
> > selection is made by controller somewhere else.
> > 
> 
> The reason we do this is that with some audio device implementations, 
> the audio device is opened with the paramters of the first audio 
> stream created. So if have three sub-streams:
> 
> SubStream 0: 1 channel, sample rate 11025 SubStream 1: 2 channel, 
> sample rate 22050 SubStream 2: 2 channel, sample rate 44100
> 
> and you choose substream 0 as the initial substream, then with the 
> audio device may be opened at a sample rate of 11025. Then when you 
> have a stream switch to substream 2, then audio services will 
> downsample to 44100 to 11025 and 2 channels to 1 channel.
> 
> So it's always a good idea for audio renderers to create the first 
> IHXAudioStream with the parameters of the highest sample rate and 
> number of channels.
> 
> In CWMAudioFormat::Init(), after the call to ParseOpaqueData(), we 
> know all the information about every sub-stream. Therefore, at that 
> point, we could calculate the required decoder output buffer size for 
> each substream. Then we would just take the maximum size across all 
> substreams and use that for the decoder buffer size. Then, it would 
> not be necessary to re-allocate this buffer in UpdateAudioFormat().
> 
> Eric
> 
> 
> =============================================
> Eric Hyche (ehyche@real.com)
> Technical Lead
> RealNetworks, Inc.  
> 
> > -----Original Message-----
> > From: ext-anuj.dhamija@nokia.com [mailto:ext-anuj.dhamija@nokia.com]
> > Sent: Tuesday, May 13, 2008 12:11 PM
> > To: ehyche@real.com; datatype-dev@helixcommunity.org
> > Cc: nokia-private-dev@helixcommunity.org
> > Subject: RE: [Nokia-private-dev] CR: Helix Crashes while
> playing WMV
> > file
> > 
> > Hi Eric,
> > 
> > There is no substream switch happening here and so fix you
> suggested
> > may not work.
> > 
> > This is the flow of how initially buffer is allocated:
> > A) CWMAudioFormat::Init is invoked
> > B) CWMAudioFormat::ParseOpaqueData ==> Initialise array of audio 
> > decoders with substream headers
> > C) ChooseInitialActiveSubStream ==> Choose the Active substream
> > D) UpdateAudioFormat ==> Allocate Decoder Output Buffer for Active 
> > Substream
> > 
> > Now later when first packet from any of the substream is received 
> > CWMAudioFormat::DecodeAudioData gets invoked and so far no
> change in
> > buffer size is made. GetNextAssembledFrame() is then invoked which 
> > finds the stream-id for received packet and change the active 
> > stream-id to the same. But still Output buffer is of same
> size as the
> > initial Active substream.
> > pDecoder->Decode is then called and there it crashes if the initial
> > active substream was of lower bit rate than the stream from which 
> > packet is received.
> > 
> > CWMAudioFormat::UpdateAudioFormat() is called again only after the 
> > decode call which is too late for the given scenario.
> > 
> > So what I have tried to do is to change the initial active
> substream
> > to be one which needs maximum output buffer size. The problem with 
> > current logic of selecting active substream is that bitrate
> parameter
> > is completely ignored and only sample rate and number of
> channels is
> > used.
> > Also choosing initial Active Substream on AudioFormat does not have 
> > any influence on the actual substream id that is displayed as that 
> > selection is made by controller somewhere else.
> > 
> > Thnx & regds
> > AD
> > -----Original Message-----
> > From: ext Eric Hyche [mailto:ehyche@real.com]
> > Sent: Tuesday, May 13, 2008 9:44 AM
> > To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas);
> > datatype-dev@helixcommunity.org
> > Cc: nokia-private-dev@helixcommunity.org
> > Subject: RE: [Nokia-private-dev] CR: Helix Crashes while
> playing WMV
> > file
> > 
> > 
> > I don't think we should change which stream is initially
> selected, but
> 
> > rather change how the size of the decoder output buffer is computed.
> > 
> > It sounds like we currently compute the size of the output decoder 
> > buffer based upon the size needed for the initially selected 
> > sub-stream.
> > However, we should compute the size of the decoder output
> buffer to be
> 
> > the maximum size needed across all sub-streams.
> > 
> > I think all we need to do is make a change in
> > CWMAudioFormat::UpdateAudioFormat() here:
> > 
> >         // Allocate Decoder Buffer
> >         if (SUCCEEDED(retVal))
> >         {
> >             // Did the size change?
> >             if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
> >             {
> > 
> > This is where we detect that a sub-stream switch has
> occurred and we
> > adjust the size of the decoder output buffer. It seems to
> me we should
> 
> > only let ulDecoderBufferSize go up, but not be reduced. 
> Let's say we
> > have a stream switch to a lower bitrate sub-stream. Therefore, the 
> > required decoder output buffer size for this new sub-stream might 
> > change to a lower number. So currently we would re-compute
> the size of
> 
> > this buffer and re-allocate it. However, if we get a packet
> from the
> > old sub-stream in after this point, we will not have enough room to 
> > decode it.
> > 
> > So I would just do the following:
> > 
> > -            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
> > +            if (m_ulDecoderBufferSize >  m_ulMaxDecoderOutputBytes)
> > 
> > Does this fix your problem?
> > 
> > Eric
> > 
> > =============================================
> > Eric Hyche (ehyche@real.com)
> > Technical Lead
> > RealNetworks, Inc.  
> > 
> > > -----Original Message-----
> > > From: nokia-private-dev-bounces@helixcommunity.org
> > > [mailto:nokia-private-dev-bounces@helixcommunity.org] On
> Behalf Of
> > > ext-anuj.dhamija@nokia.com
> > > Sent: Monday, May 12, 2008 8:03 PM
> > > To: datatype-dev@helixcommunity.org
> > > Cc: nokia-private-dev@helixcommunity.org
> > > Subject: [Nokia-private-dev] CR: Helix Crashes while
> > playing WMV file
> > > 
> > > 
> > > 			"Nokia submits this code under the terms of a
> > commercial
> > > contribution agreement with RealNetworks, and I am authorized to 
> > > contribute this code under said agreement."
> > > 
> > > 			  
> > > 			Modified by:  ext-anuj.dhamija@nokia.com
> > > 			  
> > > 			Reviewed by: 
> > > 			  
> > > 			Date: 05/12/2008
> > > 			  
> > > 			Project: SymbianMmf_wm
> > > 			  
> > > 			Synopsis: Multiple Audio Streams in WMV File
> > cause Helix
> > > Audiocontroller Crash
> > > 
> > > 			Overview: 
> > > 			In WM Audio Format
> > > (CWMAduiFormat::UpdateAudioFormat) output buffer for
> > decoded data is
> > > allocated with size for the stream which is selected as
> > initial active
> > 
> > > stream based on sampling rate and number of channels (in 
> > > CWMAudioFormat::ChooseInitialActiveSubStream
> > > method). This buffer is then used for decoder output
> > disregard of the
> > > fact that which stream gets decoded. As long as the decoded
> > stream is
> > > of less bitrate than the one chosen as active, there is
> no problem. 
> > > But when the stream to be decoded is of higher bit rate
> > than the one
> > > chosen as active ,then decoded output overflows the output buffer 
> > > causing the crash.
> > > 
> > > 			Fix: 
> > > 			Currently choice of Initial Active substream is
> > made based on
> > > sample rate and number of channels. Whereas the size of
> > decoded output
> > 
> > > depends on samples per frame. So if there are two streams
> with same
> > > sampling rate and same number of channels, samples per
> > frame would be
> > > higher for the stream with higher bitrate and so it would need a 
> > > bigger buffer if the packets of this stream are to be decoded.
> > > 
> > > 			Since only one buffer is used for decoder output
> and packets from
> > > any of streams may have to
> > be decoded
> > > (and not necessarily the one chosen as initial active
> > > stream) depending on what stream is chosen by controller,
> > the size of
> > > buffer should be chosen for the stream with max samples per
> > frame. So
> > > fix is made to chose the initial active stream as one
> which has max
> > > samples per frame. If samples per frame are same then
> > choose the one
> > > with higher sampling rate and number of channels.
> > > 
> > > 			Files modified & changes: 
> > > 			src\datatype\wm\audio\renderer\wmaformat.cpp
> > > 
> > > 			Image Size and Heap Use impact: None
> > > 
> > > 			Module Release testing (STIF, Audio) : Passed
> > > 
> > > 			Test case(s) Added  : No
> > > 
> > > 			Memory leak check performed : Passed, No leaks
> > found
> > > 			  
> > > 			Platforms and Profiles Build Verified: 
> > > helix-client-s60-50-mmf-mdf-arm
> > > 
> > > 			Platforms and Profiles Functionality
> > > verified: armv5
> > > 			  
> > > 			Branch: Head, 210CayS
> > > 
> > > 
> > > Index: wmaformat.cpp
> > > 
> ===================================================================
> > > RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
> > > retrieving revision 1.4
> > > diff -u -w -r1.4 wmaformat.cpp 
> > > --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4 
> > > +++ wmaformat.cpp       12 May 2008 19:44:12 -0000 
> > > @@ -815,6 +815,7 @@ 
> > >          // Initialize our counters 
> > >          UINT16 usCurNumChannels   = 0; 
> > >          UINT32 ulCurSampleRate    = 0; 
> > > +                       UINT32 ulCurSampleOut    = 0; 
> > >          UINT32 ulInitialStream    = m_ulNumSubStreams; 
> > >          UINT32 i                  = 0; 
> > >          // Clear the return value @@ -833,15 +834,26 @@
> > >                  retVal =
> > > m_ppWMAudioDecoder[i]->GetNumChannels(&usNumChannels); 
> > >                  if (SUCCEEDED(retVal)) 
> > >                  {
> > > +                                       UINT32 ulSampleOut = 0; 
> > > +                                       retVal =
> > > m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&ulSampleOut); 
> > >                      // Get the sample rate for this substream 
> > >                      UINT32 ulSampleRate = 0; 
> > >                      retVal =
> > > m_ppWMAudioDecoder[i]->GetSampleRate(&ulSampleRate); 
> > >                      if (SUCCEEDED(retVal)) 
> > >                      { 
> > > -                        // Choose the highest sample rate 
> > > and for substreams 
> > > -                        // with the same sample rate, choose 
> > > the highest 
> > > -                        // number of channels 
> > > -                        if (ulSampleRate > ulCurSampleRate) 
> > > +                                               // Choose the
> > > highest samples per frame
> > > +                                               //for
> > > substreams with the same samples per frame,
> > > +                                               //choose the
> > > highest sample rate
> > > +                                               //for same
> > > sample rate choose the max number of channels
> > > +                                               if
> > > (ulSampleOut > ulCurSampleOut)
> > > +                                               {
> > > +                                                       
> > > ulCurSampleOut   = ulSampleOut; 
> > > +                                                       
> > > ulCurSampleRate  = ulSampleRate;
> > > +                                                       
> > > usCurNumChannels = usNumChannels;
> > > +                                                       
> > > ulInitialStream  = i;
> > > +                                               } 
> > > +                                               else
> > > if(ulSampleOut == ulCurSampleOut &&
> > > +                                                             
> > >   ulSampleRate > ulCurSampleRate) 
> > >                          { 
> > >                              ulCurSampleRate  = ulSampleRate; 
> > >                              usCurNumChannels = usNumChannels; 
> > > ______________________________________________
> > > 
> > > thnx & regds
> > > AD
> > > 
> > > 
> > 
> 


From weian.chen at intel.com  Wed May 21 23:59:16 2008
From: weian.chen at intel.com (Chen, Weian)
Date: Wed May 21 22:46:22 2008
Subject: [datatype-dev]an urgent question on encoder
Message-ID: 

Hi Eric:

 

How many encoders (including audio and video) does Helix have? And could
you please provide the list to me?

 

Thanks a lot

Weian

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080522/bd433762/attachment-0001.html
From ehyche at real.com  Thu May 22 08:35:20 2008
From: ehyche at real.com (Eric Hyche)
Date: Thu May 22 07:22:16 2008
Subject: [datatype-dev] CR: Fix the thumbnail issue that when the video
	streamcan not support time-seeking, the dbus-server will hang up
In-Reply-To: 
References: 
	<009601c8b9c0$7c61e930$db68a8c0@EHYCHED620>
	
Message-ID: <00d301c8bc21$72ac5b60$db68a8c0@EHYCHED620>


> 1.       The content is 
> Demo_512k_RV10_480x272_30fps_RA_355k_music.rm, and the seek 
> time is 1000. BTW, when playing back, if we seek it, it also failed.
> 

OK - I think there's a bug already filed on the fact that
seeking fails here.

> 2.       If we call into SeekDone() with asynchronous mode 
> (seems only content with time-seeking issue will use 
> asynchronous mode), then the system will hang up, we can?t 
> return back.
> 

Well, anything played back via http:// may use an asynchonous 
seek as well.

So you are saying that if you call Seek() from within SeekDone(HXR_FAIL)
callback that the Seek call never returns?

Eric

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: Chen, Weian [mailto:weian.chen@intel.com] 
> Sent: Monday, May 19, 2008 10:44 PM
> To: ehyche@real.com; datatype-dev@helixcommunity.org
> Subject: RE: [datatype-dev] CR: Fix the thumbnail issue that 
> when the video streamcan not support time-seeking, the 
> dbus-server will hang up
> 
> Eric:
> 
>  
> 
> 1.       The content is 
> Demo_512k_RV10_480x272_30fps_RA_355k_music.rm, and the seek 
> time is 1000. BTW, when playing back, if we seek it, it also failed.
> 
> 2.       If we call into SeekDone() with asynchronous mode 
> (seems only content with time-seeking issue will use 
> asynchronous mode), then the system will hang up, we can?t 
> return back.
> 
>  
> 
> Weian
> 
> -----Original Message-----
> From: Eric Hyche [mailto:ehyche@real.com] 
> Sent: 2008?5?19? 22:56
> To: Chen, Weian; datatype-dev@helixcommunity.org
> Subject: RE: [datatype-dev] CR: Fix the thumbnail issue that 
> when the video streamcan not support time-seeking, the 
> dbus-server will hang up
> 
>  
> 
>  
> 
> Weian,
> 
>  
> 
> Several questions:
> 
>  
> 
> 1) In what circumstances are you seeing a SeekDone() call back
> 
>    from the fileformat with a status other than HXR_OK? Specifically
> 
>    I'm interested in which content and what seek time was used.
> 
>  
> 
> 2) I think being able to handle a failure in SeekDone() in a good
> 
>    change. However, the place you have made the change assumes that
> 
>    the SeekDone() call will happen synchronously (that the SeekDone()
> 
>    call will come before the m_pFileFormat->Seek(m_ulStartTime); call
> 
>    returns. We cannot assume that this will be the case. Some 
> fileformats
> 
>    may make that call asynchronously.
> 
>  
> 
>    So I think the proper place to make that call is in SeekDone(). If
> 
>    we get a failure in SeekDone() and we had a non-zero m_ulStartTime,
> 
>    then change m_ulStartTime to 0 and re-issue the 
> m_pFileFormat->Seek(m_ulStartTime)
> 
>    call. If m_ulStartTime is *already* 0, then we should error out.
> 
>  
> 
> Eric
> 
>  
> 
> =============================================
> 
> Eric Hyche (ehyche@real.com)
> 
> Technical Lead
> 
> RealNetworks, Inc.  
> 
>  
> 
> > -----Original Message-----
> 
> > From: datatype-dev-bounces@helixcommunity.org 
> 
> > [mailto:datatype-dev-bounces@helixcommunity.org] On Behalf Of 
> 
> > Chen, Weian
> 
> > Sent: Thursday, May 15, 2008 3:33 AM
> 
> > To: datatype-dev@helixcommunity.org
> 
> > Subject: [datatype-dev] CR: Fix the thumbnail issue that when 
> 
> > the video streamcan not support time-seeking, the dbus-server 
> 
> > will hang up
> 
> > 
> 
> > Synopsis:
> 
> > 
> 
> >   Fix the thumbnail issue that when the video stream can not 
> 
> > support time-seeking, the dbus-server will hang up.
> 
> > 
> 
> >  
> 
> > 
> 
> > Overview:
> 
> > 
> 
> >   When the video stream can not support time-seeking, the 
> 
> > dbus-server will hang up, and we fix it with following 
> 
> > solution: when we find the stream can not support 
> 
> > time-seeking, we set the StartTime to 0 to avoid exception.
> 
> > 
> 
> >  
> 
> > 
> 
> > Files Added:
> 
> > 
> 
> >   No file added
> 
> > 
> 
> >  
> 
> > 
> 
> > Files Modified:
> 
> > 
> 
> >   datatype/tools/dtdriver/engine/ffdriver.cpp
> 
> > 
> 
> >  
> 
> > 
> 
> > Image Size and Heap Use impact (Client-Only):
> 
> > 
> 
> >   Little
> 
> > 
> 
> >  
> 
> > 
> 
> > Platform and Profiles Affected:
> 
> > 
> 
> >   platform: linux-2.2-libc6-gcc32-i586
> 
> > 
> 
> >   profile:    helix-client-all-defines
> 
> > 
> 
> >  
> 
> > 
> 
> > Distribution Libraries Affected:
> 
> > 
> 
> >  
> 
> > 
> 
> >  
> 
> > 
> 
> > Distribution library impact and planned action:
> 
> > 
> 
> >   
> 
> > 
> 
> >  
> 
> > 
> 
> > Platforms and Profiles Build Verfied:
> 
> > 
> 
> >   Set BIF branch  ->  hxclient_3_1_0_atlas_restricted
> 
> > 
> 
> >   Set Target(s)    ->  datatype_tools_dtdrive
> 
> > 
> 
> >   Set Profile      ->  helix-client-all-defines
> 
> > 
> 
> >   System ID      ->  linux-2.2-libc6-gcc32-i586
> 
> > 
> 
> >  
> 
> > 
> 
> > Branch:
> 
> > 
> 
> >   HEAD, hxclient_3_1_0_atlas_restricted
> 
> > 
> 
> >  
> 
> > 
> 
> > Copyright assignment: 
> 
> > 
> 
> >   2.    Intel has signed and delivered a Joint Copyright 
> 
> > Assignment to RealNetworks, and received acknowledgment that 
> 
> > the agreement was received.
> 
> > 
> 
> >  
> 
> > 
> 
> > Files Attached:
> 
> > 
> 
> >   dtdriver-thumbnail-ffdriver.diff
> 
> > 
> 
> >  
> 
> > 
> 
> > Weian
> 
> > 
> 
> >  
> 
> > 
> 
> > 
> 
>  
> 
> 


From ehyche at real.com  Thu May 22 08:38:29 2008
From: ehyche at real.com (Eric Hyche)
Date: Thu May 22 07:25:30 2008
Subject: [datatype-dev]an urgent question on encoder
In-Reply-To: 
References: 
Message-ID: <00d401c8bc21$e342d610$db68a8c0@EHYCHED620>


Well, since Helix plays back many different datatypes,
then it's kind of difficult to say how many different
encoders there are.

What datatype(s) are you referring to?

Eric

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: Chen, Weian [mailto:weian.chen@intel.com] 
> Sent: Thursday, May 22, 2008 2:59 AM
> To: Eric Hyche
> Cc: datatype-dev@helixcommunity.org
> Subject: [datatype-dev]an urgent question on encoder
> 
> Hi Eric:
> 
>  
> 
> How many encoders (including audio and video) does Helix 
> have? And could you please provide the list to me?
> 
>  
> 
> Thanks a lot
> 
> Weian
> 
>  
> 
> 


From ext-anuj.dhamija at nokia.com  Thu May 22 14:04:19 2008
From: ext-anuj.dhamija at nokia.com (ext-anuj.dhamija@nokia.com)
Date: Thu May 22 12:52:02 2008
Subject: [datatype-dev] FW: CR: DHAR_7DLSSC - Helix crashes while playing
	WMV file with multiple Audi Streams - Resubmission
Message-ID: <2198383E1141814486F0B881B3260CF50257E8A6@daebe103.NOE.Nokia.com>


> 		"Nokia submits this code under the terms of a commercial
> contribution agreement with RealNetworks, and I am authorized to
> contribute this code under said agreement."
> 		 
> 		Modified by:  ext-anuj.dhamija@nokia.com
> 		 
> 		Reviewed by: 
> 		 
> 		Date: 05/21/2008
> 		 
> 		Project: SymbianMmf_wm
> 
> 		TSW Error ID: DHAR_7DLSSC
> 		 
> 		Synopsis: Multiple Audio Streams in WMV File cause Helix
> Audiocontroller Crash
> 
> 		Overview: 
> 		In WM Audio Format (CWMAduiFormat::UpdateAudioFormat)
> output buffer for decoded data is allocated with size for the stream
> which is selected as initial active stream based on sampling rate and
> number of channels (in CWMAudioFormat::ChooseInitialActiveSubStream
> method). This buffer is then used for decoder output disregard of the
> fact that which stream gets decoded. As long as the decoded stream is
> of less bitrate than the one chosen as active, there is no problem.
> But when the stream to be decoded is of higher bit rate than the one
> chosen as active ,then decoded output overflows the output buffer
> causing the crash.
> 
> 		Fix:
> 		Instead of allocating the output decoder buffer with
> respect to the selected stream, allocate it outside UpdateAudioFormat
> method using the size of stream which requires maximum decoder buffer
> size.
> 		Introduce new Function AllocateDecoderBuffer which scans
> through all the substreams and selects theh max buffer size and use
> that to allocate decoder buffer. Remove the logic of allocating
> decoder buffer from UpdateAudioFormat function.
> 
> 		Files modified & changes:
> 		src\datatype\wm\audio\renderer\wmaformat.cpp
> 		src\datatype\wm\audio\renderer\wmaformat.h
> 
> 		Image Size and Heap Use impact: None
> 
> 		Module Release testing (STIF, Audio) : Passed
> 
> 		Test case(s) Added  : No
> 
> 		Memory leak check performed : Passed, No leaks found
> 		  
> 		Platforms and Profiles Build Verified:
> helix-client-s60-50-mmf-mdf-arm
> 
> 		Platforms and Profiles Functionality verified: armv5
> 		  
> 		Branch: Head, 210CayS
> 
> 
Index: wmaformat.cpp
===================================================================
RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
retrieving revision 1.4
diff -u -w -r1.4 wmaformat.cpp
--- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4
+++ wmaformat.cpp       22 May 2008 20:45:06 -0000
@@ -137,6 +137,9 @@
                     // Set the source properties ("SrcCodec" and
"SrcBitRate").
                     // These are needed for transcoding.
                     SetSourceProperties(pHeader);
+                    retVal = AllocateDecoderBuffer();
+                    if(SUCCEEDED(retVal))
+                    {
                         // Update the CHXAudioStream format
                         retVal =
UpdateAudioFormat(m_ulLastDecodedEndTimeInSamples, TRUE); // force an
update
                         if (SUCCEEDED(retVal))
@@ -166,6 +169,8 @@
                 }
             }
          }
+      }
+
        HX_RELEASE(pOpaqueData);
     }

@@ -206,6 +211,48 @@
     return bRet;
 }

+HX_RESULT CWMAudioFormat::AllocateDecoderBuffer()
+{
+
+       HX_RESULT retVal = HXR_FAIL;
+       UINT32  ulMaxSamplesOut = 0;
+
+       // Loop through the substreams and determine
+       //then max sampleOut
+       for (int i = 0; i < m_ulNumSubStreams; i++)
+       {
+               // Make sure we have a CWMAudioDecoder for this
substream
+               if (m_ppWMAudioDecoder[i])
+               {
+                       UINT32 samplesOut = 0;
+                       retVal =
m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&samplesOut);
+                       if(SUCCEEDED(retVal))
+                       {
+                               if(samplesOut>ulMaxSamplesOut)
+                               {
+                                       ulMaxSamplesOut = samplesOut;
+                               }
+                       }
+                       else return retVal;
+               }
+       }
+
+       m_ulDecoderBufferSize =
CAudioFormat::ConvertSamplesToBytes(ulMaxSamplesOut);
+
+       // Allocate a new decoder buffer
+       HX_VECTOR_DELETE(m_pDecoderBuffer);
+       m_pDecoderBuffer = new BYTE [m_ulDecoderBufferSize];
+
+       if (!m_pDecoderBuffer)
+       {
+               // return Out Of Memory
+               retVal = HXR_OUTOFMEMORY;
+               // reset decoder buffer size to zero
+               m_ulDecoderBufferSize = 0;
+       }
+
+       return retVal;
+}
 HX_RESULT CWMAudioFormat::UpdateAudioFormat(UINT32&
rulAnchorTimeInSamples, HXBOOL bForceUpdate)
 {
     HX_RESULT retVal = HXR_FAIL;
@@ -286,26 +333,6 @@
                 m_ulCodecDelayInMs =
CAudioFormat::ConvertSamplesToMs(ulCodecDelaySamples);
             }
         }
-        // Allocate Decoder Buffer
-        if (SUCCEEDED(retVal))
-        {
-            // Did the size change?
-            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
-            {
-                // Set the return value
-                retVal = HXR_OUTOFMEMORY;
-                // Allocate a new decoder buffer
-                HX_VECTOR_DELETE(m_pDecoderBuffer);
-                m_pDecoderBuffer = new BYTE
[m_ulMaxDecoderOutputBytes];
-                if (m_pDecoderBuffer)
-                {
-                    // Clear the return value
-                    retVal = HXR_OK;
-                    // Save the decoder buffer size
-                    m_ulDecoderBufferSize = m_ulMaxDecoderOutputBytes;
-                }
-            }
-        }
     }

     return retVal;

> Index: wmaformat.h
> ===================================================================
> RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.h,v
> retrieving revision 1.3
> diff -u -w -r1.3 wmaformat.h
> --- wmaformat.h 5 Jul 2006 14:49:56 -0000       1.3
> +++ wmaformat.h 21 May 2008 22:56:46 -0000
> @@ -101,6 +101,7 @@
>      // Protected CWMAudioFormat methods
>      void          _Reset(void);
>      void          ClearDecoderArray(void);
> +   HX_RESULT     AllocateDecoderBuffer();
>      HX_RESULT     UpdateAudioFormat(UINT32& rulAnchorTime, HXBOOL
> bForceUpdate = FALSE);
>      HX_RESULT     ParseOpaqueData(IHXBuffer* pBuffer);
>      HX_RESULT     ChooseInitialActiveSubStream(void);
> 
> 
> ______________________________________________ 
> 
> thnx & regds
> AD
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080522/78bed458/attachment-0001.html
From weian.chen at intel.com  Thu May 22 17:59:37 2008
From: weian.chen at intel.com (Chen, Weian)
Date: Thu May 22 16:46:31 2008
Subject: [datatype-dev]an urgent question on encoder
In-Reply-To: <00d401c8bc21$e342d610$db68a8c0@EHYCHED620>
References: 
	<00d401c8bc21$e342d610$db68a8c0@EHYCHED620>
Message-ID: 


Eric:

I means how many encoder codec does Helix have, not decoder codec =
(palyback).

thanks
Weian
-----Original Message-----
From: Eric Hyche [mailto:ehyche@real.com]=20
Sent: 2008=C4=EA5=D4=C222=C8=D5 23:38
To: Chen, Weian
Cc: datatype-dev@helixcommunity.org
Subject: RE: [datatype-dev]an urgent question on encoder


Well, since Helix plays back many different datatypes,
then it's kind of difficult to say how many different
encoders there are.

What datatype(s) are you referring to?

Eric

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc. =20

> -----Original Message-----
> From: Chen, Weian [mailto:weian.chen@intel.com]=20
> Sent: Thursday, May 22, 2008 2:59 AM
> To: Eric Hyche
> Cc: datatype-dev@helixcommunity.org
> Subject: [datatype-dev]an urgent question on encoder
>=20
> Hi Eric:
>=20
> =20
>=20
> How many encoders (including audio and video) does Helix=20
> have? And could you please provide the list to me?
>=20
> =20
>=20
> Thanks a lot
>=20
> Weian
>=20
> =20
>=20
>=20


From gwright at real.com  Fri May 23 06:50:37 2008
From: gwright at real.com (Greg Wright)
Date: Fri May 23 05:37:23 2008
Subject: [datatype-dev] Re: [Nokia-private-dev] FW: CR: DHAR_7DLSSC - Helix
 crashes while
 playing WMV file with multiple Audi Streams - Resubmission
In-Reply-To: <2198383E1141814486F0B881B3260CF50257E8A6@daebe103.NOE.Nokia.com>
References: <2198383E1141814486F0B881B3260CF50257E8A6@daebe103.NOE.Nokia.com>
Message-ID: <4836CBAD.9000802@real.com>

Looks good to me.

This is needed on all branches that this code exists, since
this is a security problem (buffer overruns can lead to
arbitrary code execution).

--greg.

ext-anuj.dhamija@nokia.com wrote:
> 
>                   "Nokia submits this code under the terms of a
>                   commercial contribution agreement with RealNetworks,
>                   and I am authorized to contribute this code under said
>                   agreement."
> 
>                    
>                   Modified by:  ext-anuj.dhamija@nokia.com
>                    
>                   Reviewed by:
>                    
>                   Date: 05/21/2008
>                    
>                   Project: SymbianMmf_wm
> 
>                   TSW Error ID: DHAR_7DLSSC
>                    
>                   Synopsis: Multiple Audio Streams in WMV File cause
>                   Helix Audiocontroller Crash
> 
>                   Overview:
>                   In WM Audio Format (CWMAduiFormat::UpdateAudioFormat)
>                   output buffer for decoded data is allocated with size
>                   for the stream which is selected as initial active
>                   stream based on sampling rate and number of channels
>                   (in CWMAudioFormat::ChooseInitialActiveSubStream
>                   method). This buffer is then used for decoder output
>                   disregard of the fact that which stream gets decoded.
>                   As long as the decoded stream is of less bitrate than
>                   the one chosen as active, there is no problem. But
>                   when the stream to be decoded is of higher bit rate
>                   than the one chosen as active ,then decoded output
>                   overflows the output buffer causing the crash.
> 
>                   Fix:
>                   Instead of allocating the output decoder buffer with
>                   respect to the selected stream, allocate it outside
>                   UpdateAudioFormat method using the size of stream
>                   which requires maximum decoder buffer size.
> 
>                   Introduce new Function AllocateDecoderBuffer which
>                   scans through all the substreams and selects theh max
>                   buffer size and use that to allocate decoder buffer.
>                   Remove the logic of allocating decoder buffer from
>                   UpdateAudioFormat function.
> 
>                   Files modified & changes:
>                   src\datatype\wm\audio\renderer\wmaformat.cpp
>                   src\datatype\wm\audio\renderer\wmaformat.h
> 
>                   Image Size and Heap Use impact: None
> 
>                   Module Release testing (STIF, Audio) : Passed
> 
>                   Test case(s) Added  : No
> 
>                   Memory leak check performed : Passed, No leaks found
>                    
>                   Platforms and Profiles Build Verified:
>                   helix-client-s60-50-mmf-mdf-arm
> 
>                   Platforms and Profiles Functionality verified: armv5
>                    
>                   Branch: Head, 210CayS
> 
> 
> Index: wmaformat.cpp
> ===================================================================
> RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
> retrieving revision 1.4
> diff -u -w -r1.4 wmaformat.cpp
> --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4
> +++ wmaformat.cpp       22 May 2008 20:45:06 -0000
> @@ -137,6 +137,9 @@
>                      // Set the source properties ("SrcCodec" and 
> "SrcBitRate").
>                      // These are needed for transcoding.
>                      SetSourceProperties(pHeader);
> +                    retVal = AllocateDecoderBuffer();
> +                    if(SUCCEEDED(retVal))
> +                    {
>                          // Update the CHXAudioStream format
>                          retVal = 
> UpdateAudioFormat(m_ulLastDecodedEndTimeInSamples, TRUE); // force an 
> update
>                          if (SUCCEEDED(retVal))
> @@ -166,6 +169,8 @@
>                  }
>              }
>           }
> +      }
> +
>         HX_RELEASE(pOpaqueData);
>      }
> 
> @@ -206,6 +211,48 @@
>      return bRet;
>  }
> 
> +HX_RESULT CWMAudioFormat::AllocateDecoderBuffer()
> +{
> +
> +       HX_RESULT retVal = HXR_FAIL;
> +       UINT32  ulMaxSamplesOut = 0;
> +
> +       // Loop through the substreams and determine
> +       //then max sampleOut
> +       for (int i = 0; i < m_ulNumSubStreams; i++)
> +       {
> +               // Make sure we have a CWMAudioDecoder for this substream
> +               if (m_ppWMAudioDecoder[i])
> +               {
> +                       UINT32 samplesOut = 0;
> +                       retVal = 
> m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&samplesOut);
> +                       if(SUCCEEDED(retVal))
> +                       {
> +                               if(samplesOut>ulMaxSamplesOut)
> +                               {
> +                                       ulMaxSamplesOut = samplesOut;
> +                               }
> +                       }
> +                       else return retVal;
> +               }
> +       }
> +
> +       m_ulDecoderBufferSize = 
> CAudioFormat::ConvertSamplesToBytes(ulMaxSamplesOut);
> +
> +       // Allocate a new decoder buffer
> +       HX_VECTOR_DELETE(m_pDecoderBuffer);
> +       m_pDecoderBuffer = new BYTE [m_ulDecoderBufferSize];
> +
> +       if (!m_pDecoderBuffer)
> +       {
> +               // return Out Of Memory
> +               retVal = HXR_OUTOFMEMORY;
> +               // reset decoder buffer size to zero
> +               m_ulDecoderBufferSize = 0;
> +       }
> +
> +       return retVal;
> +}
>  HX_RESULT CWMAudioFormat::UpdateAudioFormat(UINT32& 
> rulAnchorTimeInSamples, HXBOOL bForceUpdate)
>  {
>      HX_RESULT retVal = HXR_FAIL;
> @@ -286,26 +333,6 @@
>                  m_ulCodecDelayInMs = 
> CAudioFormat::ConvertSamplesToMs(ulCodecDelaySamples);
>              }
>          }
> -        // Allocate Decoder Buffer
> -        if (SUCCEEDED(retVal))
> -        {
> -            // Did the size change?
> -            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
> -            {
> -                // Set the return value
> -                retVal = HXR_OUTOFMEMORY;
> -                // Allocate a new decoder buffer
> -                HX_VECTOR_DELETE(m_pDecoderBuffer);
> -                m_pDecoderBuffer = new BYTE [m_ulMaxDecoderOutputBytes];
> -                if (m_pDecoderBuffer)
> -                {
> -                    // Clear the return value
> -                    retVal = HXR_OK;
> -                    // Save the decoder buffer size
> -                    m_ulDecoderBufferSize = m_ulMaxDecoderOutputBytes;
> -                }
> -            }
> -        }
>      }
> 
>      return retVal;
> 
> Index: wmaformat.h
> ===================================================================
> RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.h,v
> retrieving revision 1.3
> diff -u -w -r1.3 wmaformat.h
> --- wmaformat.h 5 Jul 2006 14:49:56 -0000       1.3
> +++ wmaformat.h 21 May 2008 22:56:46 -0000
> @@ -101,6 +101,7 @@
>      // Protected CWMAudioFormat methods
>      void          _Reset(void);
>      void          ClearDecoderArray(void);
> +   HX_RESULT     AllocateDecoderBuffer();
>      HX_RESULT     UpdateAudioFormat(UINT32& rulAnchorTime, HXBOOL 
> bForceUpdate = FALSE);
>      HX_RESULT     ParseOpaqueData(IHXBuffer* pBuffer);
>      HX_RESULT     ChooseInitialActiveSubStream(void);
> 
> 
> ______________________________________________
> 
> *thnx & regds*
> *AD*
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Nokia-private-dev mailing list
> Nokia-private-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/nokia-private-dev


From ehyche at real.com  Fri May 23 07:23:04 2008
From: ehyche at real.com (Eric Hyche)
Date: Fri May 23 06:09:46 2008
Subject: [datatype-dev]an urgent question on encoder
In-Reply-To: 
References: 
	<00d401c8bc21$e342d610$db68a8c0@EHYCHED620>
	
Message-ID: <00af01c8bce0$84a37460$db68a8c0@EHYCHED620>


I'm still not quite sure what you are asking. Do you mean:

- what encoding capabilities does Helix currently include, and
  what codecs can Helix encode?

I'll assume this is what you are asking, and answer that question.

In present form, Helix does not include encoding capability. Currently,
there is a separate SDK called the Helix Producer SDK that is
used for encoding.

However, we have a project scheduled for later this year to integrate
the Producer SDK into the Helix atlas platform. Some of the initial
work for this integration has already taken place. Once this work is
complete, Helix will be able to encode to:

- .rm (any RA or RV version)
- .mp4 (H.264 video and MPEG-4 video)
- .wmv (WMA 2-9 and WMV 7-9)
- .ogg (vorbis and theora)
- .mp3

Does this answer your question?

Eric
=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: Chen, Weian [mailto:weian.chen@intel.com] 
> Sent: Thursday, May 22, 2008 9:00 PM
> To: ehyche@real.com
> Cc: datatype-dev@helixcommunity.org
> Subject: RE: [datatype-dev]an urgent question on encoder
> 
> 
> Eric:
> 
> I means how many encoder codec does Helix have, not decoder 
> codec (palyback).
> 
> thanks
> Weian
> -----Original Message-----
> From: Eric Hyche [mailto:ehyche@real.com] 
> Sent: 2008?5?22? 23:38
> To: Chen, Weian
> Cc: datatype-dev@helixcommunity.org
> Subject: RE: [datatype-dev]an urgent question on encoder
> 
> 
> Well, since Helix plays back many different datatypes,
> then it's kind of difficult to say how many different
> encoders there are.
> 
> What datatype(s) are you referring to?
> 
> Eric
> 
> =============================================
> Eric Hyche (ehyche@real.com)
> Technical Lead
> RealNetworks, Inc.  
> 
> > -----Original Message-----
> > From: Chen, Weian [mailto:weian.chen@intel.com] 
> > Sent: Thursday, May 22, 2008 2:59 AM
> > To: Eric Hyche
> > Cc: datatype-dev@helixcommunity.org
> > Subject: [datatype-dev]an urgent question on encoder
> > 
> > Hi Eric:
> > 
> >  
> > 
> > How many encoders (including audio and video) does Helix 
> > have? And could you please provide the list to me?
> > 
> >  
> > 
> > Thanks a lot
> > 
> > Weian
> > 
> >  
> > 
> > 
> 


From ext-anuj.dhamija at nokia.com  Fri May 23 07:45:06 2008
From: ext-anuj.dhamija at nokia.com (ext-anuj.dhamija@nokia.com)
Date: Fri May 23 06:33:05 2008
Subject: [datatype-dev] RE: [Nokia-private-dev] FW: CR: DHAR_7DLSSC - Helix
	crashes while playing WMV file with multiple Audi Streams -
	Resubmission
In-Reply-To: <4836CBAD.9000802@real.com>
References: <2198383E1141814486F0B881B3260CF50257E8A6@daebe103.NOE.Nokia.com>
	<4836CBAD.9000802@real.com>
Message-ID: <2198383E1141814486F0B881B3260CF5025B9BBA@daebe103.NOE.Nokia.com>

Hi Greg,

So you want me to check-in this on 310atlas branch in addition to
221Caynnes, 220Caynnes and Head?

Thnx & Regds
AD 

-----Original Message-----
From: ext Greg Wright [mailto:gwright@real.com] 
Sent: Friday, May 23, 2008 8:51 AM
To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas)
Cc: datatype-dev@helixcommunity.org;
nokia-private-dev@helixcommunity.org
Subject: Re: [Nokia-private-dev] FW: CR: DHAR_7DLSSC - Helix crashes
while playing WMV file with multiple Audi Streams - Resubmission

Looks good to me.

This is needed on all branches that this code exists, since this is a
security problem (buffer overruns can lead to arbitrary code execution).

--greg.

ext-anuj.dhamija@nokia.com wrote:
> 
>                   "Nokia submits this code under the terms of a
>                   commercial contribution agreement with RealNetworks,
>                   and I am authorized to contribute this code under
said
>                   agreement."
> 
>                    
>                   Modified by:  ext-anuj.dhamija@nokia.com
>                    
>                   Reviewed by:
>                    
>                   Date: 05/21/2008
>                    
>                   Project: SymbianMmf_wm
> 
>                   TSW Error ID: DHAR_7DLSSC
>                    
>                   Synopsis: Multiple Audio Streams in WMV File cause
>                   Helix Audiocontroller Crash
> 
>                   Overview:
>                   In WM Audio Format
(CWMAduiFormat::UpdateAudioFormat)
>                   output buffer for decoded data is allocated with
size
>                   for the stream which is selected as initial active
>                   stream based on sampling rate and number of channels
>                   (in CWMAudioFormat::ChooseInitialActiveSubStream
>                   method). This buffer is then used for decoder output
>                   disregard of the fact that which stream gets
decoded.
>                   As long as the decoded stream is of less bitrate
than
>                   the one chosen as active, there is no problem. But
>                   when the stream to be decoded is of higher bit rate
>                   than the one chosen as active ,then decoded output
>                   overflows the output buffer causing the crash.
> 
>                   Fix:
>                   Instead of allocating the output decoder buffer with
>                   respect to the selected stream, allocate it outside
>                   UpdateAudioFormat method using the size of stream
>                   which requires maximum decoder buffer size.
> 
>                   Introduce new Function AllocateDecoderBuffer which
>                   scans through all the substreams and selects theh
max
>                   buffer size and use that to allocate decoder buffer.
>                   Remove the logic of allocating decoder buffer from
>                   UpdateAudioFormat function.
> 
>                   Files modified & changes:
>                   src\datatype\wm\audio\renderer\wmaformat.cpp
>                   src\datatype\wm\audio\renderer\wmaformat.h
> 
>                   Image Size and Heap Use impact: None
> 
>                   Module Release testing (STIF, Audio) : Passed
> 
>                   Test case(s) Added  : No
> 
>                   Memory leak check performed : Passed, No leaks found
>                    
>                   Platforms and Profiles Build Verified:
>                   helix-client-s60-50-mmf-mdf-arm
> 
>                   Platforms and Profiles Functionality verified: armv5
>                    
>                   Branch: Head, 210CayS
> 
> 
> Index: wmaformat.cpp
> ===================================================================
> RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
> retrieving revision 1.4
> diff -u -w -r1.4 wmaformat.cpp
> --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4
> +++ wmaformat.cpp       22 May 2008 20:45:06 -0000
> @@ -137,6 +137,9 @@
>                      // Set the source properties ("SrcCodec" and 
> "SrcBitRate").
>                      // These are needed for transcoding.
>                      SetSourceProperties(pHeader);
> +                    retVal = AllocateDecoderBuffer();
> +                    if(SUCCEEDED(retVal))
> +                    {
>                          // Update the CHXAudioStream format
>                          retVal =
> UpdateAudioFormat(m_ulLastDecodedEndTimeInSamples, TRUE); // force an 
> update
>                          if (SUCCEEDED(retVal)) @@ -166,6 +169,8 @@
>                  }
>              }
>           }
> +      }
> +
>         HX_RELEASE(pOpaqueData);
>      }
> 
> @@ -206,6 +211,48 @@
>      return bRet;
>  }
> 
> +HX_RESULT CWMAudioFormat::AllocateDecoderBuffer()
> +{
> +
> +       HX_RESULT retVal = HXR_FAIL;
> +       UINT32  ulMaxSamplesOut = 0;
> +
> +       // Loop through the substreams and determine
> +       //then max sampleOut
> +       for (int i = 0; i < m_ulNumSubStreams; i++)
> +       {
> +               // Make sure we have a CWMAudioDecoder for this
substream
> +               if (m_ppWMAudioDecoder[i])
> +               {
> +                       UINT32 samplesOut = 0;
> +                       retVal =
> m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&samplesOut);
> +                       if(SUCCEEDED(retVal))
> +                       {
> +                               if(samplesOut>ulMaxSamplesOut)
> +                               {
> +                                       ulMaxSamplesOut = samplesOut;
> +                               }
> +                       }
> +                       else return retVal;
> +               }
> +       }
> +
> +       m_ulDecoderBufferSize =
> CAudioFormat::ConvertSamplesToBytes(ulMaxSamplesOut);
> +
> +       // Allocate a new decoder buffer
> +       HX_VECTOR_DELETE(m_pDecoderBuffer);
> +       m_pDecoderBuffer = new BYTE [m_ulDecoderBufferSize];
> +
> +       if (!m_pDecoderBuffer)
> +       {
> +               // return Out Of Memory
> +               retVal = HXR_OUTOFMEMORY;
> +               // reset decoder buffer size to zero
> +               m_ulDecoderBufferSize = 0;
> +       }
> +
> +       return retVal;
> +}
>  HX_RESULT CWMAudioFormat::UpdateAudioFormat(UINT32&
> rulAnchorTimeInSamples, HXBOOL bForceUpdate)  {
>      HX_RESULT retVal = HXR_FAIL;
> @@ -286,26 +333,6 @@
>                  m_ulCodecDelayInMs = 
> CAudioFormat::ConvertSamplesToMs(ulCodecDelaySamples);
>              }
>          }
> -        // Allocate Decoder Buffer
> -        if (SUCCEEDED(retVal))
> -        {
> -            // Did the size change?
> -            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
> -            {
> -                // Set the return value
> -                retVal = HXR_OUTOFMEMORY;
> -                // Allocate a new decoder buffer
> -                HX_VECTOR_DELETE(m_pDecoderBuffer);
> -                m_pDecoderBuffer = new BYTE
[m_ulMaxDecoderOutputBytes];
> -                if (m_pDecoderBuffer)
> -                {
> -                    // Clear the return value
> -                    retVal = HXR_OK;
> -                    // Save the decoder buffer size
> -                    m_ulDecoderBufferSize =
m_ulMaxDecoderOutputBytes;
> -                }
> -            }
> -        }
>      }
> 
>      return retVal;
> 
> Index: wmaformat.h
> ===================================================================
> RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.h,v
> retrieving revision 1.3
> diff -u -w -r1.3 wmaformat.h
> --- wmaformat.h 5 Jul 2006 14:49:56 -0000       1.3
> +++ wmaformat.h 21 May 2008 22:56:46 -0000
> @@ -101,6 +101,7 @@
>      // Protected CWMAudioFormat methods
>      void          _Reset(void);
>      void          ClearDecoderArray(void);
> +   HX_RESULT     AllocateDecoderBuffer();
>      HX_RESULT     UpdateAudioFormat(UINT32& rulAnchorTime, HXBOOL 
> bForceUpdate = FALSE);
>      HX_RESULT     ParseOpaqueData(IHXBuffer* pBuffer);
>      HX_RESULT     ChooseInitialActiveSubStream(void);
> 
> 
> ______________________________________________
> 
> *thnx & regds*
> *AD*
> 
> 
> ----------------------------------------------------------------------
> --
> 
> _______________________________________________
> Nokia-private-dev mailing list
> Nokia-private-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/nokia-private-dev


From gwright at real.com  Fri May 23 07:58:05 2008
From: gwright at real.com (Greg Wright)
Date: Fri May 23 06:44:48 2008
Subject: [datatype-dev] Re: [Nokia-private-dev] FW: CR: DHAR_7DLSSC - Helix
 crashes while
 playing WMV file with multiple Audi Streams - Resubmission
In-Reply-To: <2198383E1141814486F0B881B3260CF5025B9BBA@daebe103.NOE.Nokia.com>
References: <2198383E1141814486F0B881B3260CF50257E8A6@daebe103.NOE.Nokia.com>
	<4836CBAD.9000802@real.com>
	<2198383E1141814486F0B881B3260CF5025B9BBA@daebe103.NOE.Nokia.com>
Message-ID: <4836DB7D.2020501@real.com>

ext-anuj.dhamija@nokia.com wrote:
> Hi Greg,
> 
> So you want me to check-in this on 310atlas branch in addition to
> 221Caynnes, 220Caynnes and Head?

Eric will know best, I am not sure what branches have what WM
support.

--greg.

> 
> Thnx & Regds
> AD 
> 
> -----Original Message-----
> From: ext Greg Wright [mailto:gwright@real.com] 
> Sent: Friday, May 23, 2008 8:51 AM
> To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas)
> Cc: datatype-dev@helixcommunity.org;
> nokia-private-dev@helixcommunity.org
> Subject: Re: [Nokia-private-dev] FW: CR: DHAR_7DLSSC - Helix crashes
> while playing WMV file with multiple Audi Streams - Resubmission
> 
> Looks good to me.
> 
> This is needed on all branches that this code exists, since this is a
> security problem (buffer overruns can lead to arbitrary code execution).
> 
> --greg.
> 
> ext-anuj.dhamija@nokia.com wrote:
>>                   "Nokia submits this code under the terms of a
>>                   commercial contribution agreement with RealNetworks,
>>                   and I am authorized to contribute this code under
> said
>>                   agreement."
>>
>>                    
>>                   Modified by:  ext-anuj.dhamija@nokia.com
>>                    
>>                   Reviewed by:
>>                    
>>                   Date: 05/21/2008
>>                    
>>                   Project: SymbianMmf_wm
>>
>>                   TSW Error ID: DHAR_7DLSSC
>>                    
>>                   Synopsis: Multiple Audio Streams in WMV File cause
>>                   Helix Audiocontroller Crash
>>
>>                   Overview:
>>                   In WM Audio Format
> (CWMAduiFormat::UpdateAudioFormat)
>>                   output buffer for decoded data is allocated with
> size
>>                   for the stream which is selected as initial active
>>                   stream based on sampling rate and number of channels
>>                   (in CWMAudioFormat::ChooseInitialActiveSubStream
>>                   method). This buffer is then used for decoder output
>>                   disregard of the fact that which stream gets
> decoded.
>>                   As long as the decoded stream is of less bitrate
> than
>>                   the one chosen as active, there is no problem. But
>>                   when the stream to be decoded is of higher bit rate
>>                   than the one chosen as active ,then decoded output
>>                   overflows the output buffer causing the crash.
>>
>>                   Fix:
>>                   Instead of allocating the output decoder buffer with
>>                   respect to the selected stream, allocate it outside
>>                   UpdateAudioFormat method using the size of stream
>>                   which requires maximum decoder buffer size.
>>
>>                   Introduce new Function AllocateDecoderBuffer which
>>                   scans through all the substreams and selects theh
> max
>>                   buffer size and use that to allocate decoder buffer.
>>                   Remove the logic of allocating decoder buffer from
>>                   UpdateAudioFormat function.
>>
>>                   Files modified & changes:
>>                   src\datatype\wm\audio\renderer\wmaformat.cpp
>>                   src\datatype\wm\audio\renderer\wmaformat.h
>>
>>                   Image Size and Heap Use impact: None
>>
>>                   Module Release testing (STIF, Audio) : Passed
>>
>>                   Test case(s) Added  : No
>>
>>                   Memory leak check performed : Passed, No leaks found
>>                    
>>                   Platforms and Profiles Build Verified:
>>                   helix-client-s60-50-mmf-mdf-arm
>>
>>                   Platforms and Profiles Functionality verified: armv5
>>                    
>>                   Branch: Head, 210CayS
>>
>>
>> Index: wmaformat.cpp
>> ===================================================================
>> RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
>> retrieving revision 1.4
>> diff -u -w -r1.4 wmaformat.cpp
>> --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4
>> +++ wmaformat.cpp       22 May 2008 20:45:06 -0000
>> @@ -137,6 +137,9 @@
>>                      // Set the source properties ("SrcCodec" and 
>> "SrcBitRate").
>>                      // These are needed for transcoding.
>>                      SetSourceProperties(pHeader);
>> +                    retVal = AllocateDecoderBuffer();
>> +                    if(SUCCEEDED(retVal))
>> +                    {
>>                          // Update the CHXAudioStream format
>>                          retVal =
>> UpdateAudioFormat(m_ulLastDecodedEndTimeInSamples, TRUE); // force an 
>> update
>>                          if (SUCCEEDED(retVal)) @@ -166,6 +169,8 @@
>>                  }
>>              }
>>           }
>> +      }
>> +
>>         HX_RELEASE(pOpaqueData);
>>      }
>>
>> @@ -206,6 +211,48 @@
>>      return bRet;
>>  }
>>
>> +HX_RESULT CWMAudioFormat::AllocateDecoderBuffer()
>> +{
>> +
>> +       HX_RESULT retVal = HXR_FAIL;
>> +       UINT32  ulMaxSamplesOut = 0;
>> +
>> +       // Loop through the substreams and determine
>> +       //then max sampleOut
>> +       for (int i = 0; i < m_ulNumSubStreams; i++)
>> +       {
>> +               // Make sure we have a CWMAudioDecoder for this
> substream
>> +               if (m_ppWMAudioDecoder[i])
>> +               {
>> +                       UINT32 samplesOut = 0;
>> +                       retVal =
>> m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&samplesOut);
>> +                       if(SUCCEEDED(retVal))
>> +                       {
>> +                               if(samplesOut>ulMaxSamplesOut)
>> +                               {
>> +                                       ulMaxSamplesOut = samplesOut;
>> +                               }
>> +                       }
>> +                       else return retVal;
>> +               }
>> +       }
>> +
>> +       m_ulDecoderBufferSize =
>> CAudioFormat::ConvertSamplesToBytes(ulMaxSamplesOut);
>> +
>> +       // Allocate a new decoder buffer
>> +       HX_VECTOR_DELETE(m_pDecoderBuffer);
>> +       m_pDecoderBuffer = new BYTE [m_ulDecoderBufferSize];
>> +
>> +       if (!m_pDecoderBuffer)
>> +       {
>> +               // return Out Of Memory
>> +               retVal = HXR_OUTOFMEMORY;
>> +               // reset decoder buffer size to zero
>> +               m_ulDecoderBufferSize = 0;
>> +       }
>> +
>> +       return retVal;
>> +}
>>  HX_RESULT CWMAudioFormat::UpdateAudioFormat(UINT32&
>> rulAnchorTimeInSamples, HXBOOL bForceUpdate)  {
>>      HX_RESULT retVal = HXR_FAIL;
>> @@ -286,26 +333,6 @@
>>                  m_ulCodecDelayInMs = 
>> CAudioFormat::ConvertSamplesToMs(ulCodecDelaySamples);
>>              }
>>          }
>> -        // Allocate Decoder Buffer
>> -        if (SUCCEEDED(retVal))
>> -        {
>> -            // Did the size change?
>> -            if (m_ulDecoderBufferSize != m_ulMaxDecoderOutputBytes)
>> -            {
>> -                // Set the return value
>> -                retVal = HXR_OUTOFMEMORY;
>> -                // Allocate a new decoder buffer
>> -                HX_VECTOR_DELETE(m_pDecoderBuffer);
>> -                m_pDecoderBuffer = new BYTE
> [m_ulMaxDecoderOutputBytes];
>> -                if (m_pDecoderBuffer)
>> -                {
>> -                    // Clear the return value
>> -                    retVal = HXR_OK;
>> -                    // Save the decoder buffer size
>> -                    m_ulDecoderBufferSize =
> m_ulMaxDecoderOutputBytes;
>> -                }
>> -            }
>> -        }
>>      }
>>
>>      return retVal;
>>
>> Index: wmaformat.h
>> ===================================================================
>> RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.h,v
>> retrieving revision 1.3
>> diff -u -w -r1.3 wmaformat.h
>> --- wmaformat.h 5 Jul 2006 14:49:56 -0000       1.3
>> +++ wmaformat.h 21 May 2008 22:56:46 -0000
>> @@ -101,6 +101,7 @@
>>      // Protected CWMAudioFormat methods
>>      void          _Reset(void);
>>      void          ClearDecoderArray(void);
>> +   HX_RESULT     AllocateDecoderBuffer();
>>      HX_RESULT     UpdateAudioFormat(UINT32& rulAnchorTime, HXBOOL 
>> bForceUpdate = FALSE);
>>      HX_RESULT     ParseOpaqueData(IHXBuffer* pBuffer);
>>      HX_RESULT     ChooseInitialActiveSubStream(void);
>>
>>
>> ______________________________________________
>>
>> *thnx & regds*
>> *AD*
>>
>>
>> ----------------------------------------------------------------------
>> --
>>
>> _______________________________________________
>> Nokia-private-dev mailing list
>> Nokia-private-dev@helixcommunity.org
>> http://lists.helixcommunity.org/mailman/listinfo/nokia-private-dev
> 
> 


From ehyche at real.com  Fri May 23 08:11:30 2008
From: ehyche at real.com (Eric Hyche)
Date: Fri May 23 06:58:12 2008
Subject: [datatype-dev] Re: [Nokia-private-dev] FW: CR: DHAR_7DLSSC -
	Helix crashes while playing WMV file with multiple Audi Streams
	- Resubmission
In-Reply-To: <4836DB7D.2020501@real.com>
References: <2198383E1141814486F0B881B3260CF50257E8A6@daebe103.NOE.Nokia.com><4836CBAD.9000802@real.com><2198383E1141814486F0B881B3260CF5025B9BBA@daebe103.NOE.Nokia.com>
	<4836DB7D.2020501@real.com>
Message-ID: <00be01c8bce7$4894fcd0$db68a8c0@EHYCHED620>


Yes, please check in to the hxclient_3_1_0_atlas branch
as well.

Eric

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: datatype-dev-bounces@helixcommunity.org 
> [mailto:datatype-dev-bounces@helixcommunity.org] On Behalf Of 
> Greg Wright
> Sent: Friday, May 23, 2008 10:58 AM
> To: ext-anuj.dhamija@nokia.com
> Cc: nokia-private-dev@helixcommunity.org; 
> datatype-dev@helixcommunity.org
> Subject: [datatype-dev] Re: [Nokia-private-dev] FW: CR: 
> DHAR_7DLSSC - Helix crashes while playing WMV file with 
> multiple Audi Streams - Resubmission
> 
> ext-anuj.dhamija@nokia.com wrote:
> > Hi Greg,
> > 
> > So you want me to check-in this on 310atlas branch in addition to
> > 221Caynnes, 220Caynnes and Head?
> 
> Eric will know best, I am not sure what branches have what WM
> support.
> 
> --greg.
> 
> > 
> > Thnx & Regds
> > AD 
> > 
> > -----Original Message-----
> > From: ext Greg Wright [mailto:gwright@real.com] 
> > Sent: Friday, May 23, 2008 8:51 AM
> > To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas)
> > Cc: datatype-dev@helixcommunity.org;
> > nokia-private-dev@helixcommunity.org
> > Subject: Re: [Nokia-private-dev] FW: CR: DHAR_7DLSSC - Helix crashes
> > while playing WMV file with multiple Audi Streams - Resubmission
> > 
> > Looks good to me.
> > 
> > This is needed on all branches that this code exists, since 
> this is a
> > security problem (buffer overruns can lead to arbitrary 
> code execution).
> > 
> > --greg.
> > 
> > ext-anuj.dhamija@nokia.com wrote:
> >>                   "Nokia submits this code under the terms of a
> >>                   commercial contribution agreement with 
> RealNetworks,
> >>                   and I am authorized to contribute this code under
> > said
> >>                   agreement."
> >>
> >>                    
> >>                   Modified by:  ext-anuj.dhamija@nokia.com
> >>                    
> >>                   Reviewed by:
> >>                    
> >>                   Date: 05/21/2008
> >>                    
> >>                   Project: SymbianMmf_wm
> >>
> >>                   TSW Error ID: DHAR_7DLSSC
> >>                    
> >>                   Synopsis: Multiple Audio Streams in WMV 
> File cause
> >>                   Helix Audiocontroller Crash
> >>
> >>                   Overview:
> >>                   In WM Audio Format
> > (CWMAduiFormat::UpdateAudioFormat)
> >>                   output buffer for decoded data is allocated with
> > size
> >>                   for the stream which is selected as 
> initial active
> >>                   stream based on sampling rate and number 
> of channels
> >>                   (in CWMAudioFormat::ChooseInitialActiveSubStream
> >>                   method). This buffer is then used for 
> decoder output
> >>                   disregard of the fact that which stream gets
> > decoded.
> >>                   As long as the decoded stream is of less bitrate
> > than
> >>                   the one chosen as active, there is no 
> problem. But
> >>                   when the stream to be decoded is of 
> higher bit rate
> >>                   than the one chosen as active ,then 
> decoded output
> >>                   overflows the output buffer causing the crash.
> >>
> >>                   Fix:
> >>                   Instead of allocating the output decoder 
> buffer with
> >>                   respect to the selected stream, allocate 
> it outside
> >>                   UpdateAudioFormat method using the size of stream
> >>                   which requires maximum decoder buffer size.
> >>
> >>                   Introduce new Function 
> AllocateDecoderBuffer which
> >>                   scans through all the substreams and selects theh
> > max
> >>                   buffer size and use that to allocate 
> decoder buffer.
> >>                   Remove the logic of allocating decoder 
> buffer from
> >>                   UpdateAudioFormat function.
> >>
> >>                   Files modified & changes:
> >>                   src\datatype\wm\audio\renderer\wmaformat.cpp
> >>                   src\datatype\wm\audio\renderer\wmaformat.h
> >>
> >>                   Image Size and Heap Use impact: None
> >>
> >>                   Module Release testing (STIF, Audio) : Passed
> >>
> >>                   Test case(s) Added  : No
> >>
> >>                   Memory leak check performed : Passed, No 
> leaks found
> >>                    
> >>                   Platforms and Profiles Build Verified:
> >>                   helix-client-s60-50-mmf-mdf-arm
> >>
> >>                   Platforms and Profiles Functionality 
> verified: armv5
> >>                    
> >>                   Branch: Head, 210CayS
> >>
> >>
> >> Index: wmaformat.cpp
> >> ===================================================================
> >> RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
> >> retrieving revision 1.4
> >> diff -u -w -r1.4 wmaformat.cpp
> >> --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4
> >> +++ wmaformat.cpp       22 May 2008 20:45:06 -0000
> >> @@ -137,6 +137,9 @@
> >>                      // Set the source properties ("SrcCodec" and 
> >> "SrcBitRate").
> >>                      // These are needed for transcoding.
> >>                      SetSourceProperties(pHeader);
> >> +                    retVal = AllocateDecoderBuffer();
> >> +                    if(SUCCEEDED(retVal))
> >> +                    {
> >>                          // Update the CHXAudioStream format
> >>                          retVal =
> >> UpdateAudioFormat(m_ulLastDecodedEndTimeInSamples, TRUE); 
> // force an 
> >> update
> >>                          if (SUCCEEDED(retVal)) @@ -166,6 +169,8 @@
> >>                  }
> >>              }
> >>           }
> >> +      }
> >> +
> >>         HX_RELEASE(pOpaqueData);
> >>      }
> >>
> >> @@ -206,6 +211,48 @@
> >>      return bRet;
> >>  }
> >>
> >> +HX_RESULT CWMAudioFormat::AllocateDecoderBuffer()
> >> +{
> >> +
> >> +       HX_RESULT retVal = HXR_FAIL;
> >> +       UINT32  ulMaxSamplesOut = 0;
> >> +
> >> +       // Loop through the substreams and determine
> >> +       //then max sampleOut
> >> +       for (int i = 0; i < m_ulNumSubStreams; i++)
> >> +       {
> >> +               // Make sure we have a CWMAudioDecoder for this
> > substream
> >> +               if (m_ppWMAudioDecoder[i])
> >> +               {
> >> +                       UINT32 samplesOut = 0;
> >> +                       retVal =
> >> m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&samplesOut);
> >> +                       if(SUCCEEDED(retVal))
> >> +                       {
> >> +                               if(samplesOut>ulMaxSamplesOut)
> >> +                               {
> >> +                                       ulMaxSamplesOut = 
> samplesOut;
> >> +                               }
> >> +                       }
> >> +                       else return retVal;
> >> +               }
> >> +       }
> >> +
> >> +       m_ulDecoderBufferSize =
> >> CAudioFormat::ConvertSamplesToBytes(ulMaxSamplesOut);
> >> +
> >> +       // Allocate a new decoder buffer
> >> +       HX_VECTOR_DELETE(m_pDecoderBuffer);
> >> +       m_pDecoderBuffer = new BYTE [m_ulDecoderBufferSize];
> >> +
> >> +       if (!m_pDecoderBuffer)
> >> +       {
> >> +               // return Out Of Memory
> >> +               retVal = HXR_OUTOFMEMORY;
> >> +               // reset decoder buffer size to zero
> >> +               m_ulDecoderBufferSize = 0;
> >> +       }
> >> +
> >> +       return retVal;
> >> +}
> >>  HX_RESULT CWMAudioFormat::UpdateAudioFormat(UINT32&
> >> rulAnchorTimeInSamples, HXBOOL bForceUpdate)  {
> >>      HX_RESULT retVal = HXR_FAIL;
> >> @@ -286,26 +333,6 @@
> >>                  m_ulCodecDelayInMs = 
> >> CAudioFormat::ConvertSamplesToMs(ulCodecDelaySamples);
> >>              }
> >>          }
> >> -        // Allocate Decoder Buffer
> >> -        if (SUCCEEDED(retVal))
> >> -        {
> >> -            // Did the size change?
> >> -            if (m_ulDecoderBufferSize != 
> m_ulMaxDecoderOutputBytes)
> >> -            {
> >> -                // Set the return value
> >> -                retVal = HXR_OUTOFMEMORY;
> >> -                // Allocate a new decoder buffer
> >> -                HX_VECTOR_DELETE(m_pDecoderBuffer);
> >> -                m_pDecoderBuffer = new BYTE
> > [m_ulMaxDecoderOutputBytes];
> >> -                if (m_pDecoderBuffer)
> >> -                {
> >> -                    // Clear the return value
> >> -                    retVal = HXR_OK;
> >> -                    // Save the decoder buffer size
> >> -                    m_ulDecoderBufferSize =
> > m_ulMaxDecoderOutputBytes;
> >> -                }
> >> -            }
> >> -        }
> >>      }
> >>
> >>      return retVal;
> >>
> >> Index: wmaformat.h
> >> ===================================================================
> >> RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.h,v
> >> retrieving revision 1.3
> >> diff -u -w -r1.3 wmaformat.h
> >> --- wmaformat.h 5 Jul 2006 14:49:56 -0000       1.3
> >> +++ wmaformat.h 21 May 2008 22:56:46 -0000
> >> @@ -101,6 +101,7 @@
> >>      // Protected CWMAudioFormat methods
> >>      void          _Reset(void);
> >>      void          ClearDecoderArray(void);
> >> +   HX_RESULT     AllocateDecoderBuffer();
> >>      HX_RESULT     UpdateAudioFormat(UINT32& rulAnchorTime, HXBOOL 
> >> bForceUpdate = FALSE);
> >>      HX_RESULT     ParseOpaqueData(IHXBuffer* pBuffer);
> >>      HX_RESULT     ChooseInitialActiveSubStream(void);
> >>
> >>
> >> ______________________________________________
> >>
> >> *thnx & regds*
> >> *AD*
> >>
> >>
> >> 
> ----------------------------------------------------------------------
> >> --
> >>
> >> _______________________________________________
> >> Nokia-private-dev mailing list
> >> Nokia-private-dev@helixcommunity.org
> >> http://lists.helixcommunity.org/mailman/listinfo/nokia-private-dev
> > 
> > 
> 
> 
> _______________________________________________
> Datatype-dev mailing list
> Datatype-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
> 


From ext-anuj.dhamija at nokia.com  Fri May 23 08:51:37 2008
From: ext-anuj.dhamija at nokia.com (ext-anuj.dhamija@nokia.com)
Date: Fri May 23 07:40:36 2008
Subject: [datatype-dev] CN: DHAR_7DLSSC - Helix crashes while playing WMV
	file with multiple Audi Streams - Resubmission
In-Reply-To: <00be01c8bce7$4894fcd0$db68a8c0@EHYCHED620>
References: <2198383E1141814486F0B881B3260CF50257E8A6@daebe103.NOE.Nokia.com><4836CBAD.9000802@real.com><2198383E1141814486F0B881B3260CF5025B9BBA@daebe103.NOE.Nokia.com>
	<4836DB7D.2020501@real.com>
	<00be01c8bce7$4894fcd0$db68a8c0@EHYCHED620>
Message-ID: <2198383E1141814486F0B881B3260CF5025B9C63@daebe103.NOE.Nokia.com>

Checkins commited to branch Head, 221Cayns, 220Cayns and 310Atlas.

Thnx & regds
AD

-----Original Message-----
From: ext Eric Hyche [mailto:ehyche@real.com] 
Sent: Friday, May 23, 2008 10:12 AM
To: 'Greg Wright'; Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas)
Cc: nokia-private-dev@helixcommunity.org;
datatype-dev@helixcommunity.org
Subject: RE: [datatype-dev] Re: [Nokia-private-dev] FW: CR: DHAR_7DLSSC
- Helix crashes while playing WMV file with multiple Audi Streams -
Resubmission


Yes, please check in to the hxclient_3_1_0_atlas branch as well.

Eric

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: datatype-dev-bounces@helixcommunity.org
> [mailto:datatype-dev-bounces@helixcommunity.org] On Behalf Of Greg 
> Wright
> Sent: Friday, May 23, 2008 10:58 AM
> To: ext-anuj.dhamija@nokia.com
> Cc: nokia-private-dev@helixcommunity.org;
> datatype-dev@helixcommunity.org
> Subject: [datatype-dev] Re: [Nokia-private-dev] FW: CR: 
> DHAR_7DLSSC - Helix crashes while playing WMV file with multiple Audi 
> Streams - Resubmission
> 
> ext-anuj.dhamija@nokia.com wrote:
> > Hi Greg,
> > 
> > So you want me to check-in this on 310atlas branch in addition to 
> > 221Caynnes, 220Caynnes and Head?
> 
> Eric will know best, I am not sure what branches have what WM support.
> 
> --greg.
> 
> > 
> > Thnx & Regds
> > AD
> > 
> > -----Original Message-----
> > From: ext Greg Wright [mailto:gwright@real.com]
> > Sent: Friday, May 23, 2008 8:51 AM
> > To: Dhamija Anuj (EXT-InfoVisionConsultants-MSW/Dallas)
> > Cc: datatype-dev@helixcommunity.org; 
> > nokia-private-dev@helixcommunity.org
> > Subject: Re: [Nokia-private-dev] FW: CR: DHAR_7DLSSC - Helix crashes

> > while playing WMV file with multiple Audi Streams - Resubmission
> > 
> > Looks good to me.
> > 
> > This is needed on all branches that this code exists, since
> this is a
> > security problem (buffer overruns can lead to arbitrary
> code execution).
> > 
> > --greg.
> > 
> > ext-anuj.dhamija@nokia.com wrote:
> >>                   "Nokia submits this code under the terms of a
> >>                   commercial contribution agreement with
> RealNetworks,
> >>                   and I am authorized to contribute this code under
> > said
> >>                   agreement."
> >>
> >>                    
> >>                   Modified by:  ext-anuj.dhamija@nokia.com
> >>                    
> >>                   Reviewed by:
> >>                    
> >>                   Date: 05/21/2008
> >>                    
> >>                   Project: SymbianMmf_wm
> >>
> >>                   TSW Error ID: DHAR_7DLSSC
> >>                    
> >>                   Synopsis: Multiple Audio Streams in WMV
> File cause
> >>                   Helix Audiocontroller Crash
> >>
> >>                   Overview:
> >>                   In WM Audio Format
> > (CWMAduiFormat::UpdateAudioFormat)
> >>                   output buffer for decoded data is allocated with
> > size
> >>                   for the stream which is selected as
> initial active
> >>                   stream based on sampling rate and number
> of channels
> >>                   (in CWMAudioFormat::ChooseInitialActiveSubStream
> >>                   method). This buffer is then used for
> decoder output
> >>                   disregard of the fact that which stream gets
> > decoded.
> >>                   As long as the decoded stream is of less bitrate
> > than
> >>                   the one chosen as active, there is no
> problem. But
> >>                   when the stream to be decoded is of
> higher bit rate
> >>                   than the one chosen as active ,then
> decoded output
> >>                   overflows the output buffer causing the crash.
> >>
> >>                   Fix:
> >>                   Instead of allocating the output decoder
> buffer with
> >>                   respect to the selected stream, allocate
> it outside
> >>                   UpdateAudioFormat method using the size of stream
> >>                   which requires maximum decoder buffer size.
> >>
> >>                   Introduce new Function
> AllocateDecoderBuffer which
> >>                   scans through all the substreams and selects theh
> > max
> >>                   buffer size and use that to allocate
> decoder buffer.
> >>                   Remove the logic of allocating decoder
> buffer from
> >>                   UpdateAudioFormat function.
> >>
> >>                   Files modified & changes:
> >>                   src\datatype\wm\audio\renderer\wmaformat.cpp
> >>                   src\datatype\wm\audio\renderer\wmaformat.h
> >>
> >>                   Image Size and Heap Use impact: None
> >>
> >>                   Module Release testing (STIF, Audio) : Passed
> >>
> >>                   Test case(s) Added  : No
> >>
> >>                   Memory leak check performed : Passed, No
> leaks found
> >>                    
> >>                   Platforms and Profiles Build Verified:
> >>                   helix-client-s60-50-mmf-mdf-arm
> >>
> >>                   Platforms and Profiles Functionality
> verified: armv5
> >>                    
> >>                   Branch: Head, 210CayS
> >>
> >>
> >> Index: wmaformat.cpp
> >> ===================================================================
> >> RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.cpp,v
> >> retrieving revision 1.4
> >> diff -u -w -r1.4 wmaformat.cpp
> >> --- wmaformat.cpp       5 Jul 2006 14:49:56 -0000       1.4
> >> +++ wmaformat.cpp       22 May 2008 20:45:06 -0000
> >> @@ -137,6 +137,9 @@
> >>                      // Set the source properties ("SrcCodec" and 
> >> "SrcBitRate").
> >>                      // These are needed for transcoding.
> >>                      SetSourceProperties(pHeader);
> >> +                    retVal = AllocateDecoderBuffer();
> >> +                    if(SUCCEEDED(retVal))
> >> +                    {
> >>                          // Update the CHXAudioStream format
> >>                          retVal =
> >> UpdateAudioFormat(m_ulLastDecodedEndTimeInSamples, TRUE);
> // force an
> >> update
> >>                          if (SUCCEEDED(retVal)) @@ -166,6 +169,8 @@
> >>                  }
> >>              }
> >>           }
> >> +      }
> >> +
> >>         HX_RELEASE(pOpaqueData);
> >>      }
> >>
> >> @@ -206,6 +211,48 @@
> >>      return bRet;
> >>  }
> >>
> >> +HX_RESULT CWMAudioFormat::AllocateDecoderBuffer()
> >> +{
> >> +
> >> +       HX_RESULT retVal = HXR_FAIL;
> >> +       UINT32  ulMaxSamplesOut = 0;
> >> +
> >> +       // Loop through the substreams and determine
> >> +       //then max sampleOut
> >> +       for (int i = 0; i < m_ulNumSubStreams; i++)
> >> +       {
> >> +               // Make sure we have a CWMAudioDecoder for this
> > substream
> >> +               if (m_ppWMAudioDecoder[i])
> >> +               {
> >> +                       UINT32 samplesOut = 0;
> >> +                       retVal =
> >> m_ppWMAudioDecoder[i]->GetMaxSamplesOut(&samplesOut);
> >> +                       if(SUCCEEDED(retVal))
> >> +                       {
> >> +                               if(samplesOut>ulMaxSamplesOut)
> >> +                               {
> >> +                                       ulMaxSamplesOut =
> samplesOut;
> >> +                               }
> >> +                       }
> >> +                       else return retVal;
> >> +               }
> >> +       }
> >> +
> >> +       m_ulDecoderBufferSize =
> >> CAudioFormat::ConvertSamplesToBytes(ulMaxSamplesOut);
> >> +
> >> +       // Allocate a new decoder buffer
> >> +       HX_VECTOR_DELETE(m_pDecoderBuffer);
> >> +       m_pDecoderBuffer = new BYTE [m_ulDecoderBufferSize];
> >> +
> >> +       if (!m_pDecoderBuffer)
> >> +       {
> >> +               // return Out Of Memory
> >> +               retVal = HXR_OUTOFMEMORY;
> >> +               // reset decoder buffer size to zero
> >> +               m_ulDecoderBufferSize = 0;
> >> +       }
> >> +
> >> +       return retVal;
> >> +}
> >>  HX_RESULT CWMAudioFormat::UpdateAudioFormat(UINT32&
> >> rulAnchorTimeInSamples, HXBOOL bForceUpdate)  {
> >>      HX_RESULT retVal = HXR_FAIL;
> >> @@ -286,26 +333,6 @@
> >>                  m_ulCodecDelayInMs = 
> >> CAudioFormat::ConvertSamplesToMs(ulCodecDelaySamples);
> >>              }
> >>          }
> >> -        // Allocate Decoder Buffer
> >> -        if (SUCCEEDED(retVal))
> >> -        {
> >> -            // Did the size change?
> >> -            if (m_ulDecoderBufferSize != 
> m_ulMaxDecoderOutputBytes)
> >> -            {
> >> -                // Set the return value
> >> -                retVal = HXR_OUTOFMEMORY;
> >> -                // Allocate a new decoder buffer
> >> -                HX_VECTOR_DELETE(m_pDecoderBuffer);
> >> -                m_pDecoderBuffer = new BYTE
> > [m_ulMaxDecoderOutputBytes];
> >> -                if (m_pDecoderBuffer)
> >> -                {
> >> -                    // Clear the return value
> >> -                    retVal = HXR_OK;
> >> -                    // Save the decoder buffer size
> >> -                    m_ulDecoderBufferSize =
> > m_ulMaxDecoderOutputBytes;
> >> -                }
> >> -            }
> >> -        }
> >>      }
> >>
> >>      return retVal;
> >>
> >> Index: wmaformat.h
> >> ===================================================================
> >> RCS file: /cvsroot/datatype/wm/audio/renderer/wmaformat.h,v
> >> retrieving revision 1.3
> >> diff -u -w -r1.3 wmaformat.h
> >> --- wmaformat.h 5 Jul 2006 14:49:56 -0000       1.3
> >> +++ wmaformat.h 21 May 2008 22:56:46 -0000
> >> @@ -101,6 +101,7 @@
> >>      // Protected CWMAudioFormat methods
> >>      void          _Reset(void);
> >>      void          ClearDecoderArray(void);
> >> +   HX_RESULT     AllocateDecoderBuffer();
> >>      HX_RESULT     UpdateAudioFormat(UINT32& rulAnchorTime, HXBOOL 
> >> bForceUpdate = FALSE);
> >>      HX_RESULT     ParseOpaqueData(IHXBuffer* pBuffer);
> >>      HX_RESULT     ChooseInitialActiveSubStream(void);
> >>
> >>
> >> ______________________________________________
> >>
> >> *thnx & regds*
> >> *AD*
> >>
> >>
> >> 
> ----------------------------------------------------------------------
> >> --
> >>
> >> _______________________________________________
> >> Nokia-private-dev mailing list
> >> Nokia-private-dev@helixcommunity.org
> >> http://lists.helixcommunity.org/mailman/listinfo/nokia-private-dev
> > 
> > 
> 
> 
> _______________________________________________
> Datatype-dev mailing list
> Datatype-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
> 


From milko at real.com  Fri May 23 10:10:26 2008
From: milko at real.com (Milko Boic)
Date: Fri May 23 08:57:23 2008
Subject: [datatype-dev]an urgent question on encoder
Message-ID: <6.2.1.2.2.20080523095602.0a55e828@mailone.real.com>


Weian,

To Eric's list, I would also add:

.m4a (AAC)
.3gp (AAC, MPEG4 Video, H.264)
.avi (MPEG4 Video, MPEG2-L3 (mp3))
.aac (ADTS)

Some of these capabilities already are present in Atlas platfom through 
dtdriver object.

- .rm (any RA or RV version)
- .mp4 (AAC, H.264 video and MPEG-4 video)
- .m4a (AAC)
- .3gp (AAC, MPEG4 Video, H.264)
- .avi (MPEG4 Video, MPEG2-L3 (mp3))
- .aac (ADTS)

More specifically, encoding from a file (any format Helix supports) to 
above formats is supported.

The work that is ahead of us is tighter integration of the playback and 
encoding components which will accomplish the following:
- reduce the code footprint
- enable capture
- provide easy ways to cross-connect capture and playback components
- provide easy to use, high level APIs for control of capture and encoding

Let us know if you need more information.

Thanks,
Milko

----------


I'm still not quite sure what you are asking. Do you mean:

- what encoding capabilities does Helix currently include, and
   what codecs can Helix encode?

I'll assume this is what you are asking, and answer that question.

In present form, Helix does not include encoding capability. Currently,
there is a separate SDK called the Helix Producer SDK that is
used for encoding.

However, we have a project scheduled for later this year to integrate
the Producer SDK into the Helix atlas platform. Some of the initial
work for this integration has already taken place. Once this work is
complete, Helix will be able to encode to:

- .rm (any RA or RV version)
- .mp4 (H.264 video and MPEG-4 video)
- .wmv (WMA 2-9 and WMV 7-9)
- .ogg (vorbis and theora)
- .mp3

Does this answer your question?

Eric
=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.

 > -----Original Message-----
 > From: Chen, Weian [mailto:weian.chen@intel.com]
 > Sent: Thursday, May 22, 2008 9:00 PM
 > To: ehyche@real.com
 > Cc: datatype-dev@helixcommunity.org
 > Subject: RE: [datatype-dev]an urgent question on encoder
 >
 >
 > Eric:
 >
 > I means how many encoder codec does Helix have, not decoder
 > codec (palyback).
 >
 > thanks
 > Weian
 > -----Original Message-----
 > From: Eric Hyche [mailto:ehyche@real.com]
 > Sent: 2008$BG/(B5$B7n(B22$BF|(B 23:38
 > To: Chen, Weian
 > Cc: datatype-dev@helixcommunity.org
 > Subject: RE: [datatype-dev]an urgent question on encoder
 >
 >
 > Well, since Helix plays back many different datatypes,
 > then it's kind of difficult to say how many different
 > encoders there are.
 >
 > What datatype(s) are you referring to?
 >
 > Eric
 >
 > =============================================
 > Eric Hyche (ehyche@real.com)
 > Technical Lead
 > RealNetworks, Inc.
 >
 > > -----Original Message-----
 > > From: Chen, Weian [mailto:weian.chen@intel.com]
 > > Sent: Thursday, May 22, 2008 2:59 AM
 > > To: Eric Hyche
 > > Cc: datatype-dev@helixcommunity.org
 > > Subject: [datatype-dev]an urgent question on encoder
 > >
 > > Hi Eric:
 > >
 > >
 > >
 > > How many encoders (including audio and video) does Helix
 > > have? And could you please provide the list to me?
 > >
 > >
 > >
 > > Thanks a lot
 > >
 > > Weian
 > >
 > >
 > >
 > >
 >


_______________________________________________
Datatype-dev mailing list
Datatype-dev@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-dev


From Gang.Jia at nokia.com  Fri May 23 10:29:21 2008
From: Gang.Jia at nokia.com (Gang.Jia@nokia.com)
Date: Fri May 23 09:16:42 2008
Subject: [datatype-dev] Question for reverse playback for WMV
Message-ID: 

Hi Eric

I have problem to play reversely for WMV on Cays210. The problem happens
in the CASFFileFormatFile::GetPacket(). There is a part in that function
prevents the re-entrancy. But it actually stops the reversal queue build
up in Velocity Proxy. If I remove that line, reverse playback starts to
work. Now I want to know do we really need to prevent the re-entrancy?
If yes then we need to find a way to make the reversal queue work.

Thanks,
Gang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080523/6b27aaa9/attachment.html
From weian.chen at intel.com  Sat May 24 01:18:04 2008
From: weian.chen at intel.com (Chen, Weian)
Date: Sat May 24 00:04:40 2008
Subject: [datatype-dev]an urgent question on encoder
In-Reply-To: <00af01c8bce0$84a37460$db68a8c0@EHYCHED620>
References: 
	<00d401c8bc21$e342d610$db68a8c0@EHYCHED620>
	
	<00af01c8bce0$84a37460$db68a8c0@EHYCHED620>
Message-ID: 


Eric:

Yes, I have got what I want to know.
Thanks for you message.

Weian
-----Original Message-----
From: Eric Hyche [mailto:ehyche@real.com]=20
Sent: 2008=C4=EA5=D4=C223=C8=D5 22:23
To: Chen, Weian
Cc: datatype-dev@helixcommunity.org
Subject: RE: [datatype-dev]an urgent question on encoder


I'm still not quite sure what you are asking. Do you mean:

- what encoding capabilities does Helix currently include, and
  what codecs can Helix encode?

I'll assume this is what you are asking, and answer that question.

In present form, Helix does not include encoding capability. Currently,
there is a separate SDK called the Helix Producer SDK that is
used for encoding.

However, we have a project scheduled for later this year to integrate
the Producer SDK into the Helix atlas platform. Some of the initial
work for this integration has already taken place. Once this work is
complete, Helix will be able to encode to:

- .rm (any RA or RV version)
- .mp4 (H.264 video and MPEG-4 video)
- .wmv (WMA 2-9 and WMV 7-9)
- .ogg (vorbis and theora)
- .mp3

Does this answer your question?

Eric
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc. =20

> -----Original Message-----
> From: Chen, Weian [mailto:weian.chen@intel.com]=20
> Sent: Thursday, May 22, 2008 9:00 PM
> To: ehyche@real.com
> Cc: datatype-dev@helixcommunity.org
> Subject: RE: [datatype-dev]an urgent question on encoder
>=20
>=20
> Eric:
>=20
> I means how many encoder codec does Helix have, not decoder=20
> codec (palyback).
>=20
> thanks
> Weian
> -----Original Message-----
> From: Eric Hyche [mailto:ehyche@real.com]=20
> Sent: 2008=C4=EA5=D4=C222=C8=D5 23:38
> To: Chen, Weian
> Cc: datatype-dev@helixcommunity.org
> Subject: RE: [datatype-dev]an urgent question on encoder
>=20
>=20
> Well, since Helix plays back many different datatypes,
> then it's kind of difficult to say how many different
> encoders there are.
>=20
> What datatype(s) are you referring to?
>=20
> Eric
>=20
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> Eric Hyche (ehyche@real.com)
> Technical Lead
> RealNetworks, Inc. =20
>=20
> > -----Original Message-----
> > From: Chen, Weian [mailto:weian.chen@intel.com]=20
> > Sent: Thursday, May 22, 2008 2:59 AM
> > To: Eric Hyche
> > Cc: datatype-dev@helixcommunity.org
> > Subject: [datatype-dev]an urgent question on encoder
> >=20
> > Hi Eric:
> >=20
> > =20
> >=20
> > How many encoders (including audio and video) does Helix=20
> > have? And could you please provide the list to me?
> >=20
> > =20
> >=20
> > Thanks a lot
> >=20
> > Weian
> >=20
> > =20
> >=20
> >=20
>=20


From asingh at real.com  Tue May 27 04:57:57 2008
From: asingh at real.com (Anshuman Singh)
Date: Tue May 27 03:43:48 2008
Subject: [datatype-dev] Re: [Nokia-private-dev] Question for reverse
	playback for WMV
References: 
Message-ID: <020901c8bff0$ea2b9480$0b01a8c0@anshuman1>

Question for reverse playback for WMVHi Gang,

Can you please provide me the diff for the changes that works for reverse playback of wmv file.

Thanks,
Anshuman

  ----- Original Message ----- 
  From: Gang.Jia@nokia.com 
  To: datatype-dev@helixcommunity.org ; ehyche@real.com 
  Cc: nokia-private-dev@helixcommunity.org 
  Sent: Friday, May 23, 2008 10:59 PM
  Subject: [Nokia-private-dev] Question for reverse playback for WMV


  Hi Eric 

  I have problem to play reversely for WMV on Cays210. The problem happens in the CASFFileFormatFile::GetPacket(). There is a part in that function prevents the re-entrancy. But it actually stops the reversal queue build up in Velocity Proxy. If I remove that line, reverse playback starts to work. Now I want to know do we really need to prevent the re-entrancy? If yes then we need to find a way to make the reversal queue work.

  Thanks, 
  Gang 



------------------------------------------------------------------------------


  _______________________________________________
  Nokia-private-dev mailing list
  Nokia-private-dev@helixcommunity.org
  http://lists.helixcommunity.org/mailman/listinfo/nokia-private-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080527/b7a086f9/attachment.html
From Gang.Jia at nokia.com  Tue May 27 07:46:29 2008
From: Gang.Jia at nokia.com (Gang.Jia@nokia.com)
Date: Tue May 27 06:34:25 2008
Subject: [datatype-dev] RE: [Nokia-private-dev] Question for reverse
	playback for WMV
In-Reply-To: <020901c8bff0$ea2b9480$0b01a8c0@anshuman1>
References: 
	<020901c8bff0$ea2b9480$0b01a8c0@anshuman1>
Message-ID: 

Hi Anshuman
 
Here is the diff:
Index: asf_file_format_file.cpp
===================================================================
RCS file: /cvsroot/datatype/wm/fileformat/asf_file_format_file.cpp,v
retrieving revision 1.5.4.6
diff -u -w -r1.5.4.6 asf_file_format_file.cpp
--- asf_file_format_file.cpp 12 Feb 2008 17:44:36 -0000 1.5.4.6
+++ asf_file_format_file.cpp 27 May 2008 14:43:50 -0000
@@ -495,7 +495,7 @@
             // is that a call to SendPacketsFromAnyQueue() may result
             // in a call to IHXFormatResponse::PacketReady(), which may
             // result in a re-entrant call to GetPacket().
-            if (m_ulState == kStateReady)
+//            if (m_ulState == kStateReady)
             {
                 // Clear the flag saying we sent a packet
                 HXBOOL bPacketSent  = FALSE;

Thanks,
Gang

________________________________

From: ext Anshuman Singh [mailto:asingh@real.com] 
Sent: Tuesday, May 27, 2008 6:58 AM
To: Jia Gang (Nokia-D-MSW/Dallas); datatype-dev@helixcommunity.org;
ehyche@real.com
Cc: nokia-private-dev@helixcommunity.org
Subject: Re: [Nokia-private-dev] Question for reverse playback for WMV


Hi Gang,
 
Can you please provide me the diff for the changes that works for
reverse playback of wmv file.
 
Thanks,
Anshuman
 

	----- Original Message ----- 
	From: Gang.Jia@nokia.com 
	To: datatype-dev@helixcommunity.org ; ehyche@real.com 
	Cc: nokia-private-dev@helixcommunity.org 
	Sent: Friday, May 23, 2008 10:59 PM
	Subject: [Nokia-private-dev] Question for reverse playback for
WMV


	Hi Eric 

	I have problem to play reversely for WMV on Cays210. The problem
happens in the CASFFileFormatFile::GetPacket(). There is a part in that
function prevents the re-entrancy. But it actually stops the reversal
queue build up in Velocity Proxy. If I remove that line, reverse
playback starts to work. Now I want to know do we really need to prevent
the re-entrancy? If yes then we need to find a way to make the reversal
queue work.

	Thanks, 
	Gang 

	
________________________________


	

	_______________________________________________
	Nokia-private-dev mailing list
	Nokia-private-dev@helixcommunity.org
	
http://lists.helixcommunity.org/mailman/listinfo/nokia-private-dev
	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080527/e57c536f/attachment-0001.html
From asingh at real.com  Wed May 28 07:21:37 2008
From: asingh at real.com (Anshuman Singh)
Date: Wed May 28 06:07:40 2008
Subject: [datatype-dev] RE: [Nokia-private-dev] Question for
	reverseplayback for WMV
References: <020901c8bff0$ea2b9480$0b01a8c0@anshuman1>
	
Message-ID: <01fb01c8c0ce$26a06160$0b01a8c0@anshuman1>

Question for reverse playback for WMVHi Gang,

I am looking into this and will reply you shortly.

Thanks,
Anshuman
  ----- Original Message ----- 
  From: Gang.Jia@nokia.com 
  To: asingh@real.com ; datatype-dev@helixcommunity.org ; ehyche@real.com 
  Cc: nokia-private-dev@helixcommunity.org 
  Sent: Tuesday, May 27, 2008 8:16 PM
  Subject: [datatype-dev] RE: [Nokia-private-dev] Question for reverseplayback for WMV


  Hi Anshuman

  Here is the diff:
  Index: asf_file_format_file.cpp
  ===================================================================
  RCS file: /cvsroot/datatype/wm/fileformat/asf_file_format_file.cpp,v
  retrieving revision 1.5.4.6
  diff -u -w -r1.5.4.6 asf_file_format_file.cpp
  --- asf_file_format_file.cpp 12 Feb 2008 17:44:36 -0000 1.5.4.6
  +++ asf_file_format_file.cpp 27 May 2008 14:43:50 -0000
  @@ -495,7 +495,7 @@
               // is that a call to SendPacketsFromAnyQueue() may result
               // in a call to IHXFormatResponse::PacketReady(), which may
               // result in a re-entrant call to GetPacket().
  -            if (m_ulState == kStateReady)
  +//            if (m_ulState == kStateReady)
               {
                   // Clear the flag saying we sent a packet
                   HXBOOL bPacketSent  = FALSE;

  Thanks,
  Gang



------------------------------------------------------------------------------
  From: ext Anshuman Singh [mailto:asingh@real.com] 
  Sent: Tuesday, May 27, 2008 6:58 AM
  To: Jia Gang (Nokia-D-MSW/Dallas); datatype-dev@helixcommunity.org; ehyche@real.com
  Cc: nokia-private-dev@helixcommunity.org
  Subject: Re: [Nokia-private-dev] Question for reverse playback for WMV


  Hi Gang,

  Can you please provide me the diff for the changes that works for reverse playback of wmv file.

  Thanks,
  Anshuman

    ----- Original Message ----- 
    From: Gang.Jia@nokia.com 
    To: datatype-dev@helixcommunity.org ; ehyche@real.com 
    Cc: nokia-private-dev@helixcommunity.org 
    Sent: Friday, May 23, 2008 10:59 PM
    Subject: [Nokia-private-dev] Question for reverse playback for WMV


    Hi Eric 

    I have problem to play reversely for WMV on Cays210. The problem happens in the CASFFileFormatFile::GetPacket(). There is a part in that function prevents the re-entrancy. But it actually stops the reversal queue build up in Velocity Proxy. If I remove that line, reverse playback starts to work. Now I want to know do we really need to prevent the re-entrancy? If yes then we need to find a way to make the reversal queue work.

    Thanks, 
    Gang 



----------------------------------------------------------------------------


    _______________________________________________
    Nokia-private-dev mailing list
    Nokia-private-dev@helixcommunity.org
    http://lists.helixcommunity.org/mailman/listinfo/nokia-private-dev



------------------------------------------------------------------------------


  _______________________________________________
  Datatype-dev mailing list
  Datatype-dev@helixcommunity.org
  http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080528/675fbfb7/attachment.html
From ehyche at real.com  Wed May 28 14:18:51 2008
From: ehyche at real.com (Eric Hyche)
Date: Wed May 28 13:04:27 2008
Subject: [datatype-dev] CR-Client: fix for UTF16 to UTF8 conversion in wm
	fileformat
Message-ID: <56103.24.158.143.31.1212009531.squirrel@mailone.real.com>


Description
----------------------------------------
Content description strings (such as Title/Author/Copyright) are
stored as UTF16 little-endian in ASF files. In the wm fileformat
code, we had made an assumption that sizeof(wchar_t) was equal
to 2. This is correct on Windows, but on Linux, sizeof(wchar_t) can
be 4. Therefore, the UTF16->UTF8 conversion was not working correctly,
and true multi-byte characters in UTF8 (such as Author strings in
Chinese characters) were not being converted correctly.

Files Modified
----------------------------------------
common/runtime/pub/hlxosstr.h
datatype/wm/common/parse_asf_objects.cpp

Branches
----------------------------------------
HEAD and 310Atlas

Index: hlxosstr.h
===================================================================
RCS file: /cvsroot/common/runtime/pub/hlxosstr.h,v
retrieving revision 1.10.2.1
diff -u -w -r1.10.2.1 hlxosstr.h
--- hlxosstr.h  21 Mar 2008 11:15:25 -0000      1.10.2.1
+++ hlxosstr.h  28 May 2008 21:17:28 -0000
@@ -97,6 +97,7 @@
     operator char*() { return m_ascii; }
     operator unsigned char*() { return (unsigned char*) m_ascii; }
      ~HLXOsStrW();
+    int GetOutSize() { return m_outsize; }

     HLXOsStrW(const HLXOsStrW& rhs);
     HLXOsStrW& operator=(const HLXOsStrW& rhs);


Index: parse_asf_objects.cpp
===================================================================
RCS file: /cvsroot/datatype/wm/common/parse_asf_objects.cpp,v
retrieving revision 1.10.4.1
diff -u -w -r1.10.4.1 parse_asf_objects.cpp
--- parse_asf_objects.cpp       5 May 2008 06:04:38 -0000       1.10.4.1
+++ parse_asf_objects.cpp       28 May 2008 21:17:54 -0000
@@ -199,24 +199,43 @@
             // Make sure we have a large enough input buffer
             if (*pulLen >= ulByteSize)
             {
-                // Allocate an output buffer (with NULL terminator)
-                char* pszTmp = new char [ulNumWideChar + 1];
+                // Allocate an intermediate buffer. "Unicode" strings
+                // in the ASF format are always stored as UTF16 little-endian.
+                // However, on some platforms, sizeof(wchar_t) is 2 bytes and
+                // on some platforms, sizeof(wchar_t) is 4 bytes. Therefore,
+                // we cannot just assume that we can do memcpy from the
+                // input buffer into a const wchar_t* buffer.
+                wchar_t* pTmpWChar = new wchar_t [ulNumWideChar + 1];
+                if (pTmpWChar)
+                {
+                    // Null out the buffer
+                 memset((void*) pTmpWChar, 0, (ulNumWideChar + 1) * sizeof(wchar_t));
+                    // Set up the input pointers
+                    UINT16 usWChar = 0;
+                    // Copy the string, one wide char at a time
+                    UINT32 i = 0;
+                    for (i = 0; i < ulNumWideChar; i++)
+                    {
+                        usWChar = 0;
+                        UnpackUINT16LEInc(ppBuf, pulLen, &usWChar);
+                        pTmpWChar[i] = (wchar_t) usWChar;
+                    }
+                    // Convert to UTF8
+                    HLXOsStrW cStr((const wchar_t*) pTmpWChar, (size_t) ulNumWideChar);
+                    // After conversion to UTF8, the HLXOsStrW can tell
+                    // us how many bytes were needed. We add an extra byte
+                    // to this to ensure NULL termination
+                    UINT32 ulOutBufSize = (UINT32) (cStr.GetOutSize() + 1);
+                    // Allocate a buffer of this many characters
+                    char* pszTmp = new char [ulOutBufSize];
                 if (pszTmp)
                 {
-                    // Convert to ASCII
-                    wchar_t* pTmpWChar = new wchar_t[ulNumWideChar];
-                    memcpy((BYTE*) pTmpWChar,  *ppBuf,  ulNumWideChar*sizeof(wchar_t));
-                    HLXOsStrW cStr((const wchar_t*) pTmpWChar, ulNumWideChar);
-                    // Copy the string
-                    strncpy(pszTmp, (const char*) cStr, ulNumWideChar);
-                    // NULL terminate the string
-                    pszTmp[ulNumWideChar] = '\0';
-                    // Advance the input buffer
-                    *ppBuf  += ulByteSize;
-                    *pulLen -= ulByteSize;
+                        // Null out the output buffer
+                     memset((void*) pszTmp, 0, ulOutBufSize);
+                        // Copy the UTF8 string into the output buffer
+                        memcpy(pszTmp, (const char*) cStr, cStr.GetOutSize());
                     // Assign the out parameter
                     *ppszOut = pszTmp;
-                    delete [] pTmpWChar;
                     // Clear the return value
                     retVal = HXR_OK;
                 }
@@ -225,6 +244,8 @@
                     HX_VECTOR_DELETE(pszTmp);
                 }
             }
+                HX_VECTOR_DELETE(pTmpWChar);
+            }
         }
     }




=====================================
Eric Hyche, Technical Lead
RealNetworks, Inc.
ehyche@real.com



From gwright at real.com  Wed May 28 14:29:54 2008
From: gwright at real.com (Greg Wright)
Date: Wed May 28 13:15:26 2008
Subject: [datatype-dev] CR-Client: fix for UTF16 to UTF8 conversion in
	wm	fileformat
In-Reply-To: <56103.24.158.143.31.1212009531.squirrel@mailone.real.com>
References: <56103.24.158.143.31.1212009531.squirrel@mailone.real.com>
Message-ID: <483DCED2.4050607@real.com>

Eric Hyche wrote:
> Description
> ----------------------------------------
> Content description strings (such as Title/Author/Copyright) are
> stored as UTF16 little-endian in ASF files. In the wm fileformat
> code, we had made an assumption that sizeof(wchar_t) was equal
> to 2. This is correct on Windows, but on Linux, sizeof(wchar_t) can
> be 4. Therefore, the UTF16->UTF8 conversion was not working correctly,
> and true multi-byte characters in UTF8 (such as Author strings in
> Chinese characters) were not being converted correctly.
> 
> Files Modified
> ----------------------------------------
> common/runtime/pub/hlxosstr.h
> datatype/wm/common/parse_asf_objects.cpp
> 
> Branches
> ----------------------------------------
> HEAD and 310Atlas
> 
> Index: hlxosstr.h
> ===================================================================
> RCS file: /cvsroot/common/runtime/pub/hlxosstr.h,v
> retrieving revision 1.10.2.1
> diff -u -w -r1.10.2.1 hlxosstr.h
> --- hlxosstr.h  21 Mar 2008 11:15:25 -0000      1.10.2.1
> +++ hlxosstr.h  28 May 2008 21:17:28 -0000
> @@ -97,6 +97,7 @@
>      operator char*() { return m_ascii; }
>      operator unsigned char*() { return (unsigned char*) m_ascii; }
>       ~HLXOsStrW();
> +    int GetOutSize() { return m_outsize; }
> 
>      HLXOsStrW(const HLXOsStrW& rhs);
>      HLXOsStrW& operator=(const HLXOsStrW& rhs);
> 
> 
> Index: parse_asf_objects.cpp
> ===================================================================
> RCS file: /cvsroot/datatype/wm/common/parse_asf_objects.cpp,v
> retrieving revision 1.10.4.1
> diff -u -w -r1.10.4.1 parse_asf_objects.cpp
> --- parse_asf_objects.cpp       5 May 2008 06:04:38 -0000       1.10.4.1
> +++ parse_asf_objects.cpp       28 May 2008 21:17:54 -0000
> @@ -199,24 +199,43 @@
>              // Make sure we have a large enough input buffer
>              if (*pulLen >= ulByteSize)
>              {
> -                // Allocate an output buffer (with NULL terminator)
> -                char* pszTmp = new char [ulNumWideChar + 1];
> +                // Allocate an intermediate buffer. "Unicode" strings
> +                // in the ASF format are always stored as UTF16 little-endian.
> +                // However, on some platforms, sizeof(wchar_t) is 2 bytes and
> +                // on some platforms, sizeof(wchar_t) is 4 bytes. Therefore,
> +                // we cannot just assume that we can do memcpy from the
> +                // input buffer into a const wchar_t* buffer.
> +                wchar_t* pTmpWChar = new wchar_t [ulNumWideChar + 1];
> +                if (pTmpWChar)
> +                {
> +                    // Null out the buffer
> +                 memset((void*) pTmpWChar, 0, (ulNumWideChar + 1) * sizeof(wchar_t));
> +                    // Set up the input pointers
> +                    UINT16 usWChar = 0;
> +                    // Copy the string, one wide char at a time
> +                    UINT32 i = 0;
> +                    for (i = 0; i < ulNumWideChar; i++)
> +                    {
> +                        usWChar = 0;
> +                        UnpackUINT16LEInc(ppBuf, pulLen, &usWChar);
> +                        pTmpWChar[i] = (wchar_t) usWChar;
> +                    }
> +                    // Convert to UTF8
> +                    HLXOsStrW cStr((const wchar_t*) pTmpWChar, (size_t) ulNumWideChar);
> +                    // After conversion to UTF8, the HLXOsStrW can tell
> +                    // us how many bytes were needed. We add an extra byte
> +                    // to this to ensure NULL termination
> +                    UINT32 ulOutBufSize = (UINT32) (cStr.GetOutSize() + 1);
> +                    // Allocate a buffer of this many characters
> +                    char* pszTmp = new char [ulOutBufSize];
>                  if (pszTmp)
>                  {
> -                    // Convert to ASCII
> -                    wchar_t* pTmpWChar = new wchar_t[ulNumWideChar];
> -                    memcpy((BYTE*) pTmpWChar,  *ppBuf,  ulNumWideChar*sizeof(wchar_t));
> -                    HLXOsStrW cStr((const wchar_t*) pTmpWChar, ulNumWideChar);
> -                    // Copy the string
> -                    strncpy(pszTmp, (const char*) cStr, ulNumWideChar);
> -                    // NULL terminate the string
> -                    pszTmp[ulNumWideChar] = '\0';
> -                    // Advance the input buffer
> -                    *ppBuf  += ulByteSize;
> -                    *pulLen -= ulByteSize;
> +                        // Null out the output buffer
> +                     memset((void*) pszTmp, 0, ulOutBufSize);
> +                        // Copy the UTF8 string into the output buffer
> +                        memcpy(pszTmp, (const char*) cStr, cStr.GetOutSize());
>                      // Assign the out parameter
>                      *ppszOut = pszTmp;

HX_VECTOR_DELETE(pszTmp) is called below, does *ppszOut
now point to deleted data after that? Otherwise looks
good.


--reg.

> -                    delete [] pTmpWChar;
>                      // Clear the return value
>                      retVal = HXR_OK;
>                  }
> @@ -225,6 +244,8 @@
>                      HX_VECTOR_DELETE(pszTmp);
>                  }
>              }
> +                HX_VECTOR_DELETE(pTmpWChar);
> +            }
>          }
>      }

From cbailey at real.com  Wed May 28 19:38:17 2008
From: cbailey at real.com (Christina Bailey)
Date: Wed May 28 18:23:44 2008
Subject: [datatype-dev] CR: Add ExternalInterface check to the
	FlashGuestPlayerNS
Message-ID: <483E1719.3050103@real.com>

Synopsis: Mac crashes on ExternalInterface functions that do not exist.

Overview: Add functionality to check for a list of supported 
ExternalInterface functions.
If the SWF supports this feature it will send a "HXSetFunctions" message 
with a list
of supported ExternalInterface functions.

Files:

datatype/flash/flashhost/flash_guest_player_ns.cpp
datatype/flash/flashhost/pub/flash_guest_player_ns.h
    - Add catch for HXSetFunctions command, parse args into a function 
name list.
    - Before each ExternalInterface call, parse out the command from the 
xml blob
    and check if the function is in the list, fail if the list exists 
and it is not found.
    - Optimize dereference of the 'this' object in NPN_Evaluate.

datatype/flash/flashhost/flash_guest_player.cpp
datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
datatype/flash/flashhost/pub/flash_guest_player.h
datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax.h
    - move common var to base class, m_pXMLFlash

Branches: HEAD and 310Atlas

Diff:

Index: flash_guest_player.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player.cpp,v
retrieving revision 1.33.2.21
diff -w -u -5 -r1.33.2.21 flash_guest_player.cpp
--- flash_guest_player.cpp    14 May 2008 00:03:38 -0000    1.33.2.21
+++ flash_guest_player.cpp    28 May 2008 22:24:52 -0000
@@ -152,10 +152,11 @@
     , m_pFLVFileObject(NULL)
     , m_pSite(NULL)
     , m_pStats(NULL)
     , m_pRootSiteWatcher(NULL)
     , m_pRootPassiveSiteWatcher(NULL)
+    , m_pXMLFlash(NULL)
 {
     HXLOGL4(HXLOG_FPHR, "CON CFlashGuestPlayer this=%p", this);
     m_MediaSize.cx = dDefaultWindowWidth;
     m_MediaSize.cy = dDefaultWindowHeight;
     m_OffsetPoint.x = 0;
@@ -172,10 +173,11 @@
     HX_RELEASE(m_pExternalInterfaceResponse);
     HX_RELEASE(m_pRepresentingSite);
     HX_RELEASE(m_pCCF);
     HX_RELEASE(m_pContext);
     HX_RELEASE(m_pRequest);
+    HX_RELEASE(m_pXMLFlash);
 }
 
 STDMETHODIMP CFlashGuestPlayer::QueryInterface(REFIID riid, void** ppvObj)
 {
     QInterfaceList  qiList[] =
Index: flash_guest_player_ns.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player_ns.cpp,v
retrieving revision 1.27.2.38
diff -w -u -5 -r1.27.2.38 flash_guest_player_ns.cpp
--- flash_guest_player_ns.cpp    22 May 2008 05:14:00 -0000    1.27.2.38
+++ flash_guest_player_ns.cpp    29 May 2008 02:25:51 -0000
@@ -67,10 +67,11 @@
 #include "hxvsurf.h"
 #include "hxprefs.h"
 #include "hxhyper.h"
 #include "hxhypnv.h"
 #include "hxevent.h"
+#include "hxstringutil.h"
 #include "dllacces.h"
 #include "filespecutils.h"
 #include "hxinter.h" // IHXEventManager
 #include "xml_flash.h"
 #include "swfpack.h"
@@ -1509,10 +1510,12 @@
 
     HX_RELEASE(m_pOffscreenBuffer);
     HX_RELEASE(m_pMutex);
     HX_RELEASE(m_pSite);
     HX_RELEASE(m_pScheduler);
+        m_EIFunctionList.RemoveAll();
+        HX_RELEASE(m_pXMLFlash);
 
         m_bTerminated = TRUE;
     }
    
     return HXR_OK;
@@ -3707,11 +3710,11 @@
         pos = m_StringIds.AddTailString(name);
     }
     const char* sId;
     sId = (const char*) *((CHXString*) m_StringIds.GetAt(pos));
 
-    HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name, sId);
+    //HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name, sId);
     return (NPIdentifier) sId;
 }
 
 void
 CFlashGuestPlayerNS::NPN_GetStringIdentifiers(const NPUTF8** names, 
int32_t nameCount, NPIdentifier* identifiers)
@@ -3754,11 +3757,11 @@
 #if defined(_MAC_UNIX)
     // MBO - Test
     // printf("NPN_UTF8FromIdentifier\n");
 #endif    // _MAC_UNIX
 
-    HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*) identifier);
+    //HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*) identifier);
     return (NPUTF8*) new_string((char*) identifier);
 }
 
 int32_t
 CFlashGuestPlayerNS::NPN_IntFromIdentifier(NPIdentifier identifier)
@@ -3913,24 +3916,26 @@
     // From a helix 'VolumeSlider':
     //   try { __flash__toXML(HXSetVolume(49)) ; } catch (e) { 
""; }
 
     CHXString strInvokeName, strInvokeArgs;
     INT32 dIndex = -1;
+    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
+    CFlashGuestPlayerNS* pPlayer = NULL;
+
+    if (objw)
+    {
+    pPlayer = (CFlashGuestPlayerNS*) objw->m_npp->ndata;
+    }
 
     if (strstr(strScript, "HXGetExternalInterfaceStatus"))
     {
     HXLOGL4(HXLOG_FPHR, "HXExternalInteraceStatus message received. 
ExternalInterface.call is working.");
     // Send a message to Flash saying that we are able to receive 
ExternalInterface.call messages
-        if (obj)
-        {
-            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*) 
objw->m_npp->ndata;
             if (pPlayer)
             {
                 
pPlayer->SendFlashMessage("EISetExternalInterfaceStatus", "true");
             }
-        }
     return true;
     }
 
     // Remove the array brackets
     if (strScript.FindAndReplace("([", "(", FALSE))
@@ -3948,12 +3953,10 @@
     HXLOGL4(HXLOG_FPHR, "HXDebug: %s", (const char*)strInvokeArgs);
     return true;
     }
     if ((dIndex = strScript.Find("HXPosition(")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*) 
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex + strlen("HXPosition("));
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
@@ -3965,12 +3968,10 @@
    
     return true;
     }
     if ((dIndex = strScript.Find("HXMetaChanged(")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*) 
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex + strlen("HXMetaChanged("));
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
@@ -3982,12 +3983,10 @@
    
     return true;
     }
     if ((dIndex = strScript.Find("HXBufferingChanged(")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*) 
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex + 
strlen("HXBufferingChanged("));
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
@@ -3999,12 +3998,10 @@
    
     return true;
     }
     if ((dIndex = strScript.Find("HXStateChanged(\"")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*) 
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex + 
strlen("HXStateChanged(\""));
         if ((dIndex = strInvokeArgs.Find('"')) > 0)
         {
@@ -4208,25 +4205,33 @@
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
             strInvokeArgs = strInvokeArgs.Left(dIndex);
         }
     }
+    else if ((dIndex = strScript.Find("HXSetFunctions(")) >= 0)
+    {
+        strInvokeName = "HXSetFunctions";
+        strInvokeArgs = strScript.Mid(dIndex + 
strlen("HXSetFunctions(") + 1);
+        if ((dIndex = strInvokeArgs.Find(')')) > 0)
+        {
+            strInvokeArgs = strInvokeArgs.Left(dIndex);
+            if (pPlayer)
+            {
+                pPlayer->SetupEIFunctionList(strInvokeArgs);
+            }
+        }
+    }
 
     if (!strInvokeName.IsEmpty())
     {
         CHXString strInvokeXML;
         HX_RESULT hr = CHXXMLFlash::WriteInvokeXML(strInvokeName, 
strInvokeArgs, strInvokeXML);
-        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && obj)
-        {
-            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*) 
objw->m_npp->ndata;
-            if (pPlayer)
+        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && pPlayer)
             {
                 pPlayer->FlashCall(strInvokeXML);
             }
         }
-    }
 
     return true;
 }
 
 bool
@@ -4316,11 +4321,11 @@
 }
 
 void
 CFlashGuestPlayerNS::NPN_ReleaseVariantValue(NPVariant *variant)
 {
-    HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
+    //HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
    
 #if defined(_MAC_UNIX)
     // MBO - Test
     // printf("NPN_ReleaseVariantValue vriant=%ld\n", variant);
 #endif    // _MAC_UNIX
@@ -5356,11 +5361,18 @@
         NPVariant npArgv[1];
         UINT32 argCount=1;
 
         STRINGN_TO_NPVARIANT( (const char*) strInvokeXML, strlen((const 
char*)strInvokeXML), npArgv[0]);
        
+    if (EIFunctionExists(strInvokeXML))
+    {
         hr = Invoke("CallFunction", npArgv, argCount, &vresult);
+    }
+    else
+    {
+        hr = HXR_UNEXPECTED;
+    }
    
     if (SUCCEEDED(hr))
         {
             NPN_ReleaseVariantValue(&vresult);
         }
@@ -5403,5 +5415,54 @@
     // Get the current frame
     INT32 lCurFrame = 0;
     HX_RESULT retVal = Invoke("CurrentFrame", lCurFrame);
     return lCurFrame;
 }
+
+HXBOOL
+CFlashGuestPlayerNS::EIFunctionExists(const CHXString& strInvokeXML)
+{
+    // Check to see if the ExternalInterface function exists
+    HXBOOL bExists=TRUE; // Default to true, if we did not receive a 
list via HXSetFunctions, or we cannot parse, assume passive check.
+
+    // Extract the invoke name, and make sure it exists on the flash side
+    if (m_EIFunctionList.GetCount() > 0)
+    {
+    CHXString strInvokeName, strInvokeArgs;
+
+    if (m_pXMLFlash == NULL)
+    {
+        m_pXMLFlash = new CHXXMLFlash(m_pContext);
+        HX_ADDREF(m_pXMLFlash);
+    }
+
+    // Parse the XML, get the invoke name
+    if (m_pXMLFlash)
+    {
+        if (SUCCEEDED(m_pXMLFlash->ParseInvokeXML(strInvokeXML, 
strInvokeName, strInvokeArgs)) && !strInvokeName.IsEmpty())
+        {
+        if (!m_EIFunctionList.FindString(strInvokeName))
+        {
+                HXLOGL4(HXLOG_FPHR, 
"CFlashGuestPlayerNS::EIFunctionExists FAILED for invoke name: %s", 
(const char*) strInvokeName);
+            bExists = FALSE;
+        }
+        }
+    }
+    }
+
+    return bExists;
+}
+
+//
+// Create a list of known ExternalInterface functions, valid for 
CallFunction, so we do not crash on the Mac
+//
+void
+CFlashGuestPlayerNS::SetupEIFunctionList(const CHXString& strInvokeArgs)
+{
+    if (!strInvokeArgs.IsEmpty())
+    {
+    HXStringUtil::Split(strInvokeArgs, HXFLASH_ARGUMENT_DELIMITER, 
m_EIFunctionList);
+    }
+
+    HXLOGL4(HXLOG_FPHR, "CFlashGuestPlayerNS::SetupEIFunctionList: 
Created function list, count=%ld", m_EIFunctionList.GetCount());
+}
+
Index: platform/win32/flash_guest_player_ax.cpp
===================================================================
RCS file: 
/cvsroot/datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp,v
retrieving revision 1.21.2.29
diff -w -u -5 -r1.21.2.29 flash_guest_player_ax.cpp
--- platform/win32/flash_guest_player_ax.cpp    21 May 2008 12:32:41 
-0000    1.21.2.29
+++ platform/win32/flash_guest_player_ax.cpp    28 May 2008 21:48:40 -0000
@@ -132,11 +132,10 @@
         , m_lpO(NULL)
         , m_lpInPlaceObjWindowless(NULL)
         , m_lpInPlaceObj(NULL)
         , m_lpViewObject(NULL)
         , m_pMutex(NULL)
-        , m_pXMLFlash(NULL)
         , m_dFrameRate(0.0)
         , m_bInPlaceActive(FALSE)
         , m_lFlashVersion(0)
         , m_bGotInvalidateRect(FALSE)
         , m_pOffscreenBuffer(NULL)
Index: pub/flash_guest_player.h
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player.h,v
retrieving revision 1.27.2.12
diff -w -u -5 -r1.27.2.12 flash_guest_player.h
--- pub/flash_guest_player.h    25 Apr 2008 22:54:26 -0000    1.27.2.12
+++ pub/flash_guest_player.h    28 May 2008 23:22:34 -0000
@@ -106,10 +106,11 @@
 
 // Forward declarations
 class CHXSimpleList;
 class CFlashSiteWatcher;
 class CFlashPassiveSiteWatcher;
+class CHXXMLFlash;
 struct IHXCommonClassFactory;
 struct IHXFileObject;
 //struct IHXRequest;
 
 #define SOURCE_URL_FLASH_CUSTOM_VAR        "sourceURL"
@@ -247,10 +248,11 @@
     IHXFileObject*    m_pFileObject;
     IHXFileObject*    m_pFLVFileObject;
     IHXSite*        m_pSite;
     HXxPoint        m_OffsetPoint;
     IHXScheduler*    m_pScheduler;
+    CHXXMLFlash*    m_pXMLFlash;
    
     IHXExternalInterfaceResponse* m_pExternalInterfaceResponse;
     IHXSiteWindowless* m_pRepresentingSite;
 
     HXBOOL m_bWindowlessPref;     // Specifies the pref for windowless 
(true) or windowed (false)
Index: pub/flash_guest_player_ns.h
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player_ns.h,v
retrieving revision 1.14.2.15
diff -w -u -5 -r1.14.2.15 flash_guest_player_ns.h
--- pub/flash_guest_player_ns.h    10 May 2008 20:47:13 -0000    1.14.2.15
+++ pub/flash_guest_player_ns.h    28 May 2008 23:52:09 -0000
@@ -57,18 +57,18 @@
 #include "npupp.h"
 #include "hxwin.h"
 #include "hxstring.h"
 #include "hxsite2.h"
 #include "hxengin.h"
+#include "hxslist.h"
 
 #if defined (_MAC_UNIX)
 #include "platform/mac/macwindowinfo.h"
 #endif    // _MAC_UNIX
 
 // Forward declarations
 class CHXSimpleList;
-class CHXStringList;
 class CHXString;
 class DLLAccess;
 class  CHXGenericCallback;
 struct IHXCommonClassFactory;
 struct IHXMutex;
@@ -253,10 +253,12 @@
     HX_RESULT   ParseNativeMediaSize(IHXBuffer* pBuffer, REF(HXxSize) 
rSize);
     void        OnFlashPlayerStateChange(const char* pszGuestState);
 
     UINT32  GetNumFrames(void);
     UINT32  GetCurrentFrame(void);
+    HXBOOL  EIFunctionExists(const CHXString& strInvokeXML);
+    void    SetupEIFunctionList(const CHXString& strInvokeArgs);
 
     enum
     {
         kStateReady,
         kStateFSMInitDonePending,
@@ -284,10 +286,11 @@
     double              m_dFrameRate;
     UINT32        m_ulPacingInterval;
     UINT32        m_ulReadPacingInterval;
     UINT32        m_ulFileOffsetPending;
     UINT32        m_ulFileOffsetRequested;
+    CHXStringList    m_EIFunctionList;
 
     static const char* const    m_pszFlashMimeType;
     static CHXStringList    m_StringIds;
     static CHXSimpleList    m_IntIds;
     static CHXString            m_pUserAgentStr;
Index: pub/platform/win32/flash_guest_player_ax.h
===================================================================
RCS file: 
/cvsroot/datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax.h,v
retrieving revision 1.10.2.13
diff -w -u -5 -r1.10.2.13 flash_guest_player_ax.h
--- pub/platform/win32/flash_guest_player_ax.h    16 May 2008 16:37:16 
-0000    1.10.2.13
+++ pub/platform/win32/flash_guest_player_ax.h    28 May 2008 21:48:04 -0000
@@ -75,11 +75,10 @@
 // Forward declarations
 class CFlashGuestPlayer;
 class CHXString;
 class CHXGenericCallback;
 struct IHXFileObject;
-class CHXXMLFlash;
 
 class CFlashGuestPlayerAX : public CFlashGuestPlayer
               , public ShockwaveFlashObjects::_IShockwaveFlashEvents
               , public IOleClientSite
               , public IOleInPlaceSiteWindowless
@@ -311,11 +310,10 @@
     HBITMAP        m_hOldBitmap;
     void*          m_pDIBits;
     UINT32         m_ulDIBitsSize;
     UINT32         m_ulDIBitsWidth;
     UINT32         m_ulDIBitsHeight;
-    CHXXMLFlash*   m_pXMLFlash;
     double         m_dFrameRate;
     HXBOOL         m_bInPlaceActive;
     INT32          m_lFlashVersion;
     HXBOOL         m_bGotInvalidateRect;
     HXBOOL         m_bOLEInitialized;


From ping at real.com  Wed May 28 21:20:44 2008
From: ping at real.com (Henry Ping)
Date: Wed May 28 20:06:04 2008
Subject: [datatype-dev] RE: Add ExternalInterface check to the
	FlashGuestPlayerNS
In-Reply-To: <483E1719.3050103@real.com>
References: <483E1719.3050103@real.com>
Message-ID: <1071D244292640C18F8AAFF3AB7F6584@DingDong>

I'd move EI function check to the base class so that FlashGuestPlayerAX can
leverage the same checking mechanism when external interface is working in
Flash AX.

Rest looks good.

Thanks
Henry

> -----Original Message-----
> From: Christina Bailey [mailto:cbailey@real.com]
> Sent: Wednesday, May 28, 2008 7:38 PM
> To: liteplayer_dev@real.com
> Cc: datatype-dev@helixcommunity.org
> Subject: CR: Add ExternalInterface check to the FlashGuestPlayerNS
> 
> Synopsis: Mac crashes on ExternalInterface functions that do not exist.
> 
> Overview: Add functionality to check for a list of supported
> ExternalInterface functions.
> If the SWF supports this feature it will send a "HXSetFunctions" message
> with a list
> of supported ExternalInterface functions.
> 
> Files:
> 
> datatype/flash/flashhost/flash_guest_player_ns.cpp
> datatype/flash/flashhost/pub/flash_guest_player_ns.h
>     - Add catch for HXSetFunctions command, parse args into a function
> name list.
>     - Before each ExternalInterface call, parse out the command from the
> xml blob
>     and check if the function is in the list, fail if the list exists
> and it is not found.
>     - Optimize dereference of the 'this' object in NPN_Evaluate.
> 
> datatype/flash/flashhost/flash_guest_player.cpp
> datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
> datatype/flash/flashhost/pub/flash_guest_player.h
> datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax.h
>     - move common var to base class, m_pXMLFlash
> 
> Branches: HEAD and 310Atlas
> 
> Diff:
> 
> Index: flash_guest_player.cpp
> ===================================================================
> RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player.cpp,v
> retrieving revision 1.33.2.21
> diff -w -u -5 -r1.33.2.21 flash_guest_player.cpp
> --- flash_guest_player.cpp    14 May 2008 00:03:38 -0000    1.33.2.21
> +++ flash_guest_player.cpp    28 May 2008 22:24:52 -0000
> @@ -152,10 +152,11 @@
>      , m_pFLVFileObject(NULL)
>      , m_pSite(NULL)
>      , m_pStats(NULL)
>      , m_pRootSiteWatcher(NULL)
>      , m_pRootPassiveSiteWatcher(NULL)
> +    , m_pXMLFlash(NULL)
>  {
>      HXLOGL4(HXLOG_FPHR, "CON CFlashGuestPlayer this=%p", this);
>      m_MediaSize.cx = dDefaultWindowWidth;
>      m_MediaSize.cy = dDefaultWindowHeight;
>      m_OffsetPoint.x = 0;
> @@ -172,10 +173,11 @@
>      HX_RELEASE(m_pExternalInterfaceResponse);
>      HX_RELEASE(m_pRepresentingSite);
>      HX_RELEASE(m_pCCF);
>      HX_RELEASE(m_pContext);
>      HX_RELEASE(m_pRequest);
> +    HX_RELEASE(m_pXMLFlash);
>  }
> 
>  STDMETHODIMP CFlashGuestPlayer::QueryInterface(REFIID riid, void**
ppvObj)
>  {
>      QInterfaceList  qiList[] =
> Index: flash_guest_player_ns.cpp
> ===================================================================
> RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player_ns.cpp,v
> retrieving revision 1.27.2.38
> diff -w -u -5 -r1.27.2.38 flash_guest_player_ns.cpp
> --- flash_guest_player_ns.cpp    22 May 2008 05:14:00 -0000    1.27.2.38
> +++ flash_guest_player_ns.cpp    29 May 2008 02:25:51 -0000
> @@ -67,10 +67,11 @@
>  #include "hxvsurf.h"
>  #include "hxprefs.h"
>  #include "hxhyper.h"
>  #include "hxhypnv.h"
>  #include "hxevent.h"
> +#include "hxstringutil.h"
>  #include "dllacces.h"
>  #include "filespecutils.h"
>  #include "hxinter.h" // IHXEventManager
>  #include "xml_flash.h"
>  #include "swfpack.h"
> @@ -1509,10 +1510,12 @@
> 
>      HX_RELEASE(m_pOffscreenBuffer);
>      HX_RELEASE(m_pMutex);
>      HX_RELEASE(m_pSite);
>      HX_RELEASE(m_pScheduler);
> +        m_EIFunctionList.RemoveAll();
> +        HX_RELEASE(m_pXMLFlash);
> 
>          m_bTerminated = TRUE;
>      }
> 
>      return HXR_OK;
> @@ -3707,11 +3710,11 @@
>          pos = m_StringIds.AddTailString(name);
>      }
>      const char* sId;
>      sId = (const char*) *((CHXString*) m_StringIds.GetAt(pos));
> 
> -    HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name, sId);
> +    //HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name,
> sId);
>      return (NPIdentifier) sId;
>  }
> 
>  void
>  CFlashGuestPlayerNS::NPN_GetStringIdentifiers(const NPUTF8** names,
> int32_t nameCount, NPIdentifier* identifiers)
> @@ -3754,11 +3757,11 @@
>  #if defined(_MAC_UNIX)
>      // MBO - Test
>      // printf("NPN_UTF8FromIdentifier\n");
>  #endif    // _MAC_UNIX
> 
> -    HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*) identifier);
> +    //HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*)
> identifier);
>      return (NPUTF8*) new_string((char*) identifier);
>  }
> 
>  int32_t
>  CFlashGuestPlayerNS::NPN_IntFromIdentifier(NPIdentifier identifier)
> @@ -3913,24 +3916,26 @@
>      // From a helix 'VolumeSlider':
>      //   try { __flash__toXML(HXSetVolume(49)) ; } catch (e) {
> ""; }
> 
>      CHXString strInvokeName, strInvokeArgs;
>      INT32 dIndex = -1;
> +    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
> +    CFlashGuestPlayerNS* pPlayer = NULL;
> +
> +    if (objw)
> +    {
> +    pPlayer = (CFlashGuestPlayerNS*) objw->m_npp->ndata;
> +    }
> 
>      if (strstr(strScript, "HXGetExternalInterfaceStatus"))
>      {
>      HXLOGL4(HXLOG_FPHR, "HXExternalInteraceStatus message received.
> ExternalInterface.call is working.");
>      // Send a message to Flash saying that we are able to receive
> ExternalInterface.call messages
> -        if (obj)
> -        {
> -            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
> -            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
> objw->m_npp->ndata;
>              if (pPlayer)
>              {
> 
> pPlayer->SendFlashMessage("EISetExternalInterfaceStatus", "true");
>              }
> -        }
>      return true;
>      }
> 
>      // Remove the array brackets
>      if (strScript.FindAndReplace("([", "(", FALSE))
> @@ -3948,12 +3953,10 @@
>      HXLOGL4(HXLOG_FPHR, "HXDebug: %s", (const char*)strInvokeArgs);
>      return true;
>      }
>      if ((dIndex = strScript.Find("HXPosition(")) >= 0)
>      {
> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
> objw->m_npp->ndata;
>      if (pPlayer)
>      {
>          strInvokeArgs = strScript.Mid(dIndex + strlen("HXPosition("));
>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>          {
> @@ -3965,12 +3968,10 @@
> 
>      return true;
>      }
>      if ((dIndex = strScript.Find("HXMetaChanged(")) >= 0)
>      {
> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
> objw->m_npp->ndata;
>      if (pPlayer)
>      {
>          strInvokeArgs = strScript.Mid(dIndex + strlen("HXMetaChanged("));
>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>          {
> @@ -3982,12 +3983,10 @@
> 
>      return true;
>      }
>      if ((dIndex = strScript.Find("HXBufferingChanged(")) >= 0)
>      {
> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
> objw->m_npp->ndata;
>      if (pPlayer)
>      {
>          strInvokeArgs = strScript.Mid(dIndex +
> strlen("HXBufferingChanged("));
>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>          {
> @@ -3999,12 +3998,10 @@
> 
>      return true;
>      }
>      if ((dIndex = strScript.Find("HXStateChanged(\"")) >= 0)
>      {
> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
> objw->m_npp->ndata;
>      if (pPlayer)
>      {
>          strInvokeArgs = strScript.Mid(dIndex +
> strlen("HXStateChanged(\""));
>          if ((dIndex = strInvokeArgs.Find('"')) > 0)
>          {
> @@ -4208,25 +4205,33 @@
>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>          {
>              strInvokeArgs = strInvokeArgs.Left(dIndex);
>          }
>      }
> +    else if ((dIndex = strScript.Find("HXSetFunctions(")) >= 0)
> +    {
> +        strInvokeName = "HXSetFunctions";
> +        strInvokeArgs = strScript.Mid(dIndex +
> strlen("HXSetFunctions(") + 1);
> +        if ((dIndex = strInvokeArgs.Find(')')) > 0)
> +        {
> +            strInvokeArgs = strInvokeArgs.Left(dIndex);
> +            if (pPlayer)
> +            {
> +                pPlayer->SetupEIFunctionList(strInvokeArgs);
> +            }
> +        }
> +    }
> 
>      if (!strInvokeName.IsEmpty())
>      {
>          CHXString strInvokeXML;
>          HX_RESULT hr = CHXXMLFlash::WriteInvokeXML(strInvokeName,
> strInvokeArgs, strInvokeXML);
> -        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && obj)
> -        {
> -            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
> -            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
> objw->m_npp->ndata;
> -            if (pPlayer)
> +        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && pPlayer)
>              {
>                  pPlayer->FlashCall(strInvokeXML);
>              }
>          }
> -    }
> 
>      return true;
>  }
> 
>  bool
> @@ -4316,11 +4321,11 @@
>  }
> 
>  void
>  CFlashGuestPlayerNS::NPN_ReleaseVariantValue(NPVariant *variant)
>  {
> -    HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
> +    //HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
> 
>  #if defined(_MAC_UNIX)
>      // MBO - Test
>      // printf("NPN_ReleaseVariantValue vriant=%ld\n", variant);
>  #endif    // _MAC_UNIX
> @@ -5356,11 +5361,18 @@
>          NPVariant npArgv[1];
>          UINT32 argCount=1;
> 
>          STRINGN_TO_NPVARIANT( (const char*) strInvokeXML, strlen((const
> char*)strInvokeXML), npArgv[0]);
> 
> +    if (EIFunctionExists(strInvokeXML))
> +    {
>          hr = Invoke("CallFunction", npArgv, argCount, &vresult);
> +    }
> +    else
> +    {
> +        hr = HXR_UNEXPECTED;
> +    }
> 
>      if (SUCCEEDED(hr))
>          {
>              NPN_ReleaseVariantValue(&vresult);
>          }
> @@ -5403,5 +5415,54 @@
>      // Get the current frame
>      INT32 lCurFrame = 0;
>      HX_RESULT retVal = Invoke("CurrentFrame", lCurFrame);
>      return lCurFrame;
>  }
> +
> +HXBOOL
> +CFlashGuestPlayerNS::EIFunctionExists(const CHXString& strInvokeXML)
> +{
> +    // Check to see if the ExternalInterface function exists
> +    HXBOOL bExists=TRUE; // Default to true, if we did not receive a
> list via HXSetFunctions, or we cannot parse, assume passive check.
> +
> +    // Extract the invoke name, and make sure it exists on the flash side
> +    if (m_EIFunctionList.GetCount() > 0)
> +    {
> +    CHXString strInvokeName, strInvokeArgs;
> +
> +    if (m_pXMLFlash == NULL)
> +    {
> +        m_pXMLFlash = new CHXXMLFlash(m_pContext);
> +        HX_ADDREF(m_pXMLFlash);
> +    }
> +
> +    // Parse the XML, get the invoke name
> +    if (m_pXMLFlash)
> +    {
> +        if (SUCCEEDED(m_pXMLFlash->ParseInvokeXML(strInvokeXML,
> strInvokeName, strInvokeArgs)) && !strInvokeName.IsEmpty())
> +        {
> +        if (!m_EIFunctionList.FindString(strInvokeName))
> +        {
> +                HXLOGL4(HXLOG_FPHR,
> "CFlashGuestPlayerNS::EIFunctionExists FAILED for invoke name: %s",
> (const char*) strInvokeName);
> +            bExists = FALSE;
> +        }
> +        }
> +    }
> +    }
> +
> +    return bExists;
> +}
> +
> +//
> +// Create a list of known ExternalInterface functions, valid for
> CallFunction, so we do not crash on the Mac
> +//
> +void
> +CFlashGuestPlayerNS::SetupEIFunctionList(const CHXString& strInvokeArgs)
> +{
> +    if (!strInvokeArgs.IsEmpty())
> +    {
> +    HXStringUtil::Split(strInvokeArgs, HXFLASH_ARGUMENT_DELIMITER,
> m_EIFunctionList);
> +    }
> +
> +    HXLOGL4(HXLOG_FPHR, "CFlashGuestPlayerNS::SetupEIFunctionList:
> Created function list, count=%ld", m_EIFunctionList.GetCount());
> +}
> +
> Index: platform/win32/flash_guest_player_ax.cpp
> ===================================================================
> RCS file:
> /cvsroot/datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
> ,v
> retrieving revision 1.21.2.29
> diff -w -u -5 -r1.21.2.29 flash_guest_player_ax.cpp
> --- platform/win32/flash_guest_player_ax.cpp    21 May 2008 12:32:41
> -0000    1.21.2.29
> +++ platform/win32/flash_guest_player_ax.cpp    28 May 2008 21:48:40 -0000
> @@ -132,11 +132,10 @@
>          , m_lpO(NULL)
>          , m_lpInPlaceObjWindowless(NULL)
>          , m_lpInPlaceObj(NULL)
>          , m_lpViewObject(NULL)
>          , m_pMutex(NULL)
> -        , m_pXMLFlash(NULL)
>          , m_dFrameRate(0.0)
>          , m_bInPlaceActive(FALSE)
>          , m_lFlashVersion(0)
>          , m_bGotInvalidateRect(FALSE)
>          , m_pOffscreenBuffer(NULL)
> Index: pub/flash_guest_player.h
> ===================================================================
> RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player.h,v
> retrieving revision 1.27.2.12
> diff -w -u -5 -r1.27.2.12 flash_guest_player.h
> --- pub/flash_guest_player.h    25 Apr 2008 22:54:26 -0000    1.27.2.12
> +++ pub/flash_guest_player.h    28 May 2008 23:22:34 -0000
> @@ -106,10 +106,11 @@
> 
>  // Forward declarations
>  class CHXSimpleList;
>  class CFlashSiteWatcher;
>  class CFlashPassiveSiteWatcher;
> +class CHXXMLFlash;
>  struct IHXCommonClassFactory;
>  struct IHXFileObject;
>  //struct IHXRequest;
> 
>  #define SOURCE_URL_FLASH_CUSTOM_VAR        "sourceURL"
> @@ -247,10 +248,11 @@
>      IHXFileObject*    m_pFileObject;
>      IHXFileObject*    m_pFLVFileObject;
>      IHXSite*        m_pSite;
>      HXxPoint        m_OffsetPoint;
>      IHXScheduler*    m_pScheduler;
> +    CHXXMLFlash*    m_pXMLFlash;
> 
>      IHXExternalInterfaceResponse* m_pExternalInterfaceResponse;
>      IHXSiteWindowless* m_pRepresentingSite;
> 
>      HXBOOL m_bWindowlessPref;     // Specifies the pref for windowless
> (true) or windowed (false)
> Index: pub/flash_guest_player_ns.h
> ===================================================================
> RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player_ns.h,v
> retrieving revision 1.14.2.15
> diff -w -u -5 -r1.14.2.15 flash_guest_player_ns.h
> --- pub/flash_guest_player_ns.h    10 May 2008 20:47:13 -0000    1.14.2.15
> +++ pub/flash_guest_player_ns.h    28 May 2008 23:52:09 -0000
> @@ -57,18 +57,18 @@
>  #include "npupp.h"
>  #include "hxwin.h"
>  #include "hxstring.h"
>  #include "hxsite2.h"
>  #include "hxengin.h"
> +#include "hxslist.h"
> 
>  #if defined (_MAC_UNIX)
>  #include "platform/mac/macwindowinfo.h"
>  #endif    // _MAC_UNIX
> 
>  // Forward declarations
>  class CHXSimpleList;
> -class CHXStringList;
>  class CHXString;
>  class DLLAccess;
>  class  CHXGenericCallback;
>  struct IHXCommonClassFactory;
>  struct IHXMutex;
> @@ -253,10 +253,12 @@
>      HX_RESULT   ParseNativeMediaSize(IHXBuffer* pBuffer, REF(HXxSize)
> rSize);
>      void        OnFlashPlayerStateChange(const char* pszGuestState);
> 
>      UINT32  GetNumFrames(void);
>      UINT32  GetCurrentFrame(void);
> +    HXBOOL  EIFunctionExists(const CHXString& strInvokeXML);
> +    void    SetupEIFunctionList(const CHXString& strInvokeArgs);
> 
>      enum
>      {
>          kStateReady,
>          kStateFSMInitDonePending,
> @@ -284,10 +286,11 @@
>      double              m_dFrameRate;
>      UINT32        m_ulPacingInterval;
>      UINT32        m_ulReadPacingInterval;
>      UINT32        m_ulFileOffsetPending;
>      UINT32        m_ulFileOffsetRequested;
> +    CHXStringList    m_EIFunctionList;
> 
>      static const char* const    m_pszFlashMimeType;
>      static CHXStringList    m_StringIds;
>      static CHXSimpleList    m_IntIds;
>      static CHXString            m_pUserAgentStr;
> Index: pub/platform/win32/flash_guest_player_ax.h
> ===================================================================
> RCS file:
> /cvsroot/datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax
> .h,v
> retrieving revision 1.10.2.13
> diff -w -u -5 -r1.10.2.13 flash_guest_player_ax.h
> --- pub/platform/win32/flash_guest_player_ax.h    16 May 2008 16:37:16
> -0000    1.10.2.13
> +++ pub/platform/win32/flash_guest_player_ax.h    28 May 2008 21:48:04 -
> 0000
> @@ -75,11 +75,10 @@
>  // Forward declarations
>  class CFlashGuestPlayer;
>  class CHXString;
>  class CHXGenericCallback;
>  struct IHXFileObject;
> -class CHXXMLFlash;
> 
>  class CFlashGuestPlayerAX : public CFlashGuestPlayer
>                , public ShockwaveFlashObjects::_IShockwaveFlashEvents
>                , public IOleClientSite
>                , public IOleInPlaceSiteWindowless
> @@ -311,11 +310,10 @@
>      HBITMAP        m_hOldBitmap;
>      void*          m_pDIBits;
>      UINT32         m_ulDIBitsSize;
>      UINT32         m_ulDIBitsWidth;
>      UINT32         m_ulDIBitsHeight;
> -    CHXXMLFlash*   m_pXMLFlash;
>      double         m_dFrameRate;
>      HXBOOL         m_bInPlaceActive;
>      INT32          m_lFlashVersion;
>      HXBOOL         m_bGotInvalidateRect;
>      HXBOOL         m_bOLEInitialized;


From adamc at real.com  Wed May 28 21:43:51 2008
From: adamc at real.com (Adam Cappio)
Date: Wed May 28 20:29:36 2008
Subject: [datatype-dev] Re: Add ExternalInterface check to the
	FlashGuestPlayerNS
In-Reply-To: <1071D244292640C18F8AAFF3AB7F6584@DingDong>
References: <483E1719.3050103@real.com>
	<1071D244292640C18F8AAFF3AB7F6584@DingDong>
Message-ID: <483E3487.8050403@real.com>

What's the behaviour when a EI function that doesn't exist is called? 

Henry Ping wrote:
> I'd move EI function check to the base class so that FlashGuestPlayerAX can
> leverage the same checking mechanism when external interface is working in
> Flash AX.
>
> Rest looks good.
>
> Thanks
> Henry
>
>   
>> -----Original Message-----
>> From: Christina Bailey [mailto:cbailey@real.com]
>> Sent: Wednesday, May 28, 2008 7:38 PM
>> To: liteplayer_dev@real.com
>> Cc: datatype-dev@helixcommunity.org
>> Subject: CR: Add ExternalInterface check to the FlashGuestPlayerNS
>>
>> Synopsis: Mac crashes on ExternalInterface functions that do not exist.
>>
>> Overview: Add functionality to check for a list of supported
>> ExternalInterface functions.
>> If the SWF supports this feature it will send a "HXSetFunctions" message
>> with a list
>> of supported ExternalInterface functions.
>>
>> Files:
>>
>> datatype/flash/flashhost/flash_guest_player_ns.cpp
>> datatype/flash/flashhost/pub/flash_guest_player_ns.h
>>     - Add catch for HXSetFunctions command, parse args into a function
>> name list.
>>     - Before each ExternalInterface call, parse out the command from the
>> xml blob
>>     and check if the function is in the list, fail if the list exists
>> and it is not found.
>>     - Optimize dereference of the 'this' object in NPN_Evaluate.
>>
>> datatype/flash/flashhost/flash_guest_player.cpp
>> datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
>> datatype/flash/flashhost/pub/flash_guest_player.h
>> datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax.h
>>     - move common var to base class, m_pXMLFlash
>>
>> Branches: HEAD and 310Atlas
>>
>> Diff:
>>
>> Index: flash_guest_player.cpp
>> ===================================================================
>> RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player.cpp,v
>> retrieving revision 1.33.2.21
>> diff -w -u -5 -r1.33.2.21 flash_guest_player.cpp
>> --- flash_guest_player.cpp    14 May 2008 00:03:38 -0000    1.33.2.21
>> +++ flash_guest_player.cpp    28 May 2008 22:24:52 -0000
>> @@ -152,10 +152,11 @@
>>      , m_pFLVFileObject(NULL)
>>      , m_pSite(NULL)
>>      , m_pStats(NULL)
>>      , m_pRootSiteWatcher(NULL)
>>      , m_pRootPassiveSiteWatcher(NULL)
>> +    , m_pXMLFlash(NULL)
>>  {
>>      HXLOGL4(HXLOG_FPHR, "CON CFlashGuestPlayer this=%p", this);
>>      m_MediaSize.cx = dDefaultWindowWidth;
>>      m_MediaSize.cy = dDefaultWindowHeight;
>>      m_OffsetPoint.x = 0;
>> @@ -172,10 +173,11 @@
>>      HX_RELEASE(m_pExternalInterfaceResponse);
>>      HX_RELEASE(m_pRepresentingSite);
>>      HX_RELEASE(m_pCCF);
>>      HX_RELEASE(m_pContext);
>>      HX_RELEASE(m_pRequest);
>> +    HX_RELEASE(m_pXMLFlash);
>>  }
>>
>>  STDMETHODIMP CFlashGuestPlayer::QueryInterface(REFIID riid, void**
>>     
> ppvObj)
>   
>>  {
>>      QInterfaceList  qiList[] =
>> Index: flash_guest_player_ns.cpp
>> ===================================================================
>> RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player_ns.cpp,v
>> retrieving revision 1.27.2.38
>> diff -w -u -5 -r1.27.2.38 flash_guest_player_ns.cpp
>> --- flash_guest_player_ns.cpp    22 May 2008 05:14:00 -0000    1.27.2.38
>> +++ flash_guest_player_ns.cpp    29 May 2008 02:25:51 -0000
>> @@ -67,10 +67,11 @@
>>  #include "hxvsurf.h"
>>  #include "hxprefs.h"
>>  #include "hxhyper.h"
>>  #include "hxhypnv.h"
>>  #include "hxevent.h"
>> +#include "hxstringutil.h"
>>  #include "dllacces.h"
>>  #include "filespecutils.h"
>>  #include "hxinter.h" // IHXEventManager
>>  #include "xml_flash.h"
>>  #include "swfpack.h"
>> @@ -1509,10 +1510,12 @@
>>
>>      HX_RELEASE(m_pOffscreenBuffer);
>>      HX_RELEASE(m_pMutex);
>>      HX_RELEASE(m_pSite);
>>      HX_RELEASE(m_pScheduler);
>> +        m_EIFunctionList.RemoveAll();
>> +        HX_RELEASE(m_pXMLFlash);
>>
>>          m_bTerminated = TRUE;
>>      }
>>
>>      return HXR_OK;
>> @@ -3707,11 +3710,11 @@
>>          pos = m_StringIds.AddTailString(name);
>>      }
>>      const char* sId;
>>      sId = (const char*) *((CHXString*) m_StringIds.GetAt(pos));
>>
>> -    HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name, sId);
>> +    //HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name,
>> sId);
>>      return (NPIdentifier) sId;
>>  }
>>
>>  void
>>  CFlashGuestPlayerNS::NPN_GetStringIdentifiers(const NPUTF8** names,
>> int32_t nameCount, NPIdentifier* identifiers)
>> @@ -3754,11 +3757,11 @@
>>  #if defined(_MAC_UNIX)
>>      // MBO - Test
>>      // printf("NPN_UTF8FromIdentifier\n");
>>  #endif    // _MAC_UNIX
>>
>> -    HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*) identifier);
>> +    //HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*)
>> identifier);
>>      return (NPUTF8*) new_string((char*) identifier);
>>  }
>>
>>  int32_t
>>  CFlashGuestPlayerNS::NPN_IntFromIdentifier(NPIdentifier identifier)
>> @@ -3913,24 +3916,26 @@
>>      // From a helix 'VolumeSlider':
>>      //   try { __flash__toXML(HXSetVolume(49)) ; } catch (e) {
>> ""; }
>>
>>      CHXString strInvokeName, strInvokeArgs;
>>      INT32 dIndex = -1;
>> +    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> +    CFlashGuestPlayerNS* pPlayer = NULL;
>> +
>> +    if (objw)
>> +    {
>> +    pPlayer = (CFlashGuestPlayerNS*) objw->m_npp->ndata;
>> +    }
>>
>>      if (strstr(strScript, "HXGetExternalInterfaceStatus"))
>>      {
>>      HXLOGL4(HXLOG_FPHR, "HXExternalInteraceStatus message received.
>> ExternalInterface.call is working.");
>>      // Send a message to Flash saying that we are able to receive
>> ExternalInterface.call messages
>> -        if (obj)
>> -        {
>> -            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>              if (pPlayer)
>>              {
>>
>> pPlayer->SendFlashMessage("EISetExternalInterfaceStatus", "true");
>>              }
>> -        }
>>      return true;
>>      }
>>
>>      // Remove the array brackets
>>      if (strScript.FindAndReplace("([", "(", FALSE))
>> @@ -3948,12 +3953,10 @@
>>      HXLOGL4(HXLOG_FPHR, "HXDebug: %s", (const char*)strInvokeArgs);
>>      return true;
>>      }
>>      if ((dIndex = strScript.Find("HXPosition(")) >= 0)
>>      {
>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>      if (pPlayer)
>>      {
>>          strInvokeArgs = strScript.Mid(dIndex + strlen("HXPosition("));
>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>          {
>> @@ -3965,12 +3968,10 @@
>>
>>      return true;
>>      }
>>      if ((dIndex = strScript.Find("HXMetaChanged(")) >= 0)
>>      {
>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>      if (pPlayer)
>>      {
>>          strInvokeArgs = strScript.Mid(dIndex + strlen("HXMetaChanged("));
>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>          {
>> @@ -3982,12 +3983,10 @@
>>
>>      return true;
>>      }
>>      if ((dIndex = strScript.Find("HXBufferingChanged(")) >= 0)
>>      {
>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>      if (pPlayer)
>>      {
>>          strInvokeArgs = strScript.Mid(dIndex +
>> strlen("HXBufferingChanged("));
>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>          {
>> @@ -3999,12 +3998,10 @@
>>
>>      return true;
>>      }
>>      if ((dIndex = strScript.Find("HXStateChanged(\"")) >= 0)
>>      {
>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>      if (pPlayer)
>>      {
>>          strInvokeArgs = strScript.Mid(dIndex +
>> strlen("HXStateChanged(\""));
>>          if ((dIndex = strInvokeArgs.Find('"')) > 0)
>>          {
>> @@ -4208,25 +4205,33 @@
>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>          {
>>              strInvokeArgs = strInvokeArgs.Left(dIndex);
>>          }
>>      }
>> +    else if ((dIndex = strScript.Find("HXSetFunctions(")) >= 0)
>> +    {
>> +        strInvokeName = "HXSetFunctions";
>> +        strInvokeArgs = strScript.Mid(dIndex +
>> strlen("HXSetFunctions(") + 1);
>> +        if ((dIndex = strInvokeArgs.Find(')')) > 0)
>> +        {
>> +            strInvokeArgs = strInvokeArgs.Left(dIndex);
>> +            if (pPlayer)
>> +            {
>> +                pPlayer->SetupEIFunctionList(strInvokeArgs);
>> +            }
>> +        }
>> +    }
>>
>>      if (!strInvokeName.IsEmpty())
>>      {
>>          CHXString strInvokeXML;
>>          HX_RESULT hr = CHXXMLFlash::WriteInvokeXML(strInvokeName,
>> strInvokeArgs, strInvokeXML);
>> -        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && obj)
>> -        {
>> -            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>> -            if (pPlayer)
>> +        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && pPlayer)
>>              {
>>                  pPlayer->FlashCall(strInvokeXML);
>>              }
>>          }
>> -    }
>>
>>      return true;
>>  }
>>
>>  bool
>> @@ -4316,11 +4321,11 @@
>>  }
>>
>>  void
>>  CFlashGuestPlayerNS::NPN_ReleaseVariantValue(NPVariant *variant)
>>  {
>> -    HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
>> +    //HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
>>
>>  #if defined(_MAC_UNIX)
>>      // MBO - Test
>>      // printf("NPN_ReleaseVariantValue vriant=%ld\n", variant);
>>  #endif    // _MAC_UNIX
>> @@ -5356,11 +5361,18 @@
>>          NPVariant npArgv[1];
>>          UINT32 argCount=1;
>>
>>          STRINGN_TO_NPVARIANT( (const char*) strInvokeXML, strlen((const
>> char*)strInvokeXML), npArgv[0]);
>>
>> +    if (EIFunctionExists(strInvokeXML))
>> +    {
>>          hr = Invoke("CallFunction", npArgv, argCount, &vresult);
>> +    }
>> +    else
>> +    {
>> +        hr = HXR_UNEXPECTED;
>> +    }
>>
>>      if (SUCCEEDED(hr))
>>          {
>>              NPN_ReleaseVariantValue(&vresult);
>>          }
>> @@ -5403,5 +5415,54 @@
>>      // Get the current frame
>>      INT32 lCurFrame = 0;
>>      HX_RESULT retVal = Invoke("CurrentFrame", lCurFrame);
>>      return lCurFrame;
>>  }
>> +
>> +HXBOOL
>> +CFlashGuestPlayerNS::EIFunctionExists(const CHXString& strInvokeXML)
>> +{
>> +    // Check to see if the ExternalInterface function exists
>> +    HXBOOL bExists=TRUE; // Default to true, if we did not receive a
>> list via HXSetFunctions, or we cannot parse, assume passive check.
>> +
>> +    // Extract the invoke name, and make sure it exists on the flash side
>> +    if (m_EIFunctionList.GetCount() > 0)
>> +    {
>> +    CHXString strInvokeName, strInvokeArgs;
>> +
>> +    if (m_pXMLFlash == NULL)
>> +    {
>> +        m_pXMLFlash = new CHXXMLFlash(m_pContext);
>> +        HX_ADDREF(m_pXMLFlash);
>> +    }
>> +
>> +    // Parse the XML, get the invoke name
>> +    if (m_pXMLFlash)
>> +    {
>> +        if (SUCCEEDED(m_pXMLFlash->ParseInvokeXML(strInvokeXML,
>> strInvokeName, strInvokeArgs)) && !strInvokeName.IsEmpty())
>> +        {
>> +        if (!m_EIFunctionList.FindString(strInvokeName))
>> +        {
>> +                HXLOGL4(HXLOG_FPHR,
>> "CFlashGuestPlayerNS::EIFunctionExists FAILED for invoke name: %s",
>> (const char*) strInvokeName);
>> +            bExists = FALSE;
>> +        }
>> +        }
>> +    }
>> +    }
>> +
>> +    return bExists;
>> +}
>> +
>> +//
>> +// Create a list of known ExternalInterface functions, valid for
>> CallFunction, so we do not crash on the Mac
>> +//
>> +void
>> +CFlashGuestPlayerNS::SetupEIFunctionList(const CHXString& strInvokeArgs)
>> +{
>> +    if (!strInvokeArgs.IsEmpty())
>> +    {
>> +    HXStringUtil::Split(strInvokeArgs, HXFLASH_ARGUMENT_DELIMITER,
>> m_EIFunctionList);
>> +    }
>> +
>> +    HXLOGL4(HXLOG_FPHR, "CFlashGuestPlayerNS::SetupEIFunctionList:
>> Created function list, count=%ld", m_EIFunctionList.GetCount());
>> +}
>> +
>> Index: platform/win32/flash_guest_player_ax.cpp
>> ===================================================================
>> RCS file:
>> /cvsroot/datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
>> ,v
>> retrieving revision 1.21.2.29
>> diff -w -u -5 -r1.21.2.29 flash_guest_player_ax.cpp
>> --- platform/win32/flash_guest_player_ax.cpp    21 May 2008 12:32:41
>> -0000    1.21.2.29
>> +++ platform/win32/flash_guest_player_ax.cpp    28 May 2008 21:48:40 -0000
>> @@ -132,11 +132,10 @@
>>          , m_lpO(NULL)
>>          , m_lpInPlaceObjWindowless(NULL)
>>          , m_lpInPlaceObj(NULL)
>>          , m_lpViewObject(NULL)
>>          , m_pMutex(NULL)
>> -        , m_pXMLFlash(NULL)
>>          , m_dFrameRate(0.0)
>>          , m_bInPlaceActive(FALSE)
>>          , m_lFlashVersion(0)
>>          , m_bGotInvalidateRect(FALSE)
>>          , m_pOffscreenBuffer(NULL)
>> Index: pub/flash_guest_player.h
>> ===================================================================
>> RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player.h,v
>> retrieving revision 1.27.2.12
>> diff -w -u -5 -r1.27.2.12 flash_guest_player.h
>> --- pub/flash_guest_player.h    25 Apr 2008 22:54:26 -0000    1.27.2.12
>> +++ pub/flash_guest_player.h    28 May 2008 23:22:34 -0000
>> @@ -106,10 +106,11 @@
>>
>>  // Forward declarations
>>  class CHXSimpleList;
>>  class CFlashSiteWatcher;
>>  class CFlashPassiveSiteWatcher;
>> +class CHXXMLFlash;
>>  struct IHXCommonClassFactory;
>>  struct IHXFileObject;
>>  //struct IHXRequest;
>>
>>  #define SOURCE_URL_FLASH_CUSTOM_VAR        "sourceURL"
>> @@ -247,10 +248,11 @@
>>      IHXFileObject*    m_pFileObject;
>>      IHXFileObject*    m_pFLVFileObject;
>>      IHXSite*        m_pSite;
>>      HXxPoint        m_OffsetPoint;
>>      IHXScheduler*    m_pScheduler;
>> +    CHXXMLFlash*    m_pXMLFlash;
>>
>>      IHXExternalInterfaceResponse* m_pExternalInterfaceResponse;
>>      IHXSiteWindowless* m_pRepresentingSite;
>>
>>      HXBOOL m_bWindowlessPref;     // Specifies the pref for windowless
>> (true) or windowed (false)
>> Index: pub/flash_guest_player_ns.h
>> ===================================================================
>> RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player_ns.h,v
>> retrieving revision 1.14.2.15
>> diff -w -u -5 -r1.14.2.15 flash_guest_player_ns.h
>> --- pub/flash_guest_player_ns.h    10 May 2008 20:47:13 -0000    1.14.2.15
>> +++ pub/flash_guest_player_ns.h    28 May 2008 23:52:09 -0000
>> @@ -57,18 +57,18 @@
>>  #include "npupp.h"
>>  #include "hxwin.h"
>>  #include "hxstring.h"
>>  #include "hxsite2.h"
>>  #include "hxengin.h"
>> +#include "hxslist.h"
>>
>>  #if defined (_MAC_UNIX)
>>  #include "platform/mac/macwindowinfo.h"
>>  #endif    // _MAC_UNIX
>>
>>  // Forward declarations
>>  class CHXSimpleList;
>> -class CHXStringList;
>>  class CHXString;
>>  class DLLAccess;
>>  class  CHXGenericCallback;
>>  struct IHXCommonClassFactory;
>>  struct IHXMutex;
>> @@ -253,10 +253,12 @@
>>      HX_RESULT   ParseNativeMediaSize(IHXBuffer* pBuffer, REF(HXxSize)
>> rSize);
>>      void        OnFlashPlayerStateChange(const char* pszGuestState);
>>
>>      UINT32  GetNumFrames(void);
>>      UINT32  GetCurrentFrame(void);
>> +    HXBOOL  EIFunctionExists(const CHXString& strInvokeXML);
>> +    void    SetupEIFunctionList(const CHXString& strInvokeArgs);
>>
>>      enum
>>      {
>>          kStateReady,
>>          kStateFSMInitDonePending,
>> @@ -284,10 +286,11 @@
>>      double              m_dFrameRate;
>>      UINT32        m_ulPacingInterval;
>>      UINT32        m_ulReadPacingInterval;
>>      UINT32        m_ulFileOffsetPending;
>>      UINT32        m_ulFileOffsetRequested;
>> +    CHXStringList    m_EIFunctionList;
>>
>>      static const char* const    m_pszFlashMimeType;
>>      static CHXStringList    m_StringIds;
>>      static CHXSimpleList    m_IntIds;
>>      static CHXString            m_pUserAgentStr;
>> Index: pub/platform/win32/flash_guest_player_ax.h
>> ===================================================================
>> RCS file:
>> /cvsroot/datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax
>> .h,v
>> retrieving revision 1.10.2.13
>> diff -w -u -5 -r1.10.2.13 flash_guest_player_ax.h
>> --- pub/platform/win32/flash_guest_player_ax.h    16 May 2008 16:37:16
>> -0000    1.10.2.13
>> +++ pub/platform/win32/flash_guest_player_ax.h    28 May 2008 21:48:04 -
>> 0000
>> @@ -75,11 +75,10 @@
>>  // Forward declarations
>>  class CFlashGuestPlayer;
>>  class CHXString;
>>  class CHXGenericCallback;
>>  struct IHXFileObject;
>> -class CHXXMLFlash;
>>
>>  class CFlashGuestPlayerAX : public CFlashGuestPlayer
>>                , public ShockwaveFlashObjects::_IShockwaveFlashEvents
>>                , public IOleClientSite
>>                , public IOleInPlaceSiteWindowless
>> @@ -311,11 +310,10 @@
>>      HBITMAP        m_hOldBitmap;
>>      void*          m_pDIBits;
>>      UINT32         m_ulDIBitsSize;
>>      UINT32         m_ulDIBitsWidth;
>>      UINT32         m_ulDIBitsHeight;
>> -    CHXXMLFlash*   m_pXMLFlash;
>>      double         m_dFrameRate;
>>      HXBOOL         m_bInPlaceActive;
>>      INT32          m_lFlashVersion;
>>      HXBOOL         m_bGotInvalidateRect;
>>      HXBOOL         m_bOLEInitialized;
>>     
>
>   


From sgarg at real.com  Thu May 29 03:44:08 2008
From: sgarg at real.com (Sushant Garg)
Date: Thu May 29 02:29:55 2008
Subject: [datatype-dev] CR: Porting RealPlayer to Atlas Linux
Message-ID: <007401c8c178$ef635580$0701a8c0@sushant>

Skipped content of type multipart/alternative-------------- next part --------------
Index: Umakefil
===================================================================
RCS file: /cvsroot/datatype/flash/renderer/Umakefil,v
retrieving revision 1.2
diff -u -r1.2 Umakefil
--- Umakefil	5 May 2004 21:20:42 -0000	1.2
+++ Umakefil	28 May 2008 09:56:16 -0000
@@ -60,7 +60,7 @@
                            "common/import/zlib[zlib]",
                            "protocol/http[httplib]",
                            "protocol/common/util[protutillib]",
-                           "datatype/rm/common[rmcomlib]",
+                           "datatype/rm/common[rmcommonlib]",
                            "datatype/common/util[dtutillib]",
                            "datatype/image/common[imgcomlib]",
                            "datatype/image/jpg/import/jpeg-6b[jpeglib]")
From ehyche at real.com  Thu May 29 06:18:36 2008
From: ehyche at real.com (Eric Hyche)
Date: Thu May 29 05:03:52 2008
Subject: [datatype-dev] CR-Client: fix for UTF16 to UTF8 conversion in
	wm	fileformat
In-Reply-To: <483DCED2.4050607@real.com>
References: <56103.24.158.143.31.1212009531.squirrel@mailone.real.com>
	<483DCED2.4050607@real.com>
Message-ID: <010801c8c18e$81a7e540$db68a8c0@EHYCHED620>


It's kind of hard to read from the diff, but
it looks like this:

if (FAILED(retVal))
{
    HX_VECTOR_DELETE(pszTmp);
}

So it only deletes the output buffer if
the UTF8 conversion failed for some reason.
Otherwise, the out parameter holds the allocated
buffer.

Eric

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: Greg Wright [mailto:gwright@real.com] 
> Sent: Wednesday, May 28, 2008 5:30 PM
> To: ehyche@real.com
> Cc: datatype-dev@lists.helixcommunity.org
> Subject: Re: [datatype-dev] CR-Client: fix for UTF16 to UTF8 
> conversion in wm fileformat
> 
> Eric Hyche wrote:
> > Description
> > ----------------------------------------
> > Content description strings (such as Title/Author/Copyright) are
> > stored as UTF16 little-endian in ASF files. In the wm fileformat
> > code, we had made an assumption that sizeof(wchar_t) was equal
> > to 2. This is correct on Windows, but on Linux, sizeof(wchar_t) can
> > be 4. Therefore, the UTF16->UTF8 conversion was not working 
> correctly,
> > and true multi-byte characters in UTF8 (such as Author strings in
> > Chinese characters) were not being converted correctly.
> > 
> > Files Modified
> > ----------------------------------------
> > common/runtime/pub/hlxosstr.h
> > datatype/wm/common/parse_asf_objects.cpp
> > 
> > Branches
> > ----------------------------------------
> > HEAD and 310Atlas
> > 
> > Index: hlxosstr.h
> > ===================================================================
> > RCS file: /cvsroot/common/runtime/pub/hlxosstr.h,v
> > retrieving revision 1.10.2.1
> > diff -u -w -r1.10.2.1 hlxosstr.h
> > --- hlxosstr.h  21 Mar 2008 11:15:25 -0000      1.10.2.1
> > +++ hlxosstr.h  28 May 2008 21:17:28 -0000
> > @@ -97,6 +97,7 @@
> >      operator char*() { return m_ascii; }
> >      operator unsigned char*() { return (unsigned char*) m_ascii; }
> >       ~HLXOsStrW();
> > +    int GetOutSize() { return m_outsize; }
> > 
> >      HLXOsStrW(const HLXOsStrW& rhs);
> >      HLXOsStrW& operator=(const HLXOsStrW& rhs);
> > 
> > 
> > Index: parse_asf_objects.cpp
> > ===================================================================
> > RCS file: /cvsroot/datatype/wm/common/parse_asf_objects.cpp,v
> > retrieving revision 1.10.4.1
> > diff -u -w -r1.10.4.1 parse_asf_objects.cpp
> > --- parse_asf_objects.cpp       5 May 2008 06:04:38 -0000   
>     1.10.4.1
> > +++ parse_asf_objects.cpp       28 May 2008 21:17:54 -0000
> > @@ -199,24 +199,43 @@
> >              // Make sure we have a large enough input buffer
> >              if (*pulLen >= ulByteSize)
> >              {
> > -                // Allocate an output buffer (with NULL terminator)
> > -                char* pszTmp = new char [ulNumWideChar + 1];
> > +                // Allocate an intermediate buffer. 
> "Unicode" strings
> > +                // in the ASF format are always stored as 
> UTF16 little-endian.
> > +                // However, on some platforms, 
> sizeof(wchar_t) is 2 bytes and
> > +                // on some platforms, sizeof(wchar_t) is 4 
> bytes. Therefore,
> > +                // we cannot just assume that we can do 
> memcpy from the
> > +                // input buffer into a const wchar_t* buffer.
> > +                wchar_t* pTmpWChar = new wchar_t 
> [ulNumWideChar + 1];
> > +                if (pTmpWChar)
> > +                {
> > +                    // Null out the buffer
> > +                 memset((void*) pTmpWChar, 0, 
> (ulNumWideChar + 1) * sizeof(wchar_t));
> > +                    // Set up the input pointers
> > +                    UINT16 usWChar = 0;
> > +                    // Copy the string, one wide char at a time
> > +                    UINT32 i = 0;
> > +                    for (i = 0; i < ulNumWideChar; i++)
> > +                    {
> > +                        usWChar = 0;
> > +                        UnpackUINT16LEInc(ppBuf, pulLen, &usWChar);
> > +                        pTmpWChar[i] = (wchar_t) usWChar;
> > +                    }
> > +                    // Convert to UTF8
> > +                    HLXOsStrW cStr((const wchar_t*) 
> pTmpWChar, (size_t) ulNumWideChar);
> > +                    // After conversion to UTF8, the 
> HLXOsStrW can tell
> > +                    // us how many bytes were needed. We 
> add an extra byte
> > +                    // to this to ensure NULL termination
> > +                    UINT32 ulOutBufSize = (UINT32) 
> (cStr.GetOutSize() + 1);
> > +                    // Allocate a buffer of this many characters
> > +                    char* pszTmp = new char [ulOutBufSize];
> >                  if (pszTmp)
> >                  {
> > -                    // Convert to ASCII
> > -                    wchar_t* pTmpWChar = new 
> wchar_t[ulNumWideChar];
> > -                    memcpy((BYTE*) pTmpWChar,  *ppBuf,  
> ulNumWideChar*sizeof(wchar_t));
> > -                    HLXOsStrW cStr((const wchar_t*) 
> pTmpWChar, ulNumWideChar);
> > -                    // Copy the string
> > -                    strncpy(pszTmp, (const char*) cStr, 
> ulNumWideChar);
> > -                    // NULL terminate the string
> > -                    pszTmp[ulNumWideChar] = '\0';
> > -                    // Advance the input buffer
> > -                    *ppBuf  += ulByteSize;
> > -                    *pulLen -= ulByteSize;
> > +                        // Null out the output buffer
> > +                     memset((void*) pszTmp, 0, ulOutBufSize);
> > +                        // Copy the UTF8 string into the 
> output buffer
> > +                        memcpy(pszTmp, (const char*) cStr, 
> cStr.GetOutSize());
> >                      // Assign the out parameter
> >                      *ppszOut = pszTmp;
> 
> HX_VECTOR_DELETE(pszTmp) is called below, does *ppszOut
> now point to deleted data after that? Otherwise looks
> good.
> 
> 
> --reg.
> 
> > -                    delete [] pTmpWChar;
> >                      // Clear the return value
> >                      retVal = HXR_OK;
> >                  }
> > @@ -225,6 +244,8 @@
> >                      HX_VECTOR_DELETE(pszTmp);
> >                  }
> >              }
> > +                HX_VECTOR_DELETE(pTmpWChar);
> > +            }
> >          }
> >      }
> 


From weian.chen at intel.com  Thu May 29 06:29:02 2008
From: weian.chen at intel.com (Chen, Weian)
Date: Thu May 29 05:16:10 2008
Subject: [datatype-dev] CR: Fix the thumbnail issue that when the video
	streamcan not support time-seeking, the dbus-server will hang up
In-Reply-To: <00d301c8bc21$72ac5b60$db68a8c0@EHYCHED620>
References: 
	<009601c8b9c0$7c61e930$db68a8c0@EHYCHED620>
	
	<00d301c8bc21$72ac5b60$db68a8c0@EHYCHED620>
Message-ID: 

Eric:

If we have some issues on time-seeking, then we will call into =
SeekDone() with asynchronous mode, but before this, the state is =
State_SeekDonePending, and we will run into function =
m_pContext->Process(), first time m_ulProcessInterrupts not equel to 0, =
it can work well, but the second m_ulProcessInterrupts =3D=3D0, and the =
system will hung up because =
m_pScheduler2->WaitForNextEvent(ulSleepTime), so before SeekDone() is =
called, the system already hang up.

So what's your suggestion?

Thanks a lot
Weian
-----Original Message-----
From: Eric Hyche [mailto:ehyche@real.com]=20
Sent: 2008=C4=EA5=D4=C222=C8=D5 23:35
To: Chen, Weian; datatype-dev@helixcommunity.org
Subject: RE: [datatype-dev] CR: Fix the thumbnail issue that when the =
video streamcan not support time-seeking, the dbus-server will hang up


> 1.       The content is=20
> Demo_512k_RV10_480x272_30fps_RA_355k_music.rm, and the seek=20
> time is 1000. BTW, when playing back, if we seek it, it also failed.
>=20

OK - I think there's a bug already filed on the fact that
seeking fails here.

> 2.       If we call into SeekDone() with asynchronous mode=20
> (seems only content with time-seeking issue will use=20
> asynchronous mode), then the system will hang up, we can=A1=AFt=20
> return back.
>=20

Well, anything played back via http:// may use an asynchonous=20
seek as well.

So you are saying that if you call Seek() from within SeekDone(HXR_FAIL)
callback that the Seek call never returns?

Eric

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc. =20

> -----Original Message-----
> From: Chen, Weian [mailto:weian.chen@intel.com]=20
> Sent: Monday, May 19, 2008 10:44 PM
> To: ehyche@real.com; datatype-dev@helixcommunity.org
> Subject: RE: [datatype-dev] CR: Fix the thumbnail issue that=20
> when the video streamcan not support time-seeking, the=20
> dbus-server will hang up
>=20
> Eric:
>=20
> =20
>=20
> 1.       The content is=20
> Demo_512k_RV10_480x272_30fps_RA_355k_music.rm, and the seek=20
> time is 1000. BTW, when playing back, if we seek it, it also failed.
>=20
> 2.       If we call into SeekDone() with asynchronous mode=20
> (seems only content with time-seeking issue will use=20
> asynchronous mode), then the system will hang up, we can=A1=AFt=20
> return back.
>=20
> =20
>=20
> Weian
>=20
> -----Original Message-----
> From: Eric Hyche [mailto:ehyche@real.com]=20
> Sent: 2008=C4=EA5=D4=C219=C8=D5 22:56
> To: Chen, Weian; datatype-dev@helixcommunity.org
> Subject: RE: [datatype-dev] CR: Fix the thumbnail issue that=20
> when the video streamcan not support time-seeking, the=20
> dbus-server will hang up
>=20
> =20
>=20
> =20
>=20
> Weian,
>=20
> =20
>=20
> Several questions:
>=20
> =20
>=20
> 1) In what circumstances are you seeing a SeekDone() call back
>=20
>    from the fileformat with a status other than HXR_OK? Specifically
>=20
>    I'm interested in which content and what seek time was used.
>=20
> =20
>=20
> 2) I think being able to handle a failure in SeekDone() in a good
>=20
>    change. However, the place you have made the change assumes that
>=20
>    the SeekDone() call will happen synchronously (that the SeekDone()
>=20
>    call will come before the m_pFileFormat->Seek(m_ulStartTime); call
>=20
>    returns. We cannot assume that this will be the case. Some=20
> fileformats
>=20
>    may make that call asynchronously.
>=20
> =20
>=20
>    So I think the proper place to make that call is in SeekDone(). If
>=20
>    we get a failure in SeekDone() and we had a non-zero m_ulStartTime,
>=20
>    then change m_ulStartTime to 0 and re-issue the=20
> m_pFileFormat->Seek(m_ulStartTime)
>=20
>    call. If m_ulStartTime is *already* 0, then we should error out.
>=20
> =20
>=20
> Eric
>=20
> =20
>=20
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
> Eric Hyche (ehyche@real.com)
>=20
> Technical Lead
>=20
> RealNetworks, Inc. =20
>=20
> =20
>=20
> > -----Original Message-----
>=20
> > From: datatype-dev-bounces@helixcommunity.org=20
>=20
> > [mailto:datatype-dev-bounces@helixcommunity.org] On Behalf Of=20
>=20
> > Chen, Weian
>=20
> > Sent: Thursday, May 15, 2008 3:33 AM
>=20
> > To: datatype-dev@helixcommunity.org
>=20
> > Subject: [datatype-dev] CR: Fix the thumbnail issue that when=20
>=20
> > the video streamcan not support time-seeking, the dbus-server=20
>=20
> > will hang up
>=20
> >=20
>=20
> > Synopsis:
>=20
> >=20
>=20
> >   Fix the thumbnail issue that when the video stream can not=20
>=20
> > support time-seeking, the dbus-server will hang up.
>=20
> >=20
>=20
> > =20
>=20
> >=20
>=20
> > Overview:
>=20
> >=20
>=20
> >   When the video stream can not support time-seeking, the=20
>=20
> > dbus-server will hang up, and we fix it with following=20
>=20
> > solution: when we find the stream can not support=20
>=20
> > time-seeking, we set the StartTime to 0 to avoid exception.
>=20
> >=20
>=20
> > =20
>=20
> >=20
>=20
> > Files Added:
>=20
> >=20
>=20
> >   No file added
>=20
> >=20
>=20
> > =20
>=20
> >=20
>=20
> > Files Modified:
>=20
> >=20
>=20
> >   datatype/tools/dtdriver/engine/ffdriver.cpp
>=20
> >=20
>=20
> > =20
>=20
> >=20
>=20
> > Image Size and Heap Use impact (Client-Only):
>=20
> >=20
>=20
> >   Little
>=20
> >=20
>=20
> > =20
>=20
> >=20
>=20
> > Platform and Profiles Affected:
>=20
> >=20
>=20
> >   platform: linux-2.2-libc6-gcc32-i586
>=20
> >=20
>=20
> >   profile:    helix-client-all-defines
>=20
> >=20
>=20
> > =20
>=20
> >=20
>=20
> > Distribution Libraries Affected:
>=20
> >=20
>=20
> >  
>=20
> >=20
>=20
> > =20
>=20
> >=20
>=20
> > Distribution library impact and planned action:
>=20
> >=20
>=20
> >   
>=20
> >=20
>=20
> > =20
>=20
> >=20
>=20
> > Platforms and Profiles Build Verfied:
>=20
> >=20
>=20
> >   Set BIF branch  ->  hxclient_3_1_0_atlas_restricted
>=20
> >=20
>=20
> >   Set Target(s)    ->  datatype_tools_dtdrive
>=20
> >=20
>=20
> >   Set Profile      ->  helix-client-all-defines
>=20
> >=20
>=20
> >   System ID      ->  linux-2.2-libc6-gcc32-i586
>=20
> >=20
>=20
> > =20
>=20
> >=20
>=20
> > Branch:
>=20
> >=20
>=20
> >   HEAD, hxclient_3_1_0_atlas_restricted
>=20
> >=20
>=20
> > =20
>=20
> >=20
>=20
> > Copyright assignment: 
>=20
> >=20
>=20
> >   2.    Intel has signed and delivered a Joint Copyright=20
>=20
> > Assignment to RealNetworks, and received acknowledgment that=20
>=20
> > the agreement was received.
>=20
> >=20
>=20
> > =20
>=20
> >=20
>=20
> > Files Attached:
>=20
> >=20
>=20
> >   dtdriver-thumbnail-ffdriver.diff
>=20
> >=20
>=20
> > =20
>=20
> >=20
>=20
> > Weian
>=20
> >=20
>=20
> > =20
>=20
> >=20
>=20
> >=20
>=20
> =20
>=20
>=20


From vkathuria at real.com  Thu May 29 07:35:01 2008
From: vkathuria at real.com (Varun Kathuria)
Date: Thu May 29 06:21:59 2008
Subject: [datatype-dev] CR:Changes to fix MJPG playback in avi container
Message-ID: <020401c8c199$6c0d57f0$1601a8c0@varun>

Skipped content of type multipart/alternative-------------- next part --------------
Index: riff.cpp
===================================================================
RCS file: /cvsroot/datatype/common/util/riff.cpp,v
retrieving revision 1.13
diff -u -r1.13 riff.cpp
--- riff.cpp	18 Aug 2007 00:03:23 -0000	1.13
+++ riff.cpp	29 May 2008 13:56:39 -0000
@@ -108,6 +108,7 @@
     : m_pReassemblyBuffer(NULL)
     , m_ulChunkBytesRead(0)
     , m_ulChunkSize(0)
+    , m_ulChunkType(0)
 {
     m_pContext = pContext;
     m_pResponse = pResponse;
@@ -564,7 +565,7 @@
 				}
 
                 if ( (m_ulFileType == RIFF_FILE_MAGIC_NUMBER) &&
-                     (m_ulGetChunkType == (UINT32)0) )
+                     (m_ulChunkType == (UINT32)0) )
                 {
                     m_state = RS_Ready;
                     m_pResponse->RIFFGetChunkDone(HXR_FAILED, 0, NULL);
From cbailey at real.com  Thu May 29 10:45:50 2008
From: cbailey at real.com (Christina Bailey)
Date: Thu May 29 09:31:01 2008
Subject: [datatype-dev] Re: Add ExternalInterface check to
	the	FlashGuestPlayerNS
In-Reply-To: <483E3487.8050403@real.com>
References: <483E1719.3050103@real.com>	<1071D244292640C18F8AAFF3AB7F6584@DingDong>
	<483E3487.8050403@real.com>
Message-ID: <483EEBCE.7090804@real.com>



Adam Cappio wrote:
> What's the behaviour when a EI function that doesn't exist is called?
Now it will just write a log message, instead of crashing.
> Henry Ping wrote:
>> I'd move EI function check to the base class so that 
>> FlashGuestPlayerAX can
>> leverage the same checking mechanism when external interface is 
>> working in
>> Flash AX.
>>
>> Rest looks good.
>>
>> Thanks
>> Henry
>>
>>  
>>> -----Original Message-----
>>> From: Christina Bailey [mailto:cbailey@real.com]
>>> Sent: Wednesday, May 28, 2008 7:38 PM
>>> To: liteplayer_dev@real.com
>>> Cc: datatype-dev@helixcommunity.org
>>> Subject: CR: Add ExternalInterface check to the FlashGuestPlayerNS
>>>
>>> Synopsis: Mac crashes on ExternalInterface functions that do not exist.
>>>
>>> Overview: Add functionality to check for a list of supported
>>> ExternalInterface functions.
>>> If the SWF supports this feature it will send a "HXSetFunctions" 
>>> message
>>> with a list
>>> of supported ExternalInterface functions.
>>>
>>> Files:
>>>
>>> datatype/flash/flashhost/flash_guest_player_ns.cpp
>>> datatype/flash/flashhost/pub/flash_guest_player_ns.h
>>>     - Add catch for HXSetFunctions command, parse args into a function
>>> name list.
>>>     - Before each ExternalInterface call, parse out the command from 
>>> the
>>> xml blob
>>>     and check if the function is in the list, fail if the list exists
>>> and it is not found.
>>>     - Optimize dereference of the 'this' object in NPN_Evaluate.
>>>
>>> datatype/flash/flashhost/flash_guest_player.cpp
>>> datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
>>> datatype/flash/flashhost/pub/flash_guest_player.h
>>> datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax.h
>>>     - move common var to base class, m_pXMLFlash
>>>
>>> Branches: HEAD and 310Atlas
>>>
>>> Diff:
>>>
>>> Index: flash_guest_player.cpp
>>> ===================================================================
>>> RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player.cpp,v
>>> retrieving revision 1.33.2.21
>>> diff -w -u -5 -r1.33.2.21 flash_guest_player.cpp
>>> --- flash_guest_player.cpp    14 May 2008 00:03:38 -0000    1.33.2.21
>>> +++ flash_guest_player.cpp    28 May 2008 22:24:52 -0000
>>> @@ -152,10 +152,11 @@
>>>      , m_pFLVFileObject(NULL)
>>>      , m_pSite(NULL)
>>>      , m_pStats(NULL)
>>>      , m_pRootSiteWatcher(NULL)
>>>      , m_pRootPassiveSiteWatcher(NULL)
>>> +    , m_pXMLFlash(NULL)
>>>  {
>>>      HXLOGL4(HXLOG_FPHR, "CON CFlashGuestPlayer this=%p", this);
>>>      m_MediaSize.cx = dDefaultWindowWidth;
>>>      m_MediaSize.cy = dDefaultWindowHeight;
>>>      m_OffsetPoint.x = 0;
>>> @@ -172,10 +173,11 @@
>>>      HX_RELEASE(m_pExternalInterfaceResponse);
>>>      HX_RELEASE(m_pRepresentingSite);
>>>      HX_RELEASE(m_pCCF);
>>>      HX_RELEASE(m_pContext);
>>>      HX_RELEASE(m_pRequest);
>>> +    HX_RELEASE(m_pXMLFlash);
>>>  }
>>>
>>>  STDMETHODIMP CFlashGuestPlayer::QueryInterface(REFIID riid, void**
>>>     
>> ppvObj)
>>  
>>>  {
>>>      QInterfaceList  qiList[] =
>>> Index: flash_guest_player_ns.cpp
>>> ===================================================================
>>> RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player_ns.cpp,v
>>> retrieving revision 1.27.2.38
>>> diff -w -u -5 -r1.27.2.38 flash_guest_player_ns.cpp
>>> --- flash_guest_player_ns.cpp    22 May 2008 05:14:00 -0000    
>>> 1.27.2.38
>>> +++ flash_guest_player_ns.cpp    29 May 2008 02:25:51 -0000
>>> @@ -67,10 +67,11 @@
>>>  #include "hxvsurf.h"
>>>  #include "hxprefs.h"
>>>  #include "hxhyper.h"
>>>  #include "hxhypnv.h"
>>>  #include "hxevent.h"
>>> +#include "hxstringutil.h"
>>>  #include "dllacces.h"
>>>  #include "filespecutils.h"
>>>  #include "hxinter.h" // IHXEventManager
>>>  #include "xml_flash.h"
>>>  #include "swfpack.h"
>>> @@ -1509,10 +1510,12 @@
>>>
>>>      HX_RELEASE(m_pOffscreenBuffer);
>>>      HX_RELEASE(m_pMutex);
>>>      HX_RELEASE(m_pSite);
>>>      HX_RELEASE(m_pScheduler);
>>> +        m_EIFunctionList.RemoveAll();
>>> +        HX_RELEASE(m_pXMLFlash);
>>>
>>>          m_bTerminated = TRUE;
>>>      }
>>>
>>>      return HXR_OK;
>>> @@ -3707,11 +3710,11 @@
>>>          pos = m_StringIds.AddTailString(name);
>>>      }
>>>      const char* sId;
>>>      sId = (const char*) *((CHXString*) m_StringIds.GetAt(pos));
>>>
>>> -    HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name, 
>>> sId);
>>> +    //HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name,
>>> sId);
>>>      return (NPIdentifier) sId;
>>>  }
>>>
>>>  void
>>>  CFlashGuestPlayerNS::NPN_GetStringIdentifiers(const NPUTF8** names,
>>> int32_t nameCount, NPIdentifier* identifiers)
>>> @@ -3754,11 +3757,11 @@
>>>  #if defined(_MAC_UNIX)
>>>      // MBO - Test
>>>      // printf("NPN_UTF8FromIdentifier\n");
>>>  #endif    // _MAC_UNIX
>>>
>>> -    HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*) 
>>> identifier);
>>> +    //HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*)
>>> identifier);
>>>      return (NPUTF8*) new_string((char*) identifier);
>>>  }
>>>
>>>  int32_t
>>>  CFlashGuestPlayerNS::NPN_IntFromIdentifier(NPIdentifier identifier)
>>> @@ -3913,24 +3916,26 @@
>>>      // From a helix 'VolumeSlider':
>>>      //   try { __flash__toXML(HXSetVolume(49)) ; } catch (e) {
>>> ""; }
>>>
>>>      CHXString strInvokeName, strInvokeArgs;
>>>      INT32 dIndex = -1;
>>> +    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>>> +    CFlashGuestPlayerNS* pPlayer = NULL;
>>> +
>>> +    if (objw)
>>> +    {
>>> +    pPlayer = (CFlashGuestPlayerNS*) objw->m_npp->ndata;
>>> +    }
>>>
>>>      if (strstr(strScript, "HXGetExternalInterfaceStatus"))
>>>      {
>>>      HXLOGL4(HXLOG_FPHR, "HXExternalInteraceStatus message received.
>>> ExternalInterface.call is working.");
>>>      // Send a message to Flash saying that we are able to receive
>>> ExternalInterface.call messages
>>> -        if (obj)
>>> -        {
>>> -            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>>> -            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>>> objw->m_npp->ndata;
>>>              if (pPlayer)
>>>              {
>>>
>>> pPlayer->SendFlashMessage("EISetExternalInterfaceStatus", "true");
>>>              }
>>> -        }
>>>      return true;
>>>      }
>>>
>>>      // Remove the array brackets
>>>      if (strScript.FindAndReplace("([", "(", FALSE))
>>> @@ -3948,12 +3953,10 @@
>>>      HXLOGL4(HXLOG_FPHR, "HXDebug: %s", (const char*)strInvokeArgs);
>>>      return true;
>>>      }
>>>      if ((dIndex = strScript.Find("HXPosition(")) >= 0)
>>>      {
>>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>>> objw->m_npp->ndata;
>>>      if (pPlayer)
>>>      {
>>>          strInvokeArgs = strScript.Mid(dIndex + strlen("HXPosition("));
>>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>>          {
>>> @@ -3965,12 +3968,10 @@
>>>
>>>      return true;
>>>      }
>>>      if ((dIndex = strScript.Find("HXMetaChanged(")) >= 0)
>>>      {
>>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>>> objw->m_npp->ndata;
>>>      if (pPlayer)
>>>      {
>>>          strInvokeArgs = strScript.Mid(dIndex + 
>>> strlen("HXMetaChanged("));
>>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>>          {
>>> @@ -3982,12 +3983,10 @@
>>>
>>>      return true;
>>>      }
>>>      if ((dIndex = strScript.Find("HXBufferingChanged(")) >= 0)
>>>      {
>>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>>> objw->m_npp->ndata;
>>>      if (pPlayer)
>>>      {
>>>          strInvokeArgs = strScript.Mid(dIndex +
>>> strlen("HXBufferingChanged("));
>>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>>          {
>>> @@ -3999,12 +3998,10 @@
>>>
>>>      return true;
>>>      }
>>>      if ((dIndex = strScript.Find("HXStateChanged(\"")) >= 0)
>>>      {
>>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>>> objw->m_npp->ndata;
>>>      if (pPlayer)
>>>      {
>>>          strInvokeArgs = strScript.Mid(dIndex +
>>> strlen("HXStateChanged(\""));
>>>          if ((dIndex = strInvokeArgs.Find('"')) > 0)
>>>          {
>>> @@ -4208,25 +4205,33 @@
>>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>>          {
>>>              strInvokeArgs = strInvokeArgs.Left(dIndex);
>>>          }
>>>      }
>>> +    else if ((dIndex = strScript.Find("HXSetFunctions(")) >= 0)
>>> +    {
>>> +        strInvokeName = "HXSetFunctions";
>>> +        strInvokeArgs = strScript.Mid(dIndex +
>>> strlen("HXSetFunctions(") + 1);
>>> +        if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>> +        {
>>> +            strInvokeArgs = strInvokeArgs.Left(dIndex);
>>> +            if (pPlayer)
>>> +            {
>>> +                pPlayer->SetupEIFunctionList(strInvokeArgs);
>>> +            }
>>> +        }
>>> +    }
>>>
>>>      if (!strInvokeName.IsEmpty())
>>>      {
>>>          CHXString strInvokeXML;
>>>          HX_RESULT hr = CHXXMLFlash::WriteInvokeXML(strInvokeName,
>>> strInvokeArgs, strInvokeXML);
>>> -        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && obj)
>>> -        {
>>> -            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>>> -            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>>> objw->m_npp->ndata;
>>> -            if (pPlayer)
>>> +        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && pPlayer)
>>>              {
>>>                  pPlayer->FlashCall(strInvokeXML);
>>>              }
>>>          }
>>> -    }
>>>
>>>      return true;
>>>  }
>>>
>>>  bool
>>> @@ -4316,11 +4321,11 @@
>>>  }
>>>
>>>  void
>>>  CFlashGuestPlayerNS::NPN_ReleaseVariantValue(NPVariant *variant)
>>>  {
>>> -    HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
>>> +    //HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
>>>
>>>  #if defined(_MAC_UNIX)
>>>      // MBO - Test
>>>      // printf("NPN_ReleaseVariantValue vriant=%ld\n", variant);
>>>  #endif    // _MAC_UNIX
>>> @@ -5356,11 +5361,18 @@
>>>          NPVariant npArgv[1];
>>>          UINT32 argCount=1;
>>>
>>>          STRINGN_TO_NPVARIANT( (const char*) strInvokeXML, 
>>> strlen((const
>>> char*)strInvokeXML), npArgv[0]);
>>>
>>> +    if (EIFunctionExists(strInvokeXML))
>>> +    {
>>>          hr = Invoke("CallFunction", npArgv, argCount, &vresult);
>>> +    }
>>> +    else
>>> +    {
>>> +        hr = HXR_UNEXPECTED;
>>> +    }
>>>
>>>      if (SUCCEEDED(hr))
>>>          {
>>>              NPN_ReleaseVariantValue(&vresult);
>>>          }
>>> @@ -5403,5 +5415,54 @@
>>>      // Get the current frame
>>>      INT32 lCurFrame = 0;
>>>      HX_RESULT retVal = Invoke("CurrentFrame", lCurFrame);
>>>      return lCurFrame;
>>>  }
>>> +
>>> +HXBOOL
>>> +CFlashGuestPlayerNS::EIFunctionExists(const CHXString& strInvokeXML)
>>> +{
>>> +    // Check to see if the ExternalInterface function exists
>>> +    HXBOOL bExists=TRUE; // Default to true, if we did not receive a
>>> list via HXSetFunctions, or we cannot parse, assume passive check.
>>> +
>>> +    // Extract the invoke name, and make sure it exists on the 
>>> flash side
>>> +    if (m_EIFunctionList.GetCount() > 0)
>>> +    {
>>> +    CHXString strInvokeName, strInvokeArgs;
>>> +
>>> +    if (m_pXMLFlash == NULL)
>>> +    {
>>> +        m_pXMLFlash = new CHXXMLFlash(m_pContext);
>>> +        HX_ADDREF(m_pXMLFlash);
>>> +    }
>>> +
>>> +    // Parse the XML, get the invoke name
>>> +    if (m_pXMLFlash)
>>> +    {
>>> +        if (SUCCEEDED(m_pXMLFlash->ParseInvokeXML(strInvokeXML,
>>> strInvokeName, strInvokeArgs)) && !strInvokeName.IsEmpty())
>>> +        {
>>> +        if (!m_EIFunctionList.FindString(strInvokeName))
>>> +        {
>>> +                HXLOGL4(HXLOG_FPHR,
>>> "CFlashGuestPlayerNS::EIFunctionExists FAILED for invoke name: %s",
>>> (const char*) strInvokeName);
>>> +            bExists = FALSE;
>>> +        }
>>> +        }
>>> +    }
>>> +    }
>>> +
>>> +    return bExists;
>>> +}
>>> +
>>> +//
>>> +// Create a list of known ExternalInterface functions, valid for
>>> CallFunction, so we do not crash on the Mac
>>> +//
>>> +void
>>> +CFlashGuestPlayerNS::SetupEIFunctionList(const CHXString& 
>>> strInvokeArgs)
>>> +{
>>> +    if (!strInvokeArgs.IsEmpty())
>>> +    {
>>> +    HXStringUtil::Split(strInvokeArgs, HXFLASH_ARGUMENT_DELIMITER,
>>> m_EIFunctionList);
>>> +    }
>>> +
>>> +    HXLOGL4(HXLOG_FPHR, "CFlashGuestPlayerNS::SetupEIFunctionList:
>>> Created function list, count=%ld", m_EIFunctionList.GetCount());
>>> +}
>>> +
>>> Index: platform/win32/flash_guest_player_ax.cpp
>>> ===================================================================
>>> RCS file:
>>> /cvsroot/datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp 
>>>
>>> ,v
>>> retrieving revision 1.21.2.29
>>> diff -w -u -5 -r1.21.2.29 flash_guest_player_ax.cpp
>>> --- platform/win32/flash_guest_player_ax.cpp    21 May 2008 12:32:41
>>> -0000    1.21.2.29
>>> +++ platform/win32/flash_guest_player_ax.cpp    28 May 2008 21:48:40 
>>> -0000
>>> @@ -132,11 +132,10 @@
>>>          , m_lpO(NULL)
>>>          , m_lpInPlaceObjWindowless(NULL)
>>>          , m_lpInPlaceObj(NULL)
>>>          , m_lpViewObject(NULL)
>>>          , m_pMutex(NULL)
>>> -        , m_pXMLFlash(NULL)
>>>          , m_dFrameRate(0.0)
>>>          , m_bInPlaceActive(FALSE)
>>>          , m_lFlashVersion(0)
>>>          , m_bGotInvalidateRect(FALSE)
>>>          , m_pOffscreenBuffer(NULL)
>>> Index: pub/flash_guest_player.h
>>> ===================================================================
>>> RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player.h,v
>>> retrieving revision 1.27.2.12
>>> diff -w -u -5 -r1.27.2.12 flash_guest_player.h
>>> --- pub/flash_guest_player.h    25 Apr 2008 22:54:26 -0000    1.27.2.12
>>> +++ pub/flash_guest_player.h    28 May 2008 23:22:34 -0000
>>> @@ -106,10 +106,11 @@
>>>
>>>  // Forward declarations
>>>  class CHXSimpleList;
>>>  class CFlashSiteWatcher;
>>>  class CFlashPassiveSiteWatcher;
>>> +class CHXXMLFlash;
>>>  struct IHXCommonClassFactory;
>>>  struct IHXFileObject;
>>>  //struct IHXRequest;
>>>
>>>  #define SOURCE_URL_FLASH_CUSTOM_VAR        "sourceURL"
>>> @@ -247,10 +248,11 @@
>>>      IHXFileObject*    m_pFileObject;
>>>      IHXFileObject*    m_pFLVFileObject;
>>>      IHXSite*        m_pSite;
>>>      HXxPoint        m_OffsetPoint;
>>>      IHXScheduler*    m_pScheduler;
>>> +    CHXXMLFlash*    m_pXMLFlash;
>>>
>>>      IHXExternalInterfaceResponse* m_pExternalInterfaceResponse;
>>>      IHXSiteWindowless* m_pRepresentingSite;
>>>
>>>      HXBOOL m_bWindowlessPref;     // Specifies the pref for windowless
>>> (true) or windowed (false)
>>> Index: pub/flash_guest_player_ns.h
>>> ===================================================================
>>> RCS file: 
>>> /cvsroot/datatype/flash/flashhost/pub/flash_guest_player_ns.h,v
>>> retrieving revision 1.14.2.15
>>> diff -w -u -5 -r1.14.2.15 flash_guest_player_ns.h
>>> --- pub/flash_guest_player_ns.h    10 May 2008 20:47:13 -0000    
>>> 1.14.2.15
>>> +++ pub/flash_guest_player_ns.h    28 May 2008 23:52:09 -0000
>>> @@ -57,18 +57,18 @@
>>>  #include "npupp.h"
>>>  #include "hxwin.h"
>>>  #include "hxstring.h"
>>>  #include "hxsite2.h"
>>>  #include "hxengin.h"
>>> +#include "hxslist.h"
>>>
>>>  #if defined (_MAC_UNIX)
>>>  #include "platform/mac/macwindowinfo.h"
>>>  #endif    // _MAC_UNIX
>>>
>>>  // Forward declarations
>>>  class CHXSimpleList;
>>> -class CHXStringList;
>>>  class CHXString;
>>>  class DLLAccess;
>>>  class  CHXGenericCallback;
>>>  struct IHXCommonClassFactory;
>>>  struct IHXMutex;
>>> @@ -253,10 +253,12 @@
>>>      HX_RESULT   ParseNativeMediaSize(IHXBuffer* pBuffer, REF(HXxSize)
>>> rSize);
>>>      void        OnFlashPlayerStateChange(const char* pszGuestState);
>>>
>>>      UINT32  GetNumFrames(void);
>>>      UINT32  GetCurrentFrame(void);
>>> +    HXBOOL  EIFunctionExists(const CHXString& strInvokeXML);
>>> +    void    SetupEIFunctionList(const CHXString& strInvokeArgs);
>>>
>>>      enum
>>>      {
>>>          kStateReady,
>>>          kStateFSMInitDonePending,
>>> @@ -284,10 +286,11 @@
>>>      double              m_dFrameRate;
>>>      UINT32        m_ulPacingInterval;
>>>      UINT32        m_ulReadPacingInterval;
>>>      UINT32        m_ulFileOffsetPending;
>>>      UINT32        m_ulFileOffsetRequested;
>>> +    CHXStringList    m_EIFunctionList;
>>>
>>>      static const char* const    m_pszFlashMimeType;
>>>      static CHXStringList    m_StringIds;
>>>      static CHXSimpleList    m_IntIds;
>>>      static CHXString            m_pUserAgentStr;
>>> Index: pub/platform/win32/flash_guest_player_ax.h
>>> ===================================================================
>>> RCS file:
>>> /cvsroot/datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax 
>>>
>>> .h,v
>>> retrieving revision 1.10.2.13
>>> diff -w -u -5 -r1.10.2.13 flash_guest_player_ax.h
>>> --- pub/platform/win32/flash_guest_player_ax.h    16 May 2008 16:37:16
>>> -0000    1.10.2.13
>>> +++ pub/platform/win32/flash_guest_player_ax.h    28 May 2008 
>>> 21:48:04 -
>>> 0000
>>> @@ -75,11 +75,10 @@
>>>  // Forward declarations
>>>  class CFlashGuestPlayer;
>>>  class CHXString;
>>>  class CHXGenericCallback;
>>>  struct IHXFileObject;
>>> -class CHXXMLFlash;
>>>
>>>  class CFlashGuestPlayerAX : public CFlashGuestPlayer
>>>                , public ShockwaveFlashObjects::_IShockwaveFlashEvents
>>>                , public IOleClientSite
>>>                , public IOleInPlaceSiteWindowless
>>> @@ -311,11 +310,10 @@
>>>      HBITMAP        m_hOldBitmap;
>>>      void*          m_pDIBits;
>>>      UINT32         m_ulDIBitsSize;
>>>      UINT32         m_ulDIBitsWidth;
>>>      UINT32         m_ulDIBitsHeight;
>>> -    CHXXMLFlash*   m_pXMLFlash;
>>>      double         m_dFrameRate;
>>>      HXBOOL         m_bInPlaceActive;
>>>      INT32          m_lFlashVersion;
>>>      HXBOOL         m_bGotInvalidateRect;
>>>      HXBOOL         m_bOLEInitialized;
>>>     
>>
>>   
>
>
> _______________________________________________
> Datatype-dev mailing list
> Datatype-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
>

From cbailey at real.com  Thu May 29 10:44:59 2008
From: cbailey at real.com (Christina Bailey)
Date: Thu May 29 09:35:14 2008
Subject: [datatype-dev] RE: Add ExternalInterface check to
	the	FlashGuestPlayerNS
In-Reply-To: <1071D244292640C18F8AAFF3AB7F6584@DingDong>
References: <483E1719.3050103@real.com>
	<1071D244292640C18F8AAFF3AB7F6584@DingDong>
Message-ID: <483EEB9B.2030605@real.com>

I didn't move the check to the base class because it's an extra step that
is not necessary in FlashGuestPlayerAX. Now it's the same result for both
versions, a log message saying that the function does not exist, instead
of crashing on the Mac.

--christina

Henry Ping wrote:
> I'd move EI function check to the base class so that FlashGuestPlayerAX can
> leverage the same checking mechanism when external interface is working in
> Flash AX.
>
> Rest looks good.
>
> Thanks
> Henry
>
>   
>> -----Original Message-----
>> From: Christina Bailey [mailto:cbailey@real.com]
>> Sent: Wednesday, May 28, 2008 7:38 PM
>> To: liteplayer_dev@real.com
>> Cc: datatype-dev@helixcommunity.org
>> Subject: CR: Add ExternalInterface check to the FlashGuestPlayerNS
>>
>> Synopsis: Mac crashes on ExternalInterface functions that do not exist.
>>
>> Overview: Add functionality to check for a list of supported
>> ExternalInterface functions.
>> If the SWF supports this feature it will send a "HXSetFunctions" message
>> with a list
>> of supported ExternalInterface functions.
>>
>> Files:
>>
>> datatype/flash/flashhost/flash_guest_player_ns.cpp
>> datatype/flash/flashhost/pub/flash_guest_player_ns.h
>>     - Add catch for HXSetFunctions command, parse args into a function
>> name list.
>>     - Before each ExternalInterface call, parse out the command from the
>> xml blob
>>     and check if the function is in the list, fail if the list exists
>> and it is not found.
>>     - Optimize dereference of the 'this' object in NPN_Evaluate.
>>
>> datatype/flash/flashhost/flash_guest_player.cpp
>> datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
>> datatype/flash/flashhost/pub/flash_guest_player.h
>> datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax.h
>>     - move common var to base class, m_pXMLFlash
>>
>> Branches: HEAD and 310Atlas
>>
>> Diff:
>>
>> Index: flash_guest_player.cpp
>> ===================================================================
>> RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player.cpp,v
>> retrieving revision 1.33.2.21
>> diff -w -u -5 -r1.33.2.21 flash_guest_player.cpp
>> --- flash_guest_player.cpp    14 May 2008 00:03:38 -0000    1.33.2.21
>> +++ flash_guest_player.cpp    28 May 2008 22:24:52 -0000
>> @@ -152,10 +152,11 @@
>>      , m_pFLVFileObject(NULL)
>>      , m_pSite(NULL)
>>      , m_pStats(NULL)
>>      , m_pRootSiteWatcher(NULL)
>>      , m_pRootPassiveSiteWatcher(NULL)
>> +    , m_pXMLFlash(NULL)
>>  {
>>      HXLOGL4(HXLOG_FPHR, "CON CFlashGuestPlayer this=%p", this);
>>      m_MediaSize.cx = dDefaultWindowWidth;
>>      m_MediaSize.cy = dDefaultWindowHeight;
>>      m_OffsetPoint.x = 0;
>> @@ -172,10 +173,11 @@
>>      HX_RELEASE(m_pExternalInterfaceResponse);
>>      HX_RELEASE(m_pRepresentingSite);
>>      HX_RELEASE(m_pCCF);
>>      HX_RELEASE(m_pContext);
>>      HX_RELEASE(m_pRequest);
>> +    HX_RELEASE(m_pXMLFlash);
>>  }
>>
>>  STDMETHODIMP CFlashGuestPlayer::QueryInterface(REFIID riid, void**
>>     
> ppvObj)
>   
>>  {
>>      QInterfaceList  qiList[] =
>> Index: flash_guest_player_ns.cpp
>> ===================================================================
>> RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player_ns.cpp,v
>> retrieving revision 1.27.2.38
>> diff -w -u -5 -r1.27.2.38 flash_guest_player_ns.cpp
>> --- flash_guest_player_ns.cpp    22 May 2008 05:14:00 -0000    1.27.2.38
>> +++ flash_guest_player_ns.cpp    29 May 2008 02:25:51 -0000
>> @@ -67,10 +67,11 @@
>>  #include "hxvsurf.h"
>>  #include "hxprefs.h"
>>  #include "hxhyper.h"
>>  #include "hxhypnv.h"
>>  #include "hxevent.h"
>> +#include "hxstringutil.h"
>>  #include "dllacces.h"
>>  #include "filespecutils.h"
>>  #include "hxinter.h" // IHXEventManager
>>  #include "xml_flash.h"
>>  #include "swfpack.h"
>> @@ -1509,10 +1510,12 @@
>>
>>      HX_RELEASE(m_pOffscreenBuffer);
>>      HX_RELEASE(m_pMutex);
>>      HX_RELEASE(m_pSite);
>>      HX_RELEASE(m_pScheduler);
>> +        m_EIFunctionList.RemoveAll();
>> +        HX_RELEASE(m_pXMLFlash);
>>
>>          m_bTerminated = TRUE;
>>      }
>>
>>      return HXR_OK;
>> @@ -3707,11 +3710,11 @@
>>          pos = m_StringIds.AddTailString(name);
>>      }
>>      const char* sId;
>>      sId = (const char*) *((CHXString*) m_StringIds.GetAt(pos));
>>
>> -    HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name, sId);
>> +    //HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name,
>> sId);
>>      return (NPIdentifier) sId;
>>  }
>>
>>  void
>>  CFlashGuestPlayerNS::NPN_GetStringIdentifiers(const NPUTF8** names,
>> int32_t nameCount, NPIdentifier* identifiers)
>> @@ -3754,11 +3757,11 @@
>>  #if defined(_MAC_UNIX)
>>      // MBO - Test
>>      // printf("NPN_UTF8FromIdentifier\n");
>>  #endif    // _MAC_UNIX
>>
>> -    HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*) identifier);
>> +    //HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*)
>> identifier);
>>      return (NPUTF8*) new_string((char*) identifier);
>>  }
>>
>>  int32_t
>>  CFlashGuestPlayerNS::NPN_IntFromIdentifier(NPIdentifier identifier)
>> @@ -3913,24 +3916,26 @@
>>      // From a helix 'VolumeSlider':
>>      //   try { __flash__toXML(HXSetVolume(49)) ; } catch (e) {
>> ""; }
>>
>>      CHXString strInvokeName, strInvokeArgs;
>>      INT32 dIndex = -1;
>> +    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> +    CFlashGuestPlayerNS* pPlayer = NULL;
>> +
>> +    if (objw)
>> +    {
>> +    pPlayer = (CFlashGuestPlayerNS*) objw->m_npp->ndata;
>> +    }
>>
>>      if (strstr(strScript, "HXGetExternalInterfaceStatus"))
>>      {
>>      HXLOGL4(HXLOG_FPHR, "HXExternalInteraceStatus message received.
>> ExternalInterface.call is working.");
>>      // Send a message to Flash saying that we are able to receive
>> ExternalInterface.call messages
>> -        if (obj)
>> -        {
>> -            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>              if (pPlayer)
>>              {
>>
>> pPlayer->SendFlashMessage("EISetExternalInterfaceStatus", "true");
>>              }
>> -        }
>>      return true;
>>      }
>>
>>      // Remove the array brackets
>>      if (strScript.FindAndReplace("([", "(", FALSE))
>> @@ -3948,12 +3953,10 @@
>>      HXLOGL4(HXLOG_FPHR, "HXDebug: %s", (const char*)strInvokeArgs);
>>      return true;
>>      }
>>      if ((dIndex = strScript.Find("HXPosition(")) >= 0)
>>      {
>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>      if (pPlayer)
>>      {
>>          strInvokeArgs = strScript.Mid(dIndex + strlen("HXPosition("));
>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>          {
>> @@ -3965,12 +3968,10 @@
>>
>>      return true;
>>      }
>>      if ((dIndex = strScript.Find("HXMetaChanged(")) >= 0)
>>      {
>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>      if (pPlayer)
>>      {
>>          strInvokeArgs = strScript.Mid(dIndex + strlen("HXMetaChanged("));
>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>          {
>> @@ -3982,12 +3983,10 @@
>>
>>      return true;
>>      }
>>      if ((dIndex = strScript.Find("HXBufferingChanged(")) >= 0)
>>      {
>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>      if (pPlayer)
>>      {
>>          strInvokeArgs = strScript.Mid(dIndex +
>> strlen("HXBufferingChanged("));
>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>          {
>> @@ -3999,12 +3998,10 @@
>>
>>      return true;
>>      }
>>      if ((dIndex = strScript.Find("HXStateChanged(\"")) >= 0)
>>      {
>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>      if (pPlayer)
>>      {
>>          strInvokeArgs = strScript.Mid(dIndex +
>> strlen("HXStateChanged(\""));
>>          if ((dIndex = strInvokeArgs.Find('"')) > 0)
>>          {
>> @@ -4208,25 +4205,33 @@
>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>          {
>>              strInvokeArgs = strInvokeArgs.Left(dIndex);
>>          }
>>      }
>> +    else if ((dIndex = strScript.Find("HXSetFunctions(")) >= 0)
>> +    {
>> +        strInvokeName = "HXSetFunctions";
>> +        strInvokeArgs = strScript.Mid(dIndex +
>> strlen("HXSetFunctions(") + 1);
>> +        if ((dIndex = strInvokeArgs.Find(')')) > 0)
>> +        {
>> +            strInvokeArgs = strInvokeArgs.Left(dIndex);
>> +            if (pPlayer)
>> +            {
>> +                pPlayer->SetupEIFunctionList(strInvokeArgs);
>> +            }
>> +        }
>> +    }
>>
>>      if (!strInvokeName.IsEmpty())
>>      {
>>          CHXString strInvokeXML;
>>          HX_RESULT hr = CHXXMLFlash::WriteInvokeXML(strInvokeName,
>> strInvokeArgs, strInvokeXML);
>> -        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && obj)
>> -        {
>> -            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>> -            if (pPlayer)
>> +        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && pPlayer)
>>              {
>>                  pPlayer->FlashCall(strInvokeXML);
>>              }
>>          }
>> -    }
>>
>>      return true;
>>  }
>>
>>  bool
>> @@ -4316,11 +4321,11 @@
>>  }
>>
>>  void
>>  CFlashGuestPlayerNS::NPN_ReleaseVariantValue(NPVariant *variant)
>>  {
>> -    HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
>> +    //HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
>>
>>  #if defined(_MAC_UNIX)
>>      // MBO - Test
>>      // printf("NPN_ReleaseVariantValue vriant=%ld\n", variant);
>>  #endif    // _MAC_UNIX
>> @@ -5356,11 +5361,18 @@
>>          NPVariant npArgv[1];
>>          UINT32 argCount=1;
>>
>>          STRINGN_TO_NPVARIANT( (const char*) strInvokeXML, strlen((const
>> char*)strInvokeXML), npArgv[0]);
>>
>> +    if (EIFunctionExists(strInvokeXML))
>> +    {
>>          hr = Invoke("CallFunction", npArgv, argCount, &vresult);
>> +    }
>> +    else
>> +    {
>> +        hr = HXR_UNEXPECTED;
>> +    }
>>
>>      if (SUCCEEDED(hr))
>>          {
>>              NPN_ReleaseVariantValue(&vresult);
>>          }
>> @@ -5403,5 +5415,54 @@
>>      // Get the current frame
>>      INT32 lCurFrame = 0;
>>      HX_RESULT retVal = Invoke("CurrentFrame", lCurFrame);
>>      return lCurFrame;
>>  }
>> +
>> +HXBOOL
>> +CFlashGuestPlayerNS::EIFunctionExists(const CHXString& strInvokeXML)
>> +{
>> +    // Check to see if the ExternalInterface function exists
>> +    HXBOOL bExists=TRUE; // Default to true, if we did not receive a
>> list via HXSetFunctions, or we cannot parse, assume passive check.
>> +
>> +    // Extract the invoke name, and make sure it exists on the flash side
>> +    if (m_EIFunctionList.GetCount() > 0)
>> +    {
>> +    CHXString strInvokeName, strInvokeArgs;
>> +
>> +    if (m_pXMLFlash == NULL)
>> +    {
>> +        m_pXMLFlash = new CHXXMLFlash(m_pContext);
>> +        HX_ADDREF(m_pXMLFlash);
>> +    }
>> +
>> +    // Parse the XML, get the invoke name
>> +    if (m_pXMLFlash)
>> +    {
>> +        if (SUCCEEDED(m_pXMLFlash->ParseInvokeXML(strInvokeXML,
>> strInvokeName, strInvokeArgs)) && !strInvokeName.IsEmpty())
>> +        {
>> +        if (!m_EIFunctionList.FindString(strInvokeName))
>> +        {
>> +                HXLOGL4(HXLOG_FPHR,
>> "CFlashGuestPlayerNS::EIFunctionExists FAILED for invoke name: %s",
>> (const char*) strInvokeName);
>> +            bExists = FALSE;
>> +        }
>> +        }
>> +    }
>> +    }
>> +
>> +    return bExists;
>> +}
>> +
>> +//
>> +// Create a list of known ExternalInterface functions, valid for
>> CallFunction, so we do not crash on the Mac
>> +//
>> +void
>> +CFlashGuestPlayerNS::SetupEIFunctionList(const CHXString& strInvokeArgs)
>> +{
>> +    if (!strInvokeArgs.IsEmpty())
>> +    {
>> +    HXStringUtil::Split(strInvokeArgs, HXFLASH_ARGUMENT_DELIMITER,
>> m_EIFunctionList);
>> +    }
>> +
>> +    HXLOGL4(HXLOG_FPHR, "CFlashGuestPlayerNS::SetupEIFunctionList:
>> Created function list, count=%ld", m_EIFunctionList.GetCount());
>> +}
>> +
>> Index: platform/win32/flash_guest_player_ax.cpp
>> ===================================================================
>> RCS file:
>> /cvsroot/datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
>> ,v
>> retrieving revision 1.21.2.29
>> diff -w -u -5 -r1.21.2.29 flash_guest_player_ax.cpp
>> --- platform/win32/flash_guest_player_ax.cpp    21 May 2008 12:32:41
>> -0000    1.21.2.29
>> +++ platform/win32/flash_guest_player_ax.cpp    28 May 2008 21:48:40 -0000
>> @@ -132,11 +132,10 @@
>>          , m_lpO(NULL)
>>          , m_lpInPlaceObjWindowless(NULL)
>>          , m_lpInPlaceObj(NULL)
>>          , m_lpViewObject(NULL)
>>          , m_pMutex(NULL)
>> -        , m_pXMLFlash(NULL)
>>          , m_dFrameRate(0.0)
>>          , m_bInPlaceActive(FALSE)
>>          , m_lFlashVersion(0)
>>          , m_bGotInvalidateRect(FALSE)
>>          , m_pOffscreenBuffer(NULL)
>> Index: pub/flash_guest_player.h
>> ===================================================================
>> RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player.h,v
>> retrieving revision 1.27.2.12
>> diff -w -u -5 -r1.27.2.12 flash_guest_player.h
>> --- pub/flash_guest_player.h    25 Apr 2008 22:54:26 -0000    1.27.2.12
>> +++ pub/flash_guest_player.h    28 May 2008 23:22:34 -0000
>> @@ -106,10 +106,11 @@
>>
>>  // Forward declarations
>>  class CHXSimpleList;
>>  class CFlashSiteWatcher;
>>  class CFlashPassiveSiteWatcher;
>> +class CHXXMLFlash;
>>  struct IHXCommonClassFactory;
>>  struct IHXFileObject;
>>  //struct IHXRequest;
>>
>>  #define SOURCE_URL_FLASH_CUSTOM_VAR        "sourceURL"
>> @@ -247,10 +248,11 @@
>>      IHXFileObject*    m_pFileObject;
>>      IHXFileObject*    m_pFLVFileObject;
>>      IHXSite*        m_pSite;
>>      HXxPoint        m_OffsetPoint;
>>      IHXScheduler*    m_pScheduler;
>> +    CHXXMLFlash*    m_pXMLFlash;
>>
>>      IHXExternalInterfaceResponse* m_pExternalInterfaceResponse;
>>      IHXSiteWindowless* m_pRepresentingSite;
>>
>>      HXBOOL m_bWindowlessPref;     // Specifies the pref for windowless
>> (true) or windowed (false)
>> Index: pub/flash_guest_player_ns.h
>> ===================================================================
>> RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player_ns.h,v
>> retrieving revision 1.14.2.15
>> diff -w -u -5 -r1.14.2.15 flash_guest_player_ns.h
>> --- pub/flash_guest_player_ns.h    10 May 2008 20:47:13 -0000    1.14.2.15
>> +++ pub/flash_guest_player_ns.h    28 May 2008 23:52:09 -0000
>> @@ -57,18 +57,18 @@
>>  #include "npupp.h"
>>  #include "hxwin.h"
>>  #include "hxstring.h"
>>  #include "hxsite2.h"
>>  #include "hxengin.h"
>> +#include "hxslist.h"
>>
>>  #if defined (_MAC_UNIX)
>>  #include "platform/mac/macwindowinfo.h"
>>  #endif    // _MAC_UNIX
>>
>>  // Forward declarations
>>  class CHXSimpleList;
>> -class CHXStringList;
>>  class CHXString;
>>  class DLLAccess;
>>  class  CHXGenericCallback;
>>  struct IHXCommonClassFactory;
>>  struct IHXMutex;
>> @@ -253,10 +253,12 @@
>>      HX_RESULT   ParseNativeMediaSize(IHXBuffer* pBuffer, REF(HXxSize)
>> rSize);
>>      void        OnFlashPlayerStateChange(const char* pszGuestState);
>>
>>      UINT32  GetNumFrames(void);
>>      UINT32  GetCurrentFrame(void);
>> +    HXBOOL  EIFunctionExists(const CHXString& strInvokeXML);
>> +    void    SetupEIFunctionList(const CHXString& strInvokeArgs);
>>
>>      enum
>>      {
>>          kStateReady,
>>          kStateFSMInitDonePending,
>> @@ -284,10 +286,11 @@
>>      double              m_dFrameRate;
>>      UINT32        m_ulPacingInterval;
>>      UINT32        m_ulReadPacingInterval;
>>      UINT32        m_ulFileOffsetPending;
>>      UINT32        m_ulFileOffsetRequested;
>> +    CHXStringList    m_EIFunctionList;
>>
>>      static const char* const    m_pszFlashMimeType;
>>      static CHXStringList    m_StringIds;
>>      static CHXSimpleList    m_IntIds;
>>      static CHXString            m_pUserAgentStr;
>> Index: pub/platform/win32/flash_guest_player_ax.h
>> ===================================================================
>> RCS file:
>> /cvsroot/datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax
>> .h,v
>> retrieving revision 1.10.2.13
>> diff -w -u -5 -r1.10.2.13 flash_guest_player_ax.h
>> --- pub/platform/win32/flash_guest_player_ax.h    16 May 2008 16:37:16
>> -0000    1.10.2.13
>> +++ pub/platform/win32/flash_guest_player_ax.h    28 May 2008 21:48:04 -
>> 0000
>> @@ -75,11 +75,10 @@
>>  // Forward declarations
>>  class CFlashGuestPlayer;
>>  class CHXString;
>>  class CHXGenericCallback;
>>  struct IHXFileObject;
>> -class CHXXMLFlash;
>>
>>  class CFlashGuestPlayerAX : public CFlashGuestPlayer
>>                , public ShockwaveFlashObjects::_IShockwaveFlashEvents
>>                , public IOleClientSite
>>                , public IOleInPlaceSiteWindowless
>> @@ -311,11 +310,10 @@
>>      HBITMAP        m_hOldBitmap;
>>      void*          m_pDIBits;
>>      UINT32         m_ulDIBitsSize;
>>      UINT32         m_ulDIBitsWidth;
>>      UINT32         m_ulDIBitsHeight;
>> -    CHXXMLFlash*   m_pXMLFlash;
>>      double         m_dFrameRate;
>>      HXBOOL         m_bInPlaceActive;
>>      INT32          m_lFlashVersion;
>>      HXBOOL         m_bGotInvalidateRect;
>>      HXBOOL         m_bOLEInitialized;
>>     
>
>
> _______________________________________________
> Datatype-dev mailing list
> Datatype-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080529/16c79063/attachment-0001.html
From ping at real.com  Thu May 29 11:01:53 2008
From: ping at real.com (Henry Ping)
Date: Thu May 29 09:47:59 2008
Subject: [datatype-dev] RE: Add ExternalInterface check to
	the	FlashGuestPlayerNS
In-Reply-To: <483EEB9B.2030605@real.com>
References: <483E1719.3050103@real.com>
	<1071D244292640C18F8AAFF3AB7F6584@DingDong>
	<483EEB9B.2030605@real.com>
Message-ID: 

FlashGuestPlayerAX doesn't need to call them. BUT, the functions can still
reside in the base class, specifically SetupEIFunctionList and
EIFunctionExists. This makes it easier for us to call them from
FlashGuestPlayerAX in the future.

 

In addition, it appears we parse XML each time EIFunctionExists is called in
order to retrieve the method name, we can avoid XML parsing by calling
EIFunctionExists prior to the assembly of XML since we know the exact method
name.

 

Henry

 

  _____  

From: Christina Bailey [mailto:cbailey@real.com] 
Sent: Thursday, May 29, 2008 10:45 AM
To: ping@real.com
Cc: liteplayer_dev@real.com; datatype-dev@helixcommunity.org
Subject: Re: [datatype-dev] RE: Add ExternalInterface check to the
FlashGuestPlayerNS

 

I didn't move the check to the base class because it's an extra step that
is not necessary in FlashGuestPlayerAX. Now it's the same result for both
versions, a log message saying that the function does not exist, instead 
of crashing on the Mac.

--christina

Henry Ping wrote: 

I'd move EI function check to the base class so that FlashGuestPlayerAX can
leverage the same checking mechanism when external interface is working in
Flash AX.
 
Rest looks good.
 
Thanks
Henry
 
  

-----Original Message-----
From: Christina Bailey [mailto:cbailey@real.com]
Sent: Wednesday, May 28, 2008 7:38 PM
To: liteplayer_dev@real.com
Cc: datatype-dev@helixcommunity.org
Subject: CR: Add ExternalInterface check to the FlashGuestPlayerNS
 
Synopsis: Mac crashes on ExternalInterface functions that do not exist.
 
Overview: Add functionality to check for a list of supported
ExternalInterface functions.
If the SWF supports this feature it will send a "HXSetFunctions" message
with a list
of supported ExternalInterface functions.
 
Files:
 
datatype/flash/flashhost/flash_guest_player_ns.cpp
datatype/flash/flashhost/pub/flash_guest_player_ns.h
    - Add catch for HXSetFunctions command, parse args into a function
name list.
    - Before each ExternalInterface call, parse out the command from the
xml blob
    and check if the function is in the list, fail if the list exists
and it is not found.
    - Optimize dereference of the 'this' object in NPN_Evaluate.
 
datatype/flash/flashhost/flash_guest_player.cpp
datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
datatype/flash/flashhost/pub/flash_guest_player.h
datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax.h
    - move common var to base class, m_pXMLFlash
 
Branches: HEAD and 310Atlas
 
Diff:
 
Index: flash_guest_player.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player.cpp,v
retrieving revision 1.33.2.21
diff -w -u -5 -r1.33.2.21 flash_guest_player.cpp
--- flash_guest_player.cpp    14 May 2008 00:03:38 -0000    1.33.2.21
+++ flash_guest_player.cpp    28 May 2008 22:24:52 -0000
@@ -152,10 +152,11 @@
     , m_pFLVFileObject(NULL)
     , m_pSite(NULL)
     , m_pStats(NULL)
     , m_pRootSiteWatcher(NULL)
     , m_pRootPassiveSiteWatcher(NULL)
+    , m_pXMLFlash(NULL)
 {
     HXLOGL4(HXLOG_FPHR, "CON CFlashGuestPlayer this=%p", this);
     m_MediaSize.cx = dDefaultWindowWidth;
     m_MediaSize.cy = dDefaultWindowHeight;
     m_OffsetPoint.x = 0;
@@ -172,10 +173,11 @@
     HX_RELEASE(m_pExternalInterfaceResponse);
     HX_RELEASE(m_pRepresentingSite);
     HX_RELEASE(m_pCCF);
     HX_RELEASE(m_pContext);
     HX_RELEASE(m_pRequest);
+    HX_RELEASE(m_pXMLFlash);
 }
 
 STDMETHODIMP CFlashGuestPlayer::QueryInterface(REFIID riid, void**
    

ppvObj)
  

 {
     QInterfaceList  qiList[] =
Index: flash_guest_player_ns.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player_ns.cpp,v
retrieving revision 1.27.2.38
diff -w -u -5 -r1.27.2.38 flash_guest_player_ns.cpp
--- flash_guest_player_ns.cpp    22 May 2008 05:14:00 -0000    1.27.2.38
+++ flash_guest_player_ns.cpp    29 May 2008 02:25:51 -0000
@@ -67,10 +67,11 @@
 #include "hxvsurf.h"
 #include "hxprefs.h"
 #include "hxhyper.h"
 #include "hxhypnv.h"
 #include "hxevent.h"
+#include "hxstringutil.h"
 #include "dllacces.h"
 #include "filespecutils.h"
 #include "hxinter.h" // IHXEventManager
 #include "xml_flash.h"
 #include "swfpack.h"
@@ -1509,10 +1510,12 @@
 
     HX_RELEASE(m_pOffscreenBuffer);
     HX_RELEASE(m_pMutex);
     HX_RELEASE(m_pSite);
     HX_RELEASE(m_pScheduler);
+        m_EIFunctionList.RemoveAll();
+        HX_RELEASE(m_pXMLFlash);
 
         m_bTerminated = TRUE;
     }
 
     return HXR_OK;
@@ -3707,11 +3710,11 @@
         pos = m_StringIds.AddTailString(name);
     }
     const char* sId;
     sId = (const char*) *((CHXString*) m_StringIds.GetAt(pos));
 
-    HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name, sId);
+    //HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name,
sId);
     return (NPIdentifier) sId;
 }
 
 void
 CFlashGuestPlayerNS::NPN_GetStringIdentifiers(const NPUTF8** names,
int32_t nameCount, NPIdentifier* identifiers)
@@ -3754,11 +3757,11 @@
 #if defined(_MAC_UNIX)
     // MBO - Test
     // printf("NPN_UTF8FromIdentifier\n");
 #endif    // _MAC_UNIX
 
-    HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*) identifier);
+    //HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*)
identifier);
     return (NPUTF8*) new_string((char*) identifier);
 }
 
 int32_t
 CFlashGuestPlayerNS::NPN_IntFromIdentifier(NPIdentifier identifier)
@@ -3913,24 +3916,26 @@
     // From a helix 'VolumeSlider':
     //   try { __flash__toXML(HXSetVolume(49)) ; } catch (e) {
""; }
 
     CHXString strInvokeName, strInvokeArgs;
     INT32 dIndex = -1;
+    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
+    CFlashGuestPlayerNS* pPlayer = NULL;
+
+    if (objw)
+    {
+    pPlayer = (CFlashGuestPlayerNS*) objw->m_npp->ndata;
+    }
 
     if (strstr(strScript, "HXGetExternalInterfaceStatus"))
     {
     HXLOGL4(HXLOG_FPHR, "HXExternalInteraceStatus message received.
ExternalInterface.call is working.");
     // Send a message to Flash saying that we are able to receive
ExternalInterface.call messages
-        if (obj)
-        {
-            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
objw->m_npp->ndata;
             if (pPlayer)
             {
 
pPlayer->SendFlashMessage("EISetExternalInterfaceStatus", "true");
             }
-        }
     return true;
     }
 
     // Remove the array brackets
     if (strScript.FindAndReplace("([", "(", FALSE))
@@ -3948,12 +3953,10 @@
     HXLOGL4(HXLOG_FPHR, "HXDebug: %s", (const char*)strInvokeArgs);
     return true;
     }
     if ((dIndex = strScript.Find("HXPosition(")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex + strlen("HXPosition("));
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
@@ -3965,12 +3968,10 @@
 
     return true;
     }
     if ((dIndex = strScript.Find("HXMetaChanged(")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex + strlen("HXMetaChanged("));
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
@@ -3982,12 +3983,10 @@
 
     return true;
     }
     if ((dIndex = strScript.Find("HXBufferingChanged(")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex +
strlen("HXBufferingChanged("));
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
@@ -3999,12 +3998,10 @@
 
     return true;
     }
     if ((dIndex = strScript.Find("HXStateChanged(\"")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex +
strlen("HXStateChanged(\""));
         if ((dIndex = strInvokeArgs.Find('"')) > 0)
         {
@@ -4208,25 +4205,33 @@
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
             strInvokeArgs = strInvokeArgs.Left(dIndex);
         }
     }
+    else if ((dIndex = strScript.Find("HXSetFunctions(")) >= 0)
+    {
+        strInvokeName = "HXSetFunctions";
+        strInvokeArgs = strScript.Mid(dIndex +
strlen("HXSetFunctions(") + 1);
+        if ((dIndex = strInvokeArgs.Find(')')) > 0)
+        {
+            strInvokeArgs = strInvokeArgs.Left(dIndex);
+            if (pPlayer)
+            {
+                pPlayer->SetupEIFunctionList(strInvokeArgs);
+            }
+        }
+    }
 
     if (!strInvokeName.IsEmpty())
     {
         CHXString strInvokeXML;
         HX_RESULT hr = CHXXMLFlash::WriteInvokeXML(strInvokeName,
strInvokeArgs, strInvokeXML);
-        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && obj)
-        {
-            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
objw->m_npp->ndata;
-            if (pPlayer)
+        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && pPlayer)
             {
                 pPlayer->FlashCall(strInvokeXML);
             }
         }
-    }
 
     return true;
 }
 
 bool
@@ -4316,11 +4321,11 @@
 }
 
 void
 CFlashGuestPlayerNS::NPN_ReleaseVariantValue(NPVariant *variant)
 {
-    HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
+    //HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
 
 #if defined(_MAC_UNIX)
     // MBO - Test
     // printf("NPN_ReleaseVariantValue vriant=%ld\n", variant);
 #endif    // _MAC_UNIX
@@ -5356,11 +5361,18 @@
         NPVariant npArgv[1];
         UINT32 argCount=1;
 
         STRINGN_TO_NPVARIANT( (const char*) strInvokeXML, strlen((const
char*)strInvokeXML), npArgv[0]);
 
+    if (EIFunctionExists(strInvokeXML))
+    {
         hr = Invoke("CallFunction", npArgv, argCount, &vresult);
+    }
+    else
+    {
+        hr = HXR_UNEXPECTED;
+    }
 
     if (SUCCEEDED(hr))
         {
             NPN_ReleaseVariantValue(&vresult);
         }
@@ -5403,5 +5415,54 @@
     // Get the current frame
     INT32 lCurFrame = 0;
     HX_RESULT retVal = Invoke("CurrentFrame", lCurFrame);
     return lCurFrame;
 }
+
+HXBOOL
+CFlashGuestPlayerNS::EIFunctionExists(const CHXString& strInvokeXML)
+{
+    // Check to see if the ExternalInterface function exists
+    HXBOOL bExists=TRUE; // Default to true, if we did not receive a
list via HXSetFunctions, or we cannot parse, assume passive check.
+
+    // Extract the invoke name, and make sure it exists on the flash side
+    if (m_EIFunctionList.GetCount() > 0)
+    {
+    CHXString strInvokeName, strInvokeArgs;
+
+    if (m_pXMLFlash == NULL)
+    {
+        m_pXMLFlash = new CHXXMLFlash(m_pContext);
+        HX_ADDREF(m_pXMLFlash);
+    }
+
+    // Parse the XML, get the invoke name
+    if (m_pXMLFlash)
+    {
+        if (SUCCEEDED(m_pXMLFlash->ParseInvokeXML(strInvokeXML,
strInvokeName, strInvokeArgs)) && !strInvokeName.IsEmpty())
+        {
+        if (!m_EIFunctionList.FindString(strInvokeName))
+        {
+                HXLOGL4(HXLOG_FPHR,
"CFlashGuestPlayerNS::EIFunctionExists FAILED for invoke name: %s",
(const char*) strInvokeName);
+            bExists = FALSE;
+        }
+        }
+    }
+    }
+
+    return bExists;
+}
+
+//
+// Create a list of known ExternalInterface functions, valid for
CallFunction, so we do not crash on the Mac
+//
+void
+CFlashGuestPlayerNS::SetupEIFunctionList(const CHXString& strInvokeArgs)
+{
+    if (!strInvokeArgs.IsEmpty())
+    {
+    HXStringUtil::Split(strInvokeArgs, HXFLASH_ARGUMENT_DELIMITER,
m_EIFunctionList);
+    }
+
+    HXLOGL4(HXLOG_FPHR, "CFlashGuestPlayerNS::SetupEIFunctionList:
Created function list, count=%ld", m_EIFunctionList.GetCount());
+}
+
Index: platform/win32/flash_guest_player_ax.cpp
===================================================================
RCS file:
/cvsroot/datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
,v
retrieving revision 1.21.2.29
diff -w -u -5 -r1.21.2.29 flash_guest_player_ax.cpp
--- platform/win32/flash_guest_player_ax.cpp    21 May 2008 12:32:41
-0000    1.21.2.29
+++ platform/win32/flash_guest_player_ax.cpp    28 May 2008 21:48:40 -0000
@@ -132,11 +132,10 @@
         , m_lpO(NULL)
         , m_lpInPlaceObjWindowless(NULL)
         , m_lpInPlaceObj(NULL)
         , m_lpViewObject(NULL)
         , m_pMutex(NULL)
-        , m_pXMLFlash(NULL)
         , m_dFrameRate(0.0)
         , m_bInPlaceActive(FALSE)
         , m_lFlashVersion(0)
         , m_bGotInvalidateRect(FALSE)
         , m_pOffscreenBuffer(NULL)
Index: pub/flash_guest_player.h
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player.h,v
retrieving revision 1.27.2.12
diff -w -u -5 -r1.27.2.12 flash_guest_player.h
--- pub/flash_guest_player.h    25 Apr 2008 22:54:26 -0000    1.27.2.12
+++ pub/flash_guest_player.h    28 May 2008 23:22:34 -0000
@@ -106,10 +106,11 @@
 
 // Forward declarations
 class CHXSimpleList;
 class CFlashSiteWatcher;
 class CFlashPassiveSiteWatcher;
+class CHXXMLFlash;
 struct IHXCommonClassFactory;
 struct IHXFileObject;
 //struct IHXRequest;
 
 #define SOURCE_URL_FLASH_CUSTOM_VAR        "sourceURL"
@@ -247,10 +248,11 @@
     IHXFileObject*    m_pFileObject;
     IHXFileObject*    m_pFLVFileObject;
     IHXSite*        m_pSite;
     HXxPoint        m_OffsetPoint;
     IHXScheduler*    m_pScheduler;
+    CHXXMLFlash*    m_pXMLFlash;
 
     IHXExternalInterfaceResponse* m_pExternalInterfaceResponse;
     IHXSiteWindowless* m_pRepresentingSite;
 
     HXBOOL m_bWindowlessPref;     // Specifies the pref for windowless
(true) or windowed (false)
Index: pub/flash_guest_player_ns.h
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player_ns.h,v
retrieving revision 1.14.2.15
diff -w -u -5 -r1.14.2.15 flash_guest_player_ns.h
--- pub/flash_guest_player_ns.h    10 May 2008 20:47:13 -0000    1.14.2.15
+++ pub/flash_guest_player_ns.h    28 May 2008 23:52:09 -0000
@@ -57,18 +57,18 @@
 #include "npupp.h"
 #include "hxwin.h"
 #include "hxstring.h"
 #include "hxsite2.h"
 #include "hxengin.h"
+#include "hxslist.h"
 
 #if defined (_MAC_UNIX)
 #include "platform/mac/macwindowinfo.h"
 #endif    // _MAC_UNIX
 
 // Forward declarations
 class CHXSimpleList;
-class CHXStringList;
 class CHXString;
 class DLLAccess;
 class  CHXGenericCallback;
 struct IHXCommonClassFactory;
 struct IHXMutex;
@@ -253,10 +253,12 @@
     HX_RESULT   ParseNativeMediaSize(IHXBuffer* pBuffer, REF(HXxSize)
rSize);
     void        OnFlashPlayerStateChange(const char* pszGuestState);
 
     UINT32  GetNumFrames(void);
     UINT32  GetCurrentFrame(void);
+    HXBOOL  EIFunctionExists(const CHXString& strInvokeXML);
+    void    SetupEIFunctionList(const CHXString& strInvokeArgs);
 
     enum
     {
         kStateReady,
         kStateFSMInitDonePending,
@@ -284,10 +286,11 @@
     double              m_dFrameRate;
     UINT32        m_ulPacingInterval;
     UINT32        m_ulReadPacingInterval;
     UINT32        m_ulFileOffsetPending;
     UINT32        m_ulFileOffsetRequested;
+    CHXStringList    m_EIFunctionList;
 
     static const char* const    m_pszFlashMimeType;
     static CHXStringList    m_StringIds;
     static CHXSimpleList    m_IntIds;
     static CHXString            m_pUserAgentStr;
Index: pub/platform/win32/flash_guest_player_ax.h
===================================================================
RCS file:
/cvsroot/datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax
.h,v
retrieving revision 1.10.2.13
diff -w -u -5 -r1.10.2.13 flash_guest_player_ax.h
--- pub/platform/win32/flash_guest_player_ax.h    16 May 2008 16:37:16
-0000    1.10.2.13
+++ pub/platform/win32/flash_guest_player_ax.h    28 May 2008 21:48:04 -
0000
@@ -75,11 +75,10 @@
 // Forward declarations
 class CFlashGuestPlayer;
 class CHXString;
 class CHXGenericCallback;
 struct IHXFileObject;
-class CHXXMLFlash;
 
 class CFlashGuestPlayerAX : public CFlashGuestPlayer
               , public ShockwaveFlashObjects::_IShockwaveFlashEvents
               , public IOleClientSite
               , public IOleInPlaceSiteWindowless
@@ -311,11 +310,10 @@
     HBITMAP        m_hOldBitmap;
     void*          m_pDIBits;
     UINT32         m_ulDIBitsSize;
     UINT32         m_ulDIBitsWidth;
     UINT32         m_ulDIBitsHeight;
-    CHXXMLFlash*   m_pXMLFlash;
     double         m_dFrameRate;
     HXBOOL         m_bInPlaceActive;
     INT32          m_lFlashVersion;
     HXBOOL         m_bGotInvalidateRect;
     HXBOOL         m_bOLEInitialized;
    

 
 
_______________________________________________
Datatype-dev mailing list
Datatype-dev@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
 
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080529/954f9955/attachment-0001.html
From ehyche at real.com  Thu May 29 11:28:49 2008
From: ehyche at real.com (Eric Hyche)
Date: Thu May 29 10:14:12 2008
Subject: [datatype-dev] CR:Changes to fix MJPG playback in avi container
In-Reply-To: <020401c8c199$6c0d57f0$1601a8c0@varun>
References: <020401c8c199$6c0d57f0$1601a8c0@varun>
Message-ID: <01b301c8c1b9$d777c3c0$db68a8c0@EHYCHED620>


I think not only should m_ulGetChunkType should be m_ulChunkType
as in your diff, but also it looks like these changes should
also be made:

Index: riff.cpp
===================================================================
RCS file: /cvsroot/datatype/common/util/riff.cpp,v
retrieving revision 1.13
diff -u -w -u -w -r1.13 riff.cpp
--- riff.cpp    18 Aug 2007 00:03:23 -0000      1.13
+++ riff.cpp    29 May 2008 18:26:56 -0000
@@ -547,7 +547,7 @@
                 if ( HXR_OK != status )
                 {
                     m_state = RS_Ready;
-                    m_pResponse->RIFFGetChunkDone(HXR_FAILED, 0, NULL);
+                    m_pResponse->RIFFFindChunkDone(HXR_FAILED, 0);
                     return HXR_OK;
                 }

@@ -564,10 +564,10 @@
                                }

                 if ( (m_ulFileType == RIFF_FILE_MAGIC_NUMBER) &&
-                     (m_ulGetChunkType == (UINT32)0) )
+                     (m_ulChunkType == (UINT32)0) )
                 {
                     m_state = RS_Ready;
-                    m_pResponse->RIFFGetChunkDone(HXR_FAILED, 0, NULL);
+                    m_pResponse->RIFFFindChunkDone(HXR_FAILED, 0);
                     return HXR_OK;
                 }

The reason is that the only time that the state is
set to RS_GetChunkHeaderPending is when the user calls FindNextChunk(),
in which case they are expecting a callback on RIFFFindChunkDone
not RIFFGetChunkDone().

Eric

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: datatype-dev-bounces@helixcommunity.org 
> [mailto:datatype-dev-bounces@helixcommunity.org] On Behalf Of 
> Varun Kathuria
> Sent: Thursday, May 29, 2008 10:35 AM
> To: datatype-dev@helixcommunity.org
> Subject: [datatype-dev] CR:Changes to fix MJPG playback in 
> avi container
> 
>  
> Synopsis:
> Changes to fix MJPG playback in avi container on 
> linux-2.2-libc6-gcc32-i586.
>  
> Overview:
> Changed  m_ulGetChunkType to m_ulChunkType to fix error. It 
> seems a typo error, wrong variable seems to be compared. 
> Also m_ulGetChunkType is not initialized in the constructor.
>  
> Files Added:
> 
> None
>  
> Files Modified:
> /cvsroot/datatype/common/util/riff.cpp
>  
> Image Size and Heap Use impact (Client -Only):
> None.
>  
> Platforms and Profiles Affected:
> None 
>  
> Distribution Libraries Affected:
> None
>  
> Distribution library impact and planned action:
> None
>  
> Platforms and Profiles Build Verified:
> BIF branch    -> helix_restricted
> 
> Target(s)      -> splay
> Profile          -> helix-client-all-defines
> SYSTEM_ID -> linux-2.2-libc6-gcc32-i586
>  
> Branch:
> HEAD, ATLAS
>  
> Files Attached:
> diff.txt
>  
> Thanks & Regards 
> Varun Kathuria
> 


From cbailey at real.com  Thu May 29 11:45:28 2008
From: cbailey at real.com (Christina Bailey)
Date: Thu May 29 10:30:45 2008
Subject: [datatype-dev] RE: Add ExternalInterface check to
	the	FlashGuestPlayerNS
In-Reply-To: 
References: <483E1719.3050103@real.com>
	<1071D244292640C18F8AAFF3AB7F6584@DingDong>
	<483EEB9B.2030605@real.com>
	
Message-ID: <483EF9C8.2080309@real.com>



Henry Ping wrote:
>
> FlashGuestPlayerAX doesn't need to call them. BUT, the functions can 
> still reside in the base class, specifically SetupEIFunctionList and 
> EIFunctionExists. This makes it easier for us to call them from 
> FlashGuestPlayerAX in the future.
>
Okay.
>
>  
>
> In addition, it appears we parse XML each time EIFunctionExists is 
> called in order to retrieve the method name, we can avoid XML parsing 
> by calling EIFunctionExists prior to the assembly of XML since we know 
> the exact method name.
>
This is necessary because most of the invoke calls come from 
IHXExternalInterface::CallExternalFunction where the invoke name is 
embedded in the XML. It's only the rare case that uses 
CFlashGuestPlayer::SendFlashMessage. I suggest moving SendFlashMessage 
into IHXExternalInterface. This would centralize creation of the invoke 
XML and allow EI functions checks without XML parsing.

--christina
>
>  
>
> Henry
>
>  
>
> ------------------------------------------------------------------------
>
> *From:* Christina Bailey [mailto:cbailey@real.com]
> *Sent:* Thursday, May 29, 2008 10:45 AM
> *To:* ping@real.com
> *Cc:* liteplayer_dev@real.com; datatype-dev@helixcommunity.org
> *Subject:* Re: [datatype-dev] RE: Add ExternalInterface check to the 
> FlashGuestPlayerNS
>
>  
>
> I didn't move the check to the base class because it's an extra step that
> is not necessary in FlashGuestPlayerAX. Now it's the same result for both
> versions, a log message saying that the function does not exist, instead
> of crashing on the Mac.
>
> --christina
>
> Henry Ping wrote:
>
> I'd move EI function check to the base class so that FlashGuestPlayerAX can
> leverage the same checking mechanism when external interface is working in
> Flash AX.
>  
> Rest looks good.
>  
> Thanks
> Henry
>  
>   
>> -----Original Message-----
>> From: Christina Bailey [mailto:cbailey@real.com]
>> Sent: Wednesday, May 28, 2008 7:38 PM
>> To: liteplayer_dev@real.com 
>> Cc: datatype-dev@helixcommunity.org 
>> Subject: CR: Add ExternalInterface check to the FlashGuestPlayerNS
>>  
>> Synopsis: Mac crashes on ExternalInterface functions that do not exist.
>>  
>> Overview: Add functionality to check for a list of supported
>> ExternalInterface functions.
>> If the SWF supports this feature it will send a "HXSetFunctions" message
>> with a list
>> of supported ExternalInterface functions.
>>  
>> Files:
>>  
>> datatype/flash/flashhost/flash_guest_player_ns.cpp
>> datatype/flash/flashhost/pub/flash_guest_player_ns.h
>>     - Add catch for HXSetFunctions command, parse args into a function
>> name list.
>>     - Before each ExternalInterface call, parse out the command from the
>> xml blob
>>     and check if the function is in the list, fail if the list exists
>> and it is not found.
>>     - Optimize dereference of the 'this' object in NPN_Evaluate.
>>  
>> datatype/flash/flashhost/flash_guest_player.cpp
>> datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
>> datatype/flash/flashhost/pub/flash_guest_player.h
>> datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax.h
>>     - move common var to base class, m_pXMLFlash
>>  
>> Branches: HEAD and 310Atlas
>>  
>> Diff:
>>  
>> Index: flash_guest_player.cpp
>> ===================================================================
>> RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player.cpp,v
>> retrieving revision 1.33.2.21
>> diff -w -u -5 -r1.33.2.21 flash_guest_player.cpp
>> --- flash_guest_player.cpp    14 May 2008 00:03:38 -0000    1.33.2.21
>> +++ flash_guest_player.cpp    28 May 2008 22:24:52 -0000
>> @@ -152,10 +152,11 @@
>>      , m_pFLVFileObject(NULL)
>>      , m_pSite(NULL)
>>      , m_pStats(NULL)
>>      , m_pRootSiteWatcher(NULL)
>>      , m_pRootPassiveSiteWatcher(NULL)
>> +    , m_pXMLFlash(NULL)
>>  {
>>      HXLOGL4(HXLOG_FPHR, "CON CFlashGuestPlayer this=%p", this);
>>      m_MediaSize.cx = dDefaultWindowWidth;
>>      m_MediaSize.cy = dDefaultWindowHeight;
>>      m_OffsetPoint.x = 0;
>> @@ -172,10 +173,11 @@
>>      HX_RELEASE(m_pExternalInterfaceResponse);
>>      HX_RELEASE(m_pRepresentingSite);
>>      HX_RELEASE(m_pCCF);
>>      HX_RELEASE(m_pContext);
>>      HX_RELEASE(m_pRequest);
>> +    HX_RELEASE(m_pXMLFlash);
>>  }
>>  
>>  STDMETHODIMP CFlashGuestPlayer::QueryInterface(REFIID riid, void**
>>     
> ppvObj)
>   
>>  {
>>      QInterfaceList  qiList[] =
>> Index: flash_guest_player_ns.cpp
>> ===================================================================
>> RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player_ns.cpp,v
>> retrieving revision 1.27.2.38
>> diff -w -u -5 -r1.27.2.38 flash_guest_player_ns.cpp
>> --- flash_guest_player_ns.cpp    22 May 2008 05:14:00 -0000    1.27.2.38
>> +++ flash_guest_player_ns.cpp    29 May 2008 02:25:51 -0000
>> @@ -67,10 +67,11 @@
>>  #include "hxvsurf.h"
>>  #include "hxprefs.h"
>>  #include "hxhyper.h"
>>  #include "hxhypnv.h"
>>  #include "hxevent.h"
>> +#include "hxstringutil.h"
>>  #include "dllacces.h"
>>  #include "filespecutils.h"
>>  #include "hxinter.h" // IHXEventManager
>>  #include "xml_flash.h"
>>  #include "swfpack.h"
>> @@ -1509,10 +1510,12 @@
>>  
>>      HX_RELEASE(m_pOffscreenBuffer);
>>      HX_RELEASE(m_pMutex);
>>      HX_RELEASE(m_pSite);
>>      HX_RELEASE(m_pScheduler);
>> +        m_EIFunctionList.RemoveAll();
>> +        HX_RELEASE(m_pXMLFlash);
>>  
>>          m_bTerminated = TRUE;
>>      }
>>  
>>      return HXR_OK;
>> @@ -3707,11 +3710,11 @@
>>          pos = m_StringIds.AddTailString(name);
>>      }
>>      const char* sId;
>>      sId = (const char*) *((CHXString*) m_StringIds.GetAt(pos));
>>  
>> -    HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name, sId);
>> +    //HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name,
>> sId);
>>      return (NPIdentifier) sId;
>>  }
>>  
>>  void
>>  CFlashGuestPlayerNS::NPN_GetStringIdentifiers(const NPUTF8** names,
>> int32_t nameCount, NPIdentifier* identifiers)
>> @@ -3754,11 +3757,11 @@
>>  #if defined(_MAC_UNIX)
>>      // MBO - Test
>>      // printf("NPN_UTF8FromIdentifier\n");
>>  #endif    // _MAC_UNIX
>>  
>> -    HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*) identifier);
>> +    //HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*)
>> identifier);
>>      return (NPUTF8*) new_string((char*) identifier);
>>  }
>>  
>>  int32_t
>>  CFlashGuestPlayerNS::NPN_IntFromIdentifier(NPIdentifier identifier)
>> @@ -3913,24 +3916,26 @@
>>      // From a helix 'VolumeSlider':
>>      //   try { __flash__toXML(HXSetVolume(49)) ; } catch (e) {
>> ""; }
>>  
>>      CHXString strInvokeName, strInvokeArgs;
>>      INT32 dIndex = -1;
>> +    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> +    CFlashGuestPlayerNS* pPlayer = NULL;
>> +
>> +    if (objw)
>> +    {
>> +    pPlayer = (CFlashGuestPlayerNS*) objw->m_npp->ndata;
>> +    }
>>  
>>      if (strstr(strScript, "HXGetExternalInterfaceStatus"))
>>      {
>>      HXLOGL4(HXLOG_FPHR, "HXExternalInteraceStatus message received.
>> ExternalInterface.call is working.");
>>      // Send a message to Flash saying that we are able to receive
>> ExternalInterface.call messages
>> -        if (obj)
>> -        {
>> -            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>              if (pPlayer)
>>              {
>>  
>> pPlayer->SendFlashMessage("EISetExternalInterfaceStatus", "true");
>>              }
>> -        }
>>      return true;
>>      }
>>  
>>      // Remove the array brackets
>>      if (strScript.FindAndReplace("([", "(", FALSE))
>> @@ -3948,12 +3953,10 @@
>>      HXLOGL4(HXLOG_FPHR, "HXDebug: %s", (const char*)strInvokeArgs);
>>      return true;
>>      }
>>      if ((dIndex = strScript.Find("HXPosition(")) >= 0)
>>      {
>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>      if (pPlayer)
>>      {
>>          strInvokeArgs = strScript.Mid(dIndex + strlen("HXPosition("));
>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>          {
>> @@ -3965,12 +3968,10 @@
>>  
>>      return true;
>>      }
>>      if ((dIndex = strScript.Find("HXMetaChanged(")) >= 0)
>>      {
>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>      if (pPlayer)
>>      {
>>          strInvokeArgs = strScript.Mid(dIndex + strlen("HXMetaChanged("));
>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>          {
>> @@ -3982,12 +3983,10 @@
>>  
>>      return true;
>>      }
>>      if ((dIndex = strScript.Find("HXBufferingChanged(")) >= 0)
>>      {
>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>      if (pPlayer)
>>      {
>>          strInvokeArgs = strScript.Mid(dIndex +
>> strlen("HXBufferingChanged("));
>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>          {
>> @@ -3999,12 +3998,10 @@
>>  
>>      return true;
>>      }
>>      if ((dIndex = strScript.Find("HXStateChanged(\"")) >= 0)
>>      {
>> -    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>>      if (pPlayer)
>>      {
>>          strInvokeArgs = strScript.Mid(dIndex +
>> strlen("HXStateChanged(\""));
>>          if ((dIndex = strInvokeArgs.Find('"')) > 0)
>>          {
>> @@ -4208,25 +4205,33 @@
>>          if ((dIndex = strInvokeArgs.Find(')')) > 0)
>>          {
>>              strInvokeArgs = strInvokeArgs.Left(dIndex);
>>          }
>>      }
>> +    else if ((dIndex = strScript.Find("HXSetFunctions(")) >= 0)
>> +    {
>> +        strInvokeName = "HXSetFunctions";
>> +        strInvokeArgs = strScript.Mid(dIndex +
>> strlen("HXSetFunctions(") + 1);
>> +        if ((dIndex = strInvokeArgs.Find(')')) > 0)
>> +        {
>> +            strInvokeArgs = strInvokeArgs.Left(dIndex);
>> +            if (pPlayer)
>> +            {
>> +                pPlayer->SetupEIFunctionList(strInvokeArgs);
>> +            }
>> +        }
>> +    }
>>  
>>      if (!strInvokeName.IsEmpty())
>>      {
>>          CHXString strInvokeXML;
>>          HX_RESULT hr = CHXXMLFlash::WriteInvokeXML(strInvokeName,
>> strInvokeArgs, strInvokeXML);
>> -        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && obj)
>> -        {
>> -            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
>> -            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
>> objw->m_npp->ndata;
>> -            if (pPlayer)
>> +        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && pPlayer)
>>              {
>>                  pPlayer->FlashCall(strInvokeXML);
>>              }
>>          }
>> -    }
>>  
>>      return true;
>>  }
>>  
>>  bool
>> @@ -4316,11 +4321,11 @@
>>  }
>>  
>>  void
>>  CFlashGuestPlayerNS::NPN_ReleaseVariantValue(NPVariant *variant)
>>  {
>> -    HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
>> +    //HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
>>  
>>  #if defined(_MAC_UNIX)
>>      // MBO - Test
>>      // printf("NPN_ReleaseVariantValue vriant=%ld\n", variant);
>>  #endif    // _MAC_UNIX
>> @@ -5356,11 +5361,18 @@
>>          NPVariant npArgv[1];
>>          UINT32 argCount=1;
>>  
>>          STRINGN_TO_NPVARIANT( (const char*) strInvokeXML, strlen((const
>> char*)strInvokeXML), npArgv[0]);
>>  
>> +    if (EIFunctionExists(strInvokeXML))
>> +    {
>>          hr = Invoke("CallFunction", npArgv, argCount, &vresult);
>> +    }
>> +    else
>> +    {
>> +        hr = HXR_UNEXPECTED;
>> +    }
>>  
>>      if (SUCCEEDED(hr))
>>          {
>>              NPN_ReleaseVariantValue(&vresult);
>>          }
>> @@ -5403,5 +5415,54 @@
>>      // Get the current frame
>>      INT32 lCurFrame = 0;
>>      HX_RESULT retVal = Invoke("CurrentFrame", lCurFrame);
>>      return lCurFrame;
>>  }
>> +
>> +HXBOOL
>> +CFlashGuestPlayerNS::EIFunctionExists(const CHXString& strInvokeXML)
>> +{
>> +    // Check to see if the ExternalInterface function exists
>> +    HXBOOL bExists=TRUE; // Default to true, if we did not receive a
>> list via HXSetFunctions, or we cannot parse, assume passive check.
>> +
>> +    // Extract the invoke name, and make sure it exists on the flash side
>> +    if (m_EIFunctionList.GetCount() > 0)
>> +    {
>> +    CHXString strInvokeName, strInvokeArgs;
>> +
>> +    if (m_pXMLFlash == NULL)
>> +    {
>> +        m_pXMLFlash = new CHXXMLFlash(m_pContext);
>> +        HX_ADDREF(m_pXMLFlash);
>> +    }
>> +
>> +    // Parse the XML, get the invoke name
>> +    if (m_pXMLFlash)
>> +    {
>> +        if (SUCCEEDED(m_pXMLFlash->ParseInvokeXML(strInvokeXML,
>> strInvokeName, strInvokeArgs)) && !strInvokeName.IsEmpty())
>> +        {
>> +        if (!m_EIFunctionList.FindString(strInvokeName))
>> +        {
>> +                HXLOGL4(HXLOG_FPHR,
>> "CFlashGuestPlayerNS::EIFunctionExists FAILED for invoke name: %s",
>> (const char*) strInvokeName);
>> +            bExists = FALSE;
>> +        }
>> +        }
>> +    }
>> +    }
>> +
>> +    return bExists;
>> +}
>> +
>> +//
>> +// Create a list of known ExternalInterface functions, valid for
>> CallFunction, so we do not crash on the Mac
>> +//
>> +void
>> +CFlashGuestPlayerNS::SetupEIFunctionList(const CHXString& strInvokeArgs)
>> +{
>> +    if (!strInvokeArgs.IsEmpty())
>> +    {
>> +    HXStringUtil::Split(strInvokeArgs, HXFLASH_ARGUMENT_DELIMITER,
>> m_EIFunctionList);
>> +    }
>> +
>> +    HXLOGL4(HXLOG_FPHR, "CFlashGuestPlayerNS::SetupEIFunctionList:
>> Created function list, count=%ld", m_EIFunctionList.GetCount());
>> +}
>> +
>> Index: platform/win32/flash_guest_player_ax.cpp
>> ===================================================================
>> RCS file:
>> /cvsroot/datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
>> ,v
>> retrieving revision 1.21.2.29
>> diff -w -u -5 -r1.21.2.29 flash_guest_player_ax.cpp
>> --- platform/win32/flash_guest_player_ax.cpp    21 May 2008 12:32:41
>> -0000    1.21.2.29
>> +++ platform/win32/flash_guest_player_ax.cpp    28 May 2008 21:48:40 -0000
>> @@ -132,11 +132,10 @@
>>          , m_lpO(NULL)
>>          , m_lpInPlaceObjWindowless(NULL)
>>          , m_lpInPlaceObj(NULL)
>>          , m_lpViewObject(NULL)
>>          , m_pMutex(NULL)
>> -        , m_pXMLFlash(NULL)
>>          , m_dFrameRate(0.0)
>>          , m_bInPlaceActive(FALSE)
>>          , m_lFlashVersion(0)
>>          , m_bGotInvalidateRect(FALSE)
>>          , m_pOffscreenBuffer(NULL)
>> Index: pub/flash_guest_player.h
>> ===================================================================
>> RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player.h,v
>> retrieving revision 1.27.2.12
>> diff -w -u -5 -r1.27.2.12 flash_guest_player.h
>> --- pub/flash_guest_player.h    25 Apr 2008 22:54:26 -0000    1.27.2.12
>> +++ pub/flash_guest_player.h    28 May 2008 23:22:34 -0000
>> @@ -106,10 +106,11 @@
>>  
>>  // Forward declarations
>>  class CHXSimpleList;
>>  class CFlashSiteWatcher;
>>  class CFlashPassiveSiteWatcher;
>> +class CHXXMLFlash;
>>  struct IHXCommonClassFactory;
>>  struct IHXFileObject;
>>  //struct IHXRequest;
>>  
>>  #define SOURCE_URL_FLASH_CUSTOM_VAR        "sourceURL"
>> @@ -247,10 +248,11 @@
>>      IHXFileObject*    m_pFileObject;
>>      IHXFileObject*    m_pFLVFileObject;
>>      IHXSite*        m_pSite;
>>      HXxPoint        m_OffsetPoint;
>>      IHXScheduler*    m_pScheduler;
>> +    CHXXMLFlash*    m_pXMLFlash;
>>  
>>      IHXExternalInterfaceResponse* m_pExternalInterfaceResponse;
>>      IHXSiteWindowless* m_pRepresentingSite;
>>  
>>      HXBOOL m_bWindowlessPref;     // Specifies the pref for windowless
>> (true) or windowed (false)
>> Index: pub/flash_guest_player_ns.h
>> ===================================================================
>> RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player_ns.h,v
>> retrieving revision 1.14.2.15
>> diff -w -u -5 -r1.14.2.15 flash_guest_player_ns.h
>> --- pub/flash_guest_player_ns.h    10 May 2008 20:47:13 -0000    1.14.2.15
>> +++ pub/flash_guest_player_ns.h    28 May 2008 23:52:09 -0000
>> @@ -57,18 +57,18 @@
>>  #include "npupp.h"
>>  #include "hxwin.h"
>>  #include "hxstring.h"
>>  #include "hxsite2.h"
>>  #include "hxengin.h"
>> +#include "hxslist.h"
>>  
>>  #if defined (_MAC_UNIX)
>>  #include "platform/mac/macwindowinfo.h"
>>  #endif    // _MAC_UNIX
>>  
>>  // Forward declarations
>>  class CHXSimpleList;
>> -class CHXStringList;
>>  class CHXString;
>>  class DLLAccess;
>>  class  CHXGenericCallback;
>>  struct IHXCommonClassFactory;
>>  struct IHXMutex;
>> @@ -253,10 +253,12 @@
>>      HX_RESULT   ParseNativeMediaSize(IHXBuffer* pBuffer, REF(HXxSize)
>> rSize);
>>      void        OnFlashPlayerStateChange(const char* pszGuestState);
>>  
>>      UINT32  GetNumFrames(void);
>>      UINT32  GetCurrentFrame(void);
>> +    HXBOOL  EIFunctionExists(const CHXString& strInvokeXML);
>> +    void    SetupEIFunctionList(const CHXString& strInvokeArgs);
>>  
>>      enum
>>      {
>>          kStateReady,
>>          kStateFSMInitDonePending,
>> @@ -284,10 +286,11 @@
>>      double              m_dFrameRate;
>>      UINT32        m_ulPacingInterval;
>>      UINT32        m_ulReadPacingInterval;
>>      UINT32        m_ulFileOffsetPending;
>>      UINT32        m_ulFileOffsetRequested;
>> +    CHXStringList    m_EIFunctionList;
>>  
>>      static const char* const    m_pszFlashMimeType;
>>      static CHXStringList    m_StringIds;
>>      static CHXSimpleList    m_IntIds;
>>      static CHXString            m_pUserAgentStr;
>> Index: pub/platform/win32/flash_guest_player_ax.h
>> ===================================================================
>> RCS file:
>> /cvsroot/datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax
>> .h,v
>> retrieving revision 1.10.2.13
>> diff -w -u -5 -r1.10.2.13 flash_guest_player_ax.h
>> --- pub/platform/win32/flash_guest_player_ax.h    16 May 2008 16:37:16
>> -0000    1.10.2.13
>> +++ pub/platform/win32/flash_guest_player_ax.h    28 May 2008 21:48:04 -
>> 0000
>> @@ -75,11 +75,10 @@
>>  // Forward declarations
>>  class CFlashGuestPlayer;
>>  class CHXString;
>>  class CHXGenericCallback;
>>  struct IHXFileObject;
>> -class CHXXMLFlash;
>>  
>>  class CFlashGuestPlayerAX : public CFlashGuestPlayer
>>                , public ShockwaveFlashObjects::_IShockwaveFlashEvents
>>                , public IOleClientSite
>>                , public IOleInPlaceSiteWindowless
>> @@ -311,11 +310,10 @@
>>      HBITMAP        m_hOldBitmap;
>>      void*          m_pDIBits;
>>      UINT32         m_ulDIBitsSize;
>>      UINT32         m_ulDIBitsWidth;
>>      UINT32         m_ulDIBitsHeight;
>> -    CHXXMLFlash*   m_pXMLFlash;
>>      double         m_dFrameRate;
>>      HXBOOL         m_bInPlaceActive;
>>      INT32          m_lFlashVersion;
>>      HXBOOL         m_bGotInvalidateRect;
>>      HXBOOL         m_bOLEInitialized;
>>     
>  
>  
> _______________________________________________
> Datatype-dev mailing list
> Datatype-dev@helixcommunity.org 
> http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
>  
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080529/a5d39875/attachment-0001.html
From ping at real.com  Thu May 29 11:51:56 2008
From: ping at real.com (Henry Ping)
Date: Thu May 29 10:37:17 2008
Subject: [datatype-dev] RE: Add ExternalInterface check to
	the	FlashGuestPlayerNS
In-Reply-To: <483EF9C8.2080309@real.com>
References: <483E1719.3050103@real.com>
	<1071D244292640C18F8AAFF3AB7F6584@DingDong>
	<483EEB9B.2030605@real.com>
	
	<483EF9C8.2080309@real.com>
Message-ID: <11A3D22F8FE64DDBA7C929EA14FAE713@DingDong>

"

I suggest moving SendFlashMessage into IHXExternalInterface. This would
centralize creation of the invoke XML and allow EI functions checks without
XML parsing.
"

 

Sounds good.

 

Henry

 

  _____  

From: Christina Bailey [mailto:cbailey@real.com] 
Sent: Thursday, May 29, 2008 11:45 AM
To: ping@real.com
Cc: liteplayer_dev@real.com; datatype-dev@helixcommunity.org
Subject: Re: [datatype-dev] RE: Add ExternalInterface check to the
FlashGuestPlayerNS

 



Henry Ping wrote: 

FlashGuestPlayerAX doesn't need to call them. BUT, the functions can still
reside in the base class, specifically SetupEIFunctionList and
EIFunctionExists. This makes it easier for us to call them from
FlashGuestPlayerAX in the future.

Okay.



 

In addition, it appears we parse XML each time EIFunctionExists is called in
order to retrieve the method name, we can avoid XML parsing by calling
EIFunctionExists prior to the assembly of XML since we know the exact method
name.

This is necessary because most of the invoke calls come from
IHXExternalInterface::CallExternalFunction where the invoke name is embedded
in the XML. It's only the rare case that uses
CFlashGuestPlayer::SendFlashMessage. I suggest moving SendFlashMessage into
IHXExternalInterface. This would centralize creation of the invoke XML and
allow EI functions checks without XML parsing.

--christina



 

Henry

 

  _____  

From: Christina Bailey [mailto:cbailey@real.com] 
Sent: Thursday, May 29, 2008 10:45 AM
To: ping@real.com
Cc: liteplayer_dev@real.com; datatype-dev@helixcommunity.org
Subject: Re: [datatype-dev] RE: Add ExternalInterface check to the
FlashGuestPlayerNS

 

I didn't move the check to the base class because it's an extra step that
is not necessary in FlashGuestPlayerAX. Now it's the same result for both
versions, a log message saying that the function does not exist, instead 
of crashing on the Mac.

--christina

Henry Ping wrote: 

I'd move EI function check to the base class so that FlashGuestPlayerAX can
leverage the same checking mechanism when external interface is working in
Flash AX.
 
Rest looks good.
 
Thanks
Henry
 
  

-----Original Message-----
From: Christina Bailey [mailto:cbailey@real.com]
Sent: Wednesday, May 28, 2008 7:38 PM
To: liteplayer_dev@real.com
Cc: datatype-dev@helixcommunity.org
Subject: CR: Add ExternalInterface check to the FlashGuestPlayerNS
 
Synopsis: Mac crashes on ExternalInterface functions that do not exist.
 
Overview: Add functionality to check for a list of supported
ExternalInterface functions.
If the SWF supports this feature it will send a "HXSetFunctions" message
with a list
of supported ExternalInterface functions.
 
Files:
 
datatype/flash/flashhost/flash_guest_player_ns.cpp
datatype/flash/flashhost/pub/flash_guest_player_ns.h
    - Add catch for HXSetFunctions command, parse args into a function
name list.
    - Before each ExternalInterface call, parse out the command from the
xml blob
    and check if the function is in the list, fail if the list exists
and it is not found.
    - Optimize dereference of the 'this' object in NPN_Evaluate.
 
datatype/flash/flashhost/flash_guest_player.cpp
datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
datatype/flash/flashhost/pub/flash_guest_player.h
datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax.h
    - move common var to base class, m_pXMLFlash
 
Branches: HEAD and 310Atlas
 
Diff:
 
Index: flash_guest_player.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player.cpp,v
retrieving revision 1.33.2.21
diff -w -u -5 -r1.33.2.21 flash_guest_player.cpp
--- flash_guest_player.cpp    14 May 2008 00:03:38 -0000    1.33.2.21
+++ flash_guest_player.cpp    28 May 2008 22:24:52 -0000
@@ -152,10 +152,11 @@
     , m_pFLVFileObject(NULL)
     , m_pSite(NULL)
     , m_pStats(NULL)
     , m_pRootSiteWatcher(NULL)
     , m_pRootPassiveSiteWatcher(NULL)
+    , m_pXMLFlash(NULL)
 {
     HXLOGL4(HXLOG_FPHR, "CON CFlashGuestPlayer this=%p", this);
     m_MediaSize.cx = dDefaultWindowWidth;
     m_MediaSize.cy = dDefaultWindowHeight;
     m_OffsetPoint.x = 0;
@@ -172,10 +173,11 @@
     HX_RELEASE(m_pExternalInterfaceResponse);
     HX_RELEASE(m_pRepresentingSite);
     HX_RELEASE(m_pCCF);
     HX_RELEASE(m_pContext);
     HX_RELEASE(m_pRequest);
+    HX_RELEASE(m_pXMLFlash);
 }
 
 STDMETHODIMP CFlashGuestPlayer::QueryInterface(REFIID riid, void**
    

ppvObj)
  

 {
     QInterfaceList  qiList[] =
Index: flash_guest_player_ns.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player_ns.cpp,v
retrieving revision 1.27.2.38
diff -w -u -5 -r1.27.2.38 flash_guest_player_ns.cpp
--- flash_guest_player_ns.cpp    22 May 2008 05:14:00 -0000    1.27.2.38
+++ flash_guest_player_ns.cpp    29 May 2008 02:25:51 -0000
@@ -67,10 +67,11 @@
 #include "hxvsurf.h"
 #include "hxprefs.h"
 #include "hxhyper.h"
 #include "hxhypnv.h"
 #include "hxevent.h"
+#include "hxstringutil.h"
 #include "dllacces.h"
 #include "filespecutils.h"
 #include "hxinter.h" // IHXEventManager
 #include "xml_flash.h"
 #include "swfpack.h"
@@ -1509,10 +1510,12 @@
 
     HX_RELEASE(m_pOffscreenBuffer);
     HX_RELEASE(m_pMutex);
     HX_RELEASE(m_pSite);
     HX_RELEASE(m_pScheduler);
+        m_EIFunctionList.RemoveAll();
+        HX_RELEASE(m_pXMLFlash);
 
         m_bTerminated = TRUE;
     }
 
     return HXR_OK;
@@ -3707,11 +3710,11 @@
         pos = m_StringIds.AddTailString(name);
     }
     const char* sId;
     sId = (const char*) *((CHXString*) m_StringIds.GetAt(pos));
 
-    HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name, sId);
+    //HXLOGL4(HXLOG_FPHR, "NPN_GetStringIdentifier : %s -> %p", name,
sId);
     return (NPIdentifier) sId;
 }
 
 void
 CFlashGuestPlayerNS::NPN_GetStringIdentifiers(const NPUTF8** names,
int32_t nameCount, NPIdentifier* identifiers)
@@ -3754,11 +3757,11 @@
 #if defined(_MAC_UNIX)
     // MBO - Test
     // printf("NPN_UTF8FromIdentifier\n");
 #endif    // _MAC_UNIX
 
-    HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*) identifier);
+    //HXLOGL4(HXLOG_FPHR, "NPN_UTF8FromIdentifier %s", (char*)
identifier);
     return (NPUTF8*) new_string((char*) identifier);
 }
 
 int32_t
 CFlashGuestPlayerNS::NPN_IntFromIdentifier(NPIdentifier identifier)
@@ -3913,24 +3916,26 @@
     // From a helix 'VolumeSlider':
     //   try { __flash__toXML(HXSetVolume(49)) ; } catch (e) {
""; }
 
     CHXString strInvokeName, strInvokeArgs;
     INT32 dIndex = -1;
+    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
+    CFlashGuestPlayerNS* pPlayer = NULL;
+
+    if (objw)
+    {
+    pPlayer = (CFlashGuestPlayerNS*) objw->m_npp->ndata;
+    }
 
     if (strstr(strScript, "HXGetExternalInterfaceStatus"))
     {
     HXLOGL4(HXLOG_FPHR, "HXExternalInteraceStatus message received.
ExternalInterface.call is working.");
     // Send a message to Flash saying that we are able to receive
ExternalInterface.call messages
-        if (obj)
-        {
-            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
objw->m_npp->ndata;
             if (pPlayer)
             {
 
pPlayer->SendFlashMessage("EISetExternalInterfaceStatus", "true");
             }
-        }
     return true;
     }
 
     // Remove the array brackets
     if (strScript.FindAndReplace("([", "(", FALSE))
@@ -3948,12 +3953,10 @@
     HXLOGL4(HXLOG_FPHR, "HXDebug: %s", (const char*)strInvokeArgs);
     return true;
     }
     if ((dIndex = strScript.Find("HXPosition(")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex + strlen("HXPosition("));
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
@@ -3965,12 +3968,10 @@
 
     return true;
     }
     if ((dIndex = strScript.Find("HXMetaChanged(")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex + strlen("HXMetaChanged("));
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
@@ -3982,12 +3983,10 @@
 
     return true;
     }
     if ((dIndex = strScript.Find("HXBufferingChanged(")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex +
strlen("HXBufferingChanged("));
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
@@ -3999,12 +3998,10 @@
 
     return true;
     }
     if ((dIndex = strScript.Find("HXStateChanged(\"")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex +
strlen("HXStateChanged(\""));
         if ((dIndex = strInvokeArgs.Find('"')) > 0)
         {
@@ -4208,25 +4205,33 @@
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
             strInvokeArgs = strInvokeArgs.Left(dIndex);
         }
     }
+    else if ((dIndex = strScript.Find("HXSetFunctions(")) >= 0)
+    {
+        strInvokeName = "HXSetFunctions";
+        strInvokeArgs = strScript.Mid(dIndex +
strlen("HXSetFunctions(") + 1);
+        if ((dIndex = strInvokeArgs.Find(')')) > 0)
+        {
+            strInvokeArgs = strInvokeArgs.Left(dIndex);
+            if (pPlayer)
+            {
+                pPlayer->SetupEIFunctionList(strInvokeArgs);
+            }
+        }
+    }
 
     if (!strInvokeName.IsEmpty())
     {
         CHXString strInvokeXML;
         HX_RESULT hr = CHXXMLFlash::WriteInvokeXML(strInvokeName,
strInvokeArgs, strInvokeXML);
-        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && obj)
-        {
-            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*)
objw->m_npp->ndata;
-            if (pPlayer)
+        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && pPlayer)
             {
                 pPlayer->FlashCall(strInvokeXML);
             }
         }
-    }
 
     return true;
 }
 
 bool
@@ -4316,11 +4321,11 @@
 }
 
 void
 CFlashGuestPlayerNS::NPN_ReleaseVariantValue(NPVariant *variant)
 {
-    HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
+    //HXLOGL4(HXLOG_FPHR, "NPN_ReleaseVariantValue");
 
 #if defined(_MAC_UNIX)
     // MBO - Test
     // printf("NPN_ReleaseVariantValue vriant=%ld\n", variant);
 #endif    // _MAC_UNIX
@@ -5356,11 +5361,18 @@
         NPVariant npArgv[1];
         UINT32 argCount=1;
 
         STRINGN_TO_NPVARIANT( (const char*) strInvokeXML, strlen((const
char*)strInvokeXML), npArgv[0]);
 
+    if (EIFunctionExists(strInvokeXML))
+    {
         hr = Invoke("CallFunction", npArgv, argCount, &vresult);
+    }
+    else
+    {
+        hr = HXR_UNEXPECTED;
+    }
 
     if (SUCCEEDED(hr))
         {
             NPN_ReleaseVariantValue(&vresult);
         }
@@ -5403,5 +5415,54 @@
     // Get the current frame
     INT32 lCurFrame = 0;
     HX_RESULT retVal = Invoke("CurrentFrame", lCurFrame);
     return lCurFrame;
 }
+
+HXBOOL
+CFlashGuestPlayerNS::EIFunctionExists(const CHXString& strInvokeXML)
+{
+    // Check to see if the ExternalInterface function exists
+    HXBOOL bExists=TRUE; // Default to true, if we did not receive a
list via HXSetFunctions, or we cannot parse, assume passive check.
+
+    // Extract the invoke name, and make sure it exists on the flash side
+    if (m_EIFunctionList.GetCount() > 0)
+    {
+    CHXString strInvokeName, strInvokeArgs;
+
+    if (m_pXMLFlash == NULL)
+    {
+        m_pXMLFlash = new CHXXMLFlash(m_pContext);
+        HX_ADDREF(m_pXMLFlash);
+    }
+
+    // Parse the XML, get the invoke name
+    if (m_pXMLFlash)
+    {
+        if (SUCCEEDED(m_pXMLFlash->ParseInvokeXML(strInvokeXML,
strInvokeName, strInvokeArgs)) && !strInvokeName.IsEmpty())
+        {
+        if (!m_EIFunctionList.FindString(strInvokeName))
+        {
+                HXLOGL4(HXLOG_FPHR,
"CFlashGuestPlayerNS::EIFunctionExists FAILED for invoke name: %s",
(const char*) strInvokeName);
+            bExists = FALSE;
+        }
+        }
+    }
+    }
+
+    return bExists;
+}
+
+//
+// Create a list of known ExternalInterface functions, valid for
CallFunction, so we do not crash on the Mac
+//
+void
+CFlashGuestPlayerNS::SetupEIFunctionList(const CHXString& strInvokeArgs)
+{
+    if (!strInvokeArgs.IsEmpty())
+    {
+    HXStringUtil::Split(strInvokeArgs, HXFLASH_ARGUMENT_DELIMITER,
m_EIFunctionList);
+    }
+
+    HXLOGL4(HXLOG_FPHR, "CFlashGuestPlayerNS::SetupEIFunctionList:
Created function list, count=%ld", m_EIFunctionList.GetCount());
+}
+
Index: platform/win32/flash_guest_player_ax.cpp
===================================================================
RCS file:
/cvsroot/datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
,v
retrieving revision 1.21.2.29
diff -w -u -5 -r1.21.2.29 flash_guest_player_ax.cpp
--- platform/win32/flash_guest_player_ax.cpp    21 May 2008 12:32:41
-0000    1.21.2.29
+++ platform/win32/flash_guest_player_ax.cpp    28 May 2008 21:48:40 -0000
@@ -132,11 +132,10 @@
         , m_lpO(NULL)
         , m_lpInPlaceObjWindowless(NULL)
         , m_lpInPlaceObj(NULL)
         , m_lpViewObject(NULL)
         , m_pMutex(NULL)
-        , m_pXMLFlash(NULL)
         , m_dFrameRate(0.0)
         , m_bInPlaceActive(FALSE)
         , m_lFlashVersion(0)
         , m_bGotInvalidateRect(FALSE)
         , m_pOffscreenBuffer(NULL)
Index: pub/flash_guest_player.h
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player.h,v
retrieving revision 1.27.2.12
diff -w -u -5 -r1.27.2.12 flash_guest_player.h
--- pub/flash_guest_player.h    25 Apr 2008 22:54:26 -0000    1.27.2.12
+++ pub/flash_guest_player.h    28 May 2008 23:22:34 -0000
@@ -106,10 +106,11 @@
 
 // Forward declarations
 class CHXSimpleList;
 class CFlashSiteWatcher;
 class CFlashPassiveSiteWatcher;
+class CHXXMLFlash;
 struct IHXCommonClassFactory;
 struct IHXFileObject;
 //struct IHXRequest;
 
 #define SOURCE_URL_FLASH_CUSTOM_VAR        "sourceURL"
@@ -247,10 +248,11 @@
     IHXFileObject*    m_pFileObject;
     IHXFileObject*    m_pFLVFileObject;
     IHXSite*        m_pSite;
     HXxPoint        m_OffsetPoint;
     IHXScheduler*    m_pScheduler;
+    CHXXMLFlash*    m_pXMLFlash;
 
     IHXExternalInterfaceResponse* m_pExternalInterfaceResponse;
     IHXSiteWindowless* m_pRepresentingSite;
 
     HXBOOL m_bWindowlessPref;     // Specifies the pref for windowless
(true) or windowed (false)
Index: pub/flash_guest_player_ns.h
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player_ns.h,v
retrieving revision 1.14.2.15
diff -w -u -5 -r1.14.2.15 flash_guest_player_ns.h
--- pub/flash_guest_player_ns.h    10 May 2008 20:47:13 -0000    1.14.2.15
+++ pub/flash_guest_player_ns.h    28 May 2008 23:52:09 -0000
@@ -57,18 +57,18 @@
 #include "npupp.h"
 #include "hxwin.h"
 #include "hxstring.h"
 #include "hxsite2.h"
 #include "hxengin.h"
+#include "hxslist.h"
 
 #if defined (_MAC_UNIX)
 #include "platform/mac/macwindowinfo.h"
 #endif    // _MAC_UNIX
 
 // Forward declarations
 class CHXSimpleList;
-class CHXStringList;
 class CHXString;
 class DLLAccess;
 class  CHXGenericCallback;
 struct IHXCommonClassFactory;
 struct IHXMutex;
@@ -253,10 +253,12 @@
     HX_RESULT   ParseNativeMediaSize(IHXBuffer* pBuffer, REF(HXxSize)
rSize);
     void        OnFlashPlayerStateChange(const char* pszGuestState);
 
     UINT32  GetNumFrames(void);
     UINT32  GetCurrentFrame(void);
+    HXBOOL  EIFunctionExists(const CHXString& strInvokeXML);
+    void    SetupEIFunctionList(const CHXString& strInvokeArgs);
 
     enum
     {
         kStateReady,
         kStateFSMInitDonePending,
@@ -284,10 +286,11 @@
     double              m_dFrameRate;
     UINT32        m_ulPacingInterval;
     UINT32        m_ulReadPacingInterval;
     UINT32        m_ulFileOffsetPending;
     UINT32        m_ulFileOffsetRequested;
+    CHXStringList    m_EIFunctionList;
 
     static const char* const    m_pszFlashMimeType;
     static CHXStringList    m_StringIds;
     static CHXSimpleList    m_IntIds;
     static CHXString            m_pUserAgentStr;
Index: pub/platform/win32/flash_guest_player_ax.h
===================================================================
RCS file:
/cvsroot/datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax
.h,v
retrieving revision 1.10.2.13
diff -w -u -5 -r1.10.2.13 flash_guest_player_ax.h
--- pub/platform/win32/flash_guest_player_ax.h    16 May 2008 16:37:16
-0000    1.10.2.13
+++ pub/platform/win32/flash_guest_player_ax.h    28 May 2008 21:48:04 -
0000
@@ -75,11 +75,10 @@
 // Forward declarations
 class CFlashGuestPlayer;
 class CHXString;
 class CHXGenericCallback;
 struct IHXFileObject;
-class CHXXMLFlash;
 
 class CFlashGuestPlayerAX : public CFlashGuestPlayer
               , public ShockwaveFlashObjects::_IShockwaveFlashEvents
               , public IOleClientSite
               , public IOleInPlaceSiteWindowless
@@ -311,11 +310,10 @@
     HBITMAP        m_hOldBitmap;
     void*          m_pDIBits;
     UINT32         m_ulDIBitsSize;
     UINT32         m_ulDIBitsWidth;
     UINT32         m_ulDIBitsHeight;
-    CHXXMLFlash*   m_pXMLFlash;
     double         m_dFrameRate;
     HXBOOL         m_bInPlaceActive;
     INT32          m_lFlashVersion;
     HXBOOL         m_bGotInvalidateRect;
     HXBOOL         m_bOLEInitialized;
    

 
 
_______________________________________________
Datatype-dev mailing list
Datatype-dev@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
 
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080529/628b4e7a/attachment-0001.html
From cbailey at real.com  Thu May 29 14:09:50 2008
From: cbailey at real.com (Christina Bailey)
Date: Thu May 29 12:55:04 2008
Subject: [datatype-dev] CN: Add ExternalInterface check
	to	the	FlashGuestPlayerNS
In-Reply-To: <11A3D22F8FE64DDBA7C929EA14FAE713@DingDong>
References: <483E1719.3050103@real.com>	<1071D244292640C18F8AAFF3AB7F6584@DingDong>	<483EEB9B.2030605@real.com>		<483EF9C8.2080309@real.com>
	<11A3D22F8FE64DDBA7C929EA14FAE713@DingDong>
Message-ID: <483F1B9E.7000401@real.com>

Thanks, checked into HEAD and 310Atlas with the changes below. New diff 
appended.

--christina

Henry Ping wrote:
>
> "
>
> I suggest moving SendFlashMessage into IHXExternalInterface. This 
> would centralize creation of the invoke XML and allow EI functions 
> checks without XML parsing.
> "
>
>  
>
> Sounds good.
>
>  
>
> Henry
>
>  
>
> ------------------------------------------------------------------------
>
> *From:* Christina Bailey [mailto:cbailey@real.com]
> *Sent:* Thursday, May 29, 2008 11:45 AM
> *To:* ping@real.com
> *Cc:* liteplayer_dev@real.com; datatype-dev@helixcommunity.org
> *Subject:* Re: [datatype-dev] RE: Add ExternalInterface check to the 
> FlashGuestPlayerNS
>
>  
>
>
>
> Henry Ping wrote:
>
> FlashGuestPlayerAX doesn't need to call them. BUT, the functions can 
> still reside in the base class, specifically SetupEIFunctionList and 
> EIFunctionExists. This makes it easier for us to call them from 
> FlashGuestPlayerAX in the future.
>
> Okay.
>
>  
>
> In addition, it appears we parse XML each time EIFunctionExists is 
> called in order to retrieve the method name, we can avoid XML parsing 
> by calling EIFunctionExists prior to the assembly of XML since we know 
> the exact method name.
>
> This is necessary because most of the invoke calls come from 
> IHXExternalInterface::CallExternalFunction where the invoke name is 
> embedded in the XML. It's only the rare case that uses 
> CFlashGuestPlayer::SendFlashMessage. I suggest moving SendFlashMessage 
> into IHXExternalInterface. This would centralize creation of the 
> invoke XML and allow EI functions checks without XML parsing.
>
> --christina
>
>  
>
> Henry
>
>  
>
> ------------------------------------------------------------------------
>
> *From:* Christina Bailey [mailto:cbailey@real.com 
> ]
> *Sent:* Thursday, May 29, 2008 10:45 AM
> *To:* ping@real.com 
> *Cc:* liteplayer_dev@real.com ; 
> datatype-dev@helixcommunity.org 
> *Subject:* Re: [datatype-dev] RE: Add ExternalInterface check to the 
> FlashGuestPlayerNS
>
>  
>
> I didn't move the check to the base class because it's an extra step that
> is not necessary in FlashGuestPlayerAX. Now it's the same result for both
> versions, a log message saying that the function does not exist, instead
> of crashing on the Mac.
>
> --christina
>
> Henry Ping wrote:
>
> I'd move EI function check to the base class so that FlashGuestPlayerAX can
> leverage the same checking mechanism when external interface is working in
> Flash AX.
>  
> Rest looks good.
>  
> Thanks
> Henry
>  
>   
>> -----Original Message-----
>> From: Christina Bailey [mailto:cbailey@real.com]
>> Sent: Wednesday, May 28, 2008 7:38 PM
>> To: liteplayer_dev@real.com 
>> Cc: datatype-dev@helixcommunity.org 
>> Subject: CR: Add ExternalInterface check to the FlashGuestPlayerNS
>>  
>> Synopsis: Mac crashes on ExternalInterface functions that do not exist.
>>  
>> Overview: Add functionality to check for a list of supported
>> ExternalInterface functions.
>> If the SWF supports this feature it will send a "HXSetFunctions" message
>> with a list
>> of supported ExternalInterface functions.
>>  
>> Files:
>>  
>> datatype/flash/flashhost/flash_guest_player_ns.cpp
>> datatype/flash/flashhost/pub/flash_guest_player_ns.h
>>     - Add catch for HXSetFunctions command, parse args into a function
>> name list.
>>     - Before each ExternalInterface call, parse out the command from the
>> xml blob
>>     and check if the function is in the list, fail if the list exists
>> and it is not found.
>>     - Optimize dereference of the 'this' object in NPN_Evaluate.
>>  
>> datatype/flash/flashhost/flash_guest_player.cpp
>> datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp
>> datatype/flash/flashhost/pub/flash_guest_player.h
>> datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax.h
>>     - move common var to base class, m_pXMLFlash
>>  
>> Branches: HEAD and 310Atlas
>>  
>> Diff:
>>  
>>
Index: pub/hxguestplayer.h
===================================================================
RCS file: /cvsroot/datatype/common/basehost/pub/hxguestplayer.h,v
retrieving revision 1.9
diff -w -u -5 -r1.9 hxguestplayer.h
--- pub/hxguestplayer.h    6 Jul 2007 22:00:18 -0000    1.9
+++ pub/hxguestplayer.h    29 May 2008 19:54:12 -0000
@@ -459,10 +459,11 @@
     STDMETHOD_(ULONG32,Release) (THIS) PURE;
 
     // IHXExternalInterface methods
     // The pFunction value is expected to be in XML
     STDMETHOD(CallExternalFunction)     (THIS_ IHXBuffer* pFunction) PURE;
+    STDMETHOD(SendFlashMessage)         (THIS_ const char* 
pszInvokeName, const char* pszInvokeArgs) PURE;
 };
 
 /****************************************************************************
  *
  *  Interface:

Index: flash_guest_player.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player.cpp,v
retrieving revision 1.33.2.21
diff -w -u -5 -r1.33.2.21 flash_guest_player.cpp
--- flash_guest_player.cpp    14 May 2008 00:03:38 -0000    1.33.2.21
+++ flash_guest_player.cpp    29 May 2008 19:53:49 -0000
@@ -152,10 +152,11 @@
     , m_pFLVFileObject(NULL)
     , m_pSite(NULL)
     , m_pStats(NULL)
     , m_pRootSiteWatcher(NULL)
     , m_pRootPassiveSiteWatcher(NULL)
+    , m_pXMLFlash(NULL)
 {
     HXLOGL4(HXLOG_FPHR, "CON CFlashGuestPlayer this=%p", this);
     m_MediaSize.cx = dDefaultWindowWidth;
     m_MediaSize.cy = dDefaultWindowHeight;
     m_OffsetPoint.x = 0;
@@ -172,10 +173,12 @@
     HX_RELEASE(m_pExternalInterfaceResponse);
     HX_RELEASE(m_pRepresentingSite);
     HX_RELEASE(m_pCCF);
     HX_RELEASE(m_pContext);
     HX_RELEASE(m_pRequest);
+    HX_RELEASE(m_pXMLFlash);
+    m_EIFunctionList.RemoveAll();
 }
 
 STDMETHODIMP CFlashGuestPlayer::QueryInterface(REFIID riid, void** ppvObj)
 {
     QInterfaceList  qiList[] =
@@ -1244,29 +1247,26 @@
     HX_RELEASE(pFLVWrapperFileObject);
    
     return retVal;
 }
 
-HX_RESULT
-CFlashGuestPlayer::SendFlashMessage(const char* pCommand, const char* 
pArgs)
+// IHXExternalInterface::SendFlashMessage
+STDMETHODIMP
+CFlashGuestPlayer::SendFlashMessage(const char* pszInvokeName, const 
char* pszInvokeArgs)
 {
     HX_RESULT retVal = HXR_FAIL;
    
-    if (pCommand)
+    if (pszInvokeName)
     {
     // Create the invoke XML for ExternalInterface.call (CallFunction)
     CHXString strInvokeXML;
-    CHXString strCommand = pCommand;
+    CHXString strCommand = pszInvokeName;
     CHXString strArgs;
    
-    /*** MBO - Test
-    printf("CFlashGuestPlayer::SendFlashMessage %s %s\n", pCommand, 
pArgs);   
-    ***/
-   
-    if (pArgs)
+    if (pszInvokeArgs)
     {
-        strArgs = pArgs;
+        strArgs = pszInvokeArgs;
     }
 
     retVal = CHXXMLFlash::WriteInvokeXML(strCommand, strArgs, 
strInvokeXML);
 
     if (SUCCEEDED(retVal))
@@ -1312,10 +1312,11 @@
 }
 
 STDMETHODIMP
 CFlashGuestPlayer::SetPlayerPreference(const char* pszPrefName, UINT32 
ulPrefValue)
 {
+    HXLOGL4(HXLOG_FPHR, "CFlashGuestPlayer::SetPlayerPreference  %s = 
%ld", pszPrefName, ulPrefValue);
     HX_RESULT hr=HXR_OK;
 
     if (!strcmp(pszPrefName, HXGUEST_FLASH_PREF_WINDOWLESS))
     {
     m_bWindowless = m_bWindowlessPref = (ulPrefValue ? TRUE : FALSE);
@@ -1550,10 +1551,43 @@
 
     // Call the guest player's window size and position changed
     return WindowSizeOrPositionChanged(&cRect);
 }
 
+HXBOOL
+CFlashGuestPlayer::EIFunctionExists(const CHXString& strInvokeName)
+{
+    // Check to see if the ExternalInterface function exists
+    HXBOOL bExists=TRUE; // Default to true, if we did not receive a 
list via HXSetFunctions, or we cannot parse, assume passive check.
+
+    // Extract the invoke name, and make sure it exists on the flash side
+    if (m_EIFunctionList.GetCount() > 0)
+    {
+    if (!m_EIFunctionList.FindString(strInvokeName))
+    {
+            HXLOGL4(HXLOG_FPHR, "CFlashGuestPlayer::EIFunctionExists 
FAILED for invoke name: %s", (const char*) strInvokeName);
+        bExists = FALSE;
+    }
+    }
+
+    return bExists;
+}
+
+//
+// Create a list of known ExternalInterface functions, valid for 
CallFunction, so we do not crash on the Mac
+//
+void
+CFlashGuestPlayer::SetupEIFunctionList(const CHXString& strInvokeArgs)
+{
+    if (!strInvokeArgs.IsEmpty())
+    {
+    HXStringUtil::Split(strInvokeArgs, HXFLASH_ARGUMENT_DELIMITER, 
m_EIFunctionList);
+    }
+
+    HXLOGL4(HXLOG_FPHR, "CFlashGuestPlayer::SetupEIFunctionList: 
Created function list, count=%ld", m_EIFunctionList.GetCount());
+}
+
 #if defined(_WINDOWS)   
 HWND
 CFlashGuestPlayer::FindFlashWnd(HWND hParentWnd)
 {
     HWND hFlashWnd = NULL;
Index: flash_guest_player_ns.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player_ns.cpp,v
retrieving revision 1.27.2.38
diff -w -u -5 -r1.27.2.38 flash_guest_player_ns.cpp
--- flash_guest_player_ns.cpp    22 May 2008 05:14:00 -0000    1.27.2.38
+++ flash_guest_player_ns.cpp    29 May 2008 19:58:37 -0000
@@ -1509,10 +1509,11 @@
 
     HX_RELEASE(m_pOffscreenBuffer);
     HX_RELEASE(m_pMutex);
     HX_RELEASE(m_pSite);
     HX_RELEASE(m_pScheduler);
+    m_EIFunctionList.RemoveAll(); // Clear out the function list
 
         m_bTerminated = TRUE;
     }
    
     return HXR_OK;
@@ -3913,24 +3914,26 @@
     // From a helix 'VolumeSlider':
     //   try { __flash__toXML(HXSetVolume(49)) ; } catch (e) { 
""; }
 
     CHXString strInvokeName, strInvokeArgs;
     INT32 dIndex = -1;
+    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
+    CFlashGuestPlayerNS* pPlayer = NULL;
+
+    if (objw)
+    {
+     pPlayer = (CFlashGuestPlayerNS*) objw->m_npp->ndata;
+    }
 
     if (strstr(strScript, "HXGetExternalInterfaceStatus"))
     {
     HXLOGL4(HXLOG_FPHR, "HXExternalInteraceStatus message received. 
ExternalInterface.call is working.");
     // Send a message to Flash saying that we are able to receive 
ExternalInterface.call messages
-        if (obj)
-        {
-            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*) 
objw->m_npp->ndata;
             if (pPlayer)
             {
                 
pPlayer->SendFlashMessage("EISetExternalInterfaceStatus", "true");
             }
-        }
     return true;
     }
 
     // Remove the array brackets
     if (strScript.FindAndReplace("([", "(", FALSE))
@@ -3948,12 +3951,10 @@
     HXLOGL4(HXLOG_FPHR, "HXDebug: %s", (const char*)strInvokeArgs);
     return true;
     }
     if ((dIndex = strScript.Find("HXPosition(")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*) 
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex + strlen("HXPosition("));
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
@@ -3965,12 +3966,10 @@
    
     return true;
     }
     if ((dIndex = strScript.Find("HXMetaChanged(")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*) 
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex + strlen("HXMetaChanged("));
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
@@ -3982,12 +3981,10 @@
    
     return true;
     }
     if ((dIndex = strScript.Find("HXBufferingChanged(")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*) 
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex + 
strlen("HXBufferingChanged("));
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
@@ -3999,12 +3996,10 @@
    
     return true;
     }
     if ((dIndex = strScript.Find("HXStateChanged(\"")) >= 0)
     {
-    CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-        CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*) 
objw->m_npp->ndata;
     if (pPlayer)
     {
         strInvokeArgs = strScript.Mid(dIndex + 
strlen("HXStateChanged(\""));
         if ((dIndex = strInvokeArgs.Find('"')) > 0)
         {
@@ -4208,25 +4203,34 @@
         if ((dIndex = strInvokeArgs.Find(')')) > 0)
         {
             strInvokeArgs = strInvokeArgs.Left(dIndex);
         }
     }
+    else if ((dIndex = strScript.Find("HXSetFunctions(")) >= 0)
+    {
+        strInvokeName = "HXSetFunctions";
+        strInvokeArgs = strScript.Mid(dIndex + 
strlen("HXSetFunctions(") + 1);
+        if ((dIndex = strInvokeArgs.Find(')')) > 0)
+        {
+            strInvokeArgs = strInvokeArgs.Left(dIndex);
+            if (pPlayer)
+            {
+        strInvokeArgs.FindAndReplace("\"", "", TRUE); // Strip out the 
quotes.
+                pPlayer->SetupEIFunctionList(strInvokeArgs);
+            }
+        }
+    }
 
     if (!strInvokeName.IsEmpty())
     {
         CHXString strInvokeXML;
         HX_RESULT hr = CHXXMLFlash::WriteInvokeXML(strInvokeName, 
strInvokeArgs, strInvokeXML);
-        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && obj)
-        {
-            CNPObjectWrapper* objw = (CNPObjectWrapper*) obj;
-            CFlashGuestPlayerNS* pPlayer = (CFlashGuestPlayerNS*) 
objw->m_npp->ndata;
-            if (pPlayer)
+        if (SUCCEEDED(hr) && !strInvokeXML.IsEmpty() && pPlayer)
             {
                 pPlayer->FlashCall(strInvokeXML);
             }
         }
-    }
 
     return true;
 }
 
 bool
@@ -5403,5 +5407,25 @@
     // Get the current frame
     INT32 lCurFrame = 0;
     HX_RESULT retVal = Invoke("CurrentFrame", lCurFrame);
     return lCurFrame;
 }
+
+// IHXExternalInterface::SendFlashMessage
+STDMETHODIMP
+CFlashGuestPlayerNS::SendFlashMessage(const char* pszInvokeName, const 
char* pszInvokeArgs)
+{
+    HX_RESULT hr = HXR_OK;
+   
+    // Check if the function exists before we create the invoke xml, 
and call EI
+    if (m_bIsFLVSource || EIFunctionExists(pszInvokeName))
+    {
+    hr = CFlashGuestPlayer::SendFlashMessage(pszInvokeName, pszInvokeArgs);
+    }
+    else
+    {
+    hr = HXR_UNEXPECTED;
+    }
+
+    return hr;
+}
+
Index: platform/win32/flash_guest_player_ax.cpp
===================================================================
RCS file: 
/cvsroot/datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp,v
retrieving revision 1.21.2.29
diff -w -u -5 -r1.21.2.29 flash_guest_player_ax.cpp
--- platform/win32/flash_guest_player_ax.cpp    21 May 2008 12:32:41 
-0000    1.21.2.29
+++ platform/win32/flash_guest_player_ax.cpp    29 May 2008 19:53:50 -0000
@@ -132,11 +132,10 @@
         , m_lpO(NULL)
         , m_lpInPlaceObjWindowless(NULL)
         , m_lpInPlaceObj(NULL)
         , m_lpViewObject(NULL)
         , m_pMutex(NULL)
-        , m_pXMLFlash(NULL)
         , m_dFrameRate(0.0)
         , m_bInPlaceActive(FALSE)
         , m_lFlashVersion(0)
         , m_bGotInvalidateRect(FALSE)
         , m_pOffscreenBuffer(NULL)
Index: pub/flash_guest_player.h
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player.h,v
retrieving revision 1.27.2.12
diff -w -u -5 -r1.27.2.12 flash_guest_player.h
--- pub/flash_guest_player.h    25 Apr 2008 22:54:26 -0000    1.27.2.12
+++ pub/flash_guest_player.h    29 May 2008 19:53:50 -0000
@@ -59,10 +59,11 @@
 #include "hxstring.h"
 #include "hxsite2.h"
 #include "hxfiles.h"
 #include "hxmap.h"
 #include "hxengin.h"
+#include "hxslist.h"
 
 // Preference defines used by SetPlayerPreference calls
 #define HXGUEST_FLASH_PREF_WINDOWLESS "Windowless"
 // The NSPlugin-based Flash guest player always uses the
 // a fileobject to load the primary SWF into the player.
@@ -106,10 +107,11 @@
 
 // Forward declarations
 class CHXSimpleList;
 class CFlashSiteWatcher;
 class CFlashPassiveSiteWatcher;
+class CHXXMLFlash;
 struct IHXCommonClassFactory;
 struct IHXFileObject;
 //struct IHXRequest;
 
 #define SOURCE_URL_FLASH_CUSTOM_VAR        "sourceURL"
@@ -188,10 +190,11 @@
     STDMETHOD(HandleEvent)                      (THIS_ HXxEvent* 
pEvent) PURE;
     STDMETHOD_(HXBOOL,NeedsWindowedSites)       (THIS) PURE;
 
     // IHXExternalInterface methods
     STDMETHOD(CallExternalFunction)           (THIS_ IHXBuffer* 
pFunction) PURE;
+    STDMETHOD(SendFlashMessage)            (THIS_ const char* 
pszInvokeName, const char* pszInvokeArgs=NULL);
    
     // IHXFileMimeMapperResponse methods
     STDMETHOD(MimeTypeFound)               (THIS_ HX_RESULT status, 
const char* pMimeType);
    
     // IHXPassiveSiteWatcher2 methods
@@ -247,10 +250,11 @@
     IHXFileObject*    m_pFileObject;
     IHXFileObject*    m_pFLVFileObject;
     IHXSite*        m_pSite;
     HXxPoint        m_OffsetPoint;
     IHXScheduler*    m_pScheduler;
+    CHXXMLFlash*    m_pXMLFlash;
    
     IHXExternalInterfaceResponse* m_pExternalInterfaceResponse;
     IHXSiteWindowless* m_pRepresentingSite;
 
     HXBOOL m_bWindowlessPref;     // Specifies the pref for windowless 
(true) or windowed (false)
@@ -284,17 +288,19 @@
     HXBOOL    DetermineIfFLVSource(IHXRequest* pRequest,
                      IHXFileObject* pFileObject = NULL,
                      IHXValues* pStreamHeader = NULL);
     HX_RESULT    GetFLVWrapperFileObject(IHXFileObject* &pFileObject, 
UINT32& ulFileSize);
    
-    HX_RESULT    SendFlashMessage(const char* pCommand, const char* 
pArgs = NULL);
-
     HX_RESULT   _SetVolume(void);
 
     virtual UINT32  GetNumFrames(void) { return 0; }
     virtual UINT32  GetCurrentFrame(void) { return 0; }
 
+    HXBOOL          EIFunctionExists(const CHXString& strInvokeName);
+    void            SetupEIFunctionList(const CHXString& strInvokeArgs);
+    CHXStringList    m_EIFunctionList;
+
 #if defined(_WINDOWS)
     HWND                        m_hwndParent;
     static CHXMapPtrToPtr       zm_SubclassedWnds;
 
     HWND                        FindFlashWnd(HWND hParentWnd);
Index: pub/flash_guest_player_ns.h
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/pub/flash_guest_player_ns.h,v
retrieving revision 1.14.2.15
diff -w -u -5 -r1.14.2.15 flash_guest_player_ns.h
--- pub/flash_guest_player_ns.h    10 May 2008 20:47:13 -0000    1.14.2.15
+++ pub/flash_guest_player_ns.h    29 May 2008 19:53:50 -0000
@@ -119,10 +119,12 @@
     STDMETHOD(HandleEvent)              (THIS_ HXxEvent* pEvent);
     STDMETHOD_(HXBOOL,NeedsWindowedSites) (THIS);
 
     // IHXExternalInterface methods
     STDMETHOD(CallExternalFunction) (THIS_ IHXBuffer* pFunction);
+    STDMETHOD(SendFlashMessage)        (THIS_ const char* 
pszInvokeName, const char* pszInvokeArgs=NULL);
+
 
     // IHXFileResponse Methods                   ref:  hxfiles.h
     STDMETHOD(InitDone ) (THIS_ HX_RESULT status);
     STDMETHOD(SeekDone ) (THIS_ HX_RESULT status);
     STDMETHOD(ReadDone ) (THIS_ HX_RESULT status, IHXBuffer* pBuffer);
Index: pub/platform/win32/flash_guest_player_ax.h
===================================================================
RCS file: 
/cvsroot/datatype/flash/flashhost/pub/platform/win32/flash_guest_player_ax.h,v
retrieving revision 1.10.2.13
diff -w -u -5 -r1.10.2.13 flash_guest_player_ax.h
--- pub/platform/win32/flash_guest_player_ax.h    16 May 2008 16:37:16 
-0000    1.10.2.13
+++ pub/platform/win32/flash_guest_player_ax.h    29 May 2008 19:53:50 -0000
@@ -75,11 +75,10 @@
 // Forward declarations
 class CFlashGuestPlayer;
 class CHXString;
 class CHXGenericCallback;
 struct IHXFileObject;
-class CHXXMLFlash;
 
 class CFlashGuestPlayerAX : public CFlashGuestPlayer
               , public ShockwaveFlashObjects::_IShockwaveFlashEvents
               , public IOleClientSite
               , public IOleInPlaceSiteWindowless
@@ -311,11 +310,10 @@
     HBITMAP        m_hOldBitmap;
     void*          m_pDIBits;
     UINT32         m_ulDIBitsSize;
     UINT32         m_ulDIBitsWidth;
     UINT32         m_ulDIBitsHeight;
-    CHXXMLFlash*   m_pXMLFlash;
     double         m_dFrameRate;
     HXBOOL         m_bInPlaceActive;
     INT32          m_lFlashVersion;
     HXBOOL         m_bGotInvalidateRect;
     HXBOOL         m_bOLEInitialized;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080529/6d7b32cf/attachment-0001.html
From dyek at real.com  Thu May 29 14:31:39 2008
From: dyek at real.com (Daniel Yek)
Date: Thu May 29 13:18:52 2008
Subject: [datatype-dev] CR: Porting RealPlayer to Atlas Linux
In-Reply-To: <007401c8c178$ef635580$0701a8c0@sushant>
References: <007401c8c178$ef635580$0701a8c0@sushant>
Message-ID: <483F20BB.20001@real.com>

This is just a merge from HEAD. It looks good to me.

Eric might take a look at it.

-- 
Daniel Yek.



Sushant Garg wrote:
>
> *Synopsis:*
>
> Multiple changes for porting RealPlayer based on Atlas_310 Linux 
>
> *Overview:*
>
> Change the name of rmcomlib to rmcommonlib.
>
>  
>
> *Files Added:*
>
> None
>
>  
>
> *Files Modified:*
>
> /cvsroot/datatype/flash/renderer/Umakefil
>
>  
>
> *Image Size and Heap Use impact (Client -Only):
> *None.
>
>  
>
> *Platforms and Profiles Affected:*
>
> None
>
>  
>
> *Distribution Libraries Affected:*
> None
>
>  
>
> *Distribution library impact and planned action:
> *None
>
>  
>
> *Platforms and Profiles Build Verified:*
>
> BIF branch    -> realplay_gtk_atlas
>
> Target(s)      -> player_all
>
> Profile          -> helix-client-all-defines
>
> SYSTEM_ID -> linux-2.2-libc6-gcc32-i586
>
>  
>
> *Branch:*
> hxclient_3_1_0_atlas
>
>  
>
> *Files Attached:*
>
> diff_datatype.txt
>
>  
>
> Thanks & Regards
>
> Sushant Garg
>

From asingh at real.com  Fri May 30 07:13:37 2008
From: asingh at real.com (Anshuman Singh)
Date: Fri May 30 05:58:40 2008
Subject: [datatype-dev] CR: Changes in datatype/wm/fileformat to fix the
	issue with reverse playback of .wmv file
Message-ID: <00f301c8c25f$5c4eaa00$0b01a8c0@anshuman1>

Skipped content of type multipart/alternative-------------- next part --------------
Index: asf_file_format_file.cpp
===================================================================
RCS file: /cvsroot/datatype/wm/fileformat/asf_file_format_file.cpp,v
retrieving revision 1.10.2.2
diff -u -r1.10.2.2 asf_file_format_file.cpp
--- asf_file_format_file.cpp	11 Mar 2008 02:28:41 -0000	1.10.2.2
+++ asf_file_format_file.cpp	30 May 2008 13:45:55 -0000
@@ -941,11 +941,8 @@
             retVal = ProcessPacketBuffer(pBuffer);
             if (SUCCEEDED(retVal))
             {
-                // Reset the state back to ready
-                m_ulState = kStateReady;
-                // Do we have any packets to deliver?
-                if (AnyPacketsToDeliver())
-                {
+                    // Reset the state back to ready
+                    m_ulState = kStateReady;              
                     // Clear the flag saying we sent a packet
                     HXBOOL bPacketSent  = FALSE;
                     HXBOOL bCheckToRead = TRUE;
@@ -971,23 +968,39 @@
                         m_ulState = kStateReady;
                     }
                     while (bPacketSent && AnyStreamsPending());
-                }
-                else
-                {
-                    // We don't have any packets queued on any stream
-                    // Do any streams have pending requests?
-                    if (AnyStreamsPending())
+                    // Do we have any packets on any queue?
+                    if (bCheckToRead && !AnyPacketsToDeliver())
                     {
-                        // Set the state
-                        m_ulState = kStateGPReadDonePending;
-                        // Log info on the packet read
-                        HXLOGL4(HXLOG_ASFF, "\tCASFFileFormatFile::ReadDone() - reading ASF packet %I64u", m_ullPacketIndex);
-                        // Read another packet
-                        m_pFileObject->Read(m_pFilePropertiesObject->m_ulMaxDataPacketSize);
+                    		// Have we read all the packets in the data object?
+                    		if (m_ullPacketIndex >= m_pDataObject->m_ullTotalDataPackets)
+                    		{
+                    			// We have read all the packets in the data object,
+                    			// so we cannot read any more. Therefore, we
+                    			// should issue StreamDone()'s on all the streams
+                    			TerminateAllStreams();
+                    		}
+                    		else
+                    		{    
+                    			// Start filling the packet queues                                
+                    			// Set the state
+                    			m_ulState = kStateGPReadDonePending;
+                    			// Read a packet
+                    			HXLOGL4(HXLOG_ASFF, "\tCASFFileFormatFile::ReadDone() - reading ASF packet %I64u", m_ullPacketIndex);
+                                            			
+                    			// XXXMEH: ASF (up through the current spec) always has
+                    			// fixed size packets. I'm assuming that these packets are
+                    			// of reasonable size (not huge). If so, then it makes
+                    			// the implementation much simpler to read a packet at a time
+                    			// (this is what the WMF SDK does). Later, if we determine
+                    			// that we need to use less RAM, then we can change this.
+                    			// But there won't be a lot of difference - the only RAM
+                    			// savings would be that you wouldn't be reading the packet
+                    			// and payload headers along with the payload.
+                    			m_pFileObject->Read(m_pFilePropertiesObject->m_ulMaxDataPacketSize);
+                    		}
                     }
-                }
             }
-        }
+    }
         else
         {
             // Bad read
From asingh at adroit-inc.com  Fri May 30 07:13:07 2008
From: asingh at adroit-inc.com (Anshuman)
Date: Fri May 30 06:00:26 2008
Subject: [datatype-dev] RE: [Nokia-private-dev] Question for
	reverseplayback for WMV
References: <020901c8bff0$ea2b9480$0b01a8c0@anshuman1>
	
Message-ID: <00e701c8c25f$4df4a720$0b01a8c0@anshuman1>

Skipped content of type multipart/alternative-------------- next part --------------
Index: asf_file_format_file.cpp
===================================================================
RCS file: /cvsroot/datatype/wm/fileformat/asf_file_format_file.cpp,v
retrieving revision 1.10.2.2
diff -u -r1.10.2.2 asf_file_format_file.cpp
--- asf_file_format_file.cpp	11 Mar 2008 02:28:41 -0000	1.10.2.2
+++ asf_file_format_file.cpp	30 May 2008 13:45:55 -0000
@@ -941,11 +941,8 @@
             retVal = ProcessPacketBuffer(pBuffer);
             if (SUCCEEDED(retVal))
             {
-                // Reset the state back to ready
-                m_ulState = kStateReady;
-                // Do we have any packets to deliver?
-                if (AnyPacketsToDeliver())
-                {
+                    // Reset the state back to ready
+                    m_ulState = kStateReady;              
                     // Clear the flag saying we sent a packet
                     HXBOOL bPacketSent  = FALSE;
                     HXBOOL bCheckToRead = TRUE;
@@ -971,23 +968,39 @@
                         m_ulState = kStateReady;
                     }
                     while (bPacketSent && AnyStreamsPending());
-                }
-                else
-                {
-                    // We don't have any packets queued on any stream
-                    // Do any streams have pending requests?
-                    if (AnyStreamsPending())
+                    // Do we have any packets on any queue?
+                    if (bCheckToRead && !AnyPacketsToDeliver())
                     {
-                        // Set the state
-                        m_ulState = kStateGPReadDonePending;
-                        // Log info on the packet read
-                        HXLOGL4(HXLOG_ASFF, "\tCASFFileFormatFile::ReadDone() - reading ASF packet %I64u", m_ullPacketIndex);
-                        // Read another packet
-                        m_pFileObject->Read(m_pFilePropertiesObject->m_ulMaxDataPacketSize);
+                    		// Have we read all the packets in the data object?
+                    		if (m_ullPacketIndex >= m_pDataObject->m_ullTotalDataPackets)
+                    		{
+                    			// We have read all the packets in the data object,
+                    			// so we cannot read any more. Therefore, we
+                    			// should issue StreamDone()'s on all the streams
+                    			TerminateAllStreams();
+                    		}
+                    		else
+                    		{    
+                    			// Start filling the packet queues                                
+                    			// Set the state
+                    			m_ulState = kStateGPReadDonePending;
+                    			// Read a packet
+                    			HXLOGL4(HXLOG_ASFF, "\tCASFFileFormatFile::ReadDone() - reading ASF packet %I64u", m_ullPacketIndex);
+                                            			
+                    			// XXXMEH: ASF (up through the current spec) always has
+                    			// fixed size packets. I'm assuming that these packets are
+                    			// of reasonable size (not huge). If so, then it makes
+                    			// the implementation much simpler to read a packet at a time
+                    			// (this is what the WMF SDK does). Later, if we determine
+                    			// that we need to use less RAM, then we can change this.
+                    			// But there won't be a lot of difference - the only RAM
+                    			// savings would be that you wouldn't be reading the packet
+                    			// and payload headers along with the payload.
+                    			m_pFileObject->Read(m_pFilePropertiesObject->m_ulMaxDataPacketSize);
+                    		}
                     }
-                }
             }
-        }
+    }
         else
         {
             // Bad read
From ehyche at real.com  Fri May 30 08:10:13 2008
From: ehyche at real.com (Eric Hyche)
Date: Fri May 30 06:55:11 2008
Subject: [datatype-dev] CR: Changes in datatype/wm/fileformat to fix
	theissue with reverse playback of .wmv file
In-Reply-To: <00f301c8c25f$5c4eaa00$0b01a8c0@anshuman1>
References: <00f301c8c25f$5c4eaa00$0b01a8c0@anshuman1>
Message-ID: <005301c8c267$43b7acf0$db68a8c0@EHYCHED620>


Anshuman,

The diff is kind of hard to read. Can you attach
a copy of the altered .cpp file?

Eric

=============================================
Eric Hyche (ehyche@real.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: datatype-dev-bounces@helixcommunity.org 
> [mailto:datatype-dev-bounces@helixcommunity.org] On Behalf Of 
> Anshuman Singh
> Sent: Friday, May 30, 2008 10:14 AM
> To: datatype-dev
> Subject: [datatype-dev] CR: Changes in datatype/wm/fileformat 
> to fix theissue with reverse playback of .wmv file
> 
> Synopsis:
> This change fixes issue with reverse playback of  .wmv file.
>  
> Overview:
> This change allows reversal queue build up in Velocity Proxy 
> still avoiding re-entrance.
> 
>  
> Files Added:
> none
>  
> Files Modified:
> asf_file_format_file.cpp
> 
> Platforms and Profiles Affected:
> platform : win32-i386-vc7
> profile    : helix-client-all-defines
>  
> Distribution Libraries Affected:
> None
> 
> Distribution library impact and planned action:
> None
> 
> Platforms and Profiles Build Verified:
> 
> BIF branch   -> hxclient_3_1_0_atlas_restricted
> Target(s)      -> splay
> Profile          -> helix-client-all-defines
> System ID   -> win32-i386-vc7
>  
>  
> Files Attached:
>  
> Thanks & Regards
> Anshuman
> 


From ext-anuj.dhamija at nokia.com  Fri May 30 15:44:26 2008
From: ext-anuj.dhamija at nokia.com (ext-anuj.dhamija@nokia.com)
Date: Fri May 30 14:30:47 2008
Subject: [datatype-dev] CR: Helix goes in Infinite Loop during Long Video
	Streaming
Message-ID: <2198383E1141814486F0B881B3260CF502622FF1@daebe103.NOE.Nokia.com>

> 		"Nokia submits this code under the terms of a commercial
> contribution agreement with RealNetworks, and I am authorized to
> contribute this code under said agreement."
> 		 
> 		Modified by:  ext-anuj.dhamija@nokia.com
> 		 
> 		Reviewed by: 
> 		 
> 		Date: 05/29/2008
> 		 
> 		Project: SymbianMmf_rel
> 
> 		Synopsis: Helix goes in Infinite Loop during Long Video
> Streaming
> 
> 		Overview: 
> 		In H264PayloadFormat::ProducePackets method
> ReapmediaPacket method is called in a while loop. ReapmediaPacket
> retrieves packets from a queue and the while loop exits when
> IsAUComplete method returns false. IsAUComplete method uses packets
> retrieved by ReapMediaPacket to figure out if AU can be constructed
> from so far received NALU packets. However the return value from
> ReapmediaPacket is not checked. In case where ReapMediaPacket method
> returns an error (Out of memory error in this case), IsAUComplete()
> never returns false as it keeps waiting for ReapMediaPacket to fetch
> more packets whereas ReapMediaPacket keeps returning Error which is
> never checked. And this causes Infinite Loop.
> 
> 		Fix:
> 		Check return value from ReapmediaPacket for SUCCESS as
> one of the conditions in while loop.
> 
> 		Files modified & changes:
> 		src/datatype/mp4/payload/h264payld.cpp
> 
> 		Image Size and Heap Use impact: None
> 
> 		Module Release testing (STIF, Audio) : Passed
> 
> 		Test case(s) Added  : No
> 
> 		Memory leak check performed : Passed, No leaks found
> 		  
> 		Platforms and Profiles Build Verified:
> helix-client-s60-50-mmf-mdf-dsp
> 
> 		Platforms and Profiles Functionality verified: armv5
> 		  
> 		Branch: Head, 210CayS
> 
> 
> Index: h264pyld.cpp
> ===================================================================
> RCS file: /cvsroot/datatype/mp4/payload/h264pyld.cpp,v
> retrieving revision 1.4.2.4
> diff -u -w -r1.4.2.4 h264pyld.cpp
> --- h264pyld.cpp        16 May 2007 20:22:16 -0000      1.4.2.4
> +++ h264pyld.cpp        29 May 2008 23:00:40 -0000
> @@ -852,7 +852,7 @@
>          {
>              retVal = DeinterleavePackets();
> 
> -            while(IsAUComplete())
> +            while(SUCCEEDED(retVal) && IsAUComplete())
>              {
>                  retVal = ReapMediaPacket();
>              }
> 
> ______________________________________________ 
> 
> thnx & regds
> AD
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/datatype-dev/attachments/20080530/80c400ac/attachment.html
 

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.