| OLD | NEW |
| 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/base/android/audio_decoder_job.h" | 5 #include "media/base/android/audio_decoder_job.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "media/base/android/sdk_media_codec_bridge.h" | 10 #include "media/base/android/sdk_media_codec_bridge.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 size_t size, | 101 size_t size, |
| 102 bool render_output, | 102 bool render_output, |
| 103 bool /* is_late_frame */, | 103 bool /* is_late_frame */, |
| 104 base::TimeDelta current_presentation_timestamp, | 104 base::TimeDelta current_presentation_timestamp, |
| 105 MediaCodecStatus status, | 105 MediaCodecStatus status, |
| 106 const DecoderCallback& callback) { | 106 const DecoderCallback& callback) { |
| 107 render_output = render_output && (size != 0u); | 107 render_output = render_output && (size != 0u); |
| 108 bool is_audio_underrun = false; | 108 bool is_audio_underrun = false; |
| 109 | 109 |
| 110 // Ignore input value. | 110 // Ignore input value. |
| 111 current_presentation_timestamp = kNoTimestamp(); | 111 current_presentation_timestamp = kNoTimestamp; |
| 112 | 112 |
| 113 if (render_output) { | 113 if (render_output) { |
| 114 int64_t head_position; | 114 int64_t head_position; |
| 115 MediaCodecStatus play_status = | 115 MediaCodecStatus play_status = |
| 116 (static_cast<AudioCodecBridge*>(media_codec_bridge_.get())) | 116 (static_cast<AudioCodecBridge*>(media_codec_bridge_.get())) |
| 117 ->PlayOutputBuffer(output_buffer_index, size, offset, false, | 117 ->PlayOutputBuffer(output_buffer_index, size, offset, false, |
| 118 &head_position); | 118 &head_position); |
| 119 if (play_status == MEDIA_CODEC_OK) { | 119 if (play_status == MEDIA_CODEC_OK) { |
| 120 base::TimeTicks current_time = base::TimeTicks::Now(); | 120 base::TimeTicks current_time = base::TimeTicks::Now(); |
| 121 | 121 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 !static_cast<AudioCodecBridge*>(media_codec_bridge_.get()) | 240 !static_cast<AudioCodecBridge*>(media_codec_bridge_.get()) |
| 241 ->CreateAudioTrack(output_sampling_rate_, output_num_channels_)) { | 241 ->CreateAudioTrack(output_sampling_rate_, output_num_channels_)) { |
| 242 DLOG(ERROR) << __FUNCTION__ << ": cannot create AudioTrack"; | 242 DLOG(ERROR) << __FUNCTION__ << ": cannot create AudioTrack"; |
| 243 return false; | 243 return false; |
| 244 } | 244 } |
| 245 | 245 |
| 246 return true; | 246 return true; |
| 247 } | 247 } |
| 248 | 248 |
| 249 } // namespace media | 249 } // namespace media |
| OLD | NEW |