Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Side by Side Diff: media/cast/test/utility/standalone_cast_environment.cc

Issue 184813009: Cast Streaming API end-to-end browser_test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed hubbe's comments, and fixed threading/shutdown issues. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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(
hubbe 2014/03/06 19:54:43 Just use the 7-argument constructor, no need to sp
miu 2014/03/07 22:40:29 Done.
15 make_scoped_ptr<base::TickClock>(new base::DefaultTickClock()),
16 logging_config),
17 main_thread_("StandaloneCastEnvironment Main"),
18 audio_encode_thread_("StandaloneCastEnvironment Audio Encode"),
19 audio_decode_thread_("StandaloneCastEnvironment Audio Decode"),
20 video_encode_thread_("StandaloneCastEnvironment Video Encode"),
21 video_decode_thread_("StandaloneCastEnvironment Video Decode"),
22 transport_thread_("StandaloneCastEnvironment Transport") {
23 #define CREATE_TASK_RUNNER(name, options) \
24 name##_thread_.StartWithOptions(options); \
25 CastEnvironment::name##_thread_proxy_ = name##_thread_.message_loop_proxy()
26
27 CREATE_TASK_RUNNER(main,
28 base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
29 CREATE_TASK_RUNNER(audio_encode, base::Thread::Options());
30 CREATE_TASK_RUNNER(audio_decode, base::Thread::Options());
31 CREATE_TASK_RUNNER(video_encode, base::Thread::Options());
32 CREATE_TASK_RUNNER(video_decode, base::Thread::Options());
33 CREATE_TASK_RUNNER(transport, base::Thread::Options());
34
35 #undef CREATE_TASK_RUNNER
36 }
37
38 StandaloneCastEnvironment::~StandaloneCastEnvironment() {
39 DCHECK(CalledOnValidThread());
40 }
41
42 void StandaloneCastEnvironment::Shutdown() {
43 DCHECK(CalledOnValidThread());
44 main_thread_.Stop();
45 audio_encode_thread_.Stop();
46 audio_decode_thread_.Stop();
47 video_encode_thread_.Stop();
48 video_decode_thread_.Stop();
49 transport_thread_.Stop();
50 }
51
52 } // namespace cast
53 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698