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

Side by Side Diff: remoting/protocol/webrtc_dummy_video_encoder.cc

Issue 2898733002: Allow WebrtcDummyVideoEncoder::RegisterEncodeCompleteCallback to take a nullptr. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/protocol/webrtc_dummy_video_encoder.h" 5 #include "remoting/protocol/webrtc_dummy_video_encoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; 46 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
47 } 47 }
48 } 48 }
49 } 49 }
50 state_ = kInitialized; 50 state_ = kInitialized;
51 return WEBRTC_VIDEO_CODEC_OK; 51 return WEBRTC_VIDEO_CODEC_OK;
52 } 52 }
53 53
54 int32_t WebrtcDummyVideoEncoder::RegisterEncodeCompleteCallback( 54 int32_t WebrtcDummyVideoEncoder::RegisterEncodeCompleteCallback(
55 webrtc::EncodedImageCallback* callback) { 55 webrtc::EncodedImageCallback* callback) {
56 DCHECK(callback);
57 base::AutoLock lock(lock_); 56 base::AutoLock lock(lock_);
58 encoded_callback_ = callback; 57 encoded_callback_ = callback;
59 return WEBRTC_VIDEO_CODEC_OK; 58 return WEBRTC_VIDEO_CODEC_OK;
60 } 59 }
61 60
62 int32_t WebrtcDummyVideoEncoder::Release() { 61 int32_t WebrtcDummyVideoEncoder::Release() {
63 base::AutoLock lock(lock_); 62 base::AutoLock lock(lock_);
64 encoded_callback_ = nullptr; 63 encoded_callback_ = nullptr;
65 return WEBRTC_VIDEO_CODEC_OK; 64 return WEBRTC_VIDEO_CODEC_OK;
66 } 65 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 155
157 webrtc::RTPFragmentationHeader header; 156 webrtc::RTPFragmentationHeader header;
158 memset(&header, 0, sizeof(header)); 157 memset(&header, 0, sizeof(header));
159 158
160 header.VerifyAndAllocateFragmentationHeader(1); 159 header.VerifyAndAllocateFragmentationHeader(1);
161 header.fragmentationOffset[0] = 0; 160 header.fragmentationOffset[0] = 0;
162 header.fragmentationLength[0] = buffer_size; 161 header.fragmentationLength[0] = buffer_size;
163 header.fragmentationPlType[0] = 0; 162 header.fragmentationPlType[0] = 0;
164 header.fragmentationTimeDiff[0] = 0; 163 header.fragmentationTimeDiff[0] = 0;
165 164
165 DCHECK(encoded_callback_);
166 return encoded_callback_->OnEncodedImage(encoded_image, &codec_specific_info, 166 return encoded_callback_->OnEncodedImage(encoded_image, &codec_specific_info,
167 &header); 167 &header);
168 } 168 }
169 169
170 WebrtcDummyVideoEncoderFactory::WebrtcDummyVideoEncoderFactory() 170 WebrtcDummyVideoEncoderFactory::WebrtcDummyVideoEncoderFactory()
171 : main_task_runner_(base::ThreadTaskRunnerHandle::Get()) { 171 : main_task_runner_(base::ThreadTaskRunnerHandle::Get()) {
172 // TODO(isheriff): These do not really affect anything internally 172 // TODO(isheriff): These do not really affect anything internally
173 // in webrtc. 173 // in webrtc.
174 codecs_.push_back(cricket::VideoCodec("VP8")); 174 codecs_.push_back(cricket::VideoCodec("VP8"));
175 codecs_.push_back(cricket::VideoCodec("VP9")); 175 codecs_.push_back(cricket::VideoCodec("VP9"));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 void WebrtcDummyVideoEncoderFactory::SetVideoChannelStateObserver( 243 void WebrtcDummyVideoEncoderFactory::SetVideoChannelStateObserver(
244 base::WeakPtr<VideoChannelStateObserver> video_channel_state_observer) { 244 base::WeakPtr<VideoChannelStateObserver> video_channel_state_observer) {
245 DCHECK(main_task_runner_->BelongsToCurrentThread()); 245 DCHECK(main_task_runner_->BelongsToCurrentThread());
246 DCHECK(encoders_.empty()); 246 DCHECK(encoders_.empty());
247 base::AutoLock lock(lock_); 247 base::AutoLock lock(lock_);
248 video_channel_state_observer_ = video_channel_state_observer; 248 video_channel_state_observer_ = video_channel_state_observer;
249 } 249 }
250 250
251 } // namespace protocol 251 } // namespace protocol
252 } // namespace remoting 252 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698