| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/cast/test/fake_media_source.h" | 5 #include "media/cast/test/fake_media_source.h" |
| 6 | 6 |
| 7 #include "base/files/memory_mapped_file.h" | 7 #include "base/files/memory_mapped_file.h" |
| 8 #include "base/files/scoped_file.h" | 8 #include "base/files/scoped_file.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 continue; | 140 continue; |
| 141 } | 141 } |
| 142 if (audio_stream_index_ != -1) { | 142 if (audio_stream_index_ != -1) { |
| 143 LOG(WARNING) << "Found multiple audio streams."; | 143 LOG(WARNING) << "Found multiple audio streams."; |
| 144 } | 144 } |
| 145 audio_stream_index_ = static_cast<int>(i); | 145 audio_stream_index_ = static_cast<int>(i); |
| 146 audio_params_.Reset( | 146 audio_params_.Reset( |
| 147 AudioParameters::AUDIO_PCM_LINEAR, | 147 AudioParameters::AUDIO_PCM_LINEAR, |
| 148 layout, | 148 layout, |
| 149 av_codec_context->channels, | 149 av_codec_context->channels, |
| 150 av_codec_context->channels, | |
| 151 av_codec_context->sample_rate, | 150 av_codec_context->sample_rate, |
| 152 8 * av_get_bytes_per_sample(av_codec_context->sample_fmt), | 151 8 * av_get_bytes_per_sample(av_codec_context->sample_fmt), |
| 153 av_codec_context->sample_rate / kAudioPacketsPerSecond); | 152 av_codec_context->sample_rate / kAudioPacketsPerSecond); |
| 154 LOG(INFO) << "Source file has audio."; | 153 LOG(INFO) << "Source file has audio."; |
| 155 } else if (av_codec->type == AVMEDIA_TYPE_VIDEO) { | 154 } else if (av_codec->type == AVMEDIA_TYPE_VIDEO) { |
| 156 VideoFrame::Format format = | 155 VideoFrame::Format format = |
| 157 PixelFormatToVideoFormat(av_codec_context->pix_fmt); | 156 PixelFormatToVideoFormat(av_codec_context->pix_fmt); |
| 158 if (format != VideoFrame::YV12) { | 157 if (format != VideoFrame::YV12) { |
| 159 LOG(ERROR) << "Cannot handle non YV12 video format: " << format; | 158 LOG(ERROR) << "Cannot handle non YV12 video format: " << format; |
| 160 continue; | 159 continue; |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 AVCodecContext* FakeMediaSource::av_audio_context() { | 585 AVCodecContext* FakeMediaSource::av_audio_context() { |
| 587 return av_audio_stream()->codec; | 586 return av_audio_stream()->codec; |
| 588 } | 587 } |
| 589 | 588 |
| 590 AVCodecContext* FakeMediaSource::av_video_context() { | 589 AVCodecContext* FakeMediaSource::av_video_context() { |
| 591 return av_video_stream()->codec; | 590 return av_video_stream()->codec; |
| 592 } | 591 } |
| 593 | 592 |
| 594 } // namespace cast | 593 } // namespace cast |
| 595 } // namespace media | 594 } // namespace media |
| OLD | NEW |