diff --git a/src/video_engine/test/auto_test/interface/tb_external_transport.h b/src/video_engine/test/auto_test/interface/tb_external_transport.h index 1a71b4379..46a1448fc 100644 --- a/src/video_engine/test/auto_test/interface/tb_external_transport.h +++ b/src/video_engine/test/auto_test/interface/tb_external_transport.h @@ -15,8 +15,9 @@ #ifndef WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_TB_EXTERNAL_TRANSPORT_H_ #define WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_TB_EXTERNAL_TRANSPORT_H_ +#include + #include "common_types.h" -#include "list_wrapper.h" namespace webrtc { @@ -85,8 +86,8 @@ private: WebRtc_Word32 _rtcpCount; WebRtc_Word32 _dropCount; - webrtc::ListWrapper _rtpPackets; - webrtc::ListWrapper _rtcpPackets; + std::list _rtpPackets; + std::list _rtcpPackets; unsigned char _temporalLayers; unsigned short _seqNum; diff --git a/src/video_engine/test/auto_test/source/tb_external_transport.cc b/src/video_engine/test/auto_test/source/tb_external_transport.cc index f50f2eb16..1509dd6e6 100644 --- a/src/video_engine/test/auto_test/source/tb_external_transport.cc +++ b/src/video_engine/test/auto_test/source/tb_external_transport.cc @@ -48,8 +48,6 @@ TbExternalTransport::TbExternalTransport(webrtc::ViENetwork& vieNetwork) : _rtpCount(0), _rtcpCount(0), _dropCount(0), - _rtpPackets(), - _rtcpPackets(), _temporalLayers(0), _seqNum(0), _sendPID(0), @@ -196,7 +194,7 @@ int TbExternalTransport::SendPacket(int channel, const void *data, int len) _crit.Enter(); newPacket->receiveTime = NowMs() + _networkDelayMs; - _rtpPackets.PushBack(newPacket); + _rtpPackets.push_back(newPacket); _event.Set(); _crit.Leave(); return len; @@ -221,7 +219,7 @@ int TbExternalTransport::SendRTCPPacket(int channel, const void *data, int len) _crit.Enter(); newPacket->receiveTime = NowMs() + _networkDelayMs; - _rtcpPackets.PushBack(newPacket); + _rtcpPackets.push_back(newPacket); _event.Set(); _crit.Leave(); return len; @@ -300,11 +298,11 @@ bool TbExternalTransport::ViEExternalTransportProcess() VideoPacket* packet = NULL; - while (!_rtpPackets.Empty()) + while (!_rtpPackets.empty()) { // Take first packet in queue _crit.Enter(); - packet = static_cast ((_rtpPackets.First())->GetItem()); + packet = _rtpPackets.front(); WebRtc_Word64 timeToReceive = packet->receiveTime - NowMs(); if (timeToReceive > 0) { @@ -316,7 +314,7 @@ bool TbExternalTransport::ViEExternalTransportProcess() _crit.Leave(); break; } - _rtpPackets.PopFront(); + _rtpPackets.pop_front(); _crit.Leave(); // Send to ViE @@ -347,11 +345,11 @@ bool TbExternalTransport::ViEExternalTransportProcess() packet = NULL; } } - while (!_rtcpPackets.Empty()) + while (!_rtcpPackets.empty()) { // Take first packet in queue _crit.Enter(); - packet = static_cast ((_rtcpPackets.First())->GetItem()); + packet = _rtcpPackets.front(); WebRtc_Word64 timeToReceive = packet->receiveTime - NowMs(); if (timeToReceive > 0) { @@ -363,7 +361,7 @@ bool TbExternalTransport::ViEExternalTransportProcess() _crit.Leave(); break; } - _rtcpPackets.PopFront(); + _rtcpPackets.pop_front(); _crit.Leave(); // Send to ViE diff --git a/src/video_engine/vie_file_player.cc b/src/video_engine/vie_file_player.cc index dd12369ec..626744ce4 100644 --- a/src/video_engine/vie_file_player.cc +++ b/src/video_engine/vie_file_player.cc @@ -270,8 +270,12 @@ int ViEFilePlayer::StopPlay() { int ViEFilePlayer::StopPlayAudio() { // Stop sending audio. - while (MapItem* audio_item = audio_channels_sending_.First()) { - StopSendAudioOnChannel(audio_item->GetId()); + + std::set::iterator it = audio_channels_sending_.begin(); + while (it != audio_channels_sending_.end()) { + StopSendAudioOnChannel(*it); + // StopSendAudioOnChannel erases the item from the map. + it = audio_channels_sending_.begin(); } // Stop local audio playback. @@ -279,10 +283,7 @@ int ViEFilePlayer::StopPlayAudio() { StopPlayAudioLocally(local_audio_channel_); } local_audio_channel_ = -1; - while (audio_channel_buffers_.PopFront() != -1) { - } - while (audio_channels_sending_.Erase(audio_channels_sending_.First()) != -1) { - } + audio_channel_buffers_.clear(); audio_clients_ = 0; return 0; } @@ -300,8 +301,8 @@ int ViEFilePlayer::Read(void* buf, int len) { } // 2 bytes per sample. decoded_audio_length_ *= 2; - if (buf != 0) { - audio_channel_buffers_.PushBack(buf); + if (buf) { + audio_channel_buffers_.push_back(buf); } } else { // No need for new audiobuffer from file, ie the buffer read from file has @@ -315,16 +316,16 @@ int ViEFilePlayer::Read(void* buf, int len) { bool ViEFilePlayer::NeedsAudioFromFile(void* buf) { bool needs_new_audio = false; - if (audio_channel_buffers_.GetSize() == 0) { + if (audio_channel_buffers_.size() == 0) { return true; } // Check if we the buf already have read the current audio. - for (ListItem* item = audio_channel_buffers_.First(); item != NULL; - item = audio_channel_buffers_.Next(item)) { - if (item->GetItem() == buf) { + for (std::list::iterator it = audio_channel_buffers_.begin(); + it != audio_channel_buffers_.end(); ++it) { + if (*it == buf) { needs_new_audio = true; - audio_channel_buffers_.Erase(item); + audio_channel_buffers_.erase(it); break; } } @@ -381,7 +382,7 @@ int ViEFilePlayer::SendAudioOnChannel(const int audio_channel, audio_channel, mix_microphone, volume_scaling); return -1; } - audio_channels_sending_.Insert(audio_channel, NULL); + audio_channels_sending_.insert(audio_channel); CriticalSectionScoped lock(*audio_cs_); audio_clients_++; @@ -390,8 +391,8 @@ int ViEFilePlayer::SendAudioOnChannel(const int audio_channel, int ViEFilePlayer::StopSendAudioOnChannel(const int audio_channel) { int result = 0; - MapItem* audio_item = audio_channels_sending_.Find(audio_channel); - if (!audio_item) { + std::set::iterator it = audio_channels_sending_.find(audio_channel); + if (it == audio_channels_sending_.end()) { WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, id_), "ViEFilePlayer::StopSendAudioOnChannel AudioChannel %d not " "sending", audio_channel); @@ -404,7 +405,7 @@ int ViEFilePlayer::StopSendAudioOnChannel(const int audio_channel) { "VE_StopPlayingFileAsMicrophone failed. audio_channel %d", audio_channel); } - audio_channels_sending_.Erase(audio_item); + audio_channels_sending_.erase(audio_channel); CriticalSectionScoped lock(*audio_cs_); audio_clients_--; assert(audio_clients_ >= 0); diff --git a/src/video_engine/vie_file_player.h b/src/video_engine/vie_file_player.h index 7cdb57943..91e45e1a4 100644 --- a/src/video_engine/vie_file_player.h +++ b/src/video_engine/vie_file_player.h @@ -11,10 +11,12 @@ #ifndef WEBRTC_VIDEO_ENGINE_VIE_FILE_PLAYER_H_ #define WEBRTC_VIDEO_ENGINE_VIE_FILE_PLAYER_H_ +#include +#include + #include "common_types.h" #include "modules/media_file/interface/media_file_defines.h" #include "system_wrappers/interface/file_wrapper.h" -#include "system_wrappers/interface/list_wrapper.h" #include "typedefs.h" #include "video_engine/vie_frame_provider_base.h" @@ -124,10 +126,10 @@ class ViEFilePlayer // Trick - list containing VoE buffer reading this file. Used if multiple // audio channels are sending. - ListWrapper audio_channel_buffers_; + std::list audio_channel_buffers_; // AudioChannels sending audio from this file. - MapWrapper audio_channels_sending_; + std::set audio_channels_sending_; // Frame receiving decoded video from file. VideoFrame decoded_video_;