| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "base/synchronization/waitable_event.h" | 5 #include "base/synchronization/waitable_event.h" | 
| 6 #include "base/test/test_timeouts.h" | 6 #include "base/test/test_timeouts.h" | 
| 7 #include "content/public/renderer/media_stream_audio_sink.h" | 7 #include "content/public/renderer/media_stream_audio_sink.h" | 
| 8 #include "content/renderer/media/media_stream_audio_source.h" | 8 #include "content/renderer/media/media_stream_audio_source.h" | 
| 9 #include "content/renderer/media/mock_media_constraint_factory.h" | 9 #include "content/renderer/media/mock_media_constraint_factory.h" | 
| 10 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" | 10 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" | 
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 59       audio_bus_->Zero(); | 59       audio_bus_->Zero(); | 
| 60       callback->Capture(audio_bus_.get(), 0, 0, false); | 60       callback->Capture(audio_bus_.get(), 0, 0, false); | 
| 61 | 61 | 
| 62       // Sleep 1ms to yield the resource for the main thread. | 62       // Sleep 1ms to yield the resource for the main thread. | 
| 63       base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1)); | 63       base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1)); | 
| 64     } | 64     } | 
| 65   } | 65   } | 
| 66 | 66 | 
| 67   void Start() { | 67   void Start() { | 
| 68     base::PlatformThread::CreateWithPriority( | 68     base::PlatformThread::CreateWithPriority( | 
| 69         0, this, &thread_, base::kThreadPriority_RealtimeAudio); | 69         0, this, &thread_, base::ThreadPriority::REALTIME_AUDIO); | 
| 70     CHECK(!thread_.is_null()); | 70     CHECK(!thread_.is_null()); | 
| 71   } | 71   } | 
| 72 | 72 | 
| 73   void Stop() { | 73   void Stop() { | 
| 74     closure_.Signal(); | 74     closure_.Signal(); | 
| 75     base::PlatformThread::Join(thread_); | 75     base::PlatformThread::Join(thread_); | 
| 76     thread_ = base::PlatformThreadHandle(); | 76     thread_ = base::PlatformThreadHandle(); | 
| 77   } | 77   } | 
| 78 | 78 | 
| 79  private: | 79  private: | 
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 507   // Stopping the new source will stop the second track. | 507   // Stopping the new source will stop the second track. | 
| 508   EXPECT_CALL(*source.get(), OnStop()).Times(1); | 508   EXPECT_CALL(*source.get(), OnStop()).Times(1); | 
| 509   capturer->Stop(); | 509   capturer->Stop(); | 
| 510 | 510 | 
| 511   // Even though this test don't use |capturer_source_| it will be stopped | 511   // Even though this test don't use |capturer_source_| it will be stopped | 
| 512   // during teardown of the test harness. | 512   // during teardown of the test harness. | 
| 513   EXPECT_CALL(*capturer_source_.get(), OnStop()); | 513   EXPECT_CALL(*capturer_source_.get(), OnStop()); | 
| 514 } | 514 } | 
| 515 | 515 | 
| 516 }  // namespace content | 516 }  // namespace content | 
| OLD | NEW | 
|---|