- Add a SetPriority method to ThreadWrapper
- Remove 'priority' from CreateThread and related member variables from implementations
- Make supplying a name for threads, non-optional

BUG=
R=magjed@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/44729004

Cr-Commit-Position: refs/heads/master@{#8810}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8810 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest.cc b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest.cc
index 17be285..a600129 100644
--- a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest.cc
+++ b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest.cc
@@ -285,18 +285,11 @@
 
   AudioCodingModuleMtTest()
       : AudioCodingModuleTest(),
-        send_thread_(ThreadWrapper::CreateThread(CbSendThread,
-                                                 this,
-                                                 kRealtimePriority,
-                                                 "send")),
-        insert_packet_thread_(ThreadWrapper::CreateThread(CbInsertPacketThread,
-                                                          this,
-                                                          kRealtimePriority,
-                                                          "insert_packet")),
-        pull_audio_thread_(ThreadWrapper::CreateThread(CbPullAudioThread,
-                                                       this,
-                                                       kRealtimePriority,
-                                                       "pull_audio")),
+        send_thread_(ThreadWrapper::CreateThread(CbSendThread, this, "send")),
+        insert_packet_thread_(ThreadWrapper::CreateThread(
+            CbInsertPacketThread, this, "insert_packet")),
+        pull_audio_thread_(ThreadWrapper::CreateThread(
+            CbPullAudioThread, this, "pull_audio")),
         test_complete_(EventWrapper::Create()),
         send_count_(0),
         insert_packet_count_(0),
@@ -315,8 +308,11 @@
 
   void StartThreads() {
     ASSERT_TRUE(send_thread_->Start());
+    send_thread_->SetPriority(kRealtimePriority);
     ASSERT_TRUE(insert_packet_thread_->Start());
+    insert_packet_thread_->SetPriority(kRealtimePriority);
     ASSERT_TRUE(pull_audio_thread_->Start());
+    pull_audio_thread_->SetPriority(kRealtimePriority);
   }
 
   void TearDown() override {
diff --git a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc
index 829db2d..c083f28 100644
--- a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc
+++ b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc
@@ -462,18 +462,11 @@
 
   AudioCodingModuleMtTestOldApi()
       : AudioCodingModuleTestOldApi(),
-        send_thread_(ThreadWrapper::CreateThread(CbSendThread,
-                                                 this,
-                                                 kRealtimePriority,
-                                                 "send")),
-        insert_packet_thread_(ThreadWrapper::CreateThread(CbInsertPacketThread,
-                                                          this,
-                                                          kRealtimePriority,
-                                                          "insert_packet")),
-        pull_audio_thread_(ThreadWrapper::CreateThread(CbPullAudioThread,
-                                                       this,
-                                                       kRealtimePriority,
-                                                       "pull_audio")),
+        send_thread_(ThreadWrapper::CreateThread(CbSendThread, this, "send")),
+        insert_packet_thread_(ThreadWrapper::CreateThread(
+            CbInsertPacketThread, this, "insert_packet")),
+        pull_audio_thread_(ThreadWrapper::CreateThread(
+            CbPullAudioThread, this, "pull_audio")),
         test_complete_(EventWrapper::Create()),
         send_count_(0),
         insert_packet_count_(0),
@@ -492,8 +485,11 @@
 
   void StartThreads() {
     ASSERT_TRUE(send_thread_->Start());
+    send_thread_->SetPriority(kRealtimePriority);
     ASSERT_TRUE(insert_packet_thread_->Start());
+    insert_packet_thread_->SetPriority(kRealtimePriority);
     ASSERT_TRUE(pull_audio_thread_->Start());
+    pull_audio_thread_->SetPriority(kRealtimePriority);
   }
 
   void TearDown() {
diff --git a/webrtc/modules/audio_coding/main/test/APITest.cc b/webrtc/modules/audio_coding/main/test/APITest.cc
index 83b24a8..8cfe0e3 100644
--- a/webrtc/modules/audio_coding/main/test/APITest.cc
+++ b/webrtc/modules/audio_coding/main/test/APITest.cc
@@ -532,40 +532,36 @@
   // A
   // PUSH
   rtc::scoped_ptr<ThreadWrapper> myPushAudioThreadA =
-      ThreadWrapper::CreateThread(PushAudioThreadA, this, kNormalPriority,
-                                  "PushAudioThreadA");
+      ThreadWrapper::CreateThread(PushAudioThreadA, this, "PushAudioThreadA");
   CHECK_THREAD_NULLITY(myPushAudioThreadA, "Unable to start A::PUSH thread");
   // PULL
   rtc::scoped_ptr<ThreadWrapper> myPullAudioThreadA =
-      ThreadWrapper::CreateThread(PullAudioThreadA, this, kNormalPriority,
-                                  "PullAudioThreadA");
+      ThreadWrapper::CreateThread(PullAudioThreadA, this, "PullAudioThreadA");
   CHECK_THREAD_NULLITY(myPullAudioThreadA, "Unable to start A::PULL thread");
   // Process
   rtc::scoped_ptr<ThreadWrapper> myProcessThreadA = ThreadWrapper::CreateThread(
-      ProcessThreadA, this, kNormalPriority, "ProcessThreadA");
+      ProcessThreadA, this, "ProcessThreadA");
   CHECK_THREAD_NULLITY(myProcessThreadA, "Unable to start A::Process thread");
   // API
   rtc::scoped_ptr<ThreadWrapper> myAPIThreadA = ThreadWrapper::CreateThread(
-      APIThreadA, this, kNormalPriority, "APIThreadA");
+      APIThreadA, this, "APIThreadA");
   CHECK_THREAD_NULLITY(myAPIThreadA, "Unable to start A::API thread");
   // B
   // PUSH
   rtc::scoped_ptr<ThreadWrapper> myPushAudioThreadB =
-      ThreadWrapper::CreateThread(PushAudioThreadB, this, kNormalPriority,
-                                  "PushAudioThreadB");
+      ThreadWrapper::CreateThread(PushAudioThreadB, this, "PushAudioThreadB");
   CHECK_THREAD_NULLITY(myPushAudioThreadB, "Unable to start B::PUSH thread");
   // PULL
   rtc::scoped_ptr<ThreadWrapper> myPullAudioThreadB =
-      ThreadWrapper::CreateThread(PullAudioThreadB, this, kNormalPriority,
-                                  "PullAudioThreadB");
+      ThreadWrapper::CreateThread(PullAudioThreadB, this, "PullAudioThreadB");
   CHECK_THREAD_NULLITY(myPullAudioThreadB, "Unable to start B::PULL thread");
   // Process
   rtc::scoped_ptr<ThreadWrapper> myProcessThreadB = ThreadWrapper::CreateThread(
-      ProcessThreadB, this, kNormalPriority, "ProcessThreadB");
+      ProcessThreadB, this, "ProcessThreadB");
   CHECK_THREAD_NULLITY(myProcessThreadB, "Unable to start B::Process thread");
   // API
   rtc::scoped_ptr<ThreadWrapper> myAPIThreadB = ThreadWrapper::CreateThread(
-      APIThreadB, this, kNormalPriority, "APIThreadB");
+      APIThreadB, this, "APIThreadB");
   CHECK_THREAD_NULLITY(myAPIThreadB, "Unable to start B::API thread");
 
   //_apiEventA->StartTimer(true, 5000);
