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

Side by Side Diff: chrome/renderer/media/cast_session_delegate.h

Issue 138753004: Cast: IPC glue between cast library transport and encoders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more tests Created 6 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_ 5 #ifndef CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_
6 #define CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_ 6 #define CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 14 matching lines...) Expand all
25 namespace cast { 25 namespace cast {
26 class CastEnvironment; 26 class CastEnvironment;
27 class FrameInput; 27 class FrameInput;
28 28
29 namespace transport { 29 namespace transport {
30 class CastTransportSender; 30 class CastTransportSender;
31 } // namespace transport 31 } // namespace transport
32 } // namespace cast 32 } // namespace cast
33 } // namespace media 33 } // namespace media
34 34
35 namespace cast {
36 class CastIPCDispatcher;
37 };
38
35 // This class hosts CastSender and connects it to audio/video frame input 39 // This class hosts CastSender and connects it to audio/video frame input
36 // and network socket. 40 // and network socket.
37 // This class is created on the render thread and destroyed on the IO 41 // This class is created on the render thread and destroyed on the IO
38 // thread. All methods are accessible only on the IO thread. 42 // thread. All methods are accessible only on the IO thread.
39 class CastSessionDelegate { 43 class CastSessionDelegate {
40 public: 44 public:
41 typedef 45 typedef
42 base::Callback<void(const scoped_refptr<media::cast::FrameInput>&)> 46 base::Callback<void(const scoped_refptr<media::cast::FrameInput>&)>
43 FrameInputAvailableCallback; 47 FrameInputAvailableCallback;
44 48
45 CastSessionDelegate(); 49 CastSessionDelegate();
46 virtual ~CastSessionDelegate(); 50 virtual ~CastSessionDelegate();
47 51
48 // After calling StartAudio() and StartVideo() with configuration encoding 52 // After calling StartAudio() and StartVideo() with configuration encoding
49 // will begin. 53 // will begin.
50 void StartAudio(const media::cast::AudioSenderConfig& config, 54 void StartAudio(const media::cast::AudioSenderConfig& config,
51 const FrameInputAvailableCallback& callback); 55 const FrameInputAvailableCallback& callback);
52 void StartVideo(const media::cast::VideoSenderConfig& config, 56 void StartVideo(const media::cast::VideoSenderConfig& config,
53 const FrameInputAvailableCallback& callback); 57 const FrameInputAvailableCallback& callback);
58 void StartUDP(const net::IPEndPoint& local_endpoint,
59 const net::IPEndPoint& remote_endpoint);
54 60
55 private: 61 private:
56 // Start encoding threads and configure CastSender. It is ready to accept 62 // Start encoding threads and configure CastSender. It is ready to accept
57 // audio/video frames after this call. 63 // audio/video frames after this call.
58 void StartSendingInternal(); 64 void StartSendingInternal();
59 65
60 // Callback with the result of the initialization. 66 // Callback with the result of the initialization.
61 void InitializationResult(media::cast::CastInitializationStatus result); 67 void InitializationResult(media::cast::CastInitializationStatus result);
62 68
63 base::ThreadChecker thread_checker_; 69 base::ThreadChecker thread_checker_;
64 scoped_refptr<media::cast::CastEnvironment> cast_environment_; 70 scoped_refptr<media::cast::CastEnvironment> cast_environment_;
65 scoped_ptr<media::cast::CastSender> cast_sender_; 71 scoped_ptr<media::cast::CastSender> cast_sender_;
66 scoped_ptr<media::cast::transport::CastTransportSender> cast_transport_; 72 scoped_ptr<media::cast::transport::CastTransportSender> cast_transport_;
67 73
68 // Utilities threads owned by this class. They are used by CastSender for 74 // Utilities threads owned by this class. They are used by CastSender for
69 // encoding. 75 // encoding.
70 // TODO(hclam): See crbug.com/317006 for more details. 76 // TODO(hclam): See crbug.com/317006 for more details.
71 // This class shouldn't create and own threads. 77 // This class shouldn't create and own threads.
72 base::Thread audio_encode_thread_; 78 base::Thread audio_encode_thread_;
73 base::Thread video_encode_thread_; 79 base::Thread video_encode_thread_;
74 80
75 // Configuration for audio and video. 81 // Configuration for audio and video.
76 media::cast::AudioSenderConfig audio_config_; 82 media::cast::AudioSenderConfig audio_config_;
77 media::cast::VideoSenderConfig video_config_; 83 media::cast::VideoSenderConfig video_config_;
78 bool audio_configured_; 84 bool audio_configured_;
79 bool video_configured_; 85 bool video_configured_;
86 net::IPEndPoint local_endpoint_;
87 net::IPEndPoint remote_endpoint_;
88 bool transport_configured_;
80 std::vector<FrameInputAvailableCallback> frame_input_available_callbacks_; 89 std::vector<FrameInputAvailableCallback> frame_input_available_callbacks_;
81 90
82 // Proxy to the IO message loop. 91 // Proxy to the IO message loop.
83 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 92 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
84 93
85 DISALLOW_COPY_AND_ASSIGN(CastSessionDelegate); 94 DISALLOW_COPY_AND_ASSIGN(CastSessionDelegate);
86 }; 95 };
87 96
88 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_ 97 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698