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

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

Issue 24586003: Be able to build cast_unittest and related targets in Chrome tree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 4
5 #include "media/cast/audio_sender/audio_encoder.h" 5 #include "media/cast/audio_sender/audio_encoder.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/cast_defines.h" 10 #include "media/cast/cast_defines.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 default: 104 default:
105 DCHECK(false) << "Codec must be specified for audio encoder"; 105 DCHECK(false) << "Codec must be specified for audio encoder";
106 return; 106 return;
107 } 107 }
108 if (audio_encoder_->RegisterSendCodec(send_codec) != 0) { 108 if (audio_encoder_->RegisterSendCodec(send_codec) != 0) {
109 DCHECK(false) << "Invalid webrtc return value; failed to register codec"; 109 DCHECK(false) << "Invalid webrtc return value; failed to register codec";
110 } 110 }
111 } 111 }
112 112
113 AudioEncoder::~AudioEncoder() { 113 AudioEncoder::~AudioEncoder() {
114 webrtc::AudioCodingModule::Destroy(audio_encoder_);
pwestin 2013/09/25 21:24:46 This is needed to avoid a memory leak; why did you
115 } 114 }
116 115
117 // Called from main cast thread. 116 // Called from main cast thread.
118 void AudioEncoder::InsertRawAudioFrame( 117 void AudioEncoder::InsertRawAudioFrame(
119 const PcmAudioFrame* audio_frame, 118 const PcmAudioFrame* audio_frame,
120 const base::TimeTicks& recorded_time, 119 const base::TimeTicks& recorded_time,
121 const FrameEncodedCallback& frame_encoded_callback, 120 const FrameEncodedCallback& frame_encoded_callback,
122 const base::Closure release_callback) { 121 const base::Closure release_callback) {
123 cast_thread_->PostTask(CastThread::AUDIO_ENCODER, FROM_HERE, 122 cast_thread_->PostTask(CastThread::AUDIO_ENCODER, FROM_HERE,
124 base::Bind(&AudioEncoder::EncodeAudioFrameThread, this, audio_frame, 123 base::Bind(&AudioEncoder::EncodeAudioFrameThread, this, audio_frame,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // Not all insert of 10 ms will generate a callback with encoded data. 162 // Not all insert of 10 ms will generate a callback with encoded data.
164 webrtc_encoder_callback_->SetEncodedCallbackInfo(recorded_time, 163 webrtc_encoder_callback_->SetEncodedCallbackInfo(recorded_time,
165 &frame_encoded_callback); 164 &frame_encoded_callback);
166 for (int i = 0; i < number_of_10ms_blocks; ++i) { 165 for (int i = 0; i < number_of_10ms_blocks; ++i) {
167 audio_encoder_->Process(); 166 audio_encoder_->Process();
168 } 167 }
169 } 168 }
170 169
171 } // namespace media 170 } // namespace media
172 } // namespace cast 171 } // namespace cast
OLDNEW
« media/cast/audio_receiver/audio_decoder.cc ('K') | « media/cast/audio_receiver/audio_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698