OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 311 |
312 // config_.renderer must never be null if we're getting this callback. | 312 // config_.renderer must never be null if we're getting this callback. |
313 config_.renderer->OnFrame(video_frame); | 313 config_.renderer->OnFrame(video_frame); |
314 | 314 |
315 // TODO(tommi): OnRenderFrame grabs a lock too. | 315 // TODO(tommi): OnRenderFrame grabs a lock too. |
316 stats_proxy_.OnRenderedFrame(video_frame.width(), video_frame.height()); | 316 stats_proxy_.OnRenderedFrame(video_frame.width(), video_frame.height()); |
317 } | 317 } |
318 | 318 |
319 // TODO(asapersson): Consider moving callback from video_encoder.h or | 319 // TODO(asapersson): Consider moving callback from video_encoder.h or |
320 // creating a different callback. | 320 // creating a different callback. |
321 int32_t VideoReceiveStream::Encoded( | 321 EncodedImageCallback::Result VideoReceiveStream::OnEncodedImage( |
322 const EncodedImage& encoded_image, | 322 const EncodedImage& encoded_image, |
323 const CodecSpecificInfo* codec_specific_info, | 323 const CodecSpecificInfo* codec_specific_info, |
324 const RTPFragmentationHeader* fragmentation) { | 324 const RTPFragmentationHeader* fragmentation) { |
325 stats_proxy_.OnPreDecode(encoded_image, codec_specific_info); | 325 stats_proxy_.OnPreDecode(encoded_image, codec_specific_info); |
326 if (config_.pre_decode_callback) { | 326 if (config_.pre_decode_callback) { |
327 config_.pre_decode_callback->EncodedFrameCallback( | 327 config_.pre_decode_callback->EncodedFrameCallback( |
328 EncodedFrame(encoded_image._buffer, encoded_image._length, | 328 EncodedFrame(encoded_image._buffer, encoded_image._length, |
329 encoded_image._frameType)); | 329 encoded_image._frameType)); |
330 } | 330 } |
331 if (kEnableFrameRecording) { | 331 if (kEnableFrameRecording) { |
332 if (!ivf_writer_.get()) { | 332 if (!ivf_writer_.get()) { |
333 RTC_DCHECK(codec_specific_info); | 333 RTC_DCHECK(codec_specific_info); |
334 std::ostringstream oss; | 334 std::ostringstream oss; |
335 oss << "receive_bitstream_ssrc_" << config_.rtp.remote_ssrc << ".ivf"; | 335 oss << "receive_bitstream_ssrc_" << config_.rtp.remote_ssrc << ".ivf"; |
336 ivf_writer_ = | 336 ivf_writer_ = |
337 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType); | 337 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType); |
338 } | 338 } |
339 if (ivf_writer_.get()) { | 339 if (ivf_writer_.get()) { |
340 bool ok = ivf_writer_->WriteFrame(encoded_image); | 340 bool ok = ivf_writer_->WriteFrame(encoded_image); |
341 RTC_DCHECK(ok); | 341 RTC_DCHECK(ok); |
342 } | 342 } |
343 } | 343 } |
344 | 344 |
345 return 0; | 345 return Result(Result::OK, encoded_image._timeStamp); |
346 } | 346 } |
347 | 347 |
348 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) { | 348 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) { |
349 static_cast<VideoReceiveStream*>(ptr)->Decode(); | 349 static_cast<VideoReceiveStream*>(ptr)->Decode(); |
350 return true; | 350 return true; |
351 } | 351 } |
352 | 352 |
353 void VideoReceiveStream::Decode() { | 353 void VideoReceiveStream::Decode() { |
354 static const int kMaxDecodeWaitTimeMs = 50; | 354 static const int kMaxDecodeWaitTimeMs = 50; |
355 video_receiver_.Decode(kMaxDecodeWaitTimeMs); | 355 video_receiver_.Decode(kMaxDecodeWaitTimeMs); |
356 } | 356 } |
357 | 357 |
358 void VideoReceiveStream::SendNack( | 358 void VideoReceiveStream::SendNack( |
359 const std::vector<uint16_t>& sequence_numbers) { | 359 const std::vector<uint16_t>& sequence_numbers) { |
360 rtp_stream_receiver_.RequestPacketRetransmit(sequence_numbers); | 360 rtp_stream_receiver_.RequestPacketRetransmit(sequence_numbers); |
361 } | 361 } |
362 | 362 |
363 void VideoReceiveStream::RequestKeyFrame() { | 363 void VideoReceiveStream::RequestKeyFrame() { |
364 rtp_stream_receiver_.RequestKeyFrame(); | 364 rtp_stream_receiver_.RequestKeyFrame(); |
365 } | 365 } |
366 | 366 |
367 } // namespace internal | 367 } // namespace internal |
368 } // namespace webrtc | 368 } // namespace webrtc |
OLD | NEW |