Media Decode thread spins repeating GStreamerReader::DecodeAudioData() while MDSM waits in FlushDecoding()

RESOLVED WONTFIX

Status

()

P5
normal
RESOLVED WONTFIX
4 years ago
3 years ago

People

(Reporter: karlt, Unassigned)

Tracking

33 Branch
x86_64
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

4 years ago
Created attachment 8524210 [details]
stacks

+++ This bug was initially created as a clone of Bug #1034957 +++

MediaDecoderStateMachine::FlushDecoding():

  // Put a task in the decode queue to abort any decoding operations.
  // The reader is not supposed to put any tasks to deliver samples into
  // the queue after we call this (unless we request another sample from it).
  RefPtr<nsIRunnable> task;
  task = NS_NewRunnableMethod(mReader, &MediaDecoderReader::ResetDecode);
  mDecodeTaskQueue->Dispatch(task);

Also:

  // Resets all state related to decoding, emptying all buffers etc.
  // Cancels all pending Request*Data() request callbacks, and flushes the
  // decode pipeline. The decoder must not call any of the callbacks for
  // outstanding Request*Data() calls after this is called. Calls to
  // Request*Data() made after this should be processed as usual.
  // Normally this call preceedes a Seek() call, or shutdown.
  // The first samples of every stream produced after a ResetDecode() call
  // *must* be marked as "discontinuities". If it's not, seeking work won't
  // properly!
  virtual nsresult ResetDecode();

However, since http://hg.mozilla.org/mozilla-central/rev/eb9afaa0614d,
MediaDecoderReader::RequestAudioData() repeatedly dispatches to the decode
queue, meaning that RequestAudioData() calls before ResetDecode() can be
repeated after ResetDecode(), with different required behavior.

It looks like MediaDecoderReader::RequestAudioData() is expecting
DecodeAudioData() to return false in shutdown, but
GStreamerReader::DecodeAudioData() won't do that unless mReachedAudioEos and
GStreamerReader::ResetDecode() unsets mReachedAudioEos.

Doesn't reproduce easily.  I had a few tabs with videos, some of which I'd
watched to the end and others not.  Closed some of them and navigated to a new
page in others.
The code stack looks suspicious. MediaDecoderStateMachine::FlushDecoding should call MediaTaskQueue::FlushAndDispatch now instead of MediaTaskQueue::Flush
(Reporter)

Comment 2

4 years ago
(In reply to JW Wang [:jwwang] from comment #1)
> The code stack looks suspicious. MediaDecoderStateMachine::FlushDecoding
> should call MediaTaskQueue::FlushAndDispatch now instead of
> MediaTaskQueue::Flush

The stack is from a 33 release build.
Please take a look at Bug 1126359 which I just filed.
It's pretty annoying, reproduces constantly, an may be connected to this.
I'm trying to get an even better stack trace now.
Component: Audio/Video → Audio/Video: Playback
Priority: -- → P5
gstreamer is going in bug 1234092
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.