OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/media_factory.h" | 5 #include "content/renderer/media/media_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/metrics/field_trial_params.h" | 9 #include "base/metrics/field_trial_params.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Returns true if the MediaPlayerRenderer should be used for playback, false | 117 // Returns true if the MediaPlayerRenderer should be used for playback, false |
118 // if the default renderer should be used instead. | 118 // if the default renderer should be used instead. |
119 // | 119 // |
120 // Note that HLS and MP4 detection are pre-redirect and path-based. It is | 120 // Note that HLS and MP4 detection are pre-redirect and path-based. It is |
121 // possible to load such a URL and find different content. | 121 // possible to load such a URL and find different content. |
122 bool UseMediaPlayerRenderer(const GURL& url) { | 122 bool UseMediaPlayerRenderer(const GURL& url) { |
123 // Always use the default renderer for playing blob URLs. | 123 // Always use the default renderer for playing blob URLs. |
124 if (url.SchemeIsBlob()) | 124 if (url.SchemeIsBlob()) |
125 return false; | 125 return false; |
126 | 126 |
127 // The default renderer does not support HLS. | |
128 if (media::MediaCodecUtil::IsHLSURL(url)) | |
129 return true; | |
130 | |
131 // Don't use the default renderer if the container likely contains a codec we | 127 // Don't use the default renderer if the container likely contains a codec we |
132 // can't decode in software and platform decoders are not available. | 128 // can't decode in software and platform decoders are not available. |
133 if (!media::HasPlatformDecoderSupport()) { | 129 if (!media::HasPlatformDecoderSupport()) { |
134 // Assume that "mp4" means H264. Without platform decoder support we cannot | 130 // Assume that "mp4" means H264. Without platform decoder support we cannot |
135 // play it with the default renderer so use MediaPlayerRenderer. | 131 // play it with the default renderer so use MediaPlayerRenderer. |
136 // http://crbug.com/642988. | 132 // http://crbug.com/642988. |
137 if (base::ToLowerASCII(url.spec()).find("mp4") != std::string::npos) | 133 if (base::ToLowerASCII(url.spec()).find("mp4") != std::string::npos) |
138 return true; | 134 return true; |
139 } | 135 } |
140 | 136 |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 DCHECK(remote_interfaces_); | 492 DCHECK(remote_interfaces_); |
497 media_interface_factory_.reset( | 493 media_interface_factory_.reset( |
498 new MediaInterfaceFactory(remote_interfaces_)); | 494 new MediaInterfaceFactory(remote_interfaces_)); |
499 } | 495 } |
500 | 496 |
501 return media_interface_factory_.get(); | 497 return media_interface_factory_.get(); |
502 } | 498 } |
503 #endif // BUILDFLAG(ENABLE_MOJO_MEDIA) | 499 #endif // BUILDFLAG(ENABLE_MOJO_MEDIA) |
504 | 500 |
505 } // namespace content | 501 } // namespace content |
OLD | NEW |