Cannot decode issue in access_demux for VLC WinRT

This forum is about all development around libVLC.
JesseJiang
New Cone
New Cone
Posts: 2
Joined: 10 Apr 2014 11:18

Cannot decode issue in access_demux for VLC WinRT

Postby JesseJiang » 14 Apr 2014 04:13

Hi All,

I wrote a access_demux plug-in for VLC on WinRT platform. The plug-in is the same with libaccess_winrt_plugin which is built in Visual Studio.

I found it load and open successfully, but it cannot decode both video and audio packages. These packages come from our SDK, which works fine in our products.

Here is a parts of logs.

Code: Select all

avcodec decoder debug: CPU flags: 0x000053db avcodec decoder debug: direct rendering is disabled avcodec decoder debug: allowing 4 thread(s) for decoding avcodec decoder debug: avcodec codec (H264 - MPEG-4 AVC (part 10)) started avcodec decoder debug: using frame thread mode with 4 threads core decoder debug: using decoder module "avcodec" core decoder debug: looking for decoder module matching "any": 28 candidates avcodec decoder debug: CPU flags: 0x000053db avcodec decoder debug: avcodec codec (MPEG AAC Audio) started core decoder debug: using decoder module "avcodec" core demux meta debug: looking for meta reader module matching "any": 0 candidates core demux meta debug: no meta reader modules core input debug: `ppvod2://play.api.pptv.com/17150032?&type=winrt&platform=win8&vvid=60bd9b75-1558-4ae9-bfac-d3b8104019d3&content=need_drag&userLevel=1' successfully opened core input debug: Buffering 0% core input debug: Buffering 0% core input debug: Buffering 0% core input debug: Buffering 0% core input debug: Buffering 0% core input debug: Buffering 0% core input debug: Buffering 0% core input debug: Buffering 0% core input debug: Buffering 0% core input debug: Stream buffering done (416 ms in 4 ms) avcodec decoder warning: cannot decode one frame (6979 bytes) core input debug: Decoder wait done in 0 ms core generic debug: reusing audio output core audio output debug: output 'f32l' 44100 Hz Stereo frame=1 samples/8 bytes core volume debug: looking for audio volume module matching "any": 2 candidates “VLC_WINRT_PPBOX.exe”(Win32): load“D:\vlc\winrt\app\VLC_WINRT_PPBOX\bin\x86\Debug\AppX\plugins\audio_mixer\libfloat_mixer_plugin.dll”。 core volume debug: using audio volume module "float_mixer" core audio output debug: input 'f32l' 44100 Hz Stereo frame=1 samples/8 bytes core audio filter debug: looking for audio filter module matching "scaletempo": 13 candidates “VLC_WINRT_PPBOX.exe”(Win32): load“D:\vlc\winrt\app\VLC_WINRT_PPBOX\bin\x86\Debug\AppX\plugins\audio_filter\libscaletempo_plugin.dll”。 scaletempo audio filter debug: format: 44100 rate, 2 nch, 4 bps, fl32 scaletempo audio filter debug: params: 30 stride, 0.200 overlap, 14 search scaletempo audio filter debug: 1.000 scale, 1323.000 stride_in, 1323 stride_out, 1059 standing, 264 overlap, 617 search, 2204 queue, fl32 mode core audio filter debug: using audio filter module "scaletempo" core audio output debug: conversion: 'f32l'->'f32l' 44100 Hz->44100 Hz Stereo->Stereo core audio output debug: conversion pipeline complete core audio output debug: conversion: 'f32l'->'f32l' 44100 Hz->44100 Hz Stereo->Stereo core audio output debug: conversion pipeline complete core audio resampler debug: looking for audio resampler module matching "any": 2 candidates “VLC_WINRT_PPBOX.exe”(Win32): load“D:\vlc\winrt\app\VLC_WINRT_PPBOX\bin\x86\Debug\AppX\plugins\audio_filter\libugly_resampler_plugin.dll”。 core audio resampler debug: using audio resampler module "ugly_resampler" core decoder debug: End of audio preroll avcodec decoder warning: cannot decode one frame (4914 bytes) avcodec decoder warning: cannot decode one frame (3751 bytes) avcodec decoder warning: cannot decode one frame (3740 bytes) avcodec decoder warning: cannot decode one frame (2796 bytes) 线程 0x312c 已退出,返回值为 0 (0x0)。 avcodec decoder warning: cannot decode one frame (7139 bytes) avcodec decoder warning: cannot decode one frame (6304 bytes) avcodec decoder warning: cannot decode one frame (3969 bytes) avcodec decoder warning: cannot decode one frame (3710 bytes)
And here is a part of our plug-in codes.

Code: Select all

static int DemuxInit(demux_t *p_demux) { demux_sys_t *p_sys = p_demux->p_sys; /* init context */ p_sys->i_time = -1; p_sys->i_length = 0; p_sys->i_bitrate = 0; for (int i = 0; i < 128; i++) { p_sys->track[i] = NULL; } p_sys->i_length = (mtime_t)PPBOX_GetDuration() * 1000; p_sys->b_seek = p_sys->i_length > 0; p_sys->i_track = PPBOX_GetStreamCount(); if (p_sys->i_track <= 0) { Debug(L"PPBOX plugin discarded (cannot find any stream!)"); return VLC_EGENERIC; } Debug(L"found %d streams", p_sys->i_track); for (unsigned i_stream = 0; i_stream < p_sys->i_track; i_stream++) { ppbox_track_t *tk; tk = p_sys->track[i_stream] = (ppbox_track_t *)malloc(sizeof(ppbox_track_t)); memset(tk, 0, sizeof(ppbox_track_t)); tk->i_time = -1; tk->p_es = NULL; PPBOX_StreamInfoEx * p_si = (PPBOX_StreamInfoEx *)malloc(sizeof(PPBOX_StreamInfoEx)); PPBOX_GetStreamInfoEx(i_stream, p_si); tk->p_si = p_si; es_format_t fmt; if (p_si->type == PPBOX_StreamTypeEnum::ppbox_audio) { es_format_Init(&fmt, AUDIO_ES, 0); if (p_si->sub_type == PPBOX_StreamSubTypeEnum::ppbox_audio_aac) { fmt.i_codec = VLC_FOURCC('m', 'p', '4', 'a'); } if (p_si->sub_type == PPBOX_StreamSubTypeEnum::ppbox_audio_mp3) { fmt.i_codec = VLC_FOURCC('.','m', 'p', '3'); } if (p_si->sub_type == PPBOX_StreamSubTypeEnum::ppbox_audio_wma) { fmt.i_codec = VLC_FOURCC('w', 'm', 'a', '2'); } fmt.audio.i_channels = p_si->audio_format.channel_count; fmt.audio.i_rate = p_si->audio_format.sample_rate; fmt.audio.i_bitspersample = p_si->audio_format.sample_size; fmt.i_extra = p_si->format_size; fmt.p_extra = malloc(fmt.i_extra); memcpy(fmt.p_extra, p_si->format_buffer, fmt.i_extra); Debug(L"added new audio stream(codec:0x%x,ID:%d)", fmt.i_codec, i_stream); } else if (p_si->type == PPBOX_StreamTypeEnum::ppbox_video) { es_format_Init(&fmt, VIDEO_ES, 0); if (p_si->sub_type == PPBOX_StreamSubTypeEnum::ppbox_video_avc) { fmt.i_codec = VLC_FOURCC('H', '2', '6', '4'); } fmt.video.i_width = p_si->video_format.width; fmt.video.i_height = p_si->video_format.height; fmt.video.i_frame_rate = 10000000; fmt.video.i_frame_rate_base = 1; fmt.i_extra = p_si->format_size; fmt.p_extra = malloc(fmt.i_extra); memcpy(fmt.p_extra, p_si->format_buffer, fmt.i_extra); Debug(L"added new video stream(ID:%d)", i_stream); } else { es_format_Init(&fmt, UNKNOWN_ES, 0); } tk->i_cat = fmt.i_cat; if (fmt.i_cat != UNKNOWN_ES) { tk->p_es = es_out_Add(p_demux->out, &fmt); } else { Debug(L"ignoring unknown stream(ID:%d)", i_stream); } //es_format_Clean(&fmt); } return VLC_SUCCESS; } static mtime_t GetMoviePTS(demux_sys_t *p_sys) { mtime_t i_time = -1; int i; for (i = 0; i < 128; i++) { ppbox_track_t *tk = p_sys->track[i]; if (tk && tk->p_es && tk->i_time > 0) { if (i_time < 0) i_time = tk->i_time; else i_time = __MIN(i_time, tk->i_time); } } return i_time; } static int Demux(demux_t *p_demux) { demux_sys_t *p_sys = p_demux->p_sys; for (;;) { PP_int32 ret; if (!vlc_object_alive(p_demux)) return -1; PPBOX_SampleEx sample; ret = PPBOX_ReadSampleEx(&sample); /* Read and demux a packet */ if (ret == ppbox_success) { //msg_Dbg( p_demux, "PPBOX_ReadSample itrack: %lu, time: %llu", // sample.itrack, sample.time); if (p_sys->i_time < 0) es_out_Control(p_demux->out, ES_OUT_SET_PCR, sample.decode_time + 1); ppbox_track_t * tk = p_sys->track[sample.stream_index]; block_t * p_block = block_Alloc(sample.buffer_length); p_block->i_pts = sample.decode_time + sample.composite_time_delta; p_block->i_dts = sample.decode_time; memcpy(p_block->p_buffer, sample.buffer, sample.buffer_length); tk->i_time = sample.decode_time; p_sys->i_time = GetMoviePTS(p_sys); //p_sys->i_time = sample.decode_time; es_out_Send(p_demux->out, tk->p_es, p_block); es_out_Control(p_demux->out, ES_OUT_SET_PCR, sample.decode_time + 1); return 1; } else if (ret == ppbox_would_block) { Debug(L"PPBOX_ReadSample ppbox_would_block"); //usleep(10000); if (!vlc_object_alive(p_demux)) return -1; } else if (ret == ppbox_stream_end) { Debug(L"PPBOX_ReadSample ppbox_stream_end"); return 0; } else { Debug(L"PPBOX_ReadSample %s", PPBOX_GetLastErrorMsg()); return -1; } } return 1; }
PS: I did not put the plug-in into VLC source codes, because I met another problem when build VLC for WinRT.

PS2: es_format_Clean this function throw error in DemuxInit function. If I use the source codes instead of this function, it works fine.

Could someone help me to solve this issue?
Thanks a lot.

Best regards,
Jesse

Rémi Denis-Courmont
Developer
Developer
Posts: 15272
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Cannot decode issue in access_demux for VLC WinRT

Postby Rémi Denis-Courmont » 14 Apr 2014 17:17

Your data blocks are not packetized the way libavcodec expects.

And the crash is caused by not linking to the same C run-time as libvlccore.dll.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

JesseJiang
New Cone
New Cone
Posts: 2
Joined: 10 Apr 2014 11:18

Re: Cannot decode issue in access_demux for VLC WinRT

Postby JesseJiang » 21 Apr 2014 05:05

Your data blocks are not packetized the way libavcodec expects.

And the crash is caused by not linking to the same C run-time as libvlccore.dll.

I linked the vlccore.lib in my plug-in, but didn't solve this problem.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 12 guests