Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/ssrc_database.h

Issue 2702203002: Reland of Delete class SSRCDatabase, and its global ssrc registry. (Closed)
Patch Set: Move SetRtcpReceiverSsrcs call to ModuleRtpRtcpImpl::SetSendingStatus. Update tests to set SSRC ear… Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 *
4 * 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.
9 */
10
11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_SSRC_DATABASE_H_
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_SSRC_DATABASE_H_
13
14 #include <set>
15
16 #include "webrtc/base/criticalsection.h"
17 #include "webrtc/base/random.h"
18 #include "webrtc/base/thread_annotations.h"
19 #include "webrtc/system_wrappers/include/static_instance.h"
20 #include "webrtc/typedefs.h"
21
22 namespace webrtc {
23
24 // TODO(tommi, holmer): Look into whether we can eliminate locking in this
25 // class or the class itself completely once voice engine doesn't rely on it.
26 // At the moment voe_auto_test requires locking, but it's not clear if that's
27 // an issue with the test code or if it reflects real world usage or if that's
28 // the best design performance wise.
29 // If we do decide to keep the class, we should at least get rid of using
30 // StaticInstance.
31 class SSRCDatabase {
32 public:
33 static SSRCDatabase* GetSSRCDatabase();
34 static void ReturnSSRCDatabase();
35
36 uint32_t CreateSSRC();
37 void RegisterSSRC(uint32_t ssrc);
38 void ReturnSSRC(uint32_t ssrc);
39
40 protected:
41 SSRCDatabase();
42 ~SSRCDatabase();
43
44 static SSRCDatabase* CreateInstance() { return new SSRCDatabase(); }
45
46 // Friend function to allow the SSRC destructor to be accessed from the
47 // template class.
48 friend SSRCDatabase* GetStaticInstance<SSRCDatabase>(
49 CountOperation count_operation);
50
51 private:
52 rtc::CriticalSection crit_;
53 Random random_ GUARDED_BY(crit_);
54 std::set<uint32_t> ssrcs_ GUARDED_BY(crit_);
55 // TODO(tommi): Use a thread checker to ensure the object is created and
56 // deleted on the same thread. At the moment this isn't possible due to
57 // voe::ChannelOwner in voice engine. To reproduce, run:
58 // voe_auto_test --automated --gtest_filter=*MixManyChannelsForStressOpus
59 };
60 } // namespace webrtc
61
62 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_SSRC_DATABASE_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc ('k') | webrtc/modules/rtp_rtcp/source/ssrc_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698