| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/renderer/media/media_recorder_handler.h" | 5 #include "content/renderer/media/media_recorder_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/renderer/media/video_track_recorder.h" | 10 #include "content/renderer/media/video_track_recorder.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 MediaRecorderHandler::~MediaRecorderHandler() { | 22 MediaRecorderHandler::~MediaRecorderHandler() { |
| 23 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 23 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 24 // Send a |last_in_slice| to our |client_|. | 24 // Send a |last_in_slice| to our |client_|. |
| 25 if (client_) | 25 if (client_) |
| 26 client_->writeData(nullptr, 0u, true); | 26 client_->writeData(nullptr, 0u, true); |
| 27 } | 27 } |
| 28 | 28 |
| 29 bool MediaRecorderHandler::canSupportMimeType( | 29 bool MediaRecorderHandler::canSupportMimeType( |
| 30 const blink::WebString& mimeType) { | 30 const blink::WebString& mimeType) { |
| 31 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 31 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 32 // TODO(mcasas): For the time being only "video/vp8" is supported. | 32 // TODO(mcasas): For the time being only empty or "video/vp8" are supported. |
| 33 return mimeType.utf8().compare("video/vp8") == 0; | 33 return mimeType.isEmpty() || mimeType.utf8().compare("video/vp8") == 0; |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool MediaRecorderHandler::initialize( | 36 bool MediaRecorderHandler::initialize( |
| 37 blink::WebMediaRecorderHandlerClient* client, | 37 blink::WebMediaRecorderHandlerClient* client, |
| 38 const blink::WebMediaStream& media_stream, | 38 const blink::WebMediaStream& media_stream, |
| 39 const blink::WebString& mimeType) { | 39 const blink::WebString& mimeType) { |
| 40 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 40 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 41 if (!canSupportMimeType(mimeType)) { | 41 if (!canSupportMimeType(mimeType)) { |
| 42 DLOG(ERROR) << "Can't support type " << mimeType.utf8(); | 42 DLOG(ERROR) << "Can't support type " << mimeType.utf8(); |
| 43 return false; | 43 return false; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 void MediaRecorderHandler::OnVideoFrameForTesting( | 124 void MediaRecorderHandler::OnVideoFrameForTesting( |
| 125 const scoped_refptr<media::VideoFrame>& frame, | 125 const scoped_refptr<media::VideoFrame>& frame, |
| 126 const base::TimeTicks& timestamp) { | 126 const base::TimeTicks& timestamp) { |
| 127 for (auto* recorder : video_recorders_) | 127 for (auto* recorder : video_recorders_) |
| 128 recorder->OnVideoFrameForTesting(frame, timestamp); | 128 recorder->OnVideoFrameForTesting(frame, timestamp); |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace content | 131 } // namespace content |
| OLD | NEW |