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/ffmpeg/ffmpeg_common.h" | 5 #include "media/ffmpeg/ffmpeg_common.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 AudioCodec codec = CodecIDToAudioCodec(codec_context->codec_id); | 279 AudioCodec codec = CodecIDToAudioCodec(codec_context->codec_id); |
280 | 280 |
281 SampleFormat sample_format = | 281 SampleFormat sample_format = |
282 AVSampleFormatToSampleFormat(codec_context->sample_fmt); | 282 AVSampleFormatToSampleFormat(codec_context->sample_fmt); |
283 | 283 |
284 ChannelLayout channel_layout = ChannelLayoutToChromeChannelLayout( | 284 ChannelLayout channel_layout = ChannelLayoutToChromeChannelLayout( |
285 codec_context->channel_layout, codec_context->channels); | 285 codec_context->channel_layout, codec_context->channels); |
286 | 286 |
287 if (codec == kCodecOpus) { | 287 if (codec == kCodecOpus) { |
288 // |codec_context->sample_fmt| is not set by FFmpeg because Opus decoding is | 288 // |codec_context->sample_fmt| is not set by FFmpeg because Opus decoding is |
289 // not enabled in FFmpeg, so we need to manually set the sample format. | 289 // not enabled in FFmpeg. It doesn't matter what value is set here, so long |
| 290 // as it's valid, the true sample format is selected inside the decoder. |
290 sample_format = kSampleFormatS16; | 291 sample_format = kSampleFormatS16; |
291 } | 292 } |
292 | 293 |
293 base::TimeDelta seek_preroll; | 294 base::TimeDelta seek_preroll; |
294 if (codec_context->seek_preroll > 0) { | 295 if (codec_context->seek_preroll > 0) { |
295 seek_preroll = base::TimeDelta::FromMicroseconds( | 296 seek_preroll = base::TimeDelta::FromMicroseconds( |
296 codec_context->seek_preroll * 1000000.0 / codec_context->sample_rate); | 297 codec_context->seek_preroll * 1000000.0 / codec_context->sample_rate); |
297 } | 298 } |
298 | 299 |
299 base::TimeDelta codec_delay; | 300 base::TimeDelta codec_delay; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 return PIX_FMT_YUVJ420P; | 536 return PIX_FMT_YUVJ420P; |
536 case VideoFrame::YV12A: | 537 case VideoFrame::YV12A: |
537 return PIX_FMT_YUVA420P; | 538 return PIX_FMT_YUVA420P; |
538 default: | 539 default: |
539 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; | 540 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; |
540 } | 541 } |
541 return PIX_FMT_NONE; | 542 return PIX_FMT_NONE; |
542 } | 543 } |
543 | 544 |
544 } // namespace media | 545 } // namespace media |
OLD | NEW |