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

Unified Diff: media/filters/chunk_demuxer.cc

Issue 547223003: MSE: Notify Blink SourceBuffer on init segment received (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/chunk_demuxer.cc
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
index 0ff996db7398bb3f243d602a96a02d2f3d1813bc..9a8d8e9a2ff73d0f010313b0f315c3710f84dc82 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -111,11 +111,15 @@ class SourceState {
// error occurred. |*timestamp_offset| is used and possibly updated by the
// append. |append_window_start| and |append_window_end| correspond to the MSE
// spec's similarly named source buffer attributes that are used in coded
- // frame processing.
- bool Append(const uint8* data, size_t length,
- TimeDelta append_window_start,
- TimeDelta append_window_end,
- TimeDelta* timestamp_offset);
+ // frame processing. |init_segment_received_cb| is run for each new fully
+ // parsed initialization segment.
+ bool Append(
+ const uint8* data,
+ size_t length,
+ TimeDelta append_window_start,
+ TimeDelta append_window_end,
+ TimeDelta* timestamp_offset,
+ const ChunkDemuxer::InitSegmentReceivedCB& init_segment_received_cb);
acolwell GONE FROM CHROMIUM 2014/09/09 22:36:37 nit: typedef this above so you don't have to menti
wolenetz 2014/09/10 00:43:46 Done.
// Aborts the current append sequence and resets the parser.
void Abort(TimeDelta append_window_start,
@@ -199,6 +203,13 @@ class SourceState {
// during the lifetime of an Append() call.
TimeDelta* timestamp_offset_during_append_;
+ // During Append(), OnNewConfigs() will trigger the initialization segment
+ // received algorithm. This callback is only non-NULL during the lifetime of
+ // an Append() call. Note, the MSE spec explicitly disallows this algorithm
+ // during an Abort(), since Abort() is allowed only to emit coded frames, and
+ // only if the parser is PARSING_MEDIA_SEGMENT (not an INIT segment).
+ ChunkDemuxer::InitSegmentReceivedCB init_segment_received_cb_during_append_;
+
// During Append(), coded frame processing triggered by OnNewBuffers()
// requires these two attributes. These are only valid during the lifetime of
// an Append() call.
@@ -299,20 +310,27 @@ void SourceState::SetGroupStartTimestampIfInSequenceMode(
frame_processor_->SetGroupStartTimestampIfInSequenceMode(timestamp_offset);
}
-bool SourceState::Append(const uint8* data, size_t length,
- TimeDelta append_window_start,
- TimeDelta append_window_end,
- TimeDelta* timestamp_offset) {
+bool SourceState::Append(
+ const uint8* data,
+ size_t length,
+ TimeDelta append_window_start,
+ TimeDelta append_window_end,
+ TimeDelta* timestamp_offset,
+ const ChunkDemuxer::InitSegmentReceivedCB& init_segment_received_cb) {
DCHECK(timestamp_offset);
DCHECK(!timestamp_offset_during_append_);
+ DCHECK(init_segment_received_cb_during_append_.is_null());
+ DCHECK(!init_segment_received_cb.is_null());
append_window_start_during_append_ = append_window_start;
append_window_end_during_append_ = append_window_end;
timestamp_offset_during_append_ = timestamp_offset;
+ init_segment_received_cb_during_append_ = init_segment_received_cb;
// TODO(wolenetz/acolwell): Curry and pass a NewBuffersCB here bound with
// append window and timestamp offset pointer. See http://crbug.com/351454.
bool err = stream_parser_->Parse(data, length);
timestamp_offset_during_append_ = NULL;
+ init_segment_received_cb_during_append_.Reset();
return err;
}
@@ -665,6 +683,11 @@ bool SourceState::OnNewConfigs(
frame_processor_->SetAllTrackBuffersNeedRandomAccessPoint();
DVLOG(1) << "OnNewConfigs() : " << (success ? "success" : "failed");
+ if (success) {
+ // BIG TODO: add parameters to init segment received algo...
+ init_segment_received_cb_during_append_.Run();
+ }
+
return success;
}
@@ -1229,15 +1252,19 @@ Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges(const std::string& id) const {
return itr->second->GetBufferedRanges(duration_, state_ == ENDED);
}
-void ChunkDemuxer::AppendData(const std::string& id,
- const uint8* data, size_t length,
- TimeDelta append_window_start,
- TimeDelta append_window_end,
- TimeDelta* timestamp_offset) {
+void ChunkDemuxer::AppendData(
+ const std::string& id,
+ const uint8* data,
+ size_t length,
+ TimeDelta append_window_start,
+ TimeDelta append_window_end,
+ TimeDelta* timestamp_offset,
+ const InitSegmentReceivedCB& init_segment_received_cb) {
DVLOG(1) << "AppendData(" << id << ", " << length << ")";
DCHECK(!id.empty());
DCHECK(timestamp_offset);
+ DCHECK(!init_segment_received_cb.is_null());
Ranges<TimeDelta> ranges;
@@ -1260,7 +1287,8 @@ void ChunkDemuxer::AppendData(const std::string& id,
if (!source_state_map_[id]->Append(data, length,
append_window_start,
append_window_end,
- timestamp_offset)) {
+ timestamp_offset,
+ init_segment_received_cb)) {
ReportError_Locked(DEMUXER_ERROR_COULD_NOT_OPEN);
return;
}
@@ -1271,7 +1299,8 @@ void ChunkDemuxer::AppendData(const std::string& id,
if (!source_state_map_[id]->Append(data, length,
append_window_start,
append_window_end,
- timestamp_offset)) {
+ timestamp_offset,
+ init_segment_received_cb)) {
ReportError_Locked(PIPELINE_ERROR_DECODE);
return;
}
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698