MrLoick / zengl

Automatically exported from code.google.com/p/zengl
0 stars 0 forks source link

iOS - Random Crash with Theora_Video #84

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
With the latest version now I have random Access Violations here when loading 
the attached video.

              if ogg_page_serialno( @page ) <> TheoraData.StreamState.serialno Then continue;

Sometimes it works, sometimes it don't.

Original issue reported on code.google.com by wagenhei...@gmail.com on 15 Jan 2013 at 2:43

Attachments:

GoogleCodeExporter commented 8 years ago
>> With the latest version now
For iOS I changed nothing(only decoding new colorspaces was implemented). And I 
have no idea what is wrong here.

Original comment by dr.andru@gmail.com on 15 Jan 2013 at 1:14

GoogleCodeExporter commented 8 years ago
I think I solved the video problem...

I changed if ret = 0 Then break; to if ret <> 1 Then break;

ret := ogg_sync_pageout( @TheoraData.SyncState, @page );
if ret <> 1 Then break;

-----------
http://www.xiph.org/ogg/doc/libogg/ogg_sync_pageout.html

I checked here, when the crash occurs, ret value was -1

Original comment by wagenhei...@gmail.com on 18 Jan 2013 at 4:38

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago

Original comment by dr.andru@gmail.com on 18 Jan 2013 at 7:15

GoogleCodeExporter commented 8 years ago
I found same examples here :

http://svn.xiph.org/tags/theora/theora-1.1beta1/examples/player_example.c

Maybe this code helps?

    while(theora_p && !videobuf_ready){
      /* theora is one in, one out... */
      if(ogg_stream_packetout(&to,&op)>0){

        if(pp_inc){
          pp_level+=pp_inc;
          theora_control(&td,TH_DECCTL_SET_PPLEVEL,&pp_level,
           sizeof(pp_level));
          pp_inc=0;
        }
        /*HACK: This should be set after a seek or a gap, but we might not have
           a granulepos for the first packet (we only have them for the last
           packet on a page), so we just set it as often as we get it.
          To do this right, we should back-track from the last packet on the
           page and compute the correct granulepos for the first packet after
           a seek or a gap.*/
        if(op.granulepos>=0){
          theora_control(&td,TH_DECCTL_SET_GRANPOS,&op.granulepos,
           sizeof(op.granulepos));
        }
        if(theora_decode_packetin(&td,&op)==0){
          videobuf_granulepos=td.granulepos;
          videobuf_time=theora_granule_time(&td,videobuf_granulepos);
          frames++;

          /* is it already too old to be useful?  This is only actually
             useful cosmetically after a SIGSTOP.  Note that we have to
             decode the frame even if we don't show it (for now) due to
             keyframing.  Soon enough libtheora will be able to deal
             with non-keyframe seeks.  */

          if(videobuf_time>=get_time())
            videobuf_ready=1;
          else{
            /*If we are too slow, reduce the pp level.*/
            pp_inc=pp_level>0?-1:0;
            dropped++;
          }
        }

      }else
        break;
    }

Original comment by wagenhei...@gmail.com on 21 Jan 2013 at 4:10