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

Side by Side Diff: media/filters/chunk_demuxer.cc

Issue 231283005: Add live mode detection in WebM MediaSource parser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
OLDNEW
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/chunk_demuxer.h" 5 #include "media/filters/chunk_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <list> 9 #include <list>
10 10
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 bool splice_frames_enabled) 968 bool splice_frames_enabled)
969 : state_(WAITING_FOR_INIT), 969 : state_(WAITING_FOR_INIT),
970 cancel_next_seek_(false), 970 cancel_next_seek_(false),
971 host_(NULL), 971 host_(NULL),
972 open_cb_(open_cb), 972 open_cb_(open_cb),
973 need_key_cb_(need_key_cb), 973 need_key_cb_(need_key_cb),
974 enable_text_(false), 974 enable_text_(false),
975 log_cb_(log_cb), 975 log_cb_(log_cb),
976 duration_(kNoTimestamp()), 976 duration_(kNoTimestamp()),
977 user_specified_duration_(-1), 977 user_specified_duration_(-1),
978 live_mode_(false),
978 splice_frames_enabled_(splice_frames_enabled) { 979 splice_frames_enabled_(splice_frames_enabled) {
979 DCHECK(!open_cb_.is_null()); 980 DCHECK(!open_cb_.is_null());
980 DCHECK(!need_key_cb_.is_null()); 981 DCHECK(!need_key_cb_.is_null());
981 } 982 }
982 983
983 void ChunkDemuxer::Initialize( 984 void ChunkDemuxer::Initialize(
984 DemuxerHost* host, 985 DemuxerHost* host,
985 const PipelineStatusCB& cb, 986 const PipelineStatusCB& cb,
986 bool enable_text_tracks) { 987 bool enable_text_tracks) {
987 DVLOG(1) << "Init()"; 988 DVLOG(1) << "Init()";
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 } 1059 }
1059 1060
1060 TimeDelta ChunkDemuxer::GetStartTime() const { 1061 TimeDelta ChunkDemuxer::GetStartTime() const {
1061 return TimeDelta(); 1062 return TimeDelta();
1062 } 1063 }
1063 1064
1064 base::Time ChunkDemuxer::GetTimelineOffset() const { 1065 base::Time ChunkDemuxer::GetTimelineOffset() const {
1065 return timeline_offset_; 1066 return timeline_offset_;
1066 } 1067 }
1067 1068
1069 bool ChunkDemuxer::IsLiveMode() const {
1070 return live_mode_;
1071 }
1072
1068 void ChunkDemuxer::StartWaitingForSeek(TimeDelta seek_time) { 1073 void ChunkDemuxer::StartWaitingForSeek(TimeDelta seek_time) {
1069 DVLOG(1) << "StartWaitingForSeek()"; 1074 DVLOG(1) << "StartWaitingForSeek()";
1070 base::AutoLock auto_lock(lock_); 1075 base::AutoLock auto_lock(lock_);
1071 DCHECK(state_ == INITIALIZED || state_ == ENDED || state_ == SHUTDOWN || 1076 DCHECK(state_ == INITIALIZED || state_ == ENDED || state_ == SHUTDOWN ||
1072 state_ == PARSE_ERROR) << state_; 1077 state_ == PARSE_ERROR) << state_;
1073 DCHECK(seek_cb_.is_null()); 1078 DCHECK(seek_cb_.is_null());
1074 1079
1075 if (state_ == SHUTDOWN || state_ == PARSE_ERROR) 1080 if (state_ == SHUTDOWN || state_ == PARSE_ERROR)
1076 return; 1081 return;
1077 1082
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 params.timeline_offset != timeline_offset_) { 1507 params.timeline_offset != timeline_offset_) {
1503 MEDIA_LOG(log_cb_) 1508 MEDIA_LOG(log_cb_)
1504 << "Timeline offset is not the same across all SourceBuffers."; 1509 << "Timeline offset is not the same across all SourceBuffers.";
1505 ReportError_Locked(DEMUXER_ERROR_COULD_NOT_OPEN); 1510 ReportError_Locked(DEMUXER_ERROR_COULD_NOT_OPEN);
1506 return; 1511 return;
1507 } 1512 }
1508 1513
1509 timeline_offset_ = params.timeline_offset; 1514 timeline_offset_ = params.timeline_offset;
1510 } 1515 }
1511 1516
1517 live_mode_ |= params.live_mode;
acolwell GONE FROM CHROMIUM 2014/04/24 21:14:16 I feel like we should enforce an all the same or e
Sergey Ulanov 2014/04/24 23:17:45 Done.
1518
1512 // Wait until all streams have initialized. 1519 // Wait until all streams have initialized.
1513 if ((!source_id_audio_.empty() && !audio_) || 1520 if ((!source_id_audio_.empty() && !audio_) ||
1514 (!source_id_video_.empty() && !video_)) { 1521 (!source_id_video_.empty() && !video_)) {
1515 return; 1522 return;
1516 } 1523 }
1517 1524
1518 SeekAllSources(GetStartTime()); 1525 SeekAllSources(GetStartTime());
1519 StartReturningData(); 1526 StartReturningData();
1520 1527
1521 if (duration_ == kNoTimestamp()) 1528 if (duration_ == kNoTimestamp())
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 } 1662 }
1656 1663
1657 void ChunkDemuxer::ShutdownAllStreams() { 1664 void ChunkDemuxer::ShutdownAllStreams() {
1658 for (SourceStateMap::iterator itr = source_state_map_.begin(); 1665 for (SourceStateMap::iterator itr = source_state_map_.begin();
1659 itr != source_state_map_.end(); ++itr) { 1666 itr != source_state_map_.end(); ++itr) {
1660 itr->second->Shutdown(); 1667 itr->second->Shutdown();
1661 } 1668 }
1662 } 1669 }
1663 1670
1664 } // namespace media 1671 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698