| 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 29 matching lines...) Expand all Loading... |
| 40 #include "public/platform/WebMediaStreamTrack.h" | 40 #include "public/platform/WebMediaStreamTrack.h" |
| 41 #include "wtf/Assertions.h" | 41 #include "wtf/Assertions.h" |
| 42 #include <memory> | 42 #include <memory> |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 namespace { | 46 namespace { |
| 47 static const char kContentHintStringNone[] = ""; | 47 static const char kContentHintStringNone[] = ""; |
| 48 static const char kContentHintStringAudioSpeech[] = "speech"; | 48 static const char kContentHintStringAudioSpeech[] = "speech"; |
| 49 static const char kContentHintStringAudioMusic[] = "music"; | 49 static const char kContentHintStringAudioMusic[] = "music"; |
| 50 static const char kContentHintStringVideoFluid[] = "fluid"; | 50 static const char kContentHintStringVideoMotion[] = "motion"; |
| 51 static const char kContentHintStringVideoDetailed[] = "detailed"; | 51 static const char kContentHintStringVideoDetail[] = "detail"; |
| 52 } // namespace | 52 } // namespace |
| 53 | 53 |
| 54 MediaStreamTrack* MediaStreamTrack::create(ExecutionContext* context, | 54 MediaStreamTrack* MediaStreamTrack::create(ExecutionContext* context, |
| 55 MediaStreamComponent* component) { | 55 MediaStreamComponent* component) { |
| 56 return new MediaStreamTrack(context, component); | 56 return new MediaStreamTrack(context, component); |
| 57 } | 57 } |
| 58 | 58 |
| 59 MediaStreamTrack::MediaStreamTrack(ExecutionContext* context, | 59 MediaStreamTrack::MediaStreamTrack(ExecutionContext* context, |
| 60 MediaStreamComponent* component) | 60 MediaStreamComponent* component) |
| 61 : ContextLifecycleObserver(context), | 61 : ContextLifecycleObserver(context), |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 String MediaStreamTrack::contentHint() const { | 115 String MediaStreamTrack::contentHint() const { |
| 116 WebMediaStreamTrack::ContentHintType hint = m_component->contentHint(); | 116 WebMediaStreamTrack::ContentHintType hint = m_component->contentHint(); |
| 117 switch (hint) { | 117 switch (hint) { |
| 118 case WebMediaStreamTrack::ContentHintType::None: | 118 case WebMediaStreamTrack::ContentHintType::None: |
| 119 return kContentHintStringNone; | 119 return kContentHintStringNone; |
| 120 case WebMediaStreamTrack::ContentHintType::AudioSpeech: | 120 case WebMediaStreamTrack::ContentHintType::AudioSpeech: |
| 121 return kContentHintStringAudioSpeech; | 121 return kContentHintStringAudioSpeech; |
| 122 case WebMediaStreamTrack::ContentHintType::AudioMusic: | 122 case WebMediaStreamTrack::ContentHintType::AudioMusic: |
| 123 return kContentHintStringAudioMusic; | 123 return kContentHintStringAudioMusic; |
| 124 case WebMediaStreamTrack::ContentHintType::VideoFluid: | 124 case WebMediaStreamTrack::ContentHintType::VideoMotion: |
| 125 return kContentHintStringVideoFluid; | 125 return kContentHintStringVideoMotion; |
| 126 case WebMediaStreamTrack::ContentHintType::VideoDetailed: | 126 case WebMediaStreamTrack::ContentHintType::VideoDetail: |
| 127 return kContentHintStringVideoDetailed; | 127 return kContentHintStringVideoDetail; |
| 128 } | 128 } |
| 129 | 129 |
| 130 NOTREACHED(); | 130 NOTREACHED(); |
| 131 return String(); | 131 return String(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void MediaStreamTrack::setContentHint(const String& hint) { | 134 void MediaStreamTrack::setContentHint(const String& hint) { |
| 135 WebMediaStreamTrack::ContentHintType translatedHint = | 135 WebMediaStreamTrack::ContentHintType translatedHint = |
| 136 WebMediaStreamTrack::ContentHintType::None; | 136 WebMediaStreamTrack::ContentHintType::None; |
| 137 switch (m_component->source()->type()) { | 137 switch (m_component->source()->type()) { |
| 138 case MediaStreamSource::TypeAudio: | 138 case MediaStreamSource::TypeAudio: |
| 139 if (hint == kContentHintStringNone) { | 139 if (hint == kContentHintStringNone) { |
| 140 translatedHint = WebMediaStreamTrack::ContentHintType::None; | 140 translatedHint = WebMediaStreamTrack::ContentHintType::None; |
| 141 } else if (hint == kContentHintStringAudioSpeech) { | 141 } else if (hint == kContentHintStringAudioSpeech) { |
| 142 translatedHint = WebMediaStreamTrack::ContentHintType::AudioSpeech; | 142 translatedHint = WebMediaStreamTrack::ContentHintType::AudioSpeech; |
| 143 } else if (hint == kContentHintStringAudioMusic) { | 143 } else if (hint == kContentHintStringAudioMusic) { |
| 144 translatedHint = WebMediaStreamTrack::ContentHintType::AudioMusic; | 144 translatedHint = WebMediaStreamTrack::ContentHintType::AudioMusic; |
| 145 } else { | 145 } else { |
| 146 // TODO(pbos): Log warning? | 146 // TODO(pbos): Log warning? |
| 147 // Invalid values for audio are to be ignored (similar to invalid enum | 147 // Invalid values for audio are to be ignored (similar to invalid enum |
| 148 // values). | 148 // values). |
| 149 return; | 149 return; |
| 150 } | 150 } |
| 151 break; | 151 break; |
| 152 case MediaStreamSource::TypeVideo: | 152 case MediaStreamSource::TypeVideo: |
| 153 if (hint == kContentHintStringNone) { | 153 if (hint == kContentHintStringNone) { |
| 154 translatedHint = WebMediaStreamTrack::ContentHintType::None; | 154 translatedHint = WebMediaStreamTrack::ContentHintType::None; |
| 155 } else if (hint == kContentHintStringVideoFluid) { | 155 } else if (hint == kContentHintStringVideoMotion) { |
| 156 translatedHint = WebMediaStreamTrack::ContentHintType::VideoFluid; | 156 translatedHint = WebMediaStreamTrack::ContentHintType::VideoMotion; |
| 157 } else if (hint == kContentHintStringVideoDetailed) { | 157 } else if (hint == kContentHintStringVideoDetail) { |
| 158 translatedHint = WebMediaStreamTrack::ContentHintType::VideoDetailed; | 158 translatedHint = WebMediaStreamTrack::ContentHintType::VideoDetail; |
| 159 } else { | 159 } else { |
| 160 // TODO(pbos): Log warning? | 160 // TODO(pbos): Log warning? |
| 161 // Invalid values for video are to be ignored (similar to invalid enum | 161 // Invalid values for video are to be ignored (similar to invalid enum |
| 162 // values). | 162 // values). |
| 163 return; | 163 return; |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 m_component->setContentHint(translatedHint); | 167 m_component->setContentHint(translatedHint); |
| 168 } | 168 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 314 } |
| 315 | 315 |
| 316 DEFINE_TRACE(MediaStreamTrack) { | 316 DEFINE_TRACE(MediaStreamTrack) { |
| 317 visitor->trace(m_registeredMediaStreams); | 317 visitor->trace(m_registeredMediaStreams); |
| 318 visitor->trace(m_component); | 318 visitor->trace(m_component); |
| 319 EventTargetWithInlineData::trace(visitor); | 319 EventTargetWithInlineData::trace(visitor); |
| 320 ContextLifecycleObserver::trace(visitor); | 320 ContextLifecycleObserver::trace(visitor); |
| 321 } | 321 } |
| 322 | 322 |
| 323 } // namespace blink | 323 } // namespace blink |
| OLD | NEW |