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/audio_sender/audio_sender.h"
10 #include "media/cast/cast_config.h"
11 #include "media/cast/cast_environment.h"
12 #include "media/cast/cast_sender.h"
13 #include "media/cast/video_sender/video_sender.h"
25 // This calls is a pure owner class that group all required sending objects
26 // together such as pacer, packet receiver, frame input, audio and video sender.
27 class CastSenderImpl
: public CastSender
{
30 scoped_refptr
<CastEnvironment
> cast_environment
,
31 const AudioSenderConfig
* audio_config
,
32 const VideoSenderConfig
* video_config
,
33 const scoped_refptr
<GpuVideoAcceleratorFactories
>& gpu_factories
,
34 const CastInitializationCallback
& initialization_status
,
35 transport::CastTransportSender
* const transport_sender
);
37 virtual ~CastSenderImpl();
39 virtual scoped_refptr
<FrameInput
> frame_input() OVERRIDE
;
40 virtual transport::PacketReceiverCallback
packet_receiver() OVERRIDE
;
43 void ReceivedPacket(scoped_ptr
<Packet
> packet
);
44 // Used to trampoline the result back on the correct thread. And guaranteed
45 // not to be called until the creation is complete.
46 void InitializationResult(CastInitializationStatus status
) const;
48 CastInitializationCallback initialization_callback_
;
49 scoped_ptr
<AudioSender
> audio_sender_
;
50 scoped_ptr
<VideoSender
> video_sender_
;
51 scoped_refptr
<FrameInput
> frame_input_
;
52 transport::PacketReceiverCallback packet_receiver_
;
53 scoped_refptr
<CastEnvironment
> cast_environment_
;
54 uint32 ssrc_of_audio_sender_
;
55 uint32 ssrc_of_video_sender_
;
56 base::WeakPtrFactory
<CastSenderImpl
> weak_factory_
;
58 DISALLOW_COPY_AND_ASSIGN(CastSenderImpl
);
64 #endif // MEDIA_CAST_CAST_SENDER_IMPL_H_