| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 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 met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 return sp.groupid == groupid && sp.id == id; | 296 return sp.groupid == groupid && sp.id == id; |
| 297 }); | 297 }); |
| 298 } | 298 } |
| 299 | 299 |
| 300 inline const StreamParams* GetStream(const StreamParamsVec& streams, | 300 inline const StreamParams* GetStream(const StreamParamsVec& streams, |
| 301 const StreamSelector& selector) { | 301 const StreamSelector& selector) { |
| 302 return GetStream(streams, | 302 return GetStream(streams, |
| 303 [&selector](const StreamParams& sp) { return selector.Matches(sp); }); | 303 [&selector](const StreamParams& sp) { return selector.Matches(sp); }); |
| 304 } | 304 } |
| 305 | 305 |
| 306 //////////////////////////////////////////////////////////////////////////////// | |
| 307 // Deprecated methods that will be removed one of these days. | |
| 308 // Please use the methods with the same name above. | |
| 309 bool GetStream(const StreamParamsVec& streams, | |
| 310 const StreamSelector& selector, | |
| 311 StreamParams* stream_out); | |
| 312 inline bool GetStreamBySsrc(const StreamParamsVec& streams, uint32 ssrc, | |
| 313 StreamParams* stream_out) { | |
| 314 return GetStream(streams, StreamSelector(ssrc), stream_out); | |
| 315 } | |
| 316 inline bool GetStreamByIds(const StreamParamsVec& streams, | |
| 317 const std::string& groupid, | |
| 318 const std::string& id, | |
| 319 StreamParams* stream_out) { | |
| 320 return GetStream(streams, StreamSelector(groupid, id), stream_out); | |
| 321 } | |
| 322 // End deprecated methods. | |
| 323 //////////////////////////////////////////////////////////////////////////////// | |
| 324 | |
| 325 template <class Condition> | 306 template <class Condition> |
| 326 bool RemoveStream(StreamParamsVec* streams, Condition condition) { | 307 bool RemoveStream(StreamParamsVec* streams, Condition condition) { |
| 327 auto iter(std::remove_if(streams->begin(), streams->end(), condition)); | 308 auto iter(std::remove_if(streams->begin(), streams->end(), condition)); |
| 328 if (iter == streams->end()) | 309 if (iter == streams->end()) |
| 329 return false; | 310 return false; |
| 330 streams->erase(iter, streams->end()); | 311 streams->erase(iter, streams->end()); |
| 331 return true; | 312 return true; |
| 332 } | 313 } |
| 333 | 314 |
| 334 // Removes the stream from streams. Returns true if a stream is | 315 // Removes the stream from streams. Returns true if a stream is |
| (...skipping 22 matching lines...) Expand all Loading... |
| 357 bool IsOneSsrcStream(const StreamParams& sp); | 338 bool IsOneSsrcStream(const StreamParams& sp); |
| 358 | 339 |
| 359 // Checks if |sp| defines parameters for one Simulcast stream. There may be RTX | 340 // Checks if |sp| defines parameters for one Simulcast stream. There may be RTX |
| 360 // streams associated with the simulcast streams. Leaving as non-static so we | 341 // streams associated with the simulcast streams. Leaving as non-static so we |
| 361 // can test this function. | 342 // can test this function. |
| 362 bool IsSimulcastStream(const StreamParams& sp); | 343 bool IsSimulcastStream(const StreamParams& sp); |
| 363 | 344 |
| 364 } // namespace cricket | 345 } // namespace cricket |
| 365 | 346 |
| 366 #endif // TALK_MEDIA_BASE_STREAMPARAMS_H_ | 347 #endif // TALK_MEDIA_BASE_STREAMPARAMS_H_ |
| OLD | NEW |