Bug 1156201 - Reset the video dimensions cache when in initial room states to avoid issues with not correctly displaying video streams when a room is re-entered. r=mikedeboer

This commit is contained in:
Mark Banner 2015-04-22 19:17:15 +01:00
Родитель 70f12f8266
Коммит 3ca9465d75
4 изменённых файлов: 37 добавлений и 0 удалений

Просмотреть файл

@ -240,6 +240,18 @@ loop.shared.mixins = (function() {
rootObject.removeEventListener("resize", this.updateVideoContainer);
},
/**
* Resets the dimensions cache, e.g. for when the session is ended, and
* before a new session, so that we always ensure we see an update when a
* new session is started.
*/
resetDimensionsCache: function() {
this._videoDimensionsCache = {
local: {},
remote: {}
};
},
/**
* Whenever the dimensions change of a video stream, this function is called
* by `updateVideoDimensions` to store the new values and notifies the callee

Просмотреть файл

@ -383,6 +383,12 @@ loop.standaloneRoomViews = (function(mozL10n) {
this.updateVideoContainer();
}
if (nextState.roomState === ROOM_STATES.INIT ||
nextState.roomState === ROOM_STATES.GATHER ||
nextState.roomState === ROOM_STATES.READY) {
this.resetDimensionsCache();
}
// When screen sharing stops.
if (this.state.receivingScreenShare && !nextState.receivingScreenShare) {
// Remove the custom screenshare styles on the remote camera.

Просмотреть файл

@ -383,6 +383,12 @@ loop.standaloneRoomViews = (function(mozL10n) {
this.updateVideoContainer();
}
if (nextState.roomState === ROOM_STATES.INIT ||
nextState.roomState === ROOM_STATES.GATHER ||
nextState.roomState === ROOM_STATES.READY) {
this.resetDimensionsCache();
}
// When screen sharing stops.
if (this.state.receivingScreenShare && !nextState.receivingScreenShare) {
// Remove the custom screenshare styles on the remote camera.

Просмотреть файл

@ -214,6 +214,19 @@ describe("loop.standaloneRoomViews", function() {
sinon.assert.calledOnce(view.updateVideoContainer);
});
it("should reset the video dimensions cache when the gather state is entered", function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.SESSION_CONNECTED});
var view = mountTestComponent();
activeRoomStore.setStoreState({roomState: ROOM_STATES.GATHER});
expect(view._videoDimensionsCache).eql({
local: {},
remote: {}
});
})
});
describe("#publishStream", function() {