Index: chrome/renderer/media/cast_session_delegate.h |
diff --git a/chrome/renderer/media/cast_session_delegate.h b/chrome/renderer/media/cast_session_delegate.h |
index 008c327b9af83c449daa8f1850579e60c950bc97..eaa4570a82eede3a1c7ce657a9984c200985a877 100644 |
--- a/chrome/renderer/media/cast_session_delegate.h |
+++ b/chrome/renderer/media/cast_session_delegate.h |
@@ -17,7 +17,9 @@ |
#include "base/time/default_tick_clock.h" |
#include "media/cast/cast_config.h" |
#include "media/cast/cast_sender.h" |
+#include "media/cast/logging/encoding_event_subscriber.h" |
#include "media/cast/logging/logging_defines.h" |
+#include "media/cast/logging/stats_event_subscriber.h" |
namespace base { |
class BinaryValue; |
@@ -32,6 +34,7 @@ namespace cast { |
class CastEnvironment; |
class EncodingEventSubscriber; |
class FrameInput; |
+class ReceiverTimeOffsetEstimator; |
class StatsEventSubscriber; |
namespace transport { |
@@ -40,6 +43,45 @@ class CastTransportSender; |
} // namespace cast |
} // namespace media |
+class RawEventSubscriberBundleForStream { |
miu
2014/04/18 00:02:03
Have you considered declaring/defining these two n
miu
2014/04/18 00:02:03
Need class comments: What are these being used for
imcheng
2014/04/18 18:20:27
Done.
imcheng
2014/04/18 18:20:27
Done.
|
+ public: |
+ RawEventSubscriberBundleForStream( |
+ bool is_audio, |
+ media::cast::ReceiverTimeOffsetEstimator* offset_estimator, |
+ const scoped_refptr<media::cast::CastEnvironment>& cast_environment); |
miu
2014/04/18 00:02:03
nit: For consistency with a lot of the other cast
imcheng
2014/04/18 18:20:27
Done.
|
+ ~RawEventSubscriberBundleForStream(); |
+ media::cast::EncodingEventSubscriber* GetEncodingEventSubscriber(); |
+ media::cast::StatsEventSubscriber* GetStatsEventSubscriber(); |
+ |
+ private: |
+ scoped_refptr<media::cast::CastEnvironment> cast_environment_; |
miu
2014/04/18 00:02:03
const scoped_refptr<...>
imcheng
2014/04/18 18:20:27
Done.
|
+ media::cast::EncodingEventSubscriber event_subscriber_; |
+ media::cast::StatsEventSubscriber stats_subscriber_; |
+}; |
+ |
+class RawEventSubscriberBundle { |
+ public: |
+ RawEventSubscriberBundle( |
miu
2014/04/18 00:02:03
Needs explicit keyword.
imcheng
2014/04/18 18:20:27
Done.
|
+ const scoped_refptr<media::cast::CastEnvironment>& cast_environment); |
+ ~RawEventSubscriberBundle(); |
+ void AddEventSubscribers(bool is_audio); |
+ void RemoveEventSubscribers(bool is_audio); |
+ media::cast::EncodingEventSubscriber* GetEncodingEventSubscriber( |
+ bool is_audio); |
+ media::cast::StatsEventSubscriber* GetStatsEventSubscriber(bool is_audio); |
+ |
+ private: |
+ // Map from (is_audio) -> RawEventSubscriberBundleForStream. |
+ // TODO(imcheng): This works because we only have 1 audio and 1 video stream. |
+ // This needs to scale better. |
+ typedef std::map<bool, linked_ptr<RawEventSubscriberBundleForStream> > |
+ SubscribersMapByStream; |
+ scoped_refptr<media::cast::CastEnvironment> cast_environment_; |
miu
2014/04/18 00:02:03
const
imcheng
2014/04/18 18:20:27
Done.
|
+ SubscribersMapByStream subscribers_; |
+ scoped_ptr<media::cast::ReceiverTimeOffsetEstimator> |
+ receiver_offset_estimator_; |
+}; |
+ |
// This class hosts CastSender and connects it to audio/video frame input |
// and network socket. |
// This class is created on the render thread and destroyed on the IO |
@@ -106,11 +148,7 @@ class CastSessionDelegate { |
AudioFrameInputAvailableCallback audio_frame_input_available_callback_; |
VideoFrameInputAvailableCallback video_frame_input_available_callback_; |
- scoped_ptr<media::cast::EncodingEventSubscriber> audio_event_subscriber_; |
- scoped_ptr<media::cast::EncodingEventSubscriber> video_event_subscriber_; |
- |
- scoped_ptr<media::cast::StatsEventSubscriber> audio_stats_subscriber_; |
- scoped_ptr<media::cast::StatsEventSubscriber> video_stats_subscriber_; |
+ scoped_ptr<RawEventSubscriberBundle> event_subscribers_; |
// Proxy to the IO message loop. |
scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |