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 "content/renderer/media/android/media_source_delegate.h" | 5 #include "content/renderer/media/android/media_source_delegate.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 // right away. | 443 // right away. |
444 // Need to implement this properly using MediaPlayer.OnInfoListener. | 444 // Need to implement this properly using MediaPlayer.OnInfoListener. |
445 if (is_audio) { | 445 if (is_audio) { |
446 statistics_.audio_bytes_decoded += buffer->data_size(); | 446 statistics_.audio_bytes_decoded += buffer->data_size(); |
447 } else { | 447 } else { |
448 statistics_.video_bytes_decoded += buffer->data_size(); | 448 statistics_.video_bytes_decoded += buffer->data_size(); |
449 statistics_.video_frames_decoded++; | 449 statistics_.video_frames_decoded++; |
450 } | 450 } |
451 data->access_units[index].timestamp = buffer->timestamp(); | 451 data->access_units[index].timestamp = buffer->timestamp(); |
452 | 452 |
453 { // No local variable in switch-case scope. | 453 data->access_units[index].data.assign( |
454 int data_offset = buffer->decrypt_config() ? | 454 buffer->data(), buffer->data() + buffer->data_size()); |
455 buffer->decrypt_config()->data_offset() : 0; | |
456 DCHECK_LT(data_offset, buffer->data_size()); | |
457 data->access_units[index].data = std::vector<uint8>( | |
458 buffer->data() + data_offset, | |
459 buffer->data() + buffer->data_size() - data_offset); | |
460 } | |
461 #if !defined(GOOGLE_TV) | 455 #if !defined(GOOGLE_TV) |
462 // Vorbis needs 4 extra bytes padding on Android. Check | 456 // Vorbis needs 4 extra bytes padding on Android. Check |
463 // NuMediaExtractor.cpp in Android source code. | 457 // NuMediaExtractor.cpp in Android source code. |
464 if (is_audio && media::kCodecVorbis == | 458 if (is_audio && media::kCodecVorbis == |
465 audio_stream_->audio_decoder_config().codec()) { | 459 audio_stream_->audio_decoder_config().codec()) { |
466 data->access_units[index].data.insert( | 460 data->access_units[index].data.insert( |
467 data->access_units[index].data.end(), kVorbisPadding, | 461 data->access_units[index].data.end(), kVorbisPadding, |
468 kVorbisPadding + 4); | 462 kVorbisPadding + 4); |
469 } | 463 } |
470 #endif | 464 #endif |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 // current time have been garbage collected or removed by the web app, this is | 822 // current time have been garbage collected or removed by the web app, this is |
829 // unlikely. This may cause unexpected playback stall due to seek pending an | 823 // unlikely. This may cause unexpected playback stall due to seek pending an |
830 // append for a GOP prior to the last GOP demuxed. | 824 // append for a GOP prior to the last GOP demuxed. |
831 // TODO(wolenetz): Remove the possibility for this seek to cause unexpected | 825 // TODO(wolenetz): Remove the possibility for this seek to cause unexpected |
832 // player stall by replaying cached data since last keyframe in browser player | 826 // player stall by replaying cached data since last keyframe in browser player |
833 // rather than issuing browser seek. See http://crbug.com/304234. | 827 // rather than issuing browser seek. See http://crbug.com/304234. |
834 return seek_time; | 828 return seek_time; |
835 } | 829 } |
836 | 830 |
837 } // namespace content | 831 } // namespace content |
OLD | NEW |