Firefox 25 crashing on HTML5 video

Andriy Gapon avg at FreeBSD.org
Wed Nov 27 08:51:08 UTC 2013


on 03/11/2013 11:04 Florian Smeets said the following:
> On 03/11/13 05:11, Bryon wrote:
>>
>> Problem:
>> When I visit vimeo.com, attempt to play any video, firefox crashes and I
>> get:
>>
>> Assertion failed: (wrote >= 0 && wrote == got), function
>> alsa_refill_stream, file
>> /usr/ports/www/firefox/work/mozilla-release/media/libcubeb/src/cubeb_alsa.c,
>> line 319.
>> Abort
>>
>>
> 
> I'm copying the UPDATING entry that describes how to fix the issue. This
> should fix your problem.
> 
> 20121010:
>   AFFECTS: users of www/firefox and www/seamonkey
>   AUTHOR: gecko at FreeBSD.org
> 
>   When using Firefox or SeaMonkey compiled with ALSA option ON it may
>   crash on assert in alsa_refill_stream as described in ports/170473.
>   To workaround disable ARIFF_OSS in audio/alsa-plugins or use PULSEAUDIO.
> 

>From time to time I have this assertion triggered as well as another one in
alsa_stream_get_position().  I do use alsa instead of pulseaudio and do I have
ARIFF_OSS disabled.

My impression is that those assertions are simply bogus and the checked
conditions should really be handled.
The following patch seems to help me:

--- media/libcubeb/src/cubeb_alsa.c.orig	2013-11-25 12:26:52.535841261 +0200
+++ media/libcubeb/src/cubeb_alsa.c	2013-11-25 21:37:26.341186969 +0200
@@ -252,7 +252,9 @@ alsa_refill_stream(cubeb_stream * stm)
   unsigned short revents;
   snd_pcm_sframes_t avail;
   long got;
+  long towrite;
   void * p;
+  void * write_p;
   int draining;

   draining = 0;
@@ -310,14 +312,20 @@ alsa_refill_stream(cubeb_stream * stm)
     stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_ERROR);
     return ERROR;
   }
-  if (got > 0) {
-    snd_pcm_sframes_t wrote = snd_pcm_writei(stm->pcm, p, got);
-    if (wrote == -EPIPE) {
+  towrite = got;
+  write_p = p;
+  while (towrite > 0) {
+    snd_pcm_sframes_t wrote = snd_pcm_writei(stm->pcm, p, towrite);
+    if (wrote < 0) {
       snd_pcm_recover(stm->pcm, wrote, 1);
-      wrote = snd_pcm_writei(stm->pcm, p, got);
+      continue;
     }
-    assert(wrote >= 0 && wrote == got);
+    if (towrite != wrote)
+      printf("writing %d wrote %d\n", towrite, wrote);
+    assert(wrote >= 0);
     stm->write_position += wrote;
+    write_p = (char*)write_p + wrote;
+    towrite -= wrote;
     gettimeofday(&stm->last_activity, NULL);
   }
   if (got != avail) {
@@ -996,7 +1004,10 @@ alsa_stream_get_position(cubeb_stream *
     return CUBEB_OK;
   }

-  assert(delay >= 0);
+  if (delay < 0) {
+    snd_pcm_forward(stm->pcm, -delay);
+    delay = 0;
+  }

   *position = 0;
   if (stm->write_position >= (snd_pcm_uframes_t) delay) {


-- 
Andriy Gapon


More information about the freebsd-gecko mailing list