Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: media/cast/cast_sender_impl.cc

Issue 109413004: Cast:Adding cast_transport_config and cleaning up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Injecting TaskRunner Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "media/cast/cast_sender_impl.h" 4 #include "media/cast/cast_sender_impl.h"
5 5
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "media/base/video_frame.h" 10 #include "media/base/video_frame.h"
(...skipping 14 matching lines...) Expand all
25 video_sender_(video_sender) {} 25 video_sender_(video_sender) {}
26 26
27 virtual void InsertRawVideoFrame( 27 virtual void InsertRawVideoFrame(
28 const scoped_refptr<media::VideoFrame>& video_frame, 28 const scoped_refptr<media::VideoFrame>& video_frame,
29 const base::TimeTicks& capture_time) OVERRIDE { 29 const base::TimeTicks& capture_time) OVERRIDE {
30 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, 30 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE,
31 base::Bind(&VideoSender::InsertRawVideoFrame, video_sender_, 31 base::Bind(&VideoSender::InsertRawVideoFrame, video_sender_,
32 video_frame, capture_time)); 32 video_frame, capture_time));
33 } 33 }
34 34
35 virtual void InsertCodedVideoFrame(const EncodedVideoFrame* video_frame, 35 virtual void InsertCodedVideoFrame(
36 const base::TimeTicks& capture_time, 36 const transport::EncodedVideoFrame* video_frame,
37 const base::Closure callback) OVERRIDE { 37 const base::TimeTicks& capture_time,
38 const base::Closure callback) OVERRIDE {
38 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, 39 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE,
39 base::Bind(&VideoSender::InsertCodedVideoFrame, video_sender_, 40 base::Bind(&VideoSender::InsertCodedVideoFrame, video_sender_,
40 video_frame, capture_time, callback)); 41 video_frame, capture_time, callback));
41 } 42 }
42 43
43 virtual void InsertAudio(const AudioBus* audio_bus, 44 virtual void InsertAudio(const AudioBus* audio_bus,
44 const base::TimeTicks& recorded_time, 45 const base::TimeTicks& recorded_time,
45 const base::Closure& done_callback) OVERRIDE { 46 const base::Closure& done_callback) OVERRIDE {
46 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, 47 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE,
47 base::Bind(&AudioSender::InsertAudio, audio_sender_, 48 base::Bind(&AudioSender::InsertAudio, audio_sender_,
48 audio_bus, recorded_time, done_callback)); 49 audio_bus, recorded_time, done_callback));
49 } 50 }
50 51
51 virtual void InsertCodedAudioFrame(const EncodedAudioFrame* audio_frame, 52 virtual void InsertCodedAudioFrame(
52 const base::TimeTicks& recorded_time, 53 const transport::EncodedAudioFrame* audio_frame,
53 const base::Closure callback) OVERRIDE { 54 const base::TimeTicks& recorded_time,
55 const base::Closure callback) OVERRIDE {
54 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, 56 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE,
55 base::Bind(&AudioSender::InsertCodedAudioFrame, audio_sender_, 57 base::Bind(&AudioSender::InsertCodedAudioFrame, audio_sender_,
56 audio_frame, recorded_time, callback)); 58 audio_frame, recorded_time, callback));
57 } 59 }
58 60
59 protected: 61 protected:
60 virtual ~LocalFrameInput() {} 62 virtual ~LocalFrameInput() {}
61 63
62 private: 64 private:
63 friend class base::RefCountedThreadSafe<LocalFrameInput>; 65 friend class base::RefCountedThreadSafe<LocalFrameInput>;
(...skipping 22 matching lines...) Expand all
86 // e.g., audio encoding, over time. The SSRC identifier is a 88 // e.g., audio encoding, over time. The SSRC identifier is a
87 // randomly chosen value meant to be globally unique within a 89 // randomly chosen value meant to be globally unique within a
88 // particular RTP session (see Section 8). A participant need not 90 // particular RTP session (see Section 8). A participant need not
89 // use the same SSRC identifier for all the RTP sessions in a 91 // use the same SSRC identifier for all the RTP sessions in a
90 // multimedia session; the binding of the SSRC identifiers is 92 // multimedia session; the binding of the SSRC identifiers is
91 // provided through RTCP (see Section 6.5.1). If a participant 93 // provided through RTCP (see Section 6.5.1). If a participant
92 // generates multiple streams in one RTP session, for example from 94 // generates multiple streams in one RTP session, for example from
93 // separate video cameras, each MUST be identified as a different 95 // separate video cameras, each MUST be identified as a different
94 // SSRC. 96 // SSRC.
95 97
96 class LocalCastSenderPacketReceiver : public PacketReceiver { 98 class LocalCastSenderPacketReceiver : public transport::PacketReceiver {
97 public: 99 public:
98 LocalCastSenderPacketReceiver(scoped_refptr<CastEnvironment> cast_environment, 100 LocalCastSenderPacketReceiver(scoped_refptr<CastEnvironment> cast_environment,
99 base::WeakPtr<AudioSender> audio_sender, 101 base::WeakPtr<AudioSender> audio_sender,
100 base::WeakPtr<VideoSender> video_sender, 102 base::WeakPtr<VideoSender> video_sender,
101 uint32 ssrc_of_audio_sender, 103 uint32 ssrc_of_audio_sender,
102 uint32 ssrc_of_video_sender) 104 uint32 ssrc_of_video_sender)
103 : cast_environment_(cast_environment), 105 : cast_environment_(cast_environment),
104 audio_sender_(audio_sender), 106 audio_sender_(audio_sender),
105 video_sender_(video_sender), 107 video_sender_(video_sender),
106 ssrc_of_audio_sender_(ssrc_of_audio_sender), 108 ssrc_of_audio_sender_(ssrc_of_audio_sender),
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 video_encoder_controller, 163 video_encoder_controller,
162 packet_sender); 164 packet_sender);
163 } 165 }
164 166
165 CastSenderImpl::CastSenderImpl( 167 CastSenderImpl::CastSenderImpl(
166 scoped_refptr<CastEnvironment> cast_environment, 168 scoped_refptr<CastEnvironment> cast_environment,
167 const AudioSenderConfig& audio_config, 169 const AudioSenderConfig& audio_config,
168 const VideoSenderConfig& video_config, 170 const VideoSenderConfig& video_config,
169 VideoEncoderController* const video_encoder_controller, 171 VideoEncoderController* const video_encoder_controller,
170 PacketSender* const packet_sender) 172 PacketSender* const packet_sender)
171 : pacer_(cast_environment, packet_sender), 173 : pacer_(cast_environment->Clock(), packet_sender,
174 cast_environment->GetMessageTaskRunnerForThread(
175 CastEnvironment::MAIN)),
172 audio_sender_(cast_environment, audio_config, &pacer_), 176 audio_sender_(cast_environment, audio_config, &pacer_),
173 video_sender_(cast_environment, video_config, video_encoder_controller, 177 video_sender_(cast_environment, video_config, video_encoder_controller,
174 &pacer_), 178 &pacer_),
175 frame_input_(new LocalFrameInput(cast_environment, 179 frame_input_(new LocalFrameInput(cast_environment,
176 audio_sender_.AsWeakPtr(), 180 audio_sender_.AsWeakPtr(),
177 video_sender_.AsWeakPtr())), 181 video_sender_.AsWeakPtr())),
178 packet_receiver_(new LocalCastSenderPacketReceiver(cast_environment, 182 packet_receiver_(new LocalCastSenderPacketReceiver(cast_environment,
179 audio_sender_.AsWeakPtr(), video_sender_.AsWeakPtr(), 183 audio_sender_.AsWeakPtr(), video_sender_.AsWeakPtr(),
180 audio_config.incoming_feedback_ssrc, 184 audio_config.incoming_feedback_ssrc,
181 video_config.incoming_feedback_ssrc)) {} 185 video_config.incoming_feedback_ssrc)) {}
182 186
183 CastSenderImpl::~CastSenderImpl() {} 187 CastSenderImpl::~CastSenderImpl() {}
184 188
185 scoped_refptr<FrameInput> CastSenderImpl::frame_input() { 189 scoped_refptr<FrameInput> CastSenderImpl::frame_input() {
186 return frame_input_; 190 return frame_input_;
187 } 191 }
188 192
189 scoped_refptr<PacketReceiver> CastSenderImpl::packet_receiver() { 193 scoped_refptr<transport::PacketReceiver> CastSenderImpl::packet_receiver() {
190 return packet_receiver_; 194 return packet_receiver_;
191 } 195 }
192 196
193 } // namespace cast 197 } // namespace cast
194 } // namespace media 198 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698