On Fri, May 18, 2007 at 12:35:21AM +0200, Tomas Groth wrote:
> hi,
>
> > It seems our handlign of NetStream, completely driven by SWF frame
> > advancement,
> > is bogus. The current NetStream-SquareTest.swf file in our testsuite has
> > a FPS of 1 (1 frame per second). With Gnash this results in no more then one
> > video frame displayed each second, while the proprietary player keeps
> > rendering
> > new FLV frames as they arrive.
> >
> > Is this something we want to fix before the release ?
> >
> > See http://www.gnashdev.org/wiki/index.php/MovieAdvancement for related
> > issues.
> >
> Since this seems to only be a problem with low framerate SWFs, I don't think
> it's worth to fix before the release - unless the proposed fix on the wiki is
> very quick and easy...
The quick and easy patch is attached.
It only implements 'ticking' from the GTK gui, and with a very dumb rate
value (1/20 the FPS, arbitrarely - just as a proof of concept).
It uses the hearbeat for LoadVars, intervals and NetStream decoding.
I'm just not sure this is the way to go (more polling...)
--strk;
? COPTER_BUG_ISSUE.diff
? DIFF
? DIFF.drawingapi
? DIFF.get_text_value
? DIFF.shape
? DIFF2
? HEARTBEAT.DIFF
? NOTES_ABOUT_SCOPE_STACK
? P
? PATCH
? constru
? construct.patch
? files
? libltdl
? ming.m4.patch
? out.swf
? out.swf.frame0.pp
? patch
? t.as
? libbase/ChangeLog
? libbase/jpeg.cpp-original
? macros/ChangeLog
? server/as_value.cpp-EQUALS_V5
? server/edge.cpp
? server/edge.h
? server/asobj/ChangeLog
? server/vm/VariableRef.h
? testsuite/actionscript.all/MovieClip.as-new
? testsuite/actionscript.all/props.as
? testsuite/media/caption_video.flv
? testsuite/media/clouds.flv
? testsuite/media/sheep.flv
? testsuite/media/typing_long.flv
? testsuite/misc-ming.all/DIFF
? testsuite/samples/timeline
Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.91
diff -U 2 -r1.91 gtk.cpp
--- gui/gtk.cpp 14 May 2007 10:03:38 -0000 1.91
+++ gui/gtk.cpp 17 May 2007 15:41:28 -0000
@@ -310,4 +310,8 @@
g_timeout_add_full (G_PRIORITY_LOW, interval, (GSourceFunc)advance_movie,
this, NULL);
+
+ // interval/20 is an arbitrary value here.. just testing..
+ g_timeout_add_full (G_PRIORITY_LOW, interval/20, (GSourceFunc)tick_movie,
+ this, NULL);
}
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.78
diff -U 2 -r1.78 gui.cpp
--- gui/gui.cpp 15 May 2007 09:30:36 -0000 1.78
+++ gui/gui.cpp 17 May 2007 15:41:28 -0000
@@ -444,4 +444,20 @@
bool
+Gui::tick_movie(Gui* gui)
+{
+ assert(gui);
+
+ if ( gui->isStopped() ) return true;
+
+ gnash::movie_root* m = gnash::get_current_root();
+
+ if ( m->tick() ) {
+ gui->display(m);
+ }
+
+ return true;
+}
+
+bool
Gui::advance_movie(Gui* gui)
{
Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.50
diff -U 2 -r1.50 gui.h
--- gui/gui.h 13 Apr 2007 09:15:54 -0000 1.50
+++ gui/gui.h 17 May 2007 15:41:28 -0000
@@ -201,4 +201,8 @@
static bool advance_movie(Gui* gui);
+ /// Provide an heart beat to the application.
+ // (why static??)
+ static bool tick_movie(Gui* gui);
+
/// Put the application in "stop" mode
//
Index: server/character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.75
diff -U 2 -r1.75 character.h
--- server/character.h 12 May 2007 08:41:13 -0000 1.75
+++ server/character.h 17 May 2007 15:41:28 -0000
@@ -645,4 +645,10 @@
}
+ /// Receive an heart beat. Do whatever you need with it.
+ /// Pass it to child even if you don't do anything yourself
+ /// Return true if either you or any of your childs wants
+ /// a redisplay afterwards.
+ virtual bool tick() { return false; }
+
virtual void goto_frame(size_t /*target_frame*/) {}
Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.61
diff -U 2 -r1.61 movie_root.cpp
--- server/movie_root.cpp 14 May 2007 09:44:22 -0000 1.61
+++ server/movie_root.cpp 17 May 2007 15:41:29 -0000
@@ -612,4 +612,31 @@
}
+bool
+movie_root::tick()
+{
+ // GNASH_REPORT_FUNCTION;
+
+ // TODO: wrap this in a executeTimers() method
+ for (TimerList::iterator it=_intervalTimers.begin(),
+ itEnd=_intervalTimers.end();
+ it != itEnd;
+ ++it)
+ {
+ Timer& timer = *it;
+ if ( timer.expired() )
+ {
+ // log_msg("FIXME: Interval Timer Expired!\n");
+ //_movie->on_event_interval_timer();
+ timer();
+ }
+ }
+
+ //tu_random::next_random();
+
+ if ( _movie->tick() ) return true;
+
+ return false;
+}
+
void
Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.52
diff -U 2 -r1.52 movie_root.h
--- server/movie_root.h 1 May 2007 18:02:51 -0000 1.52
+++ server/movie_root.h 17 May 2007 15:41:29 -0000
@@ -322,4 +322,10 @@
void advance(float delta_time);
+ /// Provide an heart beat to the application.
+ //
+ /// @return true if wants to display afterwards
+ ///
+ bool tick();
+
/// 0-based!!
void goto_frame(size_t target_frame_number) {
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.271
diff -U 2 -r1.271 sprite_instance.cpp
--- server/sprite_instance.cpp 12 May 2007 06:50:37 -0000 1.271
+++ server/sprite_instance.cpp 17 May 2007 15:41:30 -0000
@@ -2398,4 +2398,32 @@
}
+struct TickDispatcher {
+
+ bool wantsRedisplay;
+
+ TickDispatcher()
+ :
+ wantsRedisplay(false)
+ {}
+
+ void operator() (character *ch)
+ {
+ if ( ch->tick() ) wantsRedisplay=true;
+ }
+};
+
+bool
+sprite_instance::tick()
+{
+ // Process any pending loadVariables request
+ processCompletedLoadVariableRequests();
+
+ //character::do_mouse_drag();
+
+ TickDispatcher disp;
+ m_display_list.visitAll(disp);
+ return disp.wantsRedisplay;
+}
+
void sprite_instance::advance_sprite(float delta_time)
{
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.110
diff -U 2 -r1.110 sprite_instance.h
--- server/sprite_instance.h 12 May 2007 06:50:37 -0000 1.110
+++ server/sprite_instance.h 17 May 2007 15:41:30 -0000
@@ -249,4 +249,8 @@
virtual void advance(float delta_time);
+
+ // See doc in character.h
+ bool tick();
+
//virtual void advance_root(float delta_time);
virtual void advance_sprite(float delta_time);
Index: server/video_stream_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/video_stream_instance.cpp,v
retrieving revision 1.23
diff -U 2 -r1.23 video_stream_instance.cpp
--- server/video_stream_instance.cpp 4 May 2007 12:16:07 -0000 1.23
+++ server/video_stream_instance.cpp 17 May 2007 15:41:30 -0000
@@ -129,4 +129,18 @@
}
+bool
+video_stream_instance::tick()
+{
+ if (!_ns) return false;
+
+ _ns->advance(); // should be ->tick probably
+ if (_ns->newFrameReady())
+ {
+ set_invalidated();
+ return true;
+ }
+ return false;
+}
+
void
video_stream_instance::add_invalidated_bounds(InvalidatedRanges& ranges,
Index: server/video_stream_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/video_stream_instance.h,v
retrieving revision 1.11
diff -U 2 -r1.11 video_stream_instance.h
--- server/video_stream_instance.h 3 May 2007 15:41:06 -0000 1.11
+++ server/video_stream_instance.h 17 May 2007 15:41:30 -0000
@@ -56,4 +56,7 @@
virtual void advance(float delta_time);
+
+ bool tick();
+
void display();
_______________________________________________
Gnash-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-dev