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