Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2011 Ericsson AB. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 | 100 |
| 101 if (!ended()) | 101 if (!ended()) |
| 102 MediaStreamCenter::instance().didSetMediaStreamTrackEnabled( | 102 MediaStreamCenter::instance().didSetMediaStreamTrackEnabled( |
| 103 m_component.get()); | 103 m_component.get()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 bool MediaStreamTrack::muted() const { | 106 bool MediaStreamTrack::muted() const { |
| 107 return m_component->muted(); | 107 return m_component->muted(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 String MediaStreamTrack::contentHint() const { | |
| 111 DEFINE_STATIC_LOCAL(String, none, ("")); | |
| 112 DEFINE_STATIC_LOCAL(String, speech, ("speech")); | |
|
Guido Urdaneta
2016/12/08 10:35:36
Do you really need these? You are only using them
pbos
2016/12/08 16:58:32
Done, do you prefer this over inlining the strings
| |
| 113 DEFINE_STATIC_LOCAL(String, music, ("music")); | |
| 114 DEFINE_STATIC_LOCAL(String, fluid, ("fluid")); | |
| 115 DEFINE_STATIC_LOCAL(String, detailed, ("detailed")); | |
| 116 WebMediaStreamTrack::ContentHint hint = m_component->contentHint(); | |
| 117 switch (hint) { | |
| 118 case WebMediaStreamTrack::ContentHint::None: | |
| 119 return none; | |
| 120 case WebMediaStreamTrack::ContentHint::AudioSpeech: | |
| 121 return speech; | |
| 122 case WebMediaStreamTrack::ContentHint::AudioMusic: | |
| 123 return music; | |
| 124 case WebMediaStreamTrack::ContentHint::VideoFluid: | |
| 125 return fluid; | |
| 126 case WebMediaStreamTrack::ContentHint::VideoDetailed: | |
| 127 return detailed; | |
| 128 } | |
| 129 | |
| 130 NOTREACHED(); | |
| 131 return String(); | |
| 132 } | |
| 133 | |
| 134 void MediaStreamTrack::setContentHint(const String& hint) { | |
| 135 WebMediaStreamTrack::ContentHint translatedHint = | |
| 136 WebMediaStreamTrack::ContentHint::None; | |
| 137 switch (m_component->source()->type()) { | |
| 138 case MediaStreamSource::TypeAudio: | |
| 139 if (hint == "") { | |
| 140 translatedHint = WebMediaStreamTrack::ContentHint::None; | |
| 141 } else if (hint == "speech") { | |
| 142 translatedHint = WebMediaStreamTrack::ContentHint::AudioSpeech; | |
| 143 } else if (hint == "music") { | |
| 144 translatedHint = WebMediaStreamTrack::ContentHint::AudioMusic; | |
| 145 } else { | |
| 146 // TODO(pbos): Log warning? | |
| 147 return; | |
| 148 } | |
| 149 break; | |
| 150 case MediaStreamSource::TypeVideo: | |
| 151 if (hint == "") { | |
| 152 translatedHint = WebMediaStreamTrack::ContentHint::None; | |
| 153 } else if (hint == "fluid") { | |
| 154 translatedHint = WebMediaStreamTrack::ContentHint::VideoFluid; | |
| 155 } else if (hint == "detailed") { | |
| 156 translatedHint = WebMediaStreamTrack::ContentHint::VideoDetailed; | |
| 157 } else { | |
| 158 // TODO(pbos): Log warning? | |
| 159 return; | |
| 160 } | |
| 161 } | |
| 162 | |
| 163 m_component->setContentHint(translatedHint); | |
| 164 } | |
| 165 | |
| 110 bool MediaStreamTrack::remote() const { | 166 bool MediaStreamTrack::remote() const { |
| 111 return m_component->source()->remote(); | 167 return m_component->source()->remote(); |
| 112 } | 168 } |
| 113 | 169 |
| 114 String MediaStreamTrack::readyState() const { | 170 String MediaStreamTrack::readyState() const { |
| 115 if (ended()) | 171 if (ended()) |
| 116 return "ended"; | 172 return "ended"; |
| 117 | 173 |
| 118 switch (m_readyState) { | 174 switch (m_readyState) { |
| 119 case MediaStreamSource::ReadyStateLive: | 175 case MediaStreamSource::ReadyStateLive: |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 } | 310 } |
| 255 | 311 |
| 256 DEFINE_TRACE(MediaStreamTrack) { | 312 DEFINE_TRACE(MediaStreamTrack) { |
| 257 visitor->trace(m_registeredMediaStreams); | 313 visitor->trace(m_registeredMediaStreams); |
| 258 visitor->trace(m_component); | 314 visitor->trace(m_component); |
| 259 EventTargetWithInlineData::trace(visitor); | 315 EventTargetWithInlineData::trace(visitor); |
| 260 ActiveDOMObject::trace(visitor); | 316 ActiveDOMObject::trace(visitor); |
| 261 } | 317 } |
| 262 | 318 |
| 263 } // namespace blink | 319 } // namespace blink |
| OLD | NEW |