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

Unified Diff: media/blink/websourcebuffer_impl.cc

Issue 2643743002: Mojify demuxers and allow running {Chunk/FFmpeg}Demuxer in a Utility Process (Closed)
Patch Set: Rebase and make sure to unbind mojom::DemuxerPtr on the bound thread during termination Created 3 years, 10 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/blink/websourcebuffer_impl.h ('k') | media/filters/chunk_demuxer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/websourcebuffer_impl.cc
diff --git a/media/blink/websourcebuffer_impl.cc b/media/blink/websourcebuffer_impl.cc
index bc7f2b989d791a9887a303fcc87b87ad2d087372..b6004a3e5d38d43a43a10e253f8acfb735117b66 100644
--- a/media/blink/websourcebuffer_impl.cc
+++ b/media/blink/websourcebuffer_impl.cc
@@ -14,8 +14,8 @@
#include "base/callback_helpers.h"
#include "base/strings/string_number_conversions.h"
#include "media/base/media_tracks.h"
+#include "media/base/source_buffer.h"
#include "media/base/timestamp_constants.h"
-#include "media/filters/chunk_demuxer.h"
#include "third_party/WebKit/public/platform/WebMediaPlayer.h"
#include "third_party/WebKit/public/platform/WebSourceBufferClient.h"
@@ -42,19 +42,20 @@ static base::TimeDelta DoubleToTimeDelta(double time) {
}
WebSourceBufferImpl::WebSourceBufferImpl(const std::string& id,
- ChunkDemuxer* demuxer)
+ SourceBuffer* source_buffer)
: id_(id),
- demuxer_(demuxer),
+ source_buffer_(source_buffer),
client_(NULL),
append_window_end_(kInfiniteDuration) {
- DCHECK(demuxer_);
- demuxer_->SetTracksWatcher(
+ DCHECK(source_buffer_);
+ source_buffer_->SetTracksWatcher(
id, base::Bind(&WebSourceBufferImpl::InitSegmentReceived,
base::Unretained(this)));
}
WebSourceBufferImpl::~WebSourceBufferImpl() {
- DCHECK(!demuxer_) << "Object destroyed w/o removedFromMediaSource() call";
+ DCHECK(!source_buffer_)
+ << "Object destroyed w/o removedFromMediaSource() call";
DCHECK(!client_);
}
@@ -65,15 +66,15 @@ void WebSourceBufferImpl::setClient(blink::WebSourceBufferClient* client) {
}
bool WebSourceBufferImpl::setMode(WebSourceBuffer::AppendMode mode) {
- if (demuxer_->IsParsingMediaSegment(id_))
+ if (source_buffer_->IsParsingMediaSegment(id_))
return false;
switch (mode) {
case WebSourceBuffer::AppendModeSegments:
- demuxer_->SetSequenceMode(id_, false);
+ source_buffer_->SetSequenceMode(id_, false);
return true;
case WebSourceBuffer::AppendModeSequence:
- demuxer_->SetSequenceMode(id_, true);
+ source_buffer_->SetSequenceMode(id_, true);
return true;
}
@@ -82,7 +83,7 @@ bool WebSourceBufferImpl::setMode(WebSourceBuffer::AppendMode mode) {
}
blink::WebTimeRanges WebSourceBufferImpl::buffered() {
- Ranges<base::TimeDelta> ranges = demuxer_->GetBufferedRanges(id_);
+ Ranges<base::TimeDelta> ranges = source_buffer_->GetBufferedRanges(id_);
blink::WebTimeRanges result(ranges.size());
for (size_t i = 0; i < ranges.size(); i++) {
result[i].start = ranges.start(i).InSecondsF();
@@ -92,23 +93,23 @@ blink::WebTimeRanges WebSourceBufferImpl::buffered() {
}
double WebSourceBufferImpl::highestPresentationTimestamp() {
- return demuxer_->GetHighestPresentationTimestamp(id_).InSecondsF();
+ return source_buffer_->GetHighestPresentationTimestamp(id_).InSecondsF();
}
bool WebSourceBufferImpl::evictCodedFrames(double currentPlaybackTime,
size_t newDataSize) {
- return demuxer_->EvictCodedFrames(
- id_,
- base::TimeDelta::FromSecondsD(currentPlaybackTime),
- newDataSize);
+ return source_buffer_->EvictCodedFrames(
+ id_, base::TimeDelta::FromSecondsD(currentPlaybackTime), newDataSize);
}
bool WebSourceBufferImpl::append(const unsigned char* data,
unsigned length,
double* timestamp_offset) {
base::TimeDelta old_offset = timestamp_offset_;
- bool success = demuxer_->AppendData(id_, data, length, append_window_start_,
- append_window_end_, &timestamp_offset_);
+
+ bool success =
+ source_buffer_->AppendData(id_, data, length, append_window_start_,
+ append_window_end_, &timestamp_offset_);
// Coded frame processing may update the timestamp offset. If the caller
// provides a non-NULL |timestamp_offset| and frame processing changes the
@@ -122,9 +123,8 @@ bool WebSourceBufferImpl::append(const unsigned char* data,
}
void WebSourceBufferImpl::resetParserState() {
- demuxer_->ResetParserState(id_,
- append_window_start_, append_window_end_,
- &timestamp_offset_);
+ source_buffer_->ResetParserState(id_, append_window_start_,
+ append_window_end_, &timestamp_offset_);
// TODO(wolenetz): resetParserState should be able to modify the caller
// timestamp offset (just like WebSourceBufferImpl::append).
@@ -134,11 +134,11 @@ void WebSourceBufferImpl::resetParserState() {
void WebSourceBufferImpl::remove(double start, double end) {
DCHECK_GE(start, 0);
DCHECK_GE(end, 0);
- demuxer_->Remove(id_, DoubleToTimeDelta(start), DoubleToTimeDelta(end));
+ source_buffer_->Remove(id_, DoubleToTimeDelta(start), DoubleToTimeDelta(end));
}
bool WebSourceBufferImpl::setTimestampOffset(double offset) {
- if (demuxer_->IsParsingMediaSegment(id_))
+ if (source_buffer_->IsParsingMediaSegment(id_))
return false;
timestamp_offset_ = DoubleToTimeDelta(offset);
@@ -146,7 +146,8 @@ bool WebSourceBufferImpl::setTimestampOffset(double offset) {
// http://www.w3.org/TR/media-source/#widl-SourceBuffer-timestampOffset
// Step 6: If the mode attribute equals "sequence", then set the group start
// timestamp to new timestamp offset.
- demuxer_->SetGroupStartTimestampIfInSequenceMode(id_, timestamp_offset_);
+ source_buffer_->SetGroupStartTimestampIfInSequenceMode(id_,
+ timestamp_offset_);
return true;
}
@@ -161,8 +162,8 @@ void WebSourceBufferImpl::setAppendWindowEnd(double end) {
}
void WebSourceBufferImpl::removedFromMediaSource() {
- demuxer_->RemoveId(id_);
- demuxer_ = NULL;
+ source_buffer_->RemoveId(id_);
+ source_buffer_ = NULL;
client_ = NULL;
}
« no previous file with comments | « media/blink/websourcebuffer_impl.h ('k') | media/filters/chunk_demuxer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698