[Galaxy Tab 8.9 SGH-i957 Android Development] nrvate:
Cheers! Can you share one that doesn't work? Man, youtube is a picky little ----- ;)

Ah, interesting... So I was having great luck earlier.. On cellular data. Tried again, happened to be on WiFi... No go.. WTF I say!

Looked at logcat... The HD videos I tried were attempting to show 1080P content. That causes a failure of the decoder to render the stream.

On cellular, it doesn't play "high quality" streams.. It gets the lower quality stream instead unless you go into youtube settings and tell it to do HQ over mobile (a checkbox)

I'm guessing the real problem here is something in the video subsystem is telling youtube it's capable of rending higher quality than the hardware/software combo actually can, then blows up when youtube tries to actually do so.

Will have to look at the code and see if there's something that could be improved... at least I have an idea of what's going on! :)

E/OMX-VDEC-1080P( 170): Omx_vdec::Comp Init Returning failure, errno 19
E/OMXCodec( 170): failed to allocate node OMX.qcom.video.decoder.avc
E/OMXCodec( 170): failed to allocate node OMX.ittiam.video.decoder.avc
I/OMXCodec( 170): [OMX.google.h264.decoder] Non-Interlaced format detected
I/OMXCodec( 170): [OMX.google.h264.decoder] AVC profile = 100 (High), level = 31
I/OMXCodec( 170): [OMX.google.h264.decoder] Enable frame by frame mode
W/OMXCodec( 170): Failed to set frame packing format on component
I/OMXCodec( 170): [OMX.google.h264.decoder] video dimensions are 320 x 240
I/OMXCodec( 170): [OMX.google.h264.decoder] Crop rect is 320 x 240 @ (0, 0)
E/SoftAVC ( 170): Decoder failed: -2
E/OMXCodec( 170): [OMX.google.h264.decoder] ERROR(0x80001001, -1007)
I/SoftAAC2( 170): Reconfiguring decoder: 44100 Hz, 2 channels
E/MediaPlayer( 1719): error (1, -2147483648)
E/MediaPlayer( 1719): Error (1,-2147483648)
W/YouTube ( 1719): MediaPlayer error during playback [what=1, extra=-2147483648]

Guessing this is the misdefined variable in hardware/qcom/media/mm-video/vidc/vdec/Android.mk

ifeq ($(TARGET_BOARD_PLATFORM),msm8660)
libOmxVdec-def += -DMAX_RES_1080P
libOmxVdec-def += -DPROCESS_EXTRADATA_IN_OUTPUT_PORT
libOmxVdec-def += -DTEST_TS_FROM_SEI

However.. a little research seems to suggest the MSM8660 is actually capable of 1080P decode.

Update: "OMX-VDEC-1080P" doesn't indicate it's actually trying to decode 1080P video, just that it was built with the above-shown MAX_RES_1080P definition. If I can only find where error "19" is defined.. geez! /dig -- Erm, that's actually a generic "no such device" (ENODEV) error returned from attempting to open() the video decoder device.. i think. Yup. Sho enuf.

Probably more to do with the codec, I'd guess... More investigation! :) <~ doh, scratch that!

Should have looked at dmesg long ago, this is actually an error induced inside a kernel function, which has some debugging enabled all the time (probably because other folks are trying to figure this broken stuff out too!)

<6>[ 1060.613403] msm_vidc_dec: Inside vid_dec_open()
<3>[ 1061.644805] vidc_timer_fn() Timer expired
<3>[ 1061.644897] vidc_timer_handler() Timer expired
<3>[ 1061.644927] vid_dec_vcd_open_done(): ERROR. handle_container is NULL
<3>[ 1061.644958] callback for vcd_open returned error: 2147483661

In kernel/samsung/msm8660-common/drivers/video/msm/vidc/common/dec/vdec.c .. There's the ENODEV return and the text we see in dmesg.. hmm.. I'm done for the day ;)

rc = vcd_open(vid_dec_device_p->device_handle, true,
vid_dec_vcd_cb, client_ctx, flags);
if (!rc) {
wait_for_completion(&client_ctx->event);
if (client_ctx->event_status) {
ERR("callback for vcd_open returned error: %u",
client_ctx->event_status);
[U]rc = -ENODEV;[/U]
goto client_failure;
}

Oh fun! In laymans terms: It's trying to use MSM hardware video decoding.. and straight out fails. From what I can tell based on the code flow (after building a kernel with lots of debug logging messages added in relevant functions) the hardware simply times out. The code attempts to open the video decoder device via an Ion memory buffer, but the hardware doesn't respond and the function times out hence the "timer expired" messages.

Man, this hardware video decoding stuff is nasty! Not only is there a bunch of in-flux source code, but also on dynamically loaded firmware resident on the filesystem (/system/etc/firmware/vidc_1080p.fw) -- So I also need to see if the firmware needs an update to play nice with the newer vidc code. There's also other video-related firmware, such as the playready BS for netflix, which almost certainly isn't going to work, but I don't do netflix.. Anyone own an att note sgh-i717?! I'm curious if the current nightly builds have this working, or if this is all around broken (ie: not a problem with the device, but just a hole in CM10 right now).

Maybe it's a better use of effort to see about building CM10 with hardware video decode disabled -- then maybe youtube and other software would simply use software decoding? A video player that uses software decoding plays 720p video quite nicely, but then again... there should be significant battery savings using hardware to decode. again, more investigation...

Oh codec licensing!! DieDieDie! So bsplayer and other video things that work, have their own built-in video codecs. I found that /system/etc/media_codecs.xml defines the available codecs for each stream time, and there's a software video h264 decoder listed.. problem is, it's nowhere to be found -- the .so doesn't exist and it's nowhere in the CM tree. It appears at some point the codec from Ittiam was included, but apparently that's no longer. Looks like it was a proprietary file on ancient devices?

On to looking at other android source trees besides CM -- maybe I can pick something up from AOKP or CAF... /ponder