Closed Bug 1276849 Opened 4 years ago Closed 4 years ago

Some AudioStream::OpenCubeb() code cleanup

Categories

(Core :: Audio/Video: Playback, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: jwwang, Assigned: jwwang)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Since OpenCubeb() is always called synchronously inside Init(), we won't continue using an object should Init() fail. Therefore OpenCubeb() can just return an error without setting mState to ERRORED.
Assignee: nobody → jwwang
Blocks: 1274160
https://reviewboard.mozilla.org/r/56820/#review53524

::: dom/media/AudioStream.cpp
(Diff revision 1)
>                    const dom::AudioChannel aAudioChannel)
>  {
>    auto startTime = TimeStamp::Now();
>    mIsFirst = CubebUtils::GetFirstStream();
>  
> -  if (!CubebUtils::GetCubebContext()) {

OpenCubeb() will call that.

::: dom/media/AudioStream.cpp
(Diff revision 1)
> -      NS_WARNING(nsPrintfCString("AudioStream::OpenCubeb() %p failed to init cubeb", this).get());
> +    NS_WARNING(nsPrintfCString("AudioStream::OpenCubeb() %p failed to init cubeb", this).get());
> -      return NS_ERROR_FAILURE;
> +    return NS_ERROR_FAILURE;
> -    }
> +  }
> -  }
> -
> -  mState = INITIALIZED;

mState is already INITIALIZED. No need to set it again.
Attachment #8758564 - Flags: review?(kinetik) → review+
Comment on attachment 8758564 [details]
MozReview Request: Bug 1276849 - some AudioStream::OpenCubeb code cleanup. r=kinetik.

https://reviewboard.mozilla.org/r/56820/#review53530
Thanks!
Pushed by jwwang@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/408312a8ef14
some AudioStream::OpenCubeb code cleanup. r=kinetik.
https://hg.mozilla.org/mozilla-central/rev/408312a8ef14
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.