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/ffmpeg_demuxer.h" | 5 #include "media/filters/ffmpeg_demuxer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/base64.h" | 12 #include "base/base64.h" |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/callback_helpers.h" | 14 #include "base/callback_helpers.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
17 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
18 #include "base/metrics/sparse_histogram.h" | 18 #include "base/metrics/sparse_histogram.h" |
19 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
23 #include "base/sys_byteorder.h" | 23 #include "base/sys_byteorder.h" |
24 #include "base/task_runner_util.h" | 24 #include "base/task_runner_util.h" |
25 #include "base/task_scheduler/post_task.h" | 25 #include "base/task_scheduler/post_task.h" |
26 #include "base/threading/sequenced_worker_pool.h" | 26 #include "base/threading/sequenced_worker_pool.h" |
27 #include "base/threading/thread_task_runner_handle.h" | 27 #include "base/threading/thread_task_runner_handle.h" |
28 #include "base/time/time.h" | 28 #include "base/time/time.h" |
| 29 #include "build/build_config.h" |
29 #include "media/audio/sample_rates.h" | 30 #include "media/audio/sample_rates.h" |
30 #include "media/base/bind_to_current_loop.h" | 31 #include "media/base/bind_to_current_loop.h" |
31 #include "media/base/decrypt_config.h" | 32 #include "media/base/decrypt_config.h" |
32 #include "media/base/limits.h" | 33 #include "media/base/limits.h" |
33 #include "media/base/media_log.h" | 34 #include "media/base/media_log.h" |
34 #include "media/base/media_tracks.h" | 35 #include "media/base/media_tracks.h" |
35 #include "media/base/timestamp_constants.h" | 36 #include "media/base/timestamp_constants.h" |
36 #include "media/base/video_codecs.h" | 37 #include "media/base/video_codecs.h" |
37 #include "media/ffmpeg/ffmpeg_common.h" | 38 #include "media/ffmpeg/ffmpeg_common.h" |
38 #include "media/filters/ffmpeg_aac_bitstream_converter.h" | 39 #include "media/filters/ffmpeg_aac_bitstream_converter.h" |
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 | 1196 |
1196 void FFmpegDemuxer::OnOpenContextDone(const PipelineStatusCB& status_cb, | 1197 void FFmpegDemuxer::OnOpenContextDone(const PipelineStatusCB& status_cb, |
1197 bool result) { | 1198 bool result) { |
1198 DCHECK(task_runner_->BelongsToCurrentThread()); | 1199 DCHECK(task_runner_->BelongsToCurrentThread()); |
1199 if (stopped_) { | 1200 if (stopped_) { |
1200 MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": bad state"; | 1201 MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": bad state"; |
1201 status_cb.Run(PIPELINE_ERROR_ABORT); | 1202 status_cb.Run(PIPELINE_ERROR_ABORT); |
1202 return; | 1203 return; |
1203 } | 1204 } |
1204 | 1205 |
| 1206 #if defined(OS_ANDROID) |
| 1207 if (glue_->detected_hls()) { |
| 1208 MEDIA_LOG(INFO, media_log_) |
| 1209 << GetDisplayName() << ": detected HLS manifest"; |
| 1210 status_cb.Run(DEMUXER_ERROR_DETECTED_HLS); |
| 1211 return; |
| 1212 } |
| 1213 #endif |
| 1214 |
1205 if (!result) { | 1215 if (!result) { |
1206 MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": open context failed"; | 1216 MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": open context failed"; |
1207 status_cb.Run(DEMUXER_ERROR_COULD_NOT_OPEN); | 1217 status_cb.Run(DEMUXER_ERROR_COULD_NOT_OPEN); |
1208 return; | 1218 return; |
1209 } | 1219 } |
1210 | 1220 |
1211 // Fully initialize AVFormatContext by parsing the stream a little. | 1221 // Fully initialize AVFormatContext by parsing the stream a little. |
1212 base::PostTaskAndReplyWithResult( | 1222 base::PostTaskAndReplyWithResult( |
1213 blocking_task_runner_.get(), FROM_HERE, | 1223 blocking_task_runner_.get(), FROM_HERE, |
1214 base::Bind(&avformat_find_stream_info, glue_->format_context(), | 1224 base::Bind(&avformat_find_stream_info, glue_->format_context(), |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 | 1908 |
1899 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { | 1909 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { |
1900 DCHECK(task_runner_->BelongsToCurrentThread()); | 1910 DCHECK(task_runner_->BelongsToCurrentThread()); |
1901 for (const auto& stream : streams_) { | 1911 for (const auto& stream : streams_) { |
1902 if (stream) | 1912 if (stream) |
1903 stream->SetLiveness(liveness); | 1913 stream->SetLiveness(liveness); |
1904 } | 1914 } |
1905 } | 1915 } |
1906 | 1916 |
1907 } // namespace media | 1917 } // namespace media |
OLD | NEW |