gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Sandro Santilli
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-265-geeac240
Date: Thu, 14 Apr 2011 21:07:18 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  eeac240daa742ac711122e43d1d5fe4fa8adf111 (commit)
      from  5abc9a801d853b82c33f1747dfaf6495befa0247 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=eeac240daa742ac711122e43d1d5fe4fa8adf111


commit eeac240daa742ac711122e43d1d5fe4fa8adf111
Author: Sandro Santilli <address@hidden>
Date:   Thu Apr 14 22:49:28 2011 +0200

    Have gprocessor fetch samples from the NullSoundHandler, to allow testing 
for sound events. Do not expect the relative failure in Sound.as anymore.

diff --git a/testsuite/actionscript.all/Sound.as 
b/testsuite/actionscript.all/Sound.as
index 9b2bc3c..9a62515 100644
--- a/testsuite/actionscript.all/Sound.as
+++ b/testsuite/actionscript.all/Sound.as
@@ -273,12 +273,7 @@ check_equals(typeof(s.getDuration()), "number");
 onSoundCompleteFailed = function()
 {
     clearInterval(intval);
-    // Gnash doesn't really fail this, but gprocessor
-    // does, not using a real sound handler ...
-    // so, you'll get an XPASS with gnash, and an XFAIL
-    // with gprocessor (which is the one currently
-    // running this test anyway).
-    xfail("no onSoundComplete arrived after 3 seconds");
+    fail("no onSoundComplete arrived after 3 seconds");
     endOfTest();
 };
 
diff --git a/utilities/processor.cpp b/utilities/processor.cpp
index 44eec5c..ad08cff 100644
--- a/utilities/processor.cpp
+++ b/utilities/processor.cpp
@@ -379,6 +379,45 @@ main(int argc, char *argv[])
     return 0;
 }
 
+struct SamplesFetcher {
+       sound::sound_handler& _sh;
+       unsigned int _samplesFetched;
+       
+       SamplesFetcher(sound::sound_handler& sh)
+        : _sh(sh), _samplesFetched(0)
+    {}
+
+    // Fetch as many samples as needed for `ms' milliseconds of playback
+    void fetch(unsigned int ms)
+    {
+        // We need to fetch as many samples
+        // as needed for a theoretical 44100hz loop.
+        // That is 44100 samples each second.
+        // 44100/1000 = x/ms
+        //  x = (44100*ms) / 1000
+        unsigned int nSamples = (441*ms) / 10;
+
+        // We double because sound_handler interface takes
+        // "mono" samples... (eh.. would be wise to change)
+        unsigned int toFetch = nSamples*2;
+
+        // Now substract what we fetched already
+        toFetch -= _samplesFetched;
+
+        // And update _samplesFetched..
+        _samplesFetched += toFetch;
+
+        //log_debug("SamplesFetcher::fetch(%d) fetching %d samples", ms, 
toFetch);
+
+        boost::int16_t samples[1024];
+        while (toFetch) {
+            unsigned int n = std::min(toFetch, 1024u);
+            _sh.fetchSamples(samples, n);
+            toFetch -= n;
+        }
+    }
+};
+
 // Load the named movie, make an instance, and play it, virtually.
 // I.e. run through and render all the frames, even though we are not
 // actually doing any output (our output handlers are disabled).
@@ -386,6 +425,11 @@ main(int argc, char *argv[])
 bool
 play_movie(const std::string& filename, const RunResources& runResources)
 {
+
+    sound::sound_handler* sh = runResources.soundHandler();
+    sh->reset();
+    SamplesFetcher sFetcher(*sh);
+
     boost::intrusive_ptr<gnash::movie_definition> md;
 
     quitrequested = false;
@@ -440,6 +484,7 @@ play_movie(const std::string& filename, const RunResources& 
runResources)
     // Use a clock advanced at every iteration to match exact FPS speed.
     ManualClock cl;
 
+
     // Scope to ensure that movie_root is destroyed before the library
     // is cleared; otherwise movie_root's MovieLoader can continue to
     // add movie_definitions to MovieLibrary, which then keeps them
@@ -476,6 +521,7 @@ play_movie(const std::string& filename, const RunResources& 
runResources)
             //printf("advancing clock by %lu\n", clockAdvance);
             cl.advance(clockAdvance);
             m.advance();
+            sFetcher.fetch(cl.elapsed());
 
             if ( quitrequested ) 
             {

-----------------------------------------------------------------------

Summary of changes:
 testsuite/actionscript.all/Sound.as |    7 +----
 utilities/processor.cpp             |   46 +++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]