diff --git a/webrtc/modules/audio_device/android/low_latency_event_unittest.cc b/webrtc/modules/audio_device/android/low_latency_event_unittest.cc
index 359625b..2138f1f 100644
--- a/webrtc/modules/audio_device/android/low_latency_event_unittest.cc
+++ b/webrtc/modules/audio_device/android/low_latency_event_unittest.cc
@@ -22,10 +22,8 @@
 class LowLatencyEventTest : public testing::Test {
  public:
   LowLatencyEventTest()
-      : process_thread_(ThreadWrapper::CreateThread(CbThread,
-                                                    this,
-                                                    kRealtimePriority,
-                                                    "test_thread")),
+      : process_thread_(ThreadWrapper::CreateThread(
+            CbThread, this, "test_thread")),
         terminated_(false),
         iteration_count_(0),
         allowed_iterations_(0) {
@@ -46,6 +44,7 @@
  private:
   void Start() {
     EXPECT_TRUE(process_thread_->Start());
+    process_thread_->SetPriority(kRealtimePriority);
   }
   void Stop() {
     terminated_ = true;
diff --git a/webrtc/modules/audio_device/android/opensles_input.cc b/webrtc/modules/audio_device/android/opensles_input.cc
index f0e5347..12640e7 100644
--- a/webrtc/modules/audio_device/android/opensles_input.cc
+++ b/webrtc/modules/audio_device/android/opensles_input.cc
@@ -470,13 +470,14 @@
 }
 
 bool OpenSlesInput::StartCbThreads() {
-  rec_thread_ = ThreadWrapper::CreateThread(CbThread, this, kRealtimePriority,
+  rec_thread_ = ThreadWrapper::CreateThread(CbThread, this,
                                             "opensl_rec_thread");
   assert(rec_thread_.get());
   if (!rec_thread_->Start()) {
     assert(false);
     return false;
   }
+  rec_thread_->SetPriority(kRealtimePriority);
   OPENSL_RETURN_ON_FAILURE(
       (*sles_recorder_itf_)->SetRecordState(sles_recorder_itf_,
                                             SL_RECORDSTATE_RECORDING),
diff --git a/webrtc/modules/audio_device/android/opensles_output.cc b/webrtc/modules/audio_device/android/opensles_output.cc
index 350b5de..5782973 100644
--- a/webrtc/modules/audio_device/android/opensles_output.cc
+++ b/webrtc/modules/audio_device/android/opensles_output.cc
@@ -510,7 +510,7 @@
 }
 
 bool OpenSlesOutput::StartCbThreads() {
-  play_thread_ = ThreadWrapper::CreateThread(CbThread, this, kRealtimePriority,
+  play_thread_ = ThreadWrapper::CreateThread(CbThread, this,
                                              "opensl_play_thread");
   assert(play_thread_.get());
   OPENSL_RETURN_ON_FAILURE(
@@ -522,6 +522,7 @@
     assert(false);
     return false;
   }
+  play_thread_->SetPriority(kRealtimePriority);
   return true;
 }
 
diff --git a/webrtc/modules/audio_device/dummy/file_audio_device.cc b/webrtc/modules/audio_device/dummy/file_audio_device.cc
index cce4f5c..82569e8 100644
--- a/webrtc/modules/audio_device/dummy/file_audio_device.cc
+++ b/webrtc/modules/audio_device/dummy/file_audio_device.cc
@@ -205,12 +205,6 @@
   }
 
   // PLAYOUT
-  const char* threadName = "webrtc_audio_module_play_thread";
-  _ptrThreadPlay = ThreadWrapper::CreateThread(PlayThreadFunc,
-                                               this,
-                                               kRealtimePriority,
-                                               threadName);
-
   if (!_outputFilename.empty() && _outputFile.OpenFile(
         _outputFilename.c_str(), false, false, false) == -1) {
     printf("Failed to open playout file %s!\n", _outputFilename.c_str());
@@ -220,6 +214,9 @@
     return -1;
   }
 
+  const char* threadName = "webrtc_audio_module_play_thread";
+  _ptrThreadPlay = ThreadWrapper::CreateThread(PlayThreadFunc, this,
+                                               threadName);
   if (!_ptrThreadPlay->Start()) {
       _ptrThreadPlay.reset();
       _playing = false;
@@ -227,7 +224,7 @@
       _playoutBuffer = NULL;
       return -1;
   }
-
+  _ptrThreadPlay->SetPriority(kRealtimePriority);
   return 0;
 }
 
@@ -281,10 +278,7 @@
   }
 
   const char* threadName = "webrtc_audio_module_capture_thread";
-  _ptrThreadRec = ThreadWrapper::CreateThread(RecThreadFunc,
-                                              this,
-                                              kRealtimePriority,
-                                              threadName);
+  _ptrThreadRec = ThreadWrapper::CreateThread(RecThreadFunc, this, threadName);
 
   if (!_ptrThreadRec->Start()) {
       _ptrThreadRec.reset();
@@ -293,6 +287,7 @@
       _recordingBuffer = NULL;
       return -1;
   }
+  _ptrThreadRec->SetPriority(kRealtimePriority);
 
   return 0;
 }
diff --git a/webrtc/modules/audio_device/ios/audio_device_ios.mm b/webrtc/modules/audio_device/ios/audio_device_ios.mm
index 6b973ab..178ce3e 100644
--- a/webrtc/modules/audio_device/ios/audio_device_ios.mm
+++ b/webrtc/modules/audio_device/ios/audio_device_ios.mm
@@ -107,12 +107,12 @@
 
     // Create and start capture thread
     if (!_captureWorkerThread) {
-        _captureWorkerThread
-            = ThreadWrapper::CreateThread(RunCapture, this, kRealtimePriority,
-                                          "CaptureWorkerThread");
+        _captureWorkerThread = ThreadWrapper::CreateThread(
+            RunCapture, this, "CaptureWorkerThread");
         bool res = _captureWorkerThread->Start();
         WEBRTC_TRACE(kTraceDebug, kTraceAudioDevice,
                      _id, "CaptureWorkerThread started (res=%d)", res);
+        _captureWorkerThread->SetPriority(kRealtimePriority);
     } else {
         WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice,
                      _id, "Thread already created");
diff --git a/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc b/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc
index e590663..3516d77 100644
--- a/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc
+++ b/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc
@@ -1365,10 +1365,8 @@
     }
     // RECORDING
     const char* threadName = "webrtc_audio_module_capture_thread";
-    _ptrThreadRec = ThreadWrapper::CreateThread(RecThreadFunc,
-                                                this,
-                                                kRealtimePriority,
-                                                threadName);
+    _ptrThreadRec = ThreadWrapper::CreateThread(
+        RecThreadFunc, this, threadName);
 
     if (!_ptrThreadRec->Start())
     {
@@ -1380,6 +1378,7 @@
         _recordingBuffer = NULL;
         return -1;
     }
+    _ptrThreadRec->SetPriority(kRealtimePriority);
 
     errVal = LATE(snd_pcm_prepare)(_handleRecord);
     if (errVal < 0)
@@ -1520,9 +1519,7 @@
 
     // PLAYOUT
     const char* threadName = "webrtc_audio_module_play_thread";
-    _ptrThreadPlay =  ThreadWrapper::CreateThread(PlayThreadFunc,
-                                                  this,
-                                                  kRealtimePriority,
+    _ptrThreadPlay =  ThreadWrapper::CreateThread(PlayThreadFunc, this,
                                                   threadName);
     if (!_ptrThreadPlay->Start())
     {
@@ -1534,6 +1531,7 @@
         _playoutBuffer = NULL;
         return -1;
     }
+    _ptrThreadPlay->SetPriority(kRealtimePriority);
 
     int errVal = LATE(snd_pcm_prepare)(_handlePlayout);
     if (errVal < 0)
diff --git a/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc b/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc
index fd16e9e..9098211 100644
--- a/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc
+++ b/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc
@@ -208,7 +208,7 @@
     // RECORDING
     const char* threadName = "webrtc_audio_module_rec_thread";
     _ptrThreadRec = ThreadWrapper::CreateThread(RecThreadFunc, this,
-                                                kRealtimePriority, threadName);
+                                                threadName);
     if (!_ptrThreadRec->Start())
     {
         WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
@@ -218,10 +218,12 @@
         return -1;
     }
 
+    _ptrThreadRec->SetPriority(kRealtimePriority);
+
     // PLAYOUT
     threadName = "webrtc_audio_module_play_thread";
     _ptrThreadPlay = ThreadWrapper::CreateThread(PlayThreadFunc, this,
-                                                 kRealtimePriority, threadName);
+                                                 threadName);
     if (!_ptrThreadPlay->Start())
     {
         WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
@@ -230,6 +232,7 @@
         _ptrThreadPlay.reset();
         return -1;
     }
+    _ptrThreadPlay->SetPriority(kRealtimePriority);
 
     _initialized = true;
 
diff --git a/webrtc/modules/audio_device/mac/audio_device_mac.cc b/webrtc/modules/audio_device/mac/audio_device_mac.cc
index a717848..8c6f4c5 100644
--- a/webrtc/modules/audio_device/mac/audio_device_mac.cc
+++ b/webrtc/modules/audio_device/mac/audio_device_mac.cc
@@ -1755,10 +1755,10 @@
 
     DCHECK(!capture_worker_thread_.get());
     capture_worker_thread_ =
-        ThreadWrapper::CreateThread(RunCapture, this, kRealtimePriority,
-                                    "CaptureWorkerThread");
+        ThreadWrapper::CreateThread(RunCapture, this, "CaptureWorkerThread");
     DCHECK(capture_worker_thread_.get());
     capture_worker_thread_->Start();
+    capture_worker_thread_->SetPriority(kRealtimePriority);
 
     OSStatus err = noErr;
     if (_twoDevices)
@@ -1910,9 +1910,9 @@
 
     DCHECK(!render_worker_thread_.get());
     render_worker_thread_ =
-        ThreadWrapper::CreateThread(RunRender, this, kRealtimePriority,
-                                    "RenderWorkerThread");
+        ThreadWrapper::CreateThread(RunRender, this, "RenderWorkerThread");
     render_worker_thread_->Start();
+    render_worker_thread_->SetPriority(kRealtimePriority);
 
     if (_twoDevices || !_recording)
     {
diff --git a/webrtc/modules/audio_device/win/audio_device_wave_win.cc b/webrtc/modules/audio_device/win/audio_device_wave_win.cc
index c5f0a1a..bcea317 100644
--- a/webrtc/modules/audio_device/win/audio_device_wave_win.cc
+++ b/webrtc/modules/audio_device/win/audio_device_wave_win.cc
@@ -228,10 +228,7 @@
     }
 
     const char* threadName = "webrtc_audio_module_thread";
-    _ptrThread = ThreadWrapper::CreateThread(ThreadFunc,
-                                             this,
-                                             kRealtimePriority,
-                                             threadName);
+    _ptrThread = ThreadWrapper::CreateThread(ThreadFunc, this, threadName);
     if (!_ptrThread->Start())
     {
         WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
@@ -239,6 +236,7 @@
         _ptrThread.reset();
         return -1;
     }
+    _ptrThread->SetPriority(kRealtimePriority);
 
     const bool periodic(true);
     if (!_timeEvent.StartTimer(periodic, TIMER_PERIOD_MS))
diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.cc b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.cc
index a3f52f9..0ed3572 100644
--- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.cc
+++ b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.cc
@@ -77,10 +77,11 @@
     _eventPtr = EventWrapper::Create();
 
     _genThread = ThreadWrapper::CreateThread(SenderThreadFunction, this,
-                                             kRealtimePriority, threadName);
+                                             threadName);
     _running = true;
 
     _genThread->Start();
+    _genThread->SetPriority(kRealtimePriority);
 
     return 0;
 }
diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc
index 839f579..e55d363 100644
--- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc
+++ b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc
@@ -164,7 +164,7 @@
     }
 
     _procThread = ThreadWrapper::CreateThread(ProcThreadFunction, this,
-        kRealtimePriority, "TestSenderReceiver");
+                                              "TestSenderReceiver");
 
     _running = true;
 
@@ -178,6 +178,7 @@
     }
 
     _procThread->Start();
+    _procThread->SetPriority(kRealtimePriority);
 
     return 0;
 
diff --git a/webrtc/modules/utility/source/process_thread_impl.cc b/webrtc/modules/utility/source/process_thread_impl.cc
index 33a1c4f..5b50539 100644
--- a/webrtc/modules/utility/source/process_thread_impl.cc
+++ b/webrtc/modules/utility/source/process_thread_impl.cc
@@ -70,7 +70,7 @@
     m.module->ProcessThreadAttached(this);
 
   thread_ = ThreadWrapper::CreateThread(
-      &ProcessThreadImpl::Run, this, kNormalPriority, "ProcessThread");
+      &ProcessThreadImpl::Run, this, "ProcessThread");
   CHECK(thread_->Start());
 }
 
diff --git a/webrtc/modules/video_capture/linux/video_capture_linux.cc b/webrtc/modules/video_capture/linux/video_capture_linux.cc
index 41e0e84..23703aa 100644
--- a/webrtc/modules/video_capture/linux/video_capture_linux.cc
+++ b/webrtc/modules/video_capture/linux/video_capture_linux.cc
@@ -281,8 +281,9 @@
     if (!_captureThread)
     {
         _captureThread = ThreadWrapper::CreateThread(
-            VideoCaptureModuleV4L2::CaptureThread, this, kHighPriority);
+            VideoCaptureModuleV4L2::CaptureThread, this, "CaptureThread");
         _captureThread->Start();
+        _captureThread->SetPriority(kHighPriority);
     }
 
     // Needed to start UVC camera - from the uvcview application
diff --git a/webrtc/modules/video_render/android/video_render_android_impl.cc b/webrtc/modules/video_render/android/video_render_android_impl.cc
index 288d1fa..15b52d7 100644
--- a/webrtc/modules/video_render/android/video_render_android_impl.cc
+++ b/webrtc/modules/video_render/android/video_render_android_impl.cc
@@ -142,7 +142,6 @@
   }
 
   _javaRenderThread = ThreadWrapper::CreateThread(JavaRenderThreadFun, this,
-                                                  kRealtimePriority,
                                                   "AndroidRenderThread");
 
   if (_javaRenderThread->Start())
@@ -153,6 +152,7 @@
                  "%s: Could not start send thread", __FUNCTION__);
     return -1;
   }
+  _javaRenderThread->SetPriority(kRealtimePriority);
   return 0;
 }
 
diff --git a/webrtc/modules/video_render/incoming_video_stream.cc b/webrtc/modules/video_render/incoming_video_stream.cc
index 40966bd..6e9e8a4 100644
--- a/webrtc/modules/video_render/incoming_video_stream.cc
+++ b/webrtc/modules/video_render/incoming_video_stream.cc
@@ -179,8 +179,7 @@
   assert(incoming_render_thread_ == NULL);
 
   incoming_render_thread_ = ThreadWrapper::CreateThread(
-      IncomingVideoStreamThreadFun, this, kRealtimePriority,
-      "IncomingVideoStreamThread");
+      IncomingVideoStreamThreadFun, this, "IncomingVideoStreamThread");
   if (!incoming_render_thread_) {
     WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, module_id_,
                  "%s: No thread", __FUNCTION__);
@@ -195,6 +194,7 @@
                  "%s: Could not start send thread", __FUNCTION__);
     return -1;
   }
+  incoming_render_thread_->SetPriority(kRealtimePriority);
   deliver_buffer_event_.StartTimer(false, KEventStartupTimeMS);
 
   running_ = true;
diff --git a/webrtc/modules/video_render/ios/video_render_ios_gles20.mm b/webrtc/modules/video_render/ios/video_render_ios_gles20.mm
index 1d61a09..35382ea 100644
--- a/webrtc/modules/video_render/ios/video_render_ios_gles20.mm
+++ b/webrtc/modules/video_render/ios/video_render_ios_gles20.mm
@@ -33,7 +33,7 @@
       gles_context_([view context]),
       is_rendering_(true) {
   screen_update_thread_ = ThreadWrapper::CreateThread(
-      ScreenUpdateThreadProc, this, kRealtimePriority);
+      ScreenUpdateThreadProc, this, "ScreenUpdateGles20");
   screen_update_event_ = EventWrapper::Create();
   GetWindowRect(window_rect_);
 }
@@ -83,6 +83,7 @@
   }
 
   screen_update_thread_->Start();
+  screen_update_thread_->SetPriority(kRealtimePriority);
 
   // Start the event triggering the render process
   unsigned int monitor_freq = 60;
diff --git a/webrtc/modules/video_render/mac/video_render_agl.cc b/webrtc/modules/video_render/mac/video_render_agl.cc
index ae8b7c3..6cd4173 100644
--- a/webrtc/modules/video_render/mac/video_render_agl.cc
+++ b/webrtc/modules/video_render/mac/video_render_agl.cc
@@ -395,7 +395,8 @@
 {
     //WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s");
 
-    _screenUpdateThread = ThreadWrapper::CreateThread(ScreenUpdateThreadProc, this, kRealtimePriority);
+    _screenUpdateThread = ThreadWrapper::CreateThread(
+        ScreenUpdateThreadProc, this, "ScreenUpdate");
     _screenUpdateEvent = EventWrapper::Create();
 
     if(!IsValidWindowPtr(_windowRef))
@@ -511,7 +512,8 @@
     //WEBRTC_TRACE(kTraceDebug, "%s:%d Constructor", __FUNCTION__, __LINE__);
     //    _renderCritSec = CriticalSectionWrapper::CreateCriticalSection();
 
-    _screenUpdateThread = ThreadWrapper::CreateThread(ScreenUpdateThreadProc, this, kRealtimePriority);
+    _screenUpdateThread = ThreadWrapper::CreateThread(
+        ScreenUpdateThreadProc, this, "ScreenUpdateThread");
     _screenUpdateEvent = EventWrapper::Create();
 
     GetWindowRect(_windowRect);
@@ -737,6 +739,7 @@
         return -1;
     }
     _screenUpdateThread->Start();
+    _screenUpdateThread->SetPriority(kRealtimePriority);
 
     // Start the event triggering the render process
     unsigned int monitorFreq = 60;
@@ -1877,6 +1880,7 @@
             UnlockAGLCntx();
             return -1;
         }
+        _screenUpdateThread->SetPriority(kRealtimePriority);
         if(FALSE == _screenUpdateEvent->StartTimer(true, 1000/MONITOR_FREQ))
         {
             //WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, _id, "%s:%d Failed to start screenUpdateEvent", __FUNCTION__, __LINE__);
@@ -1887,7 +1891,8 @@
         return 0;
     }
 
-    _screenUpdateThread = ThreadWrapper::CreateThread(ScreenUpdateThreadProc, this, kRealtimePriority);
+    _screenUpdateThread = ThreadWrapper::CreateThread(ScreenUpdateThreadProc,
+        this, "ScreenUpdate");
     _screenUpdateEvent = EventWrapper::Create();
 
     if (!_screenUpdateThread)
@@ -1898,6 +1903,7 @@
     }
 
     _screenUpdateThread->Start();
+    _screenUpdateThread->SetPriority(kRealtimePriority);
     _screenUpdateEvent->StartTimer(true, 1000/MONITOR_FREQ);
 
     //WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s:%d Started screenUpdateThread", __FUNCTION__, __LINE__);
diff --git a/webrtc/modules/video_render/mac/video_render_nsopengl.mm b/webrtc/modules/video_render/mac/video_render_nsopengl.mm
index 569dd26..556eee0 100644
--- a/webrtc/modules/video_render/mac/video_render_nsopengl.mm
+++ b/webrtc/modules/video_render/mac/video_render_nsopengl.mm
@@ -380,7 +380,8 @@
 _windowRefSuperView(NULL),
 _windowRefSuperViewFrame(NSMakeRect(0,0,0,0))
 {
-    _screenUpdateThread = ThreadWrapper::CreateThread(ScreenUpdateThreadProc, this, kRealtimePriority);
+    _screenUpdateThread = ThreadWrapper::CreateThread(ScreenUpdateThreadProc,
+            this, "ScreenUpdateNSOpenGL");
     _screenUpdateEvent = EventWrapper::Create();
 }
 
@@ -437,6 +438,8 @@
             return -1;
         }
 
+        _screenUpdateThread->SetPriority(kRealtimePriority);
+
         UnlockAGLCntx();
         return 0;
     }
@@ -716,6 +719,7 @@
     }
 
     _screenUpdateThread->Start();
+    _screenUpdateThread->SetPriority(kRealtimePriority);
 
     // Start the event triggering the render process
     unsigned int monitorFreq = 60;
diff --git a/webrtc/modules/video_render/windows/video_render_direct3d9.cc b/webrtc/modules/video_render/windows/video_render_direct3d9.cc
index 99dd494..e9c08df 100644
--- a/webrtc/modules/video_render/windows/video_render_direct3d9.cc
+++ b/webrtc/modules/video_render/windows/video_render_direct3d9.cc
@@ -295,8 +295,8 @@
     _totalMemory(0),
     _availableMemory(0)
 {
-    _screenUpdateThread = ThreadWrapper::CreateThread(ScreenUpdateThreadProc,
-                                                      this, kRealtimePriority);
+    _screenUpdateThread = ThreadWrapper::CreateThread(
+        ScreenUpdateThreadProc, this, "ScreenUpdateThread");
     _screenUpdateEvent = EventWrapper::Create();
     SetRect(&_originalHwndRect, 0, 0, 0, 0);
 }
@@ -547,6 +547,7 @@
         return -1;
     }
     _screenUpdateThread->Start();
+    _screenUpdateThread->SetPriority(kRealtimePriority);
 
     // Start the event triggering the render process
     unsigned int monitorFreq = 60;