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

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

Issue 268983002: Revert of Cast: Fix two video freezing problems (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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 4
5 #include "media/cast/audio_sender/audio_sender.h" 5 #include "media/cast/audio_sender/audio_sender.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.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/cast/audio_sender/audio_encoder.h" 10 #include "media/cast/audio_sender/audio_encoder.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 transport_sender_(transport_sender), 43 transport_sender_(transport_sender),
44 rtp_stats_(audio_config.frequency), 44 rtp_stats_(audio_config.frequency),
45 rtcp_feedback_(new LocalRtcpAudioSenderFeedback(this)), 45 rtcp_feedback_(new LocalRtcpAudioSenderFeedback(this)),
46 rtcp_(cast_environment, 46 rtcp_(cast_environment,
47 rtcp_feedback_.get(), 47 rtcp_feedback_.get(),
48 transport_sender_, 48 transport_sender_,
49 NULL, // paced sender. 49 NULL, // paced sender.
50 NULL, 50 NULL,
51 audio_config.rtcp_mode, 51 audio_config.rtcp_mode,
52 base::TimeDelta::FromMilliseconds(audio_config.rtcp_interval), 52 base::TimeDelta::FromMilliseconds(audio_config.rtcp_interval),
53 audio_config.rtp_config.ssrc, 53 audio_config.sender_ssrc,
54 audio_config.incoming_feedback_ssrc, 54 audio_config.incoming_feedback_ssrc,
55 audio_config.rtcp_c_name), 55 audio_config.rtcp_c_name),
56 timers_initialized_(false), 56 timers_initialized_(false),
57 cast_initialization_cb_(STATUS_AUDIO_UNINITIALIZED), 57 cast_initialization_cb_(STATUS_AUDIO_UNINITIALIZED),
58 weak_factory_(this) { 58 weak_factory_(this) {
59 rtcp_.SetCastReceiverEventHistorySize(kReceiverRtcpEventHistorySize); 59 rtcp_.SetCastReceiverEventHistorySize(kReceiverRtcpEventHistorySize);
60 if (!audio_config.use_external_encoder) { 60 if (!audio_config.use_external_encoder) {
61 audio_encoder_.reset( 61 audio_encoder_.reset(
62 new AudioEncoder(cast_environment, 62 new AudioEncoder(cast_environment,
63 audio_config, 63 audio_config,
64 base::Bind(&AudioSender::SendEncodedAudioFrame, 64 base::Bind(&AudioSender::SendEncodedAudioFrame,
65 weak_factory_.GetWeakPtr()))); 65 weak_factory_.GetWeakPtr())));
66 cast_initialization_cb_ = audio_encoder_->InitializationResult(); 66 cast_initialization_cb_ = audio_encoder_->InitializationResult();
67 } 67 }
68
69 media::cast::transport::CastTransportAudioConfig transport_config;
70 transport_config.codec = audio_config.codec;
71 transport_config.rtp.config = audio_config.rtp_config;
72 transport_config.frequency = audio_config.frequency;
73 transport_config.channels = audio_config.channels;
74 transport_config.rtp.max_outstanding_frames =
75 audio_config.rtp_config.max_delay_ms / 100 + 1;
76 transport_sender_->InitializeAudio(transport_config);
77
78 transport_sender_->SubscribeAudioRtpStatsCallback( 68 transport_sender_->SubscribeAudioRtpStatsCallback(
79 base::Bind(&AudioSender::StoreStatistics, weak_factory_.GetWeakPtr())); 69 base::Bind(&AudioSender::StoreStatistics, weak_factory_.GetWeakPtr()));
80 } 70 }
81 71
82 AudioSender::~AudioSender() {} 72 AudioSender::~AudioSender() {}
83 73
84 void AudioSender::InitializeTimers() { 74 void AudioSender::InitializeTimers() {
85 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 75 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
86 if (!timers_initialized_) { 76 if (!timers_initialized_) {
87 timers_initialized_ = true; 77 timers_initialized_ = true;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // We don't send audio logging messages since all captured audio frames will 132 // We don't send audio logging messages since all captured audio frames will
143 // be sent. 133 // be sent.
144 transport::RtcpSenderLogMessage empty_msg; 134 transport::RtcpSenderLogMessage empty_msg;
145 rtp_stats_.UpdateInfo(cast_environment_->Clock()->NowTicks()); 135 rtp_stats_.UpdateInfo(cast_environment_->Clock()->NowTicks());
146 rtcp_.SendRtcpFromRtpSender(empty_msg, rtp_stats_.sender_info()); 136 rtcp_.SendRtcpFromRtpSender(empty_msg, rtp_stats_.sender_info());
147 ScheduleNextRtcpReport(); 137 ScheduleNextRtcpReport();
148 } 138 }
149 139
150 } // namespace cast 140 } // namespace cast
151 } // namespace media 141 } // namespace media
OLDNEW
« no previous file with comments | « chrome/renderer/media/cast_session_delegate.cc ('k') | media/cast/audio_sender/audio_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698