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

Side by Side Diff: content/renderer/media/media_stream_video_source.h

Issue 129923002: Implements MediaStreamVideoSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_MEDIA_STREAM_VIDEO_SOURCE_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 #include "content/renderer/media/media_stream_source_extra_data.h" 11 #include "content/renderer/media/media_stream_source_extra_data.h"
12 #include "content/renderer/media/webrtc/webrtc_video_source_adapter.h"
12 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" 13 #include "third_party/WebKit/public/platform/WebMediaConstraints.h"
13 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" 14 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
14 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 15 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
15 16
16 namespace media { 17 namespace media {
17 class VideoFrame; 18 class VideoFrame;
18 } 19 }
19 20
20 namespace content { 21 namespace content {
21 22
22 // MediaStreamVideoSource is an interface used for sending video frames to a 23 // MediaStreamVideoSource is an interface used for sending video frames to a
23 // MediaStreamVideoTrack. 24 // MediaStreamVideoTrack.
24 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html 25 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html
25 // All methods calls will be done from the main render thread. 26 // All methods calls will be done from the main render thread.
26 class CONTENT_EXPORT MediaStreamVideoSource 27 class CONTENT_EXPORT MediaStreamVideoSource
27 : public MediaStreamSourceExtraData { 28 : public MediaStreamSourceExtraData {
28 public: 29 public:
30 MediaStreamVideoSource();
31
29 // Puts |track| in the registered tracks list. Will later 32 // Puts |track| in the registered tracks list. Will later
30 // deliver frames to it according to |constraints|. 33 // deliver frames to it according to |constraints|.
31 void AddTrack(const blink::WebMediaStreamTrack& track, 34 void AddTrack(const blink::WebMediaStreamTrack& track,
32 const blink::WebMediaConstraints& constraints); 35 const blink::WebMediaConstraints& constraints);
33 36
34 // Removes |track| from the registered tracks list, i.e. will stop delivering 37 // Removes |track| from the registered tracks list, i.e. will stop delivering
35 // frame to |track|. 38 // frame to |track|.
36 void RemoveTrack(const blink::WebMediaStreamTrack& track); 39 void RemoveTrack(const blink::WebMediaStreamTrack& track);
37 40
38 protected: 41 protected:
39 // Sets ready state and notifies the ready state to all registered tracks. 42 // Sets ready state and notifies the ready state to all registered tracks.
40 virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state); 43 virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state);
41 44
42 // Delivers |frame| to registered tracks according to their constraints. 45 // Delivers |frame| to registered tracks according to their constraints.
43 virtual void DeliverVideoFrame(const scoped_refptr<media::VideoFrame>& frame); 46 virtual void DeliverVideoFrame(const scoped_refptr<media::VideoFrame>& frame);
44 47
48 // For testing only.
49 void SetMsFactory(MediaStreamDependencyFactory* factory);
Jói 2014/01/09 11:18:13 If it's only for testing, name it SetMsFactoryForT
50
45 virtual ~MediaStreamVideoSource(); 51 virtual ~MediaStreamVideoSource();
52
53 private:
Jói 2014/01/09 11:18:13 missing DISALLOW_COPY_AND_ASSIGN
54 typedef std::vector<WebRtcVideoSourceAdapter*> WebRtcVideoSourceAdapters;
55
56 WebRtcVideoSourceAdapters adapters_;
57 MediaStreamDependencyFactory* factory_;
46 }; 58 };
47 59
48 } // namespace content 60 } // namespace content
49 61
50 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ 62 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698