OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "media/cast/test/utility/standalone_cast_environment.h" | |
6 | |
7 #include "base/time/default_tick_clock.h" | |
8 | |
9 namespace media { | |
10 namespace cast { | |
11 | |
12 StandaloneCastEnvironment::StandaloneCastEnvironment( | |
13 const CastLoggingConfig& logging_config) | |
14 : CastEnvironment( | |
15 make_scoped_ptr<base::TickClock>(new base::DefaultTickClock()), | |
16 NULL, | |
hubbe
2014/03/07 22:48:50
That's not what I meant...
Why not just pass in th
miu
2014/03/08 02:20:49
The base class must be constructed before the deri
| |
17 NULL, | |
18 NULL, | |
19 NULL, | |
20 NULL, | |
21 NULL, | |
22 logging_config), | |
23 main_thread_("StandaloneCastEnvironment Main"), | |
24 audio_encode_thread_("StandaloneCastEnvironment Audio Encode"), | |
25 audio_decode_thread_("StandaloneCastEnvironment Audio Decode"), | |
26 video_encode_thread_("StandaloneCastEnvironment Video Encode"), | |
27 video_decode_thread_("StandaloneCastEnvironment Video Decode"), | |
28 transport_thread_("StandaloneCastEnvironment Transport") { | |
29 #define CREATE_TASK_RUNNER(name, options) \ | |
30 name##_thread_.StartWithOptions(options); \ | |
31 CastEnvironment::name##_thread_proxy_ = name##_thread_.message_loop_proxy() | |
32 | |
33 CREATE_TASK_RUNNER(main, | |
34 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | |
35 CREATE_TASK_RUNNER(audio_encode, base::Thread::Options()); | |
36 CREATE_TASK_RUNNER(audio_decode, base::Thread::Options()); | |
37 CREATE_TASK_RUNNER(video_encode, base::Thread::Options()); | |
38 CREATE_TASK_RUNNER(video_decode, base::Thread::Options()); | |
39 CREATE_TASK_RUNNER(transport, base::Thread::Options()); | |
40 | |
41 #undef CREATE_TASK_RUNNER | |
42 } | |
43 | |
44 StandaloneCastEnvironment::~StandaloneCastEnvironment() { | |
45 DCHECK(CalledOnValidThread()); | |
46 } | |
47 | |
48 void StandaloneCastEnvironment::Shutdown() { | |
49 DCHECK(CalledOnValidThread()); | |
50 main_thread_.Stop(); | |
51 audio_encode_thread_.Stop(); | |
52 audio_decode_thread_.Stop(); | |
53 video_encode_thread_.Stop(); | |
54 video_decode_thread_.Stop(); | |
55 transport_thread_.Stop(); | |
56 } | |
57 | |
58 } // namespace cast | |
59 } // namespace media | |
OLD | NEW |