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

Side by Side Diff: media/cast/sender/audio_sender.cc

Issue 1878883003: Refactor: simplify interface of SenderRtcpSession and CastTransport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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
« no previous file with comments | « media/cast/net/rtcp/sender_rtcp_session.cc ('k') | media/cast/sender/frame_sender.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 4
5 #include "media/cast/sender/audio_sender.h" 5 #include "media/cast/sender/audio_sender.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ptr_util.h"
11 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
12 #include "media/cast/common/rtp_time.h" 13 #include "media/cast/common/rtp_time.h"
13 #include "media/cast/net/cast_transport_config.h" 14 #include "media/cast/net/cast_transport_config.h"
14 #include "media/cast/sender/audio_encoder.h" 15 #include "media/cast/sender/audio_encoder.h"
15 16
16 namespace media { 17 namespace media {
17 namespace cast { 18 namespace cast {
18 19
19 AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment, 20 AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment,
20 const AudioSenderConfig& audio_config, 21 const AudioSenderConfig& audio_config,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 audio_config.frequency / audio_encoder_->GetSamplesPerFrame(); 62 audio_config.frequency / audio_encoder_->GetSamplesPerFrame();
62 63
63 media::cast::CastTransportRtpConfig transport_config; 64 media::cast::CastTransportRtpConfig transport_config;
64 transport_config.ssrc = audio_config.ssrc; 65 transport_config.ssrc = audio_config.ssrc;
65 transport_config.feedback_ssrc = audio_config.receiver_ssrc; 66 transport_config.feedback_ssrc = audio_config.receiver_ssrc;
66 transport_config.rtp_payload_type = audio_config.rtp_payload_type; 67 transport_config.rtp_payload_type = audio_config.rtp_payload_type;
67 transport_config.aes_key = audio_config.aes_key; 68 transport_config.aes_key = audio_config.aes_key;
68 transport_config.aes_iv_mask = audio_config.aes_iv_mask; 69 transport_config.aes_iv_mask = audio_config.aes_iv_mask;
69 70
70 transport_sender->InitializeAudio( 71 transport_sender->InitializeAudio(
71 transport_config, base::Bind(&AudioSender::OnReceivedCastFeedback, 72 transport_config, base::WrapUnique(new FrameSender::RtcpClient(
72 weak_factory_.GetWeakPtr()), 73 weak_factory_.GetWeakPtr())));
73 base::Bind(&AudioSender::OnMeasuredRoundTripTime,
74 weak_factory_.GetWeakPtr()),
75 base::Bind(&AudioSender::OnReceivedPli, weak_factory_.GetWeakPtr()));
76 } 74 }
77 75
78 AudioSender::~AudioSender() {} 76 AudioSender::~AudioSender() {}
79 77
80 void AudioSender::InsertAudio(std::unique_ptr<AudioBus> audio_bus, 78 void AudioSender::InsertAudio(std::unique_ptr<AudioBus> audio_bus,
81 const base::TimeTicks& recorded_time) { 79 const base::TimeTicks& recorded_time) {
82 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 80 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
83 81
84 if (!audio_encoder_) { 82 if (!audio_encoder_) {
85 NOTREACHED(); 83 NOTREACHED();
(...skipping 29 matching lines...) Expand all
115 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 113 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
116 114
117 samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped; 115 samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped;
118 DCHECK_GE(samples_in_encoder_, 0); 116 DCHECK_GE(samples_in_encoder_, 0);
119 117
120 SendEncodedFrame(encoder_bitrate, std::move(encoded_frame)); 118 SendEncodedFrame(encoder_bitrate, std::move(encoded_frame));
121 } 119 }
122 120
123 } // namespace cast 121 } // namespace cast
124 } // namespace media 122 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/net/rtcp/sender_rtcp_session.cc ('k') | media/cast/sender/frame_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698