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

Side by Side Diff: Source/platform/mediastream/MediaStreamSource.h

Issue 133733004: Adding owner access from WebMediaStreamTrack::ExtraData (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Ericsson AB. All rights reserved. 2 * Copyright (C) 2011 Ericsson AB. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 namespace WebCore { 45 namespace WebCore {
46 46
47 class PLATFORM_EXPORT MediaStreamSource : public RefCounted<MediaStreamSource> { 47 class PLATFORM_EXPORT MediaStreamSource : public RefCounted<MediaStreamSource> {
48 public: 48 public:
49 class Observer { 49 class Observer {
50 public: 50 public:
51 virtual ~Observer() { } 51 virtual ~Observer() { }
52 virtual void sourceChangedState() = 0; 52 virtual void sourceChangedState() = 0;
53 }; 53 };
54 54
55 class ExtraData { 55 class ExtraData : public RefCounted<ExtraData> {
56 public: 56 public:
57 virtual ~ExtraData() { } 57 virtual ~ExtraData() { }
58 }; 58 };
59 59
60 enum Type { 60 enum Type {
61 TypeAudio, 61 TypeAudio,
62 TypeVideo 62 TypeVideo
63 }; 63 };
64 64
65 enum ReadyState { 65 enum ReadyState {
66 ReadyStateLive = 0, 66 ReadyStateLive = 0,
67 ReadyStateMuted = 1, 67 ReadyStateMuted = 1,
68 ReadyStateEnded = 2 68 ReadyStateEnded = 2
69 }; 69 };
70 70
71 static PassRefPtr<MediaStreamSource> create(const String& id, Type, const St ring& name, ReadyState = ReadyStateLive, bool requiresConsumer = false); 71 static PassRefPtr<MediaStreamSource> create(const String& id, Type, const St ring& name, ReadyState = ReadyStateLive, bool requiresConsumer = false);
72 72
73 const String& id() const { return m_id; } 73 const String& id() const { return m_id; }
74 Type type() const { return m_type; } 74 Type type() const { return m_type; }
75 const String& name() const { return m_name; } 75 const String& name() const { return m_name; }
76 76
77 void setReadyState(ReadyState); 77 void setReadyState(ReadyState);
78 ReadyState readyState() const { return m_readyState; } 78 ReadyState readyState() const { return m_readyState; }
79 79
80 void addObserver(Observer*); 80 void addObserver(Observer*);
81 void removeObserver(Observer*); 81 void removeObserver(Observer*);
82 82
83 ExtraData* extraData() const { return m_extraData.get(); } 83 ExtraData* extraData() const { return m_extraData.get(); }
84 void setExtraData(ExtraData* extraData) { m_extraData = adoptPtr(extraData); } 84 void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData ; }
85 85
86 void setConstraints(PassRefPtr<MediaConstraints> constraints) { m_constraint s = constraints; } 86 void setConstraints(PassRefPtr<MediaConstraints> constraints) { m_constraint s = constraints; }
87 MediaConstraints* constraints() { return m_constraints.get(); } 87 MediaConstraints* constraints() { return m_constraints.get(); }
88 88
89 void setAudioFormat(size_t numberOfChannels, float sampleRate); 89 void setAudioFormat(size_t numberOfChannels, float sampleRate);
90 void consumeAudio(AudioBus*, size_t numberOfFrames); 90 void consumeAudio(AudioBus*, size_t numberOfFrames);
91 91
92 bool requiresAudioConsumer() const { return m_requiresConsumer; } 92 bool requiresAudioConsumer() const { return m_requiresConsumer; }
93 void addAudioConsumer(PassRefPtr<AudioDestinationConsumer>); 93 void addAudioConsumer(PassRefPtr<AudioDestinationConsumer>);
94 bool removeAudioConsumer(AudioDestinationConsumer*); 94 bool removeAudioConsumer(AudioDestinationConsumer*);
95 const Vector<RefPtr<AudioDestinationConsumer> >& audioConsumers() { return m _audioConsumers; } 95 const Vector<RefPtr<AudioDestinationConsumer> >& audioConsumers() { return m _audioConsumers; }
96 96
97 private: 97 private:
98 MediaStreamSource(const String& id, Type, const String& name, ReadyState, bo ol requiresConsumer); 98 MediaStreamSource(const String& id, Type, const String& name, ReadyState, bo ol requiresConsumer);
99 99
100 String m_id; 100 String m_id;
101 Type m_type; 101 Type m_type;
102 String m_name; 102 String m_name;
103 ReadyState m_readyState; 103 ReadyState m_readyState;
104 bool m_requiresConsumer; 104 bool m_requiresConsumer;
105 Vector<Observer*> m_observers; 105 Vector<Observer*> m_observers;
106 Mutex m_audioConsumersLock; 106 Mutex m_audioConsumersLock;
107 Vector<RefPtr<AudioDestinationConsumer> > m_audioConsumers; 107 Vector<RefPtr<AudioDestinationConsumer> > m_audioConsumers;
108 OwnPtr<ExtraData> m_extraData; 108 RefPtr<ExtraData> m_extraData;
abarth-chromium 2014/01/10 15:41:18 I don't understand why this need to be ref counted
Tommy Widenflycht 2014/01/13 13:08:40 Doh, neither do I. I was just making sure all of "
109 RefPtr<MediaConstraints> m_constraints; 109 RefPtr<MediaConstraints> m_constraints;
110 }; 110 };
111 111
112 typedef Vector<RefPtr<MediaStreamSource> > MediaStreamSourceVector; 112 typedef Vector<RefPtr<MediaStreamSource> > MediaStreamSourceVector;
113 113
114 } // namespace WebCore 114 } // namespace WebCore
115 115
116 #endif // MediaStreamSource_h 116 #endif // MediaStreamSource_h
OLDNEW
« no previous file with comments | « Source/platform/exported/WebMediaStreamSource.cpp ('k') | public/platform/WebMediaStreamTrack.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698