Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 2770293002: Detect HLS from demuxing results (Closed)
Patch Set: Minor changes in comments Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/pipeline_status.h ('k') | media/blink/webmediaplayer_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "media/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 } 1315 }
1316 1316
1317 void WebMediaPlayerImpl::OnError(PipelineStatus status) { 1317 void WebMediaPlayerImpl::OnError(PipelineStatus status) {
1318 DVLOG(1) << __func__; 1318 DVLOG(1) << __func__;
1319 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1319 DCHECK(main_task_runner_->BelongsToCurrentThread());
1320 DCHECK_NE(status, PIPELINE_OK); 1320 DCHECK_NE(status, PIPELINE_OK);
1321 1321
1322 if (suppress_destruction_errors_) 1322 if (suppress_destruction_errors_)
1323 return; 1323 return;
1324 1324
1325 #if defined(OS_ANDROID)
1326 if (status == PipelineStatus::DEMUXER_ERROR_DETECTED_HLS) {
1327 renderer_factory_selector_->SetUseMediaPlayer(true);
1328
1329 pipeline_controller_.Stop();
1330
1331 main_task_runner_->PostTask(
1332 FROM_HERE, base::Bind(&WebMediaPlayerImpl::StartPipeline, AsWeakPtr()));
1333 return;
1334 }
1335 #endif
1336
1325 ReportPipelineError(load_type_, status, media_log_.get()); 1337 ReportPipelineError(load_type_, status, media_log_.get());
1326 media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(status)); 1338 media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(status));
1327 1339
1328 if (ready_state_ == WebMediaPlayer::kReadyStateHaveNothing) { 1340 if (ready_state_ == WebMediaPlayer::kReadyStateHaveNothing) {
1329 // Any error that occurs before reaching ReadyStateHaveMetadata should 1341 // Any error that occurs before reaching ReadyStateHaveMetadata should
1330 // be considered a format error. 1342 // be considered a format error.
1331 SetNetworkState(WebMediaPlayer::kNetworkStateFormatError); 1343 SetNetworkState(WebMediaPlayer::kNetworkStateFormatError);
1332 } else { 1344 } else {
1333 SetNetworkState(PipelineErrorToNetworkState(status)); 1345 SetNetworkState(PipelineErrorToNetworkState(status));
1334 } 1346 }
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 } 1817 }
1806 #endif // defined(OS_ANDROID) // WMPI_CAST 1818 #endif // defined(OS_ANDROID) // WMPI_CAST
1807 1819
1808 void WebMediaPlayerImpl::DataSourceInitialized(bool success) { 1820 void WebMediaPlayerImpl::DataSourceInitialized(bool success) {
1809 DVLOG(1) << __func__; 1821 DVLOG(1) << __func__;
1810 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1822 DCHECK(main_task_runner_->BelongsToCurrentThread());
1811 1823
1812 if (observer_ && IsNewRemotePlaybackPipelineEnabled() && data_source_) 1824 if (observer_ && IsNewRemotePlaybackPipelineEnabled() && data_source_)
1813 observer_->OnDataSourceInitialized(data_source_->GetUrlAfterRedirects()); 1825 observer_->OnDataSourceInitialized(data_source_->GetUrlAfterRedirects());
1814 1826
1815 #if defined(OS_ANDROID)
1816 // We can't play HLS URLs with WebMediaPlayerImpl, so in cases where they are
1817 // encountered, instruct the HTML media element to use the MediaPlayerRenderer
1818 // instead.
1819 //
1820 // TODO(tguilbert): Detect the presence of HLS based on demuxing results,
1821 // rather than the URL string. See crbug.com/663503.
1822 if (data_source_) {
1823 const GURL url_after_redirects = data_source_->GetUrlAfterRedirects();
1824 if (MediaCodecUtil::IsHLSURL(url_after_redirects)) {
1825 renderer_factory_selector_->SetUseMediaPlayer(true);
1826 }
1827 }
1828 #endif
1829
1830 if (!success) { 1827 if (!success) {
1831 SetNetworkState(WebMediaPlayer::kNetworkStateFormatError); 1828 SetNetworkState(WebMediaPlayer::kNetworkStateFormatError);
1832 1829
1833 // Not really necessary, since the pipeline was never started, but it at 1830 // Not really necessary, since the pipeline was never started, but it at
1834 // least this makes sure that the error handling code is in sync. 1831 // least this makes sure that the error handling code is in sync.
1835 UpdatePlayState(); 1832 UpdatePlayState();
1836 1833
1837 return; 1834 return;
1838 } 1835 }
1839 1836
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
2729 } 2726 }
2730 2727
2731 #undef UMA_HISTOGRAM_VIDEO_HEIGHT 2728 #undef UMA_HISTOGRAM_VIDEO_HEIGHT
2732 2729
2733 void WebMediaPlayerImpl::SetTickClockForTest(base::TickClock* tick_clock) { 2730 void WebMediaPlayerImpl::SetTickClockForTest(base::TickClock* tick_clock) {
2734 tick_clock_.reset(tick_clock); 2731 tick_clock_.reset(tick_clock);
2735 buffered_data_source_host_.SetTickClockForTest(tick_clock); 2732 buffered_data_source_host_.SetTickClockForTest(tick_clock);
2736 } 2733 }
2737 2734
2738 } // namespace media 2735 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline_status.h ('k') | media/blink/webmediaplayer_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698