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 #ifndef MEDIA_CAST_CAST_SENDER_IMPL_H_ | 4 #ifndef MEDIA_CAST_CAST_SENDER_IMPL_H_ |
5 #define MEDIA_CAST_CAST_SENDER_IMPL_H_ | 5 #define MEDIA_CAST_CAST_SENDER_IMPL_H_ |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "media/cast/audio_sender/audio_sender.h" | |
10 #include "media/cast/cast_config.h" | 9 #include "media/cast/cast_config.h" |
11 #include "media/cast/cast_defines.h" | 10 #include "media/cast/cast_defines.h" |
12 #include "media/cast/cast_environment.h" | 11 #include "media/cast/cast_environment.h" |
13 #include "media/cast/cast_sender.h" | 12 #include "media/cast/cast_sender.h" |
14 #include "media/cast/video_sender/video_sender.h" | 13 #include "media/cast/sender/audio_sender.h" |
| 14 #include "media/cast/sender/video_sender.h" |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 class VideoFrame; | 17 class VideoFrame; |
18 | 18 |
19 namespace cast { | 19 namespace cast { |
20 class AudioSender; | 20 class AudioSender; |
21 class VideoSender; | 21 class VideoSender; |
22 | 22 |
23 // This class combines all required sending objects such as the audio and video | 23 // This class combines all required sending objects such as the audio and video |
24 // senders, pacer, packet receiver and frame input. | 24 // senders, pacer, packet receiver and frame input. |
25 class CastSenderImpl : public CastSender { | 25 class CastSenderImpl : public CastSender { |
26 public: | 26 public: |
27 CastSenderImpl(scoped_refptr<CastEnvironment> cast_environment, | 27 CastSenderImpl(scoped_refptr<CastEnvironment> cast_environment, |
28 transport::CastTransportSender* const transport_sender); | 28 CastTransportSender* const transport_sender); |
29 | 29 |
30 virtual void InitializeAudio( | 30 virtual void InitializeAudio( |
31 const AudioSenderConfig& audio_config, | 31 const AudioSenderConfig& audio_config, |
32 const CastInitializationCallback& cast_initialization_cb) OVERRIDE; | 32 const CastInitializationCallback& cast_initialization_cb) OVERRIDE; |
33 virtual void InitializeVideo( | 33 virtual void InitializeVideo( |
34 const VideoSenderConfig& video_config, | 34 const VideoSenderConfig& video_config, |
35 const CastInitializationCallback& cast_initialization_cb, | 35 const CastInitializationCallback& cast_initialization_cb, |
36 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, | 36 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, |
37 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) | 37 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) |
38 OVERRIDE; | 38 OVERRIDE; |
39 | 39 |
40 virtual ~CastSenderImpl(); | 40 virtual ~CastSenderImpl(); |
41 | 41 |
42 virtual scoped_refptr<AudioFrameInput> audio_frame_input() OVERRIDE; | 42 virtual scoped_refptr<AudioFrameInput> audio_frame_input() OVERRIDE; |
43 virtual scoped_refptr<VideoFrameInput> video_frame_input() OVERRIDE; | 43 virtual scoped_refptr<VideoFrameInput> video_frame_input() OVERRIDE; |
44 | 44 |
45 virtual transport::PacketReceiverCallback packet_receiver() OVERRIDE; | 45 virtual PacketReceiverCallback packet_receiver() OVERRIDE; |
46 | 46 |
47 private: | 47 private: |
48 void ReceivedPacket(scoped_ptr<Packet> packet); | 48 void ReceivedPacket(scoped_ptr<Packet> packet); |
49 | 49 |
50 CastInitializationCallback initialization_callback_; | 50 CastInitializationCallback initialization_callback_; |
51 scoped_ptr<AudioSender> audio_sender_; | 51 scoped_ptr<AudioSender> audio_sender_; |
52 scoped_ptr<VideoSender> video_sender_; | 52 scoped_ptr<VideoSender> video_sender_; |
53 scoped_refptr<AudioFrameInput> audio_frame_input_; | 53 scoped_refptr<AudioFrameInput> audio_frame_input_; |
54 scoped_refptr<VideoFrameInput> video_frame_input_; | 54 scoped_refptr<VideoFrameInput> video_frame_input_; |
55 scoped_refptr<CastEnvironment> cast_environment_; | 55 scoped_refptr<CastEnvironment> cast_environment_; |
56 // The transport sender is owned by the owner of the CastSender, and should be | 56 // The transport sender is owned by the owner of the CastSender, and should be |
57 // valid throughout the lifetime of the CastSender. | 57 // valid throughout the lifetime of the CastSender. |
58 transport::CastTransportSender* const transport_sender_; | 58 CastTransportSender* const transport_sender_; |
59 uint32 ssrc_of_audio_sender_; | 59 uint32 ssrc_of_audio_sender_; |
60 uint32 ssrc_of_video_sender_; | 60 uint32 ssrc_of_video_sender_; |
61 | 61 |
62 // NOTE: Weak pointers must be invalidated before all other member variables. | 62 // NOTE: Weak pointers must be invalidated before all other member variables. |
63 base::WeakPtrFactory<CastSenderImpl> weak_factory_; | 63 base::WeakPtrFactory<CastSenderImpl> weak_factory_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(CastSenderImpl); | 65 DISALLOW_COPY_AND_ASSIGN(CastSenderImpl); |
66 }; | 66 }; |
67 | 67 |
68 } // namespace cast | 68 } // namespace cast |
69 } // namespace media | 69 } // namespace media |
70 | 70 |
71 #endif // MEDIA_CAST_CAST_SENDER_IMPL_H_ | 71 #endif // MEDIA_CAST_CAST_SENDER_IMPL_H_ |
OLD | NEW |