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

Side by Side Diff: third_party/WebKit/Source/platform/mediastream/MediaStreamComponent.h

Issue 2540263003: Carry MediaStreamComponent properties on clone. (Closed)
Patch Set: added test + todo comments Created 4 years 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
1 /* 1 /*
2 * Copyright (C) 2011 Ericsson AB. All rights reserved. 2 * Copyright (C) 2011 Ericsson AB. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 USING_FAST_MALLOC(TrackData); 59 USING_FAST_MALLOC(TrackData);
60 60
61 public: 61 public:
62 virtual void getSettings(WebMediaStreamTrack::Settings&) = 0; 62 virtual void getSettings(WebMediaStreamTrack::Settings&) = 0;
63 virtual ~TrackData() {} 63 virtual ~TrackData() {}
64 }; 64 };
65 65
66 static MediaStreamComponent* create(MediaStreamSource*); 66 static MediaStreamComponent* create(MediaStreamSource*);
67 static MediaStreamComponent* create(const String& id, MediaStreamSource*); 67 static MediaStreamComponent* create(const String& id, MediaStreamSource*);
68 68
69 MediaStreamComponent* clone() const;
70
69 // |m_trackData| may hold pointers to GC objects indirectly, and it may touch 71 // |m_trackData| may hold pointers to GC objects indirectly, and it may touch
70 // eagerly finalized objects in destruction. 72 // eagerly finalized objects in destruction.
71 // So this class runs pre-finalizer to finalize |m_trackData| promptly. 73 // So this class runs pre-finalizer to finalize |m_trackData| promptly.
72 void dispose(); 74 void dispose();
73 75
74 MediaStreamSource* source() const { return m_source.get(); } 76 MediaStreamSource* source() const { return m_source.get(); }
75 77
76 String id() const { return m_id; } 78 String id() const { return m_id; }
77 bool enabled() const { return m_enabled; } 79 bool enabled() const { return m_enabled; }
78 void setEnabled(bool enabled) { m_enabled = enabled; } 80 void setEnabled(bool enabled) { m_enabled = enabled; }
79 bool muted() const { return m_muted; } 81 bool muted() const { return m_muted; }
80 void setMuted(bool muted) { m_muted = muted; } 82 void setMuted(bool muted) { m_muted = muted; }
81 AudioSourceProvider* getAudioSourceProvider() { return &m_sourceProvider; } 83 AudioSourceProvider* getAudioSourceProvider() { return &m_sourceProvider; }
82 void setSourceProvider(WebAudioSourceProvider* provider) { 84 void setSourceProvider(WebAudioSourceProvider* provider) {
83 m_sourceProvider.wrap(provider); 85 m_sourceProvider.wrap(provider);
84 } 86 }
85 87
86 TrackData* getTrackData() const { return m_trackData.get(); } 88 TrackData* getTrackData() const { return m_trackData.get(); }
87 void setTrackData(std::unique_ptr<TrackData> trackData) { 89 void setTrackData(std::unique_ptr<TrackData> trackData) {
88 m_trackData = std::move(trackData); 90 m_trackData = std::move(trackData);
89 } 91 }
90 void getSettings(WebMediaStreamTrack::Settings&); 92 void getSettings(WebMediaStreamTrack::Settings&);
91 93
92 DECLARE_TRACE(); 94 DECLARE_TRACE();
93 95
94 private: 96 private:
95 MediaStreamComponent(const String& id, MediaStreamSource*); 97 MediaStreamComponent(const String& id, MediaStreamSource*);
98 MediaStreamComponent(const String& id,
99 MediaStreamSource*,
100 bool enabled,
101 bool muted);
96 102
97 // AudioSourceProviderImpl wraps a WebAudioSourceProvider::provideInput() 103 // AudioSourceProviderImpl wraps a WebAudioSourceProvider::provideInput()
98 // calls into chromium to get a rendered audio stream. 104 // calls into chromium to get a rendered audio stream.
99 105
100 class PLATFORM_EXPORT AudioSourceProviderImpl final 106 class PLATFORM_EXPORT AudioSourceProviderImpl final
101 : public AudioSourceProvider { 107 : public AudioSourceProvider {
102 public: 108 public:
103 AudioSourceProviderImpl() : m_webAudioSourceProvider(0) {} 109 AudioSourceProviderImpl() : m_webAudioSourceProvider(0) {}
104 110
105 ~AudioSourceProviderImpl() override {} 111 ~AudioSourceProviderImpl() override {}
(...skipping 16 matching lines...) Expand all
122 bool m_enabled; 128 bool m_enabled;
123 bool m_muted; 129 bool m_muted;
124 std::unique_ptr<TrackData> m_trackData; 130 std::unique_ptr<TrackData> m_trackData;
125 }; 131 };
126 132
127 typedef HeapVector<Member<MediaStreamComponent>> MediaStreamComponentVector; 133 typedef HeapVector<Member<MediaStreamComponent>> MediaStreamComponentVector;
128 134
129 } // namespace blink 135 } // namespace blink
130 136
131 #endif // MediaStreamComponent_h 137 #endif // MediaStreamComponent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698