| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_MEDIA_STREAM_TRACK_COLLECTION_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_MEDIA_STREAM_TRACK_COLLECTION_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_MEDIA_STREAM_TRACK_COLLECTION_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_MEDIA_STREAM_TRACK_COLLECTION_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 AdapterEntry* entry() { return &it_->second; } | 78 AdapterEntry* entry() { return &it_->second; } |
| 79 | 79 |
| 80 scoped_refptr<WebRtcMediaStreamTrackAdapterMap> map_; | 80 scoped_refptr<WebRtcMediaStreamTrackAdapterMap> map_; |
| 81 Type type_; | 81 Type type_; |
| 82 MapEntryIterator it_; | 82 MapEntryIterator it_; |
| 83 // A reference to the entry's adapter, ensures that |HasOneRef| is false. | 83 // A reference to the entry's adapter, ensures that |HasOneRef| is false. |
| 84 scoped_refptr<WebRtcMediaStreamTrackAdapter> adapter_; | 84 scoped_refptr<WebRtcMediaStreamTrackAdapter> adapter_; |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 // Called on the main thread. |
| 87 WebRtcMediaStreamTrackAdapterMap( | 88 WebRtcMediaStreamTrackAdapterMap( |
| 88 PeerConnectionDependencyFactory* const factory, | 89 PeerConnectionDependencyFactory* const factory); |
| 89 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread); | |
| 90 | 90 |
| 91 // Gets the new reference to the local track adapter by ID, or null if no such | 91 // Gets the new reference to the local track adapter by ID, or null if no such |
| 92 // adapter was found. When all references are destroyed the adapter is | 92 // adapter was found. When all references are destroyed the adapter is |
| 93 // disposed and removed from the map. This method can be called from any | 93 // disposed and removed from the map. This method can be called from any |
| 94 // thread, but references must be destroyed on the main thread. | 94 // thread, but references must be destroyed on the main thread. |
| 95 std::unique_ptr<AdapterRef> GetLocalTrackAdapter(const std::string& id); | 95 std::unique_ptr<AdapterRef> GetLocalTrackAdapter(const std::string& id); |
| 96 // Invoke on the main thread. Gets a new reference to the local track adapter | 96 // Invoke on the main thread. Gets a new reference to the local track adapter |
| 97 // for the web track. If no adapter exists for the track one is created and | 97 // for the web track. If no adapter exists for the track one is created and |
| 98 // initialized. When all references are destroyed the adapter is disposed and | 98 // initialized. When all references are destroyed the adapter is disposed and |
| 99 // removed from the map. References must be destroyed on the main thread. | 99 // removed from the map. References must be destroyed on the main thread. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; | 136 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; |
| 137 | 137 |
| 138 mutable base::Lock lock_; | 138 mutable base::Lock lock_; |
| 139 std::map<std::string, AdapterEntry> local_track_adapters_; | 139 std::map<std::string, AdapterEntry> local_track_adapters_; |
| 140 std::map<std::string, AdapterEntry> remote_track_adapters_; | 140 std::map<std::string, AdapterEntry> remote_track_adapters_; |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 } // namespace content | 143 } // namespace content |
| 144 | 144 |
| 145 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_MEDIA_STREAM_TRACK_COLLECTION_H_ | 145 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_MEDIA_STREAM_TRACK_COLLECTION_H_ |
| OLD | NEW |