| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 2 * Copyright (C) 2011 Ericsson AB. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. 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 are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 PassRefPtr<MediaStreamDescriptor> MediaStreamDescriptor::create(const String& id
, const MediaStreamComponentVector& audioComponents, const MediaStreamComponentV
ector& videoComponents) | 49 PassRefPtr<MediaStreamDescriptor> MediaStreamDescriptor::create(const String& id
, const MediaStreamComponentVector& audioComponents, const MediaStreamComponentV
ector& videoComponents) |
| 50 { | 50 { |
| 51 return adoptRef(new MediaStreamDescriptor(id, audioComponents, videoComponen
ts)); | 51 return adoptRef(new MediaStreamDescriptor(id, audioComponents, videoComponen
ts)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void MediaStreamDescriptor::addComponent(PassRefPtr<MediaStreamComponent> compon
ent) | 54 void MediaStreamDescriptor::addComponent(PassRefPtr<MediaStreamComponent> compon
ent) |
| 55 { | 55 { |
| 56 switch (component->source()->type()) { | 56 switch (component->source()->type()) { |
| 57 case MediaStreamSource::TypeAudio: | 57 case MediaStreamSource::TypeAudio: |
| 58 if (m_audioComponents.find(component) == notFound) | 58 if (m_audioComponents.find(component) == kNotFound) |
| 59 m_audioComponents.append(component); | 59 m_audioComponents.append(component); |
| 60 break; | 60 break; |
| 61 case MediaStreamSource::TypeVideo: | 61 case MediaStreamSource::TypeVideo: |
| 62 if (m_videoComponents.find(component) == notFound) | 62 if (m_videoComponents.find(component) == kNotFound) |
| 63 m_videoComponents.append(component); | 63 m_videoComponents.append(component); |
| 64 break; | 64 break; |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 void MediaStreamDescriptor::removeComponent(PassRefPtr<MediaStreamComponent> com
ponent) | 68 void MediaStreamDescriptor::removeComponent(PassRefPtr<MediaStreamComponent> com
ponent) |
| 69 { | 69 { |
| 70 size_t pos = notFound; | 70 size_t pos = kNotFound; |
| 71 switch (component->source()->type()) { | 71 switch (component->source()->type()) { |
| 72 case MediaStreamSource::TypeAudio: | 72 case MediaStreamSource::TypeAudio: |
| 73 pos = m_audioComponents.find(component); | 73 pos = m_audioComponents.find(component); |
| 74 if (pos != notFound) | 74 if (pos != kNotFound) |
| 75 m_audioComponents.remove(pos); | 75 m_audioComponents.remove(pos); |
| 76 break; | 76 break; |
| 77 case MediaStreamSource::TypeVideo: | 77 case MediaStreamSource::TypeVideo: |
| 78 pos = m_videoComponents.find(component); | 78 pos = m_videoComponents.find(component); |
| 79 if (pos != notFound) | 79 if (pos != kNotFound) |
| 80 m_videoComponents.remove(pos); | 80 m_videoComponents.remove(pos); |
| 81 break; | 81 break; |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 void MediaStreamDescriptor::addRemoteTrack(MediaStreamComponent* component) | 85 void MediaStreamDescriptor::addRemoteTrack(MediaStreamComponent* component) |
| 86 { | 86 { |
| 87 if (m_client) | 87 if (m_client) |
| 88 m_client->addRemoteTrack(component); | 88 m_client->addRemoteTrack(component); |
| 89 else | 89 else |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 m_audioComponents.append((*iter)); | 122 m_audioComponents.append((*iter)); |
| 123 } | 123 } |
| 124 for (MediaStreamComponentVector::const_iterator iter = videoComponents.begin
(); iter != videoComponents.end(); ++iter) { | 124 for (MediaStreamComponentVector::const_iterator iter = videoComponents.begin
(); iter != videoComponents.end(); ++iter) { |
| 125 (*iter)->setStream(this); | 125 (*iter)->setStream(this); |
| 126 m_videoComponents.append((*iter)); | 126 m_videoComponents.append((*iter)); |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace WebCore | 130 } // namespace WebCore |
| 131 | 131 |
| OLD | NEW |