OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 // After calling StartAudio() or StartVideo() encoding of that media will | 47 // After calling StartAudio() or StartVideo() encoding of that media will |
48 // begin as soon as data is delivered to its sink, if the second method is | 48 // begin as soon as data is delivered to its sink, if the second method is |
49 // called the first media will be restarted. It is strongly recommended not to | 49 // called the first media will be restarted. It is strongly recommended not to |
50 // deliver any data between calling the two methods. | 50 // deliver any data between calling the two methods. |
51 // It's OK to call only one of the two methods. | 51 // It's OK to call only one of the two methods. |
52 void StartAudio(const media::cast::AudioSenderConfig& config, | 52 void StartAudio(const media::cast::AudioSenderConfig& config, |
53 const FrameInputAvailableCallback& callback); | 53 const FrameInputAvailableCallback& callback); |
54 void StartVideo(const media::cast::VideoSenderConfig& config, | 54 void StartVideo(const media::cast::VideoSenderConfig& config, |
55 const FrameInputAvailableCallback& callback); | 55 const FrameInputAvailableCallback& callback); |
| 56 void StartUDP(const net::IPEndPoint& local_endpoint, |
| 57 const net::IPEndPoint& remote_endpoint); |
56 | 58 |
57 protected: | 59 protected: |
58 // Callback with the result of the initialization. | 60 // Callback with the result of the initialization. |
59 // If this callback is called with STATUS_INITIALIZED it will report back | 61 // If this callback is called with STATUS_INITIALIZED it will report back |
60 // to the sinks that it's ready to accept incoming audio / video frames. | 62 // to the sinks that it's ready to accept incoming audio / video frames. |
61 void InitializationResult(media::cast::CastInitializationStatus result) const; | 63 void InitializationResult(media::cast::CastInitializationStatus result) const; |
62 | 64 |
63 private: | 65 private: |
64 // Start encoding threads and initialize the CastEnvironment. | 66 // Start encoding threads and initialize the CastEnvironment. |
65 void Initialize(); | 67 void Initialize(); |
66 | 68 |
67 // Configure CastSender. It is ready to accept audio / video frames after | 69 // Configure CastSender. It is ready to accept audio / video frames after |
68 // receiving a successful call to InitializationResult. | 70 // receiving a successful call to InitializationResult. |
69 void StartSendingInternal(const FrameInputAvailableCallback& callback, | 71 void StartSendingInternal(); |
70 bool is_audio); | 72 |
| 73 void StatusNotificationCB( |
| 74 media::cast::transport::CastTransportStatus status); |
71 | 75 |
72 base::ThreadChecker thread_checker_; | 76 base::ThreadChecker thread_checker_; |
73 scoped_refptr<media::cast::CastEnvironment> cast_environment_; | 77 scoped_refptr<media::cast::CastEnvironment> cast_environment_; |
74 scoped_ptr<media::cast::CastSender> cast_sender_; | 78 scoped_ptr<media::cast::CastSender> cast_sender_; |
75 scoped_ptr<media::cast::transport::CastTransportSender> cast_transport_; | 79 scoped_ptr<media::cast::transport::CastTransportSender> cast_transport_; |
76 | 80 |
77 // Utilities threads owned by this class. They are used by CastSender for | 81 // Utilities threads owned by this class. They are used by CastSender for |
78 // encoding. | 82 // encoding. |
79 // TODO(hclam): See crbug.com/317006 for more details. | 83 // TODO(hclam): See crbug.com/317006 for more details. |
80 // This class shouldn't create and own threads. | 84 // This class shouldn't create and own threads. |
81 base::Thread audio_encode_thread_; | 85 base::Thread audio_encode_thread_; |
82 base::Thread video_encode_thread_; | 86 base::Thread video_encode_thread_; |
83 | 87 |
84 // Configuration for audio and video. | 88 // Configuration for audio and video. |
85 scoped_ptr<media::cast::AudioSenderConfig> audio_config_; | 89 scoped_ptr<media::cast::AudioSenderConfig> audio_config_; |
86 scoped_ptr<media::cast::VideoSenderConfig> video_config_; | 90 scoped_ptr<media::cast::VideoSenderConfig> video_config_; |
87 | 91 |
88 scoped_ptr<FrameInputAvailableCallback> audio_frame_input_available_callback_; | 92 FrameInputAvailableCallback audio_frame_input_available_callback_; |
89 scoped_ptr<FrameInputAvailableCallback> video_frame_input_available_callback_; | 93 FrameInputAvailableCallback video_frame_input_available_callback_; |
| 94 |
| 95 net::IPEndPoint local_endpoint_; |
| 96 net::IPEndPoint remote_endpoint_; |
| 97 bool transport_configured_; |
90 | 98 |
91 // Proxy to the IO message loop. | 99 // Proxy to the IO message loop. |
92 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 100 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
93 | 101 |
94 DISALLOW_COPY_AND_ASSIGN(CastSessionDelegate); | 102 DISALLOW_COPY_AND_ASSIGN(CastSessionDelegate); |
95 }; | 103 }; |
96 | 104 |
97 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_ | 105 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_ |
OLD | NEW |