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

Side by Side Diff: media/base/android/media_codec_audio_decoder.cc

Issue 1285733002: Pass buffer offset to PlayOutputBuffer() call (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bot Created 5 years, 4 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/base/android/media_codec_audio_decoder.h ('k') | media/base/android/media_codec_bridge.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/base/android/media_codec_audio_decoder.h" 5 #include "media/base/android/media_codec_audio_decoder.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 "media/base/android/media_codec_bridge.h" 9 #include "media/base/android/media_codec_bridge.h"
10 #include "media/base/audio_timestamp_helper.h" 10 #include "media/base/audio_timestamp_helper.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 DCHECK(media_codec_bridge_); 152 DCHECK(media_codec_bridge_);
153 153
154 int old_sampling_rate = output_sampling_rate_; 154 int old_sampling_rate = output_sampling_rate_;
155 output_sampling_rate_ = media_codec_bridge_->GetOutputSamplingRate(); 155 output_sampling_rate_ = media_codec_bridge_->GetOutputSamplingRate();
156 if (output_sampling_rate_ != old_sampling_rate) 156 if (output_sampling_rate_ != old_sampling_rate)
157 ResetTimestampHelper(); 157 ResetTimestampHelper();
158 } 158 }
159 159
160 void MediaCodecAudioDecoder::Render(int buffer_index, 160 void MediaCodecAudioDecoder::Render(int buffer_index,
161 size_t offset,
161 size_t size, 162 size_t size,
162 bool render_output, 163 bool render_output,
163 base::TimeDelta pts, 164 base::TimeDelta pts,
164 bool eos_encountered) { 165 bool eos_encountered) {
165 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); 166 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread());
166 167
167 DVLOG(2) << class_name() << "::" << __FUNCTION__ << " pts:" << pts; 168 DVLOG(2) << class_name() << "::" << __FUNCTION__ << " pts:" << pts;
168 169
169 render_output = render_output && (size != 0u); 170 render_output = render_output && (size != 0u);
170 171
171 if (render_output) { 172 if (render_output) {
172 int64 head_position = 173 int64 head_position =
173 (static_cast<AudioCodecBridge*>(media_codec_bridge_.get())) 174 (static_cast<AudioCodecBridge*>(media_codec_bridge_.get()))
174 ->PlayOutputBuffer(buffer_index, size); 175 ->PlayOutputBuffer(buffer_index, size, offset);
175 176
176 size_t new_frames_count = size / bytes_per_frame_; 177 size_t new_frames_count = size / bytes_per_frame_;
177 frame_count_ += new_frames_count; 178 frame_count_ += new_frames_count;
178 audio_timestamp_helper_->AddFrames(new_frames_count); 179 audio_timestamp_helper_->AddFrames(new_frames_count);
179 int64 frames_to_play = frame_count_ - head_position; 180 int64 frames_to_play = frame_count_ - head_position;
180 DCHECK_GE(frames_to_play, 0); 181 DCHECK_GE(frames_to_play, 0);
181 182
182 base::TimeDelta last_buffered = audio_timestamp_helper_->GetTimestamp(); 183 base::TimeDelta last_buffered = audio_timestamp_helper_->GetTimestamp();
183 base::TimeDelta now_playing = 184 base::TimeDelta now_playing =
184 last_buffered - 185 last_buffered -
(...skipping 29 matching lines...) Expand all
214 if (audio_timestamp_helper_) 215 if (audio_timestamp_helper_)
215 base_timestamp_ = audio_timestamp_helper_->GetTimestamp(); 216 base_timestamp_ = audio_timestamp_helper_->GetTimestamp();
216 217
217 audio_timestamp_helper_.reset( 218 audio_timestamp_helper_.reset(
218 new AudioTimestampHelper(configs_.audio_sampling_rate)); 219 new AudioTimestampHelper(configs_.audio_sampling_rate));
219 220
220 audio_timestamp_helper_->SetBaseTimestamp(base_timestamp_); 221 audio_timestamp_helper_->SetBaseTimestamp(base_timestamp_);
221 } 222 }
222 223
223 } // namespace media 224 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_codec_audio_decoder.h ('k') | media/base/android/media_codec_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698