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

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

Issue 229503002: Cast: Make castv2 mirroring performance test run again (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 6 years, 8 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/audio_receiver/audio_receiver.h ('k') | media/cast/cast_environment.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 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_receiver/audio_receiver.h" 5 #include "media/cast/audio_receiver/audio_receiver.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 if (!audio_config.use_external_decoder) 52 if (!audio_config.use_external_decoder)
53 audio_decoder_.reset(new AudioDecoder(cast_environment, audio_config)); 53 audio_decoder_.reset(new AudioDecoder(cast_environment, audio_config));
54 decryptor_.Initialize(audio_config.aes_key, audio_config.aes_iv_mask); 54 decryptor_.Initialize(audio_config.aes_key, audio_config.aes_iv_mask);
55 rtcp_.SetTargetDelay(target_delay_delta_); 55 rtcp_.SetTargetDelay(target_delay_delta_);
56 cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_); 56 cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_);
57 memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_)); 57 memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_));
58 } 58 }
59 59
60 AudioReceiver::~AudioReceiver() { 60 AudioReceiver::~AudioReceiver() {
61 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 61 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
62
63 // If any callbacks for encoded audio frames are queued, flush them out now.
64 // This is critical because some Closures in |frame_request_queue_| may have
65 // Unretained references to |this|.
66 while (!frame_request_queue_.empty()) {
67 frame_request_queue_.front().Run(
68 make_scoped_ptr<transport::EncodedAudioFrame>(NULL), base::TimeTicks());
69 frame_request_queue_.pop_front();
70 }
71
72 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber_); 62 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber_);
73 } 63 }
74 64
75 void AudioReceiver::InitializeTimers() { 65 void AudioReceiver::InitializeTimers() {
76 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 66 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
77 ScheduleNextRtcpReport(); 67 ScheduleNextRtcpReport();
78 ScheduleNextCastMessage(); 68 ScheduleNextCastMessage();
79 } 69 }
80 70
81 void AudioReceiver::OnReceivedPayloadData(const uint8* payload_data, 71 void AudioReceiver::OnReceivedPayloadData(const uint8* payload_data,
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 } 373 }
384 374
385 void AudioReceiver::SendNextCastMessage() { 375 void AudioReceiver::SendNextCastMessage() {
386 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 376 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
387 framer_.SendCastMessage(); // Will only send a message if it is time. 377 framer_.SendCastMessage(); // Will only send a message if it is time.
388 ScheduleNextCastMessage(); 378 ScheduleNextCastMessage();
389 } 379 }
390 380
391 } // namespace cast 381 } // namespace cast
392 } // namespace media 382 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/audio_receiver/audio_receiver.h ('k') | media/cast/cast_environment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698