|   |   | 
| Line 8: | Line 8: | 
|  | ** Blake Wu |  | ** Blake Wu | 
|  | 
 |  | 
 | 
|  | ----
 |  | ===Good To Know=== | 
|  |   |  | We gather some common problems of media playback in the following pages: | 
|  | * Device Porting Issues
 |  | * [[TPESystem/Media/DevicePortingIssues|Device Porting Issues]] | 
|  | *# '''Problem: I cannot playback video files with large resolution.'''
 |  | ** We've encountered some similar issues while porting different devices. If you are a developer on a new platform and you encounter some media playback problems, please visit this page and check whether there is any solution already to your problems or not. | 
|  | *#* Solution: Make sure '''''ro.moz.omx.hw.max_width''''' & '''''ro.moz.omx.hw.max_height''''' values are suitable for video decoding on the target device.
 |  | 
|  | *#* Reference: {{bug|911113}}
 |  | 
|  | *#** Each time one video clip is going to be played, ''OMXCodecProxy'' is used to handle resource management of hardware video decoders.
 |  | 
|  | *#** After one video ''OMXCodec'' has been created successfully, ''OMXCodecProxy'' will double check the product ofthese two values with the actual video resolution.
 |  | 
|  | *#** If the video resolution is bigger than the product of these two values, ''OMXCodecProxy'' will destroy this newly created ''OMXCodec''. As a result, the playbackof this video clip will be abandoned in this case.
 |  | 
|  | *# '''Problem: I cannot generate thumbnails of my video files in thevideo application.'''
 |  | 
|  | *#* Solution: Check the color format enum definition, '''''HAL_PIXEL_FORMAT_XXX''''', to see if '''''GrallocImage::GetAsSurface()''''' can handle color format conversion correctly.
 |  | 
|  | *#* Reference: {{bug|891274}} and {{bug|931733}} |  | 
|  | *#** Currently ''HAL_PIXEL_FORMAT_XXX'' is hardcoded in GrallocImages.h.
 |  | 
|  | *#** The way how ''HAL_PIXEL_FORMAT_XXX'' should be ported in Firefox OS will be improved in the near future. |  | 
|  | *# '''Problem: I always encounter OMXCodec::waitForBufferFilled_l() timeout with ''"Timed out waiting for output buffers: 0/xxx"'' message while playing somespecific video files (usually mp4 files.)'''
 |  | 
|  | *#* Solution: Make sure all the buffers allocated from '''''ANativeWindows''''' can be used for video decoding.
 |  | 
|  | *#* Reference: {{attachment|744257}} on {{bug|864230}}
 |  | 
|  | *#** In AOSP, ANativeWindow is used as a buffer source and also as a render target. ANativeWindow needs to keep at least ''minUndequeuedBufs'' whilerendering video.Although some number of buffers have to be kept in ANativeWindow, every buffer in the buffer queue can takes turns to be filled, be rendered, and be emptied. So utilization of buffers in the queue is ok.
 |  | 
|  | *#** In Firefox OS, ANativeWindow is used as abuffer source, but not as arender target. If we keep ''minUndequeuedBufs'' buffers in ANativeWindow, these buffers will always be kept in ANativeWindow andnever have chances to be filled. As a result, it's very easy to encounterbuffer starvation during video decoding.
 |  | 
|  | *# '''Problem: I cannot resume playbackby clicking the play button after the video/audio has been paused.'''
 |  | 
|  | *#* Solution: Make sure to return '''''ERROR_UNSUPPORTED''''' in '''''OMXCodec::pause()''''' if underlying OMX IL component doesn't support pause and resume function.
 |  | 
|  | *#* Reference: {{attachment|8340486}} on {{bug|919590}}
 |  | 
|  | *#** This solution is not yet ''review+'',but this isthe suggested solutionbased on the discussion on bugzilla.
 |  |