OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "remoting/client/plugin/media_source_video_renderer.h" | 5 #include "remoting/client/plugin/media_source_video_renderer.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 public: | 21 public: |
22 typedef std::vector<uint8_t> DataBuffer; | 22 typedef std::vector<uint8_t> DataBuffer; |
23 | 23 |
24 VideoWriter(const webrtc::DesktopSize& frame_size, const char* codec_id); | 24 VideoWriter(const webrtc::DesktopSize& frame_size, const char* codec_id); |
25 virtual ~VideoWriter(); | 25 virtual ~VideoWriter(); |
26 | 26 |
27 const webrtc::DesktopSize& size() { return frame_size_; } | 27 const webrtc::DesktopSize& size() { return frame_size_; } |
28 int64_t last_frame_timestamp() { return timecode_ - kFrameIntervalNs; } | 28 int64_t last_frame_timestamp() { return timecode_ - kFrameIntervalNs; } |
29 | 29 |
30 // IMkvWriter interface. | 30 // IMkvWriter interface. |
31 virtual mkvmuxer::int32 Write(const void* buf, mkvmuxer::uint32 len) OVERRIDE; | 31 virtual mkvmuxer::int32 Write(const void* buf, mkvmuxer::uint32 len) override; |
32 virtual mkvmuxer::int64 Position() const OVERRIDE; | 32 virtual mkvmuxer::int64 Position() const override; |
33 virtual mkvmuxer::int32 Position(mkvmuxer::int64 position) OVERRIDE; | 33 virtual mkvmuxer::int32 Position(mkvmuxer::int64 position) override; |
34 virtual bool Seekable() const OVERRIDE; | 34 virtual bool Seekable() const override; |
35 virtual void ElementStartNotify(mkvmuxer::uint64 element_id, | 35 virtual void ElementStartNotify(mkvmuxer::uint64 element_id, |
36 mkvmuxer::int64 position) OVERRIDE; | 36 mkvmuxer::int64 position) override; |
37 | 37 |
38 scoped_ptr<DataBuffer> OnVideoFrame(const std::string& video_data, | 38 scoped_ptr<DataBuffer> OnVideoFrame(const std::string& video_data, |
39 bool keyframe); | 39 bool keyframe); |
40 | 40 |
41 private: | 41 private: |
42 webrtc::DesktopSize frame_size_; | 42 webrtc::DesktopSize frame_size_; |
43 const char* codec_id_; | 43 const char* codec_id_; |
44 | 44 |
45 scoped_ptr<DataBuffer> output_data_; | 45 scoped_ptr<DataBuffer> output_data_; |
46 int64_t position_; | 46 int64_t position_; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 // First bit is set to 0 for key frames. | 236 // First bit is set to 0 for key frames. |
237 bool keyframe = (packet->data()[0] & 1) == 0; | 237 bool keyframe = (packet->data()[0] & 1) == 0; |
238 | 238 |
239 scoped_ptr<VideoWriter::DataBuffer> buffer = | 239 scoped_ptr<VideoWriter::DataBuffer> buffer = |
240 writer_->OnVideoFrame(packet->data(), keyframe); | 240 writer_->OnVideoFrame(packet->data(), keyframe); |
241 delegate_->OnMediaSourceData(&(*(buffer->begin())), buffer->size(), keyframe); | 241 delegate_->OnMediaSourceData(&(*(buffer->begin())), buffer->size(), keyframe); |
242 } | 242 } |
243 | 243 |
244 } // namespace remoting | 244 } // namespace remoting |
OLD | NEW |