Tuesday, February 24, 2009

WindowsMobile Microsoft video renderer crashes for Odd resolution width

 
 
WindowsMobile Microsoft video renderer crashes with the following error for RGB565 data with 179x99 video resolution:
 
Data Abort: Thread=8a66da00 Proc=88a8b8b0 'wmplayer'
AKY=00080001 PC=03fa0060(coredll.dll+0x00054060) RA=0305798c(quartz.dll+0x0007398c) BVA=29b9a01c FSR=00000007
Unhandled exception at 0x03fa0060 in wmplayer.exe: 0xC0000005: Access violation reading location 0x01b9a01c.

Unhandled exception at 0x03fa0060 in wmplayer.exe: 0xC0000005: Access violation reading location 0x01b9a01c.
 
Odd Resolution Clip: 179x99 resolution
DecideBufferSize () size as 179x99*2
SetActualDatalength() as 179x99 * 2

Solution :
--------------
if I modified the DecideBufferSize to 180x99*2 then it is working fine.
renderer is doing some alignment for odd resolution clip is it so ?

Before giving the output to the renderer from our decoder, we need to align width and height to multiple's 0f 4 or 2;
 
Alignment to 4 :
----------------
  if( nFrameWidth & 0x03)
  {
   nFrameWidth = nFrameWidth  - ( nFrameWidth & 0x03);
  }
Alignment to 2 :
-----------------
  if(nFrameWidth & 0x01)
  {
   nFrameWidth = nFrameWidth - 1;   
  }
 
Note: I also got the above error if I do the following:
i) allocating memory size as 179x99 in DecideBufferSize()  and set the Width and height as 180x100 .

No comments: