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

Side by Side Diff: media/cast/cast_environment.cc

Issue 109413004: Cast:Adding cast_transport_config and cleaning up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 11 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
« no previous file with comments | « media/cast/cast_environment.h ('k') | media/cast/cast_receiver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "media/cast/cast_environment.h" 5 #include "media/cast/cast_environment.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 using base::TaskRunner; 9 using base::TaskRunner;
10 10
11 namespace media { 11 namespace media {
12 namespace cast { 12 namespace cast {
13 13
14 CastEnvironment::CastEnvironment( 14 CastEnvironment::CastEnvironment(
15 base::TickClock* clock, 15 base::TickClock* clock,
16 scoped_refptr<TaskRunner> main_thread_proxy, 16 scoped_refptr<TaskRunner> main_thread_proxy,
17 scoped_refptr<TaskRunner> audio_encode_thread_proxy, 17 scoped_refptr<TaskRunner> audio_encode_thread_proxy,
18 scoped_refptr<TaskRunner> audio_decode_thread_proxy, 18 scoped_refptr<TaskRunner> audio_decode_thread_proxy,
19 scoped_refptr<TaskRunner> video_encode_thread_proxy, 19 scoped_refptr<TaskRunner> video_encode_thread_proxy,
20 scoped_refptr<TaskRunner> video_decode_thread_proxy, 20 scoped_refptr<TaskRunner> video_decode_thread_proxy,
21 scoped_refptr<TaskRunner> transport_thread_proxy,
21 const CastLoggingConfig& config) 22 const CastLoggingConfig& config)
22 : clock_(clock), 23 : clock_(clock),
23 main_thread_proxy_(main_thread_proxy), 24 main_thread_proxy_(main_thread_proxy),
24 audio_encode_thread_proxy_(audio_encode_thread_proxy), 25 audio_encode_thread_proxy_(audio_encode_thread_proxy),
25 audio_decode_thread_proxy_(audio_decode_thread_proxy), 26 audio_decode_thread_proxy_(audio_decode_thread_proxy),
26 video_encode_thread_proxy_(video_encode_thread_proxy), 27 video_encode_thread_proxy_(video_encode_thread_proxy),
27 video_decode_thread_proxy_(video_decode_thread_proxy), 28 video_decode_thread_proxy_(video_decode_thread_proxy),
29 transport_thread_proxy_(transport_thread_proxy),
28 logging_(new LoggingImpl(main_thread_proxy, config)) { 30 logging_(new LoggingImpl(main_thread_proxy, config)) {
29 DCHECK(main_thread_proxy) << "Main thread required"; 31 DCHECK(main_thread_proxy) << "Main thread required";
30 } 32 }
31 33
32 CastEnvironment::~CastEnvironment() {} 34 CastEnvironment::~CastEnvironment() {}
33 35
34 bool CastEnvironment::PostTask(ThreadId identifier, 36 bool CastEnvironment::PostTask(ThreadId identifier,
35 const tracked_objects::Location& from_here, 37 const tracked_objects::Location& from_here,
36 const base::Closure& task) { 38 const base::Closure& task) {
37 scoped_refptr<TaskRunner> task_runner = 39 scoped_refptr<TaskRunner> task_runner =
(...skipping 18 matching lines...) Expand all
56 case CastEnvironment::MAIN: 58 case CastEnvironment::MAIN:
57 return main_thread_proxy_; 59 return main_thread_proxy_;
58 case CastEnvironment::AUDIO_ENCODER: 60 case CastEnvironment::AUDIO_ENCODER:
59 return audio_encode_thread_proxy_; 61 return audio_encode_thread_proxy_;
60 case CastEnvironment::AUDIO_DECODER: 62 case CastEnvironment::AUDIO_DECODER:
61 return audio_decode_thread_proxy_; 63 return audio_decode_thread_proxy_;
62 case CastEnvironment::VIDEO_ENCODER: 64 case CastEnvironment::VIDEO_ENCODER:
63 return video_encode_thread_proxy_; 65 return video_encode_thread_proxy_;
64 case CastEnvironment::VIDEO_DECODER: 66 case CastEnvironment::VIDEO_DECODER:
65 return video_decode_thread_proxy_; 67 return video_decode_thread_proxy_;
68 case CastEnvironment::TRANSPORT:
69 return transport_thread_proxy_;
66 default: 70 default:
67 NOTREACHED() << "Invalid Thread identifier"; 71 NOTREACHED() << "Invalid Thread identifier";
68 return NULL; 72 return NULL;
69 } 73 }
70 } 74 }
71 75
72 bool CastEnvironment::CurrentlyOn(ThreadId identifier) { 76 bool CastEnvironment::CurrentlyOn(ThreadId identifier) {
73 switch (identifier) { 77 switch (identifier) {
74 case CastEnvironment::MAIN: 78 case CastEnvironment::MAIN:
75 return main_thread_proxy_->RunsTasksOnCurrentThread(); 79 return main_thread_proxy_->RunsTasksOnCurrentThread();
76 case CastEnvironment::AUDIO_ENCODER: 80 case CastEnvironment::AUDIO_ENCODER:
77 return audio_encode_thread_proxy_->RunsTasksOnCurrentThread(); 81 return audio_encode_thread_proxy_->RunsTasksOnCurrentThread();
78 case CastEnvironment::AUDIO_DECODER: 82 case CastEnvironment::AUDIO_DECODER:
79 return audio_decode_thread_proxy_->RunsTasksOnCurrentThread(); 83 return audio_decode_thread_proxy_->RunsTasksOnCurrentThread();
80 case CastEnvironment::VIDEO_ENCODER: 84 case CastEnvironment::VIDEO_ENCODER:
81 return video_encode_thread_proxy_->RunsTasksOnCurrentThread(); 85 return video_encode_thread_proxy_->RunsTasksOnCurrentThread();
82 case CastEnvironment::VIDEO_DECODER: 86 case CastEnvironment::VIDEO_DECODER:
83 return video_decode_thread_proxy_->RunsTasksOnCurrentThread(); 87 return video_decode_thread_proxy_->RunsTasksOnCurrentThread();
88 case CastEnvironment::TRANSPORT:
89 return transport_thread_proxy_->RunsTasksOnCurrentThread();
84 default: 90 default:
85 NOTREACHED() << "Invalid thread identifier"; 91 NOTREACHED() << "Invalid thread identifier";
86 return false; 92 return false;
87 } 93 }
88 } 94 }
89 95
90 base::TickClock* CastEnvironment::Clock() const { 96 base::TickClock* CastEnvironment::Clock() const {
91 return clock_; 97 return clock_;
92 } 98 }
93 99
94 LoggingImpl* CastEnvironment::Logging() { 100 LoggingImpl* CastEnvironment::Logging() {
95 DCHECK(CurrentlyOn(CastEnvironment::MAIN)) << 101 DCHECK(CurrentlyOn(CastEnvironment::MAIN)) <<
96 "Must be called from main thread"; 102 "Must be called from main thread";
97 return logging_.get(); 103 return logging_.get();
98 } 104 }
99 105
100 } // namespace cast 106 } // namespace cast
101 } // namespace media 107 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/cast_environment.h ('k') | media/cast/cast_receiver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698