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

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

Issue 8480028: support video device enumeration from renderer process. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: code review Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_STREAM_MEDIA_STREAM_IMPL_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_STREAM_MEDIA_STREAM_IMPL_H_
6 #define CONTENT_RENDERER_MEDIA_STREAM_MEDIA_STREAM_IMPL_H_ 6 #define CONTENT_RENDERER_MEDIA_STREAM_MEDIA_STREAM_IMPL_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h"
10 #include "webkit/media/media_stream_client.h" 12 #include "webkit/media/media_stream_client.h"
11 13
14 class MediaStreamDispatcher;
12 class VideoCaptureImplManager; 15 class VideoCaptureImplManager;
13 16
14 // A implementation of StreamClient to provide supporting functions, such as 17 // A implementation of StreamClient to provide supporting functions, such as
15 // GetVideoDecoder. 18 // GetVideoDecoder.
16 class MediaStreamImpl 19 class MediaStreamImpl
17 : public webkit_media::MediaStreamClient, 20 : public webkit_media::MediaStreamClient,
21 public MediaStreamDispatcherEventHandler,
18 public base::RefCountedThreadSafe<MediaStreamImpl> { 22 public base::RefCountedThreadSafe<MediaStreamImpl> {
19 public: 23 public:
20 explicit MediaStreamImpl(VideoCaptureImplManager* vc_manager); 24 explicit MediaStreamImpl(MediaStreamDispatcher* media_stream_dispatcher_,
25 VideoCaptureImplManager* vc_manager);
21 virtual ~MediaStreamImpl(); 26 virtual ~MediaStreamImpl();
22 27
23 // Implement webkit_media::StreamClient. 28 // Implement webkit_media::StreamClient.
24 virtual scoped_refptr<media::VideoDecoder> GetVideoDecoder( 29 virtual scoped_refptr<media::VideoDecoder> GetVideoDecoder(
25 const GURL& url, 30 const GURL& url,
26 media::MessageLoopFactory* message_loop_factory) OVERRIDE; 31 media::MessageLoopFactory* message_loop_factory) OVERRIDE;
27 32
33 // Implement MediaStreamDispatcherEventHandler.
34 virtual void OnStreamGenerated(
35 int request_id,
36 const std::string& label,
37 const media_stream::StreamDeviceInfoArray& audio_array,
38 const media_stream::StreamDeviceInfoArray& video_array) OVERRIDE;
39 virtual void OnStreamGenerationFailed(int request_id) OVERRIDE;
40 virtual void OnVideoDeviceFailed(
41 const std::string& label,
42 int index) OVERRIDE;
43 virtual void OnAudioDeviceFailed(
44 const std::string& label,
45 int index) OVERRIDE;
46 virtual void OnDevicesEnumerated(
47 int request_id,
48 const media_stream::StreamDeviceInfoArray& device_array) OVERRIDE;
49 virtual void OnDevicesEnumerationFailed(int request_id) OVERRIDE;
50 virtual void OnDeviceOpened(
51 int request_id,
52 const std::string& label,
53 const media_stream::StreamDeviceInfo& device_info) OVERRIDE;
54 virtual void OnDeviceOpenFailed(int request_id) OVERRIDE;
55
28 private: 56 private:
57 // media_stream_dispatcher_ is a weak reference, owned by RenderView. It's
58 // valid for the lifetime of RenderView.
59 MediaStreamDispatcher* media_stream_dispatcher_;
60
29 scoped_refptr<VideoCaptureImplManager> vc_manager_; 61 scoped_refptr<VideoCaptureImplManager> vc_manager_;
62 std::string local_label_;
30 63
31 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); 64 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl);
32 }; 65 };
33 66
34 #endif // CONTENT_RENDERER_MEDIA_STREAM_MEDIA_STREAM_IMPL_H_ 67 #endif // CONTENT_RENDERER_MEDIA_STREAM_MEDIA_STREAM_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698