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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 return false; | 729 return false; |
730 if (is_audio && audio_stream_) { | 730 if (is_audio && audio_stream_) { |
731 media::AudioDecoderConfig config = audio_stream_->audio_decoder_config(); | 731 media::AudioDecoderConfig config = audio_stream_->audio_decoder_config(); |
732 configs->audio_codec = config.codec(); | 732 configs->audio_codec = config.codec(); |
733 configs->audio_channels = | 733 configs->audio_channels = |
734 media::ChannelLayoutToChannelCount(config.channel_layout()); | 734 media::ChannelLayoutToChannelCount(config.channel_layout()); |
735 configs->audio_sampling_rate = config.samples_per_second(); | 735 configs->audio_sampling_rate = config.samples_per_second(); |
736 configs->is_audio_encrypted = config.is_encrypted(); | 736 configs->is_audio_encrypted = config.is_encrypted(); |
737 configs->audio_extra_data = std::vector<uint8>( | 737 configs->audio_extra_data = std::vector<uint8>( |
738 config.extra_data(), config.extra_data() + config.extra_data_size()); | 738 config.extra_data(), config.extra_data() + config.extra_data_size()); |
739 configs->audio_codec_delay_ns = static_cast<int64_t>( | |
740 config.codec_delay() * | |
741 (static_cast<double>(base::Time::kNanosecondsPerSecond) / | |
742 config.samples_per_second())); | |
743 configs->audio_seek_preroll_ns = | |
744 config.seek_preroll().InMicroseconds() * | |
745 base::Time::kNanosecondsPerMicrosecond; | |
746 return true; | 739 return true; |
747 } | 740 } |
748 if (!is_audio && video_stream_) { | 741 if (!is_audio && video_stream_) { |
749 media::VideoDecoderConfig config = video_stream_->video_decoder_config(); | 742 media::VideoDecoderConfig config = video_stream_->video_decoder_config(); |
750 configs->video_codec = config.codec(); | 743 configs->video_codec = config.codec(); |
751 configs->video_size = config.natural_size(); | 744 configs->video_size = config.natural_size(); |
752 configs->is_video_encrypted = config.is_encrypted(); | 745 configs->is_video_encrypted = config.is_encrypted(); |
753 configs->video_extra_data = std::vector<uint8>( | 746 configs->video_extra_data = std::vector<uint8>( |
754 config.extra_data(), config.extra_data() + config.extra_data_size()); | 747 config.extra_data(), config.extra_data() + config.extra_data_size()); |
755 return true; | 748 return true; |
756 } | 749 } |
757 return false; | 750 return false; |
758 } | 751 } |
759 | 752 |
760 } // namespace content | 753 } // namespace content |
OLD | NEW |