blob: a2b3353c0e2ec525965fb683e56ae57b794320a0 [file] [log] [blame]
deadbeef6979b022015-09-24 16:47:53 -07001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
deadbeef6979b022015-09-24 16:47:53 -07003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
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.
deadbeef6979b022015-09-24 16:47:53 -07009 */
10
Steve Anton10542f22019-01-11 09:11:00 -080011#include "pc/rtp_receiver.h"
deadbeef6979b022015-09-24 16:47:53 -070012
Yves Gerey3e707812018-11-28 16:47:49 +010013#include <stddef.h>
Jonas Olssona4d87372019-07-05 19:08:33 +020014
Henrik Boström9e6fd2b2017-11-21 13:41:51 +010015#include <utility>
Steve Anton36b29d12017-10-30 09:57:42 -070016#include <vector>
17
Steve Anton10542f22019-01-11 09:11:00 -080018#include "pc/media_stream.h"
Markus Handella1b82012021-05-26 18:56:30 +020019#include "pc/media_stream_proxy.h"
Harald Alvestrandc24a2182022-02-23 13:44:59 +000020#include "rtc_base/thread.h"
deadbeef70ab1a12015-09-28 16:53:55 -070021
22namespace webrtc {
23
Harald Alvestrandc72af932018-01-11 17:18:19 +010024// This function is only expected to be called on the signalling thread.
Ruslan Burakov501bfba2019-02-11 10:29:19 +010025int RtpReceiverInternal::GenerateUniqueId() {
Harald Alvestrandc72af932018-01-11 17:18:19 +010026 static int g_unique_id = 0;
27
28 return ++g_unique_id;
29}
30
Ruslan Burakov501bfba2019-02-11 10:29:19 +010031std::vector<rtc::scoped_refptr<MediaStreamInterface>>
32RtpReceiverInternal::CreateStreamsFromIds(std::vector<std::string> stream_ids) {
Henrik Boström199e27b2018-07-04 20:51:53 +020033 std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams(
34 stream_ids.size());
35 for (size_t i = 0; i < stream_ids.size(); ++i) {
36 streams[i] = MediaStreamProxy::Create(
37 rtc::Thread::Current(), MediaStream::Create(std::move(stream_ids[i])));
38 }
39 return streams;
40}
41
deadbeef70ab1a12015-09-28 16:53:55 -070042} // namespace webrtc