Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_OBSERVER_H_ | |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_OBSERVER_H_ | |
| 7 | |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/threading/non_thread_safe.h" | |
| 11 #include "content/common/content_export.h" | |
| 12 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | |
| 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h" | |
| 14 | |
| 15 namespace content { | |
| 16 | |
| 17 // MediaStreamSourceObserver listens to events on MediaSourceInterface and | |
| 18 // notify WebKit. It will be owned by MediaStreamSourceExtraData. | |
| 19 // | |
| 20 // This will create circular reference to MediaStreamSource: | |
| 21 // MediaStreamSource -> MediaStreamSourceExtraData -> MediaStreamSourceObserver | |
| 22 // -> MediaStreamSource | |
| 23 // Currently, it relies on manually releasing the reference count, like what | |
| 24 // ~UserMediaRequestInfo() does. | |
| 25 // TODO(kcwu): fix the circular reference after ExtraData::Owner() is | |
| 26 // implemented, which let us get MediaStreamSource without increasing reference | |
| 27 // count. | |
| 28 class CONTENT_EXPORT MediaStreamSourceObserver | |
| 29 : NON_EXPORTED_BASE(public webrtc::ObserverInterface), | |
| 30 NON_EXPORTED_BASE(public base::NonThreadSafe) { | |
| 31 public: | |
| 32 MediaStreamSourceObserver(webrtc::MediaSourceInterface* webrtc_source, | |
| 33 const WebKit::WebMediaStreamSource& webkit_source); | |
|
perkj_chrome
2013/04/18 13:36:20
How about preparing for ExtraData::Owner() ?
c
| |
| 34 virtual ~MediaStreamSourceObserver(); | |
| 35 | |
| 36 // webrtc::ObserverInterface implementation. | |
| 37 virtual void OnChanged() OVERRIDE; | |
| 38 | |
| 39 private: | |
| 40 webrtc::MediaSourceInterface::SourceState state_; | |
| 41 scoped_refptr<webrtc::MediaSourceInterface> webrtc_source_; | |
| 42 WebKit::WebMediaStreamSource webkit_source_; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(MediaStreamSourceObserver); | |
| 45 }; | |
| 46 | |
| 47 } // namespace content | |
| 48 | |
| 49 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_OBSERVER_H_ | |
| OLD | NEW |