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" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
14 #include "base/time/default_tick_clock.h" | 14 #include "base/time/default_tick_clock.h" |
15 #include "media/cast/cast_config.h" | 15 #include "media/cast/cast_config.h" |
16 #include "media/cast/cast_sender.h" | 16 #include "media/cast/cast_sender.h" |
| 17 #include "media/cast/logging/logging_defines.h" |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 class MessageLoopProxy; | 20 class MessageLoopProxy; |
20 } // namespace base | 21 } // namespace base |
21 | 22 |
22 namespace media { | 23 namespace media { |
23 class VideoFrame; | 24 class VideoFrame; |
24 | 25 |
25 namespace cast { | 26 namespace cast { |
26 class CastEnvironment; | 27 class CastEnvironment; |
| 28 class CastLoggingConfig; |
27 class EncodingEventSubscriber; | 29 class EncodingEventSubscriber; |
28 class FrameInput; | 30 class FrameInput; |
29 | 31 |
30 namespace transport { | 32 namespace transport { |
31 class CastTransportSender; | 33 class CastTransportSender; |
32 } // namespace transport | 34 } // namespace transport |
33 } // namespace cast | 35 } // namespace cast |
34 } // namespace media | 36 } // namespace media |
35 | 37 |
36 // This class hosts CastSender and connects it to audio/video frame input | 38 // This class hosts CastSender and connects it to audio/video frame input |
(...skipping 25 matching lines...) Expand all Loading... |
62 void GetEventLogsAndReset(const EventLogsCallback& callback); | 64 void GetEventLogsAndReset(const EventLogsCallback& callback); |
63 | 65 |
64 protected: | 66 protected: |
65 // Callback with the result of the initialization. | 67 // Callback with the result of the initialization. |
66 // If this callback is called with STATUS_INITIALIZED it will report back | 68 // If this callback is called with STATUS_INITIALIZED it will report back |
67 // to the sinks that it's ready to accept incoming audio / video frames. | 69 // to the sinks that it's ready to accept incoming audio / video frames. |
68 void InitializationResult(media::cast::CastInitializationStatus result) const; | 70 void InitializationResult(media::cast::CastInitializationStatus result) const; |
69 | 71 |
70 private: | 72 private: |
71 // Start encoding threads and initialize the CastEnvironment. | 73 // Start encoding threads and initialize the CastEnvironment. |
72 void Initialize(); | 74 void Initialize(const media::cast::CastLoggingConfig& logging_config); |
73 | 75 |
74 // Configure CastSender. It is ready to accept audio / video frames after | 76 // Configure CastSender. It is ready to accept audio / video frames after |
75 // receiving a successful call to InitializationResult. | 77 // receiving a successful call to InitializationResult. |
76 void StartSendingInternal(); | 78 void StartSendingInternal(); |
77 | 79 |
78 void StatusNotificationCB( | 80 void StatusNotificationCB( |
79 media::cast::transport::CastTransportStatus status); | 81 media::cast::transport::CastTransportStatus status); |
80 | 82 |
| 83 // Adds logs collected from transport on browser side. |
| 84 void LogRawEvents(const std::vector<media::cast::PacketEvent>& packet_events); |
| 85 |
81 base::ThreadChecker thread_checker_; | 86 base::ThreadChecker thread_checker_; |
82 scoped_refptr<media::cast::CastEnvironment> cast_environment_; | 87 scoped_refptr<media::cast::CastEnvironment> cast_environment_; |
83 scoped_ptr<media::cast::CastSender> cast_sender_; | 88 scoped_ptr<media::cast::CastSender> cast_sender_; |
84 scoped_ptr<media::cast::transport::CastTransportSender> cast_transport_; | 89 scoped_ptr<media::cast::transport::CastTransportSender> cast_transport_; |
85 | 90 |
86 // Configuration for audio and video. | 91 // Configuration for audio and video. |
87 scoped_ptr<media::cast::AudioSenderConfig> audio_config_; | 92 scoped_ptr<media::cast::AudioSenderConfig> audio_config_; |
88 scoped_ptr<media::cast::VideoSenderConfig> video_config_; | 93 scoped_ptr<media::cast::VideoSenderConfig> video_config_; |
89 | 94 |
90 FrameInputAvailableCallback audio_frame_input_available_callback_; | 95 FrameInputAvailableCallback audio_frame_input_available_callback_; |
91 FrameInputAvailableCallback video_frame_input_available_callback_; | 96 FrameInputAvailableCallback video_frame_input_available_callback_; |
92 | 97 |
93 scoped_ptr<media::cast::EncodingEventSubscriber> audio_event_subscriber_; | 98 scoped_ptr<media::cast::EncodingEventSubscriber> audio_event_subscriber_; |
94 scoped_ptr<media::cast::EncodingEventSubscriber> video_event_subscriber_; | 99 scoped_ptr<media::cast::EncodingEventSubscriber> video_event_subscriber_; |
95 | 100 |
96 net::IPEndPoint local_endpoint_; | 101 net::IPEndPoint local_endpoint_; |
97 net::IPEndPoint remote_endpoint_; | 102 net::IPEndPoint remote_endpoint_; |
98 bool transport_configured_; | 103 bool transport_configured_; |
99 | 104 |
100 // Proxy to the IO message loop. | 105 // Proxy to the IO message loop. |
101 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 106 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
102 | 107 |
103 DISALLOW_COPY_AND_ASSIGN(CastSessionDelegate); | 108 DISALLOW_COPY_AND_ASSIGN(CastSessionDelegate); |
104 }; | 109 }; |
105 | 110 |
106 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_ | 111 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_ |
OLD | NEW |