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