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
3 // found in the LICENSE file.
4 #ifndef MEDIA_CAST_CAST_SENDER_IMPL_H_
5 #define MEDIA_CAST_CAST_SENDER_IMPL_H_
7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "media/cast/cast_config.h"
10 #include "media/cast/cast_defines.h"
11 #include "media/cast/cast_environment.h"
12 #include "media/cast/cast_sender.h"
13 #include "media/cast/sender/audio_sender.h"
14 #include "media/cast/sender/video_sender.h"
23 // This class combines all required sending objects such as the audio and video
24 // senders, pacer, packet receiver and frame input.
25 class CastSenderImpl
: public CastSender
{
27 CastSenderImpl(scoped_refptr
<CastEnvironment
> cast_environment
,
28 CastTransportSender
* const transport_sender
);
30 void InitializeAudio(const AudioSenderConfig
& audio_config
,
31 const StatusChangeCallback
& status_change_cb
) final
;
33 const VideoSenderConfig
& video_config
,
34 const StatusChangeCallback
& status_change_cb
,
35 const CreateVideoEncodeAcceleratorCallback
& create_vea_cb
,
36 const CreateVideoEncodeMemoryCallback
& create_video_encode_mem_cb
)
39 void SetTargetPlayoutDelay(base::TimeDelta new_target_playout_delay
) final
;
41 ~CastSenderImpl() final
;
43 scoped_refptr
<AudioFrameInput
> audio_frame_input() final
;
44 scoped_refptr
<VideoFrameInput
> video_frame_input() final
;
47 void ReceivedPacket(scoped_ptr
<Packet
> packet
);
48 void OnAudioStatusChange(const StatusChangeCallback
& status_change_cb
,
49 OperationalStatus status
);
50 void OnVideoStatusChange(const StatusChangeCallback
& status_change_cb
,
51 OperationalStatus status
);
53 scoped_ptr
<AudioSender
> audio_sender_
;
54 scoped_ptr
<VideoSender
> video_sender_
;
55 scoped_refptr
<AudioFrameInput
> audio_frame_input_
;
56 scoped_refptr
<VideoFrameInput
> video_frame_input_
;
57 scoped_refptr
<CastEnvironment
> cast_environment_
;
58 // The transport sender is owned by the owner of the CastSender, and should be
59 // valid throughout the lifetime of the CastSender.
60 CastTransportSender
* const transport_sender_
;
62 // NOTE: Weak pointers must be invalidated before all other member variables.
63 base::WeakPtrFactory
<CastSenderImpl
> weak_factory_
;
65 DISALLOW_COPY_AND_ASSIGN(CastSenderImpl
);
71 #endif // MEDIA_CAST_CAST_SENDER_IMPL_H_