aboutsummaryrefslogtreecommitdiff
path: root/www/firefox/files/patch-bug1664115
blob: 6672aa67459dca4bd623329bc1c5efbbf5fe3e94 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Revert bug 1647717 to workaround the issue of occational tab crashing when
using any cubeb backends other than pulse-rust to play media. The loss of
such change will be that users will not be able to do profiling on threads
created by libcubeb.

diff --git dom/media/AudioStream.cpp dom/media/AudioStream.cpp
index 1b62a26ab32b2..35c61f612bf72 100644
--- dom/media/AudioStream.cpp
+++ dom/media/AudioStream.cpp
@@ -25,7 +25,6 @@
 #endif
 #include "Tracing.h"
 #include "webaudio/blink/DenormalDisabler.h"
-#include "AudioThreadRegistry.h"
 
 // Use abort() instead of exception in SoundTouch.
 #define ST_NO_EXCEPTION_HANDLING 1
@@ -138,9 +137,7 @@
       mTimeStretcher(nullptr),
       mState(INITIALIZED),
       mDataSource(aSource),
-      mPrefillQuirk(false),
-      mAudioThreadId(0),
-      mSandboxed(CubebUtils::SandboxEnabled()) {
+      mPrefillQuirk(false) {
 #if defined(XP_WIN)
   if (XRE_IsContentProcess()) {
     audio::AudioNotificationReceiver::Register(this);
@@ -587,21 +584,7 @@
       aWriter.Available());
 }
 
-bool AudioStream::CheckThreadIdChanged() {
-#ifdef MOZ_GECKO_PROFILER
-  auto id = profiler_current_thread_id();
-  if (id != mAudioThreadId) {
-    mAudioThreadId = id;
-    return true;
-  }
-#endif
-  return false;
-}
-
 long AudioStream::DataCallback(void* aBuffer, long aFrames) {
-  if (!mSandboxed && CheckThreadIdChanged()) {
-    CubebUtils::GetAudioThreadRegistry()->Register(mAudioThreadId);
-  }
   WebCore::DenormalDisabler disabler;
 
   TRACE_AUDIO_CALLBACK_BUDGET(aFrames, mAudioClock.GetInputRate());
@@ -657,9 +640,6 @@
   mDumpFile.Write(static_cast<const AudioDataValue*>(aBuffer),
                   aFrames * mOutChannels);
 
-  if (!mSandboxed && writer.Available() != 0) {
-    CubebUtils::GetAudioThreadRegistry()->Unregister(mAudioThreadId);
-  }
   return aFrames - writer.Available();
 }
 
diff --git dom/media/AudioStream.h dom/media/AudioStream.h
index 933e4cb3bfdb5..5d2181e632af9 100644
--- dom/media/AudioStream.h
+++ dom/media/AudioStream.h
@@ -307,7 +307,6 @@ class AudioStream final
 
   template <typename Function, typename... Args>
   int InvokeCubeb(Function aFunction, Args&&... aArgs);
-  bool CheckThreadIdChanged();
 
   // The monitor is held to protect all access to member variables.
   Monitor mMonitor;
@@ -341,9 +340,6 @@ class AudioStream final
   // the default device is used. It is set
   // during the Init() in decoder thread.
   RefPtr<AudioDeviceInfo> mSinkInfo;
-  /* Contains the id of the audio thread, from profiler_get_thread_id. */
-  std::atomic<int> mAudioThreadId;
-  const bool mSandboxed = false;
 
   MozPromiseHolder<MediaSink::EndedPromise> mEndedPromise;
   Atomic<bool> mPlaybackComplete;