| OLD | NEW |
| 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 #ifndef MEDIA_BLINK_WEBSOURCEBUFFER_IMPL_H_ | 5 #ifndef MEDIA_BLINK_WEBSOURCEBUFFER_IMPL_H_ |
| 6 #define MEDIA_BLINK_WEBSOURCEBUFFER_IMPL_H_ | 6 #define MEDIA_BLINK_WEBSOURCEBUFFER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "third_party/WebKit/public/platform/WebSourceBuffer.h" | 15 #include "third_party/WebKit/public/platform/WebSourceBuffer.h" |
| 16 | 16 |
| 17 namespace media { | 17 namespace media { |
| 18 class ChunkDemuxer; | 18 class ChunkDemuxer; |
| 19 class MediaTracks; |
| 19 | 20 |
| 20 class WebSourceBufferImpl : public blink::WebSourceBuffer { | 21 class WebSourceBufferImpl : public blink::WebSourceBuffer { |
| 21 public: | 22 public: |
| 22 WebSourceBufferImpl(const std::string& id, ChunkDemuxer* demuxer); | 23 WebSourceBufferImpl(const std::string& id, ChunkDemuxer* demuxer); |
| 23 ~WebSourceBufferImpl() override; | 24 ~WebSourceBufferImpl() override; |
| 24 | 25 |
| 25 // blink::WebSourceBuffer implementation. | 26 // blink::WebSourceBuffer implementation. |
| 26 void setClient(blink::WebSourceBufferClient* client) override; | 27 void setClient(blink::WebSourceBufferClient* client) override; |
| 27 bool setMode(AppendMode mode) override; | 28 bool setMode(AppendMode mode) override; |
| 28 blink::WebTimeRanges buffered() override; | 29 blink::WebTimeRanges buffered() override; |
| 29 bool evictCodedFrames(double currentPlaybackTime, | 30 bool evictCodedFrames(double currentPlaybackTime, |
| 30 size_t newDataSize) override; | 31 size_t newDataSize) override; |
| 31 void append( | 32 void append( |
| 32 const unsigned char* data, | 33 const unsigned char* data, |
| 33 unsigned length, | 34 unsigned length, |
| 34 double* timestamp_offset) override; | 35 double* timestamp_offset) override; |
| 35 void resetParserState() override; | 36 void resetParserState() override; |
| 36 void remove(double start, double end) override; | 37 void remove(double start, double end) override; |
| 37 bool setTimestampOffset(double offset) override; | 38 bool setTimestampOffset(double offset) override; |
| 38 void setAppendWindowStart(double start) override; | 39 void setAppendWindowStart(double start) override; |
| 39 void setAppendWindowEnd(double end) override; | 40 void setAppendWindowEnd(double end) override; |
| 40 void removedFromMediaSource() override; | 41 void removedFromMediaSource() override; |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 // Demuxer callback handler to process an initialization segment received | 44 // Demuxer callback handler to process an initialization segment received |
| 44 // during an append() call. | 45 // during an append() call. |
| 45 void InitSegmentReceived(); | 46 void InitSegmentReceived(const MediaTracks& tracks); |
| 46 | 47 |
| 47 std::string id_; | 48 std::string id_; |
| 48 ChunkDemuxer* demuxer_; // Owned by WebMediaPlayerImpl. | 49 ChunkDemuxer* demuxer_; // Owned by WebMediaPlayerImpl. |
| 49 | 50 |
| 50 blink::WebSourceBufferClient* client_; | 51 blink::WebSourceBufferClient* client_; |
| 51 | 52 |
| 52 // Controls the offset applied to timestamps when processing appended media | 53 // Controls the offset applied to timestamps when processing appended media |
| 53 // segments. It is initially 0, which indicates that no offset is being | 54 // segments. It is initially 0, which indicates that no offset is being |
| 54 // applied. Both setTimestampOffset() and append() may update this value. | 55 // applied. Both setTimestampOffset() and append() may update this value. |
| 55 base::TimeDelta timestamp_offset_; | 56 base::TimeDelta timestamp_offset_; |
| 56 | 57 |
| 57 base::TimeDelta append_window_start_; | 58 base::TimeDelta append_window_start_; |
| 58 base::TimeDelta append_window_end_; | 59 base::TimeDelta append_window_end_; |
| 59 | 60 |
| 60 DISALLOW_COPY_AND_ASSIGN(WebSourceBufferImpl); | 61 DISALLOW_COPY_AND_ASSIGN(WebSourceBufferImpl); |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 } // namespace media | 64 } // namespace media |
| 64 | 65 |
| 65 #endif // MEDIA_BLINK_WEBSOURCEBUFFER_IMPL_H_ | 66 #endif // MEDIA_BLINK_WEBSOURCEBUFFER_IMPL_H_ |
| OLD | NEW |