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

Side by Side Diff: content/renderer/media/android/media_source_delegate.cc

Issue 239743005: Updates WebMediaPlayerAndroid and MediaSourceDelegate to respect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: const Created 6 years, 8 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
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 "content/renderer/media/android/media_source_delegate.h" 5 #include "content/renderer/media/android/media_source_delegate.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 config.extra_data(), config.extra_data() + config.extra_data_size()); 670 config.extra_data(), config.extra_data() + config.extra_data_size());
671 } 671 }
672 if (video_stream_) { 672 if (video_stream_) {
673 media::VideoDecoderConfig config = video_stream_->video_decoder_config(); 673 media::VideoDecoderConfig config = video_stream_->video_decoder_config();
674 configs->video_codec = config.codec(); 674 configs->video_codec = config.codec();
675 configs->video_size = config.natural_size(); 675 configs->video_size = config.natural_size();
676 configs->is_video_encrypted = config.is_encrypted(); 676 configs->is_video_encrypted = config.is_encrypted();
677 configs->video_extra_data = std::vector<uint8>( 677 configs->video_extra_data = std::vector<uint8>(
678 config.extra_data(), config.extra_data() + config.extra_data_size()); 678 config.extra_data(), config.extra_data() + config.extra_data_size());
679 } 679 }
680 configs->duration_ms = GetDurationMs(); 680 configs->duration = GetDuration();
681 681
682 if (demuxer_client_) 682 if (demuxer_client_)
683 demuxer_client_->DemuxerReady(demuxer_client_id_, *configs); 683 demuxer_client_->DemuxerReady(demuxer_client_id_, *configs);
684 684
685 base::AutoLock auto_lock(is_video_encrypted_lock_); 685 base::AutoLock auto_lock(is_video_encrypted_lock_);
686 is_video_encrypted_ = configs->is_video_encrypted; 686 is_video_encrypted_ = configs->is_video_encrypted;
687 } 687 }
688 688
689 int MediaSourceDelegate::GetDurationMs() { 689 base::TimeDelta MediaSourceDelegate::GetDuration() const {
690 DCHECK(media_loop_->BelongsToCurrentThread()); 690 DCHECK(media_loop_->BelongsToCurrentThread());
691 if (!chunk_demuxer_) 691 if (!chunk_demuxer_)
692 return -1; 692 return media::kNoTimestamp();
693 693
694 double duration_ms = chunk_demuxer_->GetDuration() * 1000; 694 double duration = chunk_demuxer_->GetDuration();
695 if (duration_ms > std::numeric_limits<int32>::max()) { 695 if (duration == std::numeric_limits<double>::infinity())
696 LOG(WARNING) << "Duration from ChunkDemuxer is too large; probably " 696 return media::kInfiniteDuration();
697 "something has gone wrong."; 697
698 return std::numeric_limits<int32>::max(); 698 return ConvertSecondsToTimestamp(duration);
699 }
700 return duration_ms;
701 } 699 }
702 700
703 void MediaSourceDelegate::OnDemuxerOpened() { 701 void MediaSourceDelegate::OnDemuxerOpened() {
704 DCHECK(main_loop_->BelongsToCurrentThread()); 702 DCHECK(main_loop_->BelongsToCurrentThread());
705 if (media_source_opened_cb_.is_null()) 703 if (media_source_opened_cb_.is_null())
706 return; 704 return;
707 705
708 media_source_opened_cb_.Run(new WebMediaSourceImpl( 706 media_source_opened_cb_.Run(new WebMediaSourceImpl(
709 chunk_demuxer_.get(), base::Bind(&LogMediaSourceError, media_log_))); 707 chunk_demuxer_.get(), base::Bind(&LogMediaSourceError, media_log_)));
710 } 708 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 // current time have been garbage collected or removed by the web app, this is 756 // current time have been garbage collected or removed by the web app, this is
759 // unlikely. This may cause unexpected playback stall due to seek pending an 757 // unlikely. This may cause unexpected playback stall due to seek pending an
760 // append for a GOP prior to the last GOP demuxed. 758 // append for a GOP prior to the last GOP demuxed.
761 // TODO(wolenetz): Remove the possibility for this seek to cause unexpected 759 // TODO(wolenetz): Remove the possibility for this seek to cause unexpected
762 // player stall by replaying cached data since last keyframe in browser player 760 // player stall by replaying cached data since last keyframe in browser player
763 // rather than issuing browser seek. See http://crbug.com/304234. 761 // rather than issuing browser seek. See http://crbug.com/304234.
764 return seek_time; 762 return seek_time;
765 } 763 }
766 764
767 } // namespace content 765 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/android/media_source_delegate.h ('k') | content/renderer/media/android/webmediaplayer_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698