OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/filters/decrypting_audio_decoder.h" | 5 #include "media/filters/decrypting_audio_decoder.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 DecodePendingBuffer(); | 287 DecodePendingBuffer(); |
288 return; | 288 return; |
289 } | 289 } |
290 | 290 |
291 state_ = kWaitingForKey; | 291 state_ = kWaitingForKey; |
292 return; | 292 return; |
293 } | 293 } |
294 | 294 |
295 if (status == Decryptor::kNeedMoreData) { | 295 if (status == Decryptor::kNeedMoreData) { |
296 DVLOG(2) << "DeliverFrame() - kNeedMoreData"; | 296 DVLOG(2) << "DeliverFrame() - kNeedMoreData"; |
297 if (scoped_pending_buffer_to_decode->end_of_stream()) { | 297 state_ = scoped_pending_buffer_to_decode->end_of_stream() ? kDecodeFinished |
298 state_ = kDecodeFinished; | 298 : kIdle; |
299 output_cb_.Run(AudioBuffer::CreateEOSBuffer()); | |
300 } else { | |
301 state_ = kIdle; | |
302 } | |
303 base::ResetAndReturn(&decode_cb_).Run(kOk); | 299 base::ResetAndReturn(&decode_cb_).Run(kOk); |
304 return; | 300 return; |
305 } | 301 } |
306 | 302 |
307 DCHECK_EQ(status, Decryptor::kSuccess); | 303 DCHECK_EQ(status, Decryptor::kSuccess); |
308 DCHECK(!frames.empty()); | 304 DCHECK(!frames.empty()); |
309 ProcessDecodedFrames(frames); | 305 ProcessDecodedFrames(frames); |
310 | 306 |
311 if (scoped_pending_buffer_to_decode->end_of_stream()) { | 307 if (scoped_pending_buffer_to_decode->end_of_stream()) { |
312 // Set |pending_buffer_to_decode_| back as we need to keep flushing the | 308 // Set |pending_buffer_to_decode_| back as we need to keep flushing the |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 357 } |
362 | 358 |
363 frame->set_timestamp(current_time); | 359 frame->set_timestamp(current_time); |
364 timestamp_helper_->AddFrames(frame->frame_count()); | 360 timestamp_helper_->AddFrames(frame->frame_count()); |
365 | 361 |
366 output_cb_.Run(frame); | 362 output_cb_.Run(frame); |
367 } | 363 } |
368 } | 364 } |
369 | 365 |
370 } // namespace media | 366 } // namespace media |
OLD | NEW |