| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 |
| 11 | #include "pc/rtp_receiver.h" |
| 12 |
| 13 | #include <stddef.h> |
| 14 |
| 15 | #include <atomic> |
| 16 | #include <utility> |
| 17 | #include <vector> |
| 18 |
| 19 | #include "pc/media_stream.h" |
| 20 | #include "pc/media_stream_proxy.h" |
| 21 | #include "rtc_base/thread.h" |
| 22 |
| 23 | namespace webrtc { |
| 24 |
| 25 | // This function is only expected to be called on the signalling thread. |
| 26 | // On the other hand, some test or even production setups may use |
| 27 | // several signaling threads. |
| 28 | int RtpReceiverInternal::GenerateUniqueId() { |
| 29 | static std::atomic<int> g_unique_id{0}; |
| 30 |
| 31 | return ++g_unique_id; |
| 32 | } |
| 33 |
| 34 | std::vector<rtc::scoped_refptr<MediaStreamInterface>> |
| 35 | RtpReceiverInternal::CreateStreamsFromIds(std::vector<std::string> stream_ids) { |
| 36 | std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams( |
| 37 | stream_ids.size()); |
| 38 | for (size_t i = 0; i < stream_ids.size(); ++i) { |
| 39 | streams[i] = MediaStreamProxy::Create( |
| 40 | rtc::Thread::Current(), MediaStream::Create(std::move(stream_ids[i]))); |
| 41 | } |
| 42 | return streams; |
| 43 | } |
| 44 |
| 45 | } // namespace webrtc |
| 46 